Question: Rename Idents in Seurat Object
0
gravatar for Thorerges
6 months ago by
Thorerges10
Thorerges10 wrote:

I have a seurat object that looks as such:

> object
An object of class Seurat  15780 features across 6272 samples within 1 assay  Active assay: RNA (15780 features)  2 dimensional
    > reductions calculated: pca, umap

Identities based on the clustering I've done look as such:

> head(uc@active.ident)
N7.EpiA.AGACTCGAAAGGGC N7.EpiA.GACGATTGGAAACA N7.EpiA.GACGGCACGACGTT N7.EpiA.GTACTTTGCTAAGC N7.EpiA.TAGGCAACTCCTTA 
                     0                      0                      0                      0                      0 
N7.EpiA.TATCACTGCTATTC 
                     0 
Levels: 0 1 2 3 4

How do I assign barcodes based on pre-determined clusters in seurat V3? I already know which barcodes belong to which cluster.

Any help is appreciated!

rna-seq • 1.2k views
ADD COMMENTlink written 6 months ago by Thorerges10
1

You mean, you want to assign some categorical value to each cell that you already know belongs to a particular class? You can simply edit the meta.data field. To access meta.data, do this: object@meta.data. This will give you a table. The row of the table are all cells, you can get their sequence from, row.names(object@meta.data). Now, if your category is A, B and C, with X, Y and Z cells (let suppose in sequence) then make a character vector: New_idents <- rep(c("A","B","C), times =c("X,Y,Z)). Then assign this to meta.data as : object@meta.data$"Newcluster" <- as.factor(New_idents).

If they are not in sequence, you would have to do little more work, but in principle you can modulate meta.data. To then plot this, just use group.by="Newcluster" in DimPlot().

ADD REPLYlink written 6 months ago by piyushjo550
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1322 users visited in the last hour