<p>It would have been better if you have shared your code as well as the error messages you got format these as such.</p>

<p>As far as I can understand, your problem is that you failed to make your cluster as default ids. For this you can use:</p>

<pre><code>seurat_obj &lt;- SetIdent(seurat_obj, id=seurat_obj@meta.data$column_of_interest).
</code></pre>

<p>The cluster identities are stored in the <code>@meta.data</code> slot of your object.</p>

CC BY-SA 4.0
2020-01-16T08:23:12.037Z
thank you for you answers, I don't know what I done yesterday, today it worked... do you know what I should do relative to the question?
RomainL.
CC BY-SA 4.0
2020-01-15T16:49:54.260Z
2020-01-15T16:49:54.260Z
haci
<p>I am aware of this question <a href="https://bioinformatics.stackexchange.com/questions/4249/manually-define-clusters-in-seurat-and-determine-marker-genes">Manually define clusters in Seurat and determine marker genes</a> that is similar but I couldn't make tit work for my use case.</p>
<p>So I have a single cell experiments and the clustering id not great I have a small groups of 6 cells (I know it is extremely small, but nonetheless I would like to make the most of it) that are clearly isolate in UMAP and display marker that I am interresting in.</p>
<p>I managed to get those cells names in barcode (e.g.: AGCCAGCTCGCTTTAT).</p>
<p>I would like to compute differential expression of those cells against all others groups (using FindMarkers or FindAllMarkers).</p>
<p>I tried to manually define the cluster in:
Seurat_obj@meta.data$seurat_clusters
But using FindMarkers (it says this groups don't exist)</p>
<p>then I try to modify
s_19270BC@active.ident</p>
<p>but then it could not found metadata attached to my newly define group.</p>
<p>I am kind of stuck and any help is warmly welcome</p>
<h1>Code</h1>
<p>My R is quite rusty...</p>
<pre><code>names_ # a vector with the names of the cell I want as a cluster

# my seurat object have 5 cluster 0..4. So I want to add a 6th clusters with id 5

#First attempt manually modify the vector active.ident and cluster
# they are both factor so we need to add a factor level
levels(seurat_obj@active.ident) = c(levels(seurat_obj@active.ident), 5)
levels(seurat_obj@meta.data<span class="math-container">$seurat_clusters) = c(levels(seurat_obj@meta.data$</span>seurat_clusters), 5)
# then modify them :
seurat_obj@active.ident[which(row.names(seurat_obj@meta.data) %in%  names_)] = 5
seurat_obj@meta.data$seurat_clusters[which(row.names(seurat_obj@meta.data) %in%  names_)] = 5

FindMarkers(s_19270BC, ident.1 = 5)
 
</code></pre>
<p>So This morning it works... I don't know what I have done yesterday...</p>
<p>EDIT:
I added the Code I used</p>

<r><seurat><differential-expression>
Seurat define manually a cluster and find markers
# Seurat define manually a cluster and find markers

(Asked by: username_0 on 2020-01-15)

I am aware of this question Manually define clusters in Seurat and determine marker genes that is similar but I couldn't make tit work for my use case.
So I have a single cell experiments and the clustering id not great I have a small groups of 6 cells (I know it is extremely small, but nonetheless I would like to make the most of it) that are clearly isolate in UMAP and display marker that I am interresting in.
I managed to get those cells names in barcode (e.g.: AGCCAGCTCGCTTTAT).
I would like to compute differential expression of those cells against all others groups (using FindMarkers or FindAllMarkers).
I tried to manually define the cluster in:
Seurat_obj@meta.data$seurat_clusters
But using FindMarkers (it says this groups don't exist)
then I try to modify
s_19270BC@active.ident
but then it could not found metadata attached to my newly define group.
I am kind of stuck and any help is warmly welcome
Code
My R is quite rusty...
names_ # a vector with the names of the cell I want as a cluster

# my seurat object have 5 cluster 0..4. So I want to add a 6th clusters with id 5

#First attempt manually modify the vector active.ident and cluster
# they are both factor so we need to add a factor level
levels(seurat_obj@active.ident) = c(levels(seurat_obj@active.ident), 5)
levels(seurat_obj@meta.data$seurat_clusters) = c(levels(seurat_obj@meta.data$seurat_clusters), 5)
# then modify them :
seurat_obj@active.ident[which(row.names(seurat_obj@meta.data) %in%  names_)] = 5
seurat_obj@meta.data$seurat_clusters[which(row.names(seurat_obj@meta.data) %in%  names_)] = 5

FindMarkers(s_19270BC, ident.1 = 5)
 

So This morning it works... I don't know what I have done yesterday...
EDIT:
I added the Code I used

**Tags:** r, seurat, differential-expression

---

## 1 answers

### Answer by username_1 on 2020-01-15. Score: 2 | Accepted answer

It would have been better if you have shared your code as well as the error messages you got format these as such.
As far as I can understand, your problem is that you failed to make your cluster as default ids. For this you can use:
seurat_obj <- SetIdent(seurat_obj, id=seurat_obj@meta.data$column_of_interest).

The cluster identities are stored in the @meta.data slot of your object.

> **Comments:**
> **username_0**: thank you for you answers, I don't know what I done yesterday, today it worked... do you know what I should do relative to the question?  

---

