Hello,
I am working off of a Seurat object that consists of multiple samples merged together. How would I add sample identifiers to an already created/merged dataset in relation to the orig.ident?
For example, I have a merged object with orig.idents of sample1_lane 1, sample1_lane2, sample2_lane1, sample2_lane2. I would like to add meta data so that sample1_lane1 and sample1_lane2 cells can be identified as "Sample1", sample2_lane1 and sample2_lane2 as "Sample2" etc.
Thanks!
Hi,
This is more of an R question than a Seurat question but essentially you need to make a new vector that maps your orig.idents to the new sample names and then add that to a new metadata column. One way of doing that could be:
object$sample <- plyr::mapvalues(
x = object$orig.ident,
from = c("sample1_lane1", "sample1_lane2", "sample2_lane1", "sample2_lane2"),
to = c("Sample1", "Sample1", "Sample2", "Sample2")
)
Most helpful comment
Hi,
This is more of an R question than a Seurat question but essentially you need to make a new vector that maps your
orig.identsto the new sample names and then add that to a new metadata column. One way of doing that could be: