souporcell
souporcell copied to clipboard
integrating with seurat object
Hi, I was wondering how you best integrate genotype data from souporcell into an existing seurat object so that each cell can be colored by genotype (or origin such as donor/recipient in transplant or maternal/fetal in pregnancy). For example as done in Fig3A or your Nature paper. Thank you.
I really don't know, sorry. I didn't use seurat for anything in the souporcell paper. The little that I have used it in general, I do some analysis and then export it to some csv files that I can combine with whatever other data I have. Fig3 was made by combining umap or tsne (cant remember) coordinates with cluster file and an annotation from the maternal/fetal paper. I just write python scripts which parse files and match things up and then outputs a new tsv/csv that is conducive to graphing. Sorry, but I hate the complicated seurat objects and working in R at all except for ggplot so I avoid it by writing other integration code myself. For me its faster to write a parsing script in 5-10 min than reading the seurat docs.
got it. thanks for the quick reply.
@afmalone I might recommend checking out the vartrix github, they provide an example of loading specific loci into Seurat metadata. If you want to load the entire variant matrix, you could possibly add it with Seurat's CreateAssayObject() function, take a look at the multimodal vignette for more details
Has this been resolved? I need to label each cell by barcode in a Seurat object using the cluster IDs generated by souporcell.
in case someone still wants an answer:
##create matrix as you usually do when working with 10X output Batch_matrix<-Read10X(data.dir="/path/to/outs/filtered_feature_bc_matrix/") ##read your souporcell output clusters.tsv table meta<-read.table(file="/path/to/souporcell/clusters.tsv",header=TRUE) ##you need to have your cell barcodes as row names rownames(meta) <- meta[,1] ##remove old column with cell barcodes meta <- subset(meta, select = -1) ##create data frame meta.frame<-as.data.frame(meta) ##create Seurat object with souporcell output as meta data Batch<-CreateSeuratObject(Batch_matrix,meta.data = meta.frame)