Assigning multiple identities to seurat metadata
1
0
Entering edit mode
15 months ago
정지수 • 0

Hi all,

I want to assign multiple idents to my seurat object. In my case, I have scRNA data of "Normal" and patient ID "11251". So far, I assigned identity following disease stage(normal or disease) like

seu.obj <- CreateSeuratObject(counts = 11251_mtx, project = "Normal")

and I found that seu.obj has orig.ident column, with Normal. I want to assign patient ID to my seurat object. Object has 2 columns, first, column with Normal and second, column with patient ID like 11251. How can I do that?

Please help me, thanks to you all in advance.

single-cell Seurat scRNA-seq • 1.0k views
ADD COMMENT
0
Entering edit mode
15 months ago
jv ★ 1.8k

You can add as much column/metadata to a Seurat object as you want. There is a Seurat function AddMetaData as well as list-like notation for setting/accessing the metadata. For example the following will do the same thing for you:

# use Seurat function
meta <- rep('11251', times = length(seu.obj$orig.ident))
seu.obj <- AddMetaData(object = seu.obj, metadata = meta, col.name = 'patient_id')

# use alternate method
seu.obj[['patient_id']] <- meta

https://mojaveazure.github.io/seurat-object/reference/AddMetaData.html

ADD COMMENT

Login before adding your answer.

Traffic: 1460 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6