TransWikia.com

How to add cluster name to metadata in Seurat?

Bioinformatics Asked by Najeha Mohamed on August 21, 2021

I’m working on a Seurat object and want to name the clusters according to 2 values alone (yes/no). So I want to add a new column to metadata and annotate the clusters (UMAP) with it.

head([email protected])
        orig.ident nCount_RNA nFeature_RNA percent.mito RNA_snn_res.0.6 seurat_clusters
BC01_02       BC01   999789.2         9225 0.2385090196               6               6
BC01_03       BC01   999776.9         9568 0.2925109851               6               6
BC01_04       BC01   999595.1         7482 0.0009888404               6               6
BC01_05       BC01   999992.0         8301 0.3801925053               6               6

I want to add a new column imported from a csv file that contains the row.names same as the meta.data with the status column as yes and no.

head(status)
               status
BC01_02           yes
BC01_03           yes
BC01_04           yes
BC01_05           yes

After adding the column, I want to name the clusters with yes or no, how is it possible?

One Answer

To add the column status can try the following:

[email protected]$status <- status[row.names([email protected]),]$status

To rename the clusters you can try the following:

[email protected]$seurat_clusters <- [email protected]$status

However, I think the plotting functions in Seurat do not use the cluster information from [email protected], rather they use information from [email protected]. So, I guess you have to do the following instead:

[email protected] <-  [email protected]$status

This should work, but, I will verify and update this answer later.

Answered by Ramasamy Kandasamy on August 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP