How to label metadata of Seurat object based gene read count
0
0
Entering edit mode
2.1 years ago
cook.675 ▴ 220

I have a scRNA-seq dataset that was mapped to both the mouse and mCMV genomes. All the genes from mCMV begin with "392XXXX" and there are 161 of them

For each cell in the dataset, I want to add a metadata identifier if at least one read was detected from at least one of these genes.

Any tips greatly appreciated!

thanks

seurat scRNA-seq • 516 views
ADD COMMENT
0
Entering edit mode

Untested but should work in theory. If you get an error you may need to convert the counts from a sparse to dense matrix with as.matrix.

library("stringr")
library("Seurat")

mCMV_data <- GetAssayData(seu, assay="RNA", slot="counts")
mCMV_data <- mCMV_data[str_starts(rownames(mCMV_data), "392"), ]

seu$mCMVExpr <- rowSums(mCMV_data > 0) > 1
ADD REPLY

Login before adding your answer.

Traffic: 2243 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