I have a relatively complex data set of 10x samples where Total-Seq barcodes have been used to map individual biological samples( 3-4 samples) per 10 sample.
The raw data are orgnized togehter in one seurat Object. The problem is code as it is now allows subseting of samples based on their nummeric position, and i would realy like to use "group_by_genetic donor" option for downstream analysis. It is essential.
Part of the code is like this:
explanatory<-readRDS("20220502_OVCA.rds")
table([email protected]$orig.ident, [email protected]$hash.ID)
controls<-list(OVCA_4=c(1,2),OVCA_7=c(3), OVCA_11=(4),OVCA12=(2))
sMat<-sMat <- Reduce(cbind, lapply(names(controls), function(name) {
samples <- paste0("B-",(controls[[name]]))
[email protected]$orig.ident == name & [email protected]$hash.ID %in% samples
}))
flt <- apply(sMat,1,sum) > 0
sMat <- Reduce(cbind, lapply(names(controls), function(name) {
samples <- paste0("B-",(controls[[name]]))`
So this works but I end up with umap plot where als cells from controls are there but i can not say where is sample 4 from 10x sample 10.
I believe that I have to add metadata to seurat object explaining what is what. I tried generating CSV file listing somethinkg like:
Sample 3 TrueSeq barcode (do I need a sequence here?) and sample name. After loading csv file I tried addMetaData function but it just does not work. I believe CSV file is not organized correctly. I know that rownames have to be identical to rownames in Seurat object but not sure how to implement this.
I also tried simple:
sobj$genetic_donors<-Donors$genetic_donor #Donors being the csv imported data frame
but it does not do the trick.
I have seen on some other places people are usinng gsub but I am not sure what to replace in original dataset.