meichendong / SCDC

SCDC
42 stars 9 forks source link

Error running SCD_qc #16

Open dfermin opened 4 years ago

dfermin commented 4 years ago

Hi

I'm trying to use SCDC on my data set but keep getting an error at the single cell QC step.

res_qc <- SCDC_qc(scrna,
    ct.varname="celltype",
    sample="sampleID",
    scetname="NEPH",
    arow="sampleID",
    ct.sub=c("Podocyte", "PT"))

This is the error I get:

Error in apply(y, 1, var, na.rm=TRUE) :
  dim(X) must have a positive length

I'm not sure what's causing the problem but I'm not really able to move forward based upon the vignette. I'm running R 3.5.3 in case it helps. Also I've included some basic info about the ESET object I'm working with (called scrna). I created it from 10 of our scRNAseq samples generated from 1OX genomics platform.

Here is a description of the input ESET object scrna:

> scrna
ExpressionSet (storageMode: lockedEnvironment)
assayData: 21375 features, 20367 samples
  element names: exprs
protocolData: none
phenoData
  sampleNames: SAMP001_cell00001 SAMP001_cell00002 ... SAMP010_cell03421 (20367 total)
  varLabels: origCellLabs newCellLab ... cellTotalCount (5 total)
  varMetadata: labelDescription
featureData
  featureNames: 7SK 7SK.2 ... ZZZ3 (21375 total)
  fvarLabels: fdata
  fvarMetadata: labelDescription
experimentData: use 'experimentData(object)'
Annotation:

A quick look at the first few lines of the ESET expression matrix:

> exprs(scrna)[1:10,1:5]
         SAMP001_cell00001 SAMP001_cell00002 SAMP001_cell00003 SAMP001_cell00004 SAMP001_cell00005
7SK                        0                   0                   0                   0                   0
7SK.2                      0                   0                   0                   0                   0
A1BG                       0                   0                   0                   0                   0
A1BG-AS1                   0                   0                   0                   0                   0
A1CF                       0                   0                   0                   0                   0
A2M                        0                   0                   0                   0                   0
A2M-AS1                    0                   0                   0                   0                   0
A4GALT                     0                   0                   0                   0                   0
AAAS                       0                   0                   0                   0                   0
AACS                       0                   0                   0                   0                   0

A quick look at the pData for the ESET phenotype data.frame

> head(pData(scrna))
                          origCellLabs          newCellLab    celltype  sampleID cellTotalCount
SAMP001_cell00001 AAACCCAAGGTTCATC-1 SAMP001_cell00001          PT SAMP001       1653.758
SAMP001_cell00002 AAACCCAGTTCTTGCC-1 SAMP001_cell00002         FIB SAMP001       3178.582
SAMP001_cell00003 AAACGAACATCATCTT-1 SAMP001_cell00003 TAL/DCT/ALT SAMP001       2885.478
SAMP001_cell00004 AAACGAAGTGCGTGCT-1 SAMP001_cell00004     T Cells SAMP001       1435.963
SAMP001_cell00005 AAACGAATCTCCACTG-1 SAMP001_cell00005     B Cells SAMP001       1659.236
SAMP001_cell00006 AAAGAACTCCGGCTTT-1 SAMP001_cell00006     T Cells SAMP001       1822.484
tiagobrc commented 4 years ago

I get the same error. The funny part is that it works with some factor levels but not others.

meichendong commented 3 years ago

Hi @dfermin , @tiagobrc , thanks for trying SCDC and reporting the bug! It looks to me that the possible reason triggered the error is, some cell types only exist in one subject. I updated some corresponding functions, and please let me know if you still encounter errors! Sorry for the late response.