compbiomed / singleCellTK

Interactively analyze single cell genomic data
https://camplab.net/sctk/
Other
170 stars 74 forks source link

runCellQC on multiple samples #721

Closed cmtom closed 9 months ago

cmtom commented 9 months ago

Hello,

I have the pipeline working for a single sample but run into issues when I load in multiple samples. Below is my code and the error I get. I was wondering if I'm doing something wrong or if you have any suggestions?

scex4 <- importCellRanger(cellRangerDirs ='./datasets',sampleNames = c("sample1","sample2","sample3","sample4")) unique(scex4$sample) [1] "sample1" "sample2" "sample3" "sample4" head(scex4) class: SingleCellExperiment dim: 6 5727894 metadata(1): sctk assays(1): counts rownames(6): ENSMUSG00000051951 ENSMUSG00000089699 ... ENSMUSG00000025900 ENSMUSG00000025902 rowData names(3): feature_ID feature_name feature_type colnames(5727894): sample1_AAACCCAAGAAACCCA-1 sample1_AAACCCAAGAAACCCG-1 ... sample4_TTTGTTGTCTTTGCTG-1 sample4_TTTGTTGTCTTTGGAG-1 colData names(3): cell_barcode column_name sample reducedDimNames(0): mainExpName: NULL altExpNames(0): scex4 <- runCellQC(scex4, sample = c("sample1","sample2","sample3","sample4"), algorithms = c("QCMetrics", "doubletFinder", "decontX"), mitoRef = "mouse", mitoIDType = "ensembl", mitoGeneLocation = "rownames", seed = 12345) Error in .manageCellVar(inSCE, var = sample) : Invalid variable length

If I run runCellQC() as above except with sample = NULL, it uses 30GB of RAM and takes a very long time, it still has yet to finish. If I use "scDblFinder" instead then I get an error: Cholmod error 'problem too large' at file ../Core/cholmod_dense.c

joshua-d-campbell commented 9 months ago

Hello @cmtom, thanks for using our tool! The "sample" parameter needs to be given a vector of sample labels that is the same length as the number of cells. It denotes which sample each cell belongs to. So your code should look like this:

scex4 <- runCellQC(scex4, sample = scex4$sample, ....)

with the "..." being the rest of the parameters you set. Just let me know if you have any more questions. I will move this to a Discussion as others may have the same question.