<p><code>M &lt;- SetIdent(M, value = &quot;status&quot;)</code></p>
<p>or more explicitly</p>
<p><code>M &lt;- SetIdent(M, value = M@meta.data$status)</code></p>
<p>You can also use the <code>group.by</code> argument of <code>UMAPPlot()</code> or other plotting functions from <code>Seurat</code> for that matter.</p>

CC BY-SA 4.0
2020-07-24T17:42:29.613Z
2020-07-24T17:42:29.613Z
haci
<p>Im trying to change the active.ident to another column in metadata but this error keeps popping up! I recently upgraded to R version 4.0.2 from 3.6.1 The older version was working but the new one isn't. I don't understand how to fix it?</p>
<pre><code>M@active.ident &lt;- M@meta.data$status
Error in (function (cl, name, valueClass)  : 
assignment of an object of class “character” is not valid for @‘active.ident’ in an object of class 
“Seurat”; is(value, &quot;factor&quot;) is not TRUE

head(M@meta.data) 
        orig.ident nCount_RNA nFeature_RNA percent.mito   status  RNA_snn_res.0.6 seurat_clusters 
BC03_03       BC03   998414.7         3356   0.07869098 nonTumor                0               0
BC03_09       BC03   999853.6         7616   0.12964336  primary                0               0
BC03_13       BC03   998206.5         8457   0.17672205  primary                0               0
BC03_17       BC03   999535.1         7494   0.11323008  primary                0               0
</code></pre>
<p>I want to run the UMAP with the clusters named according to the status and not seurat clusters.However, the code isnt working..</p>

<r><scrnaseq><seurat><sequence-annotation><clustering>
Changing active.ident in Seurat
# Changing active.ident in Seurat

(Asked by: username_0 on 2020-07-24)

Im trying to change the active.ident to another column in metadata but this error keeps popping up! I recently upgraded to R version 4.0.2 from 3.6.1 The older version was working but the new one isn't. I don't understand how to fix it?
M@active.ident <- M@meta.data$status
Error in (function (cl, name, valueClass)  : 
assignment of an object of class “character” is not valid for @‘active.ident’ in an object of class 
“Seurat”; is(value, "factor") is not TRUE

head(M@meta.data) 
        orig.ident nCount_RNA nFeature_RNA percent.mito   status  RNA_snn_res.0.6 seurat_clusters 
BC03_03       BC03   998414.7         3356   0.07869098 nonTumor                0               0
BC03_09       BC03   999853.6         7616   0.12964336  primary                0               0
BC03_13       BC03   998206.5         8457   0.17672205  primary                0               0
BC03_17       BC03   999535.1         7494   0.11323008  primary                0               0

I want to run the UMAP with the clusters named according to the status and not seurat clusters.However, the code isnt working..

**Tags:** r, scrnaseq, seurat, sequence-annotation, clustering

---

## 1 answers

### Answer by username_1 on 2020-07-24. Score: 2

`M <- SetIdent(M, value = "status")`

or more explicitly

`M <- SetIdent(M, value = M@meta.data$status)`

You can also use the `group.by` argument of `UMAPPlot()` or other plotting functions from `Seurat` for that matter.


---

