<p>Assuming you are following the basic seurat guide:</p>

<pre><code>pbmc@ident
</code></pre>

<p>You can access the <code>'ident'</code> slot of your Seurat object and you will get a vector of the cluster IDs and the names will be the respective cells.</p>

<pre><code>head(seuratobj@ident)
Cell1A7 Cell1C4 Cell1D1 Cell1D2 Cell1D3 Cell1D5
0 3 3 1 3 1 
Levels: 0 1 2 3 4
</code></pre>

CC BY-SA 4.0
2019-03-05T10:09:33.233Z
In my example, the printing wasn't great but essentially Cell1A7 is in cluster 0, Cell 1C4 is in cluster 3, etc...
story
CC BY-SA 4.0
2019-03-05T10:08:46.403Z
2019-03-05T10:25:58.553Z
2019-03-05T10:25:58.553Z
story
<p>I have followed the Seurat T<a href="https://satijalab.org/seurat/immune_alignment.html" rel="nofollow noreferrer">utorial:Integrating stimulated vs. control PBMC datasets</a> to learn cell-type specific responses by using my data. And I am confused about how to write the script to calculate the cell number of each sample on each cluster. </p>

<p>I have run TSENPlot to know the samples and I'm using another TSENPlot to get the clusters. If I want to know find the cluster1 of each sample's number how can I write the script? </p>

<p><a href="https://i.sstatic.net/MbRGr.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/MbRGr.jpg" alt="enter image description here"></a></p>

CC BY-SA 4.0
2019-03-05T10:22:59.363Z
Please [edit] your question and give us some more details. What exactly do you need? Can you show us the code you have run?
terdon
<single-cell>
how to write the script to know each sample's cluster number?
# how to write the script to know each sample's cluster number?

(Asked by: username_0 on 2019-03-05)

I have followed the Seurat T[utorial:Integrating stimulated vs. control PBMC datasets](https://satijalab.org/seurat/immune_alignment.html) to learn cell-type specific responses by using my data. And I am confused about how to write the script to calculate the cell number of each sample on each cluster.

I have run TSENPlot to know the samples and I'm using another TSENPlot to get the clusters. If I want to know find the cluster1 of each sample's number how can I write the script?

[![enter image description here](https://i.sstatic.net/MbRGr.jpg)](https://i.sstatic.net/MbRGr.jpg)

**Tags:** single-cell
> **Comments:**
> **username_1**: Please [edit] your question and give us some more details. What exactly do you need? Can you show us the code you have run?  

---

## 1 answers

### Answer by username_2 on 2019-03-05. Score: 2

Assuming you are following the basic seurat guide:
pbmc@ident

You can access the 'ident' slot of your Seurat object and you will get a vector of the cluster IDs and the names will be the respective cells.
head(seuratobj@ident)
Cell1A7 Cell1C4 Cell1D1 Cell1D2 Cell1D3 Cell1D5
0 3 3 1 3 1 
Levels: 0 1 2 3 4

> **Comments:**
> **username_2**: In my example, the printing wasn't great but essentially Cell1A7 is in cluster 0, Cell 1C4 is in cluster 3, etc...  

---

