dviraran / SingleR

SingleR: Single-cell RNA-seq cell types Recognition (legacy version)
GNU General Public License v3.0
266 stars 98 forks source link

Error in calculateSignatures #35

Closed chenv3 closed 5 years ago

chenv3 commented 5 years ago

Hi,

I've been using the CreateSinglerObject to run SingleR for a number of different samples that I'm working with. What I've observed is that for some cell line samples, I come across an error when it gets to the calculateSignatures step.

Estimating ssGSEA scores for 4 gene sets.

  |                                                                            
  |                                                                      |   0%Using parallel with 15 cores
  |======================================================================| 100%
Error in scores[, i:last] <- a : 
  number of items to replace is not a multiple of replacement length
Calls: CreateSinglerObject -> calculateSignatures
In addition: Warning message:
In .local(expr, gset.idx.list, ...) :
  1471 genes with constant expression values throuhgout the samples.
Execution halted

Upon digging further into the code, it seems like this is because when the scores matrix is generated the number of rows is based on the length of egc. However, potentially due to the number of genes with constant expression values, the results returned by the gsva function is actually shorter. (In my case "Cytotoxicity" was missing.)

I don't know if you had any advice for how to avoid/fix this error.

Thanks

dviraran commented 5 years ago

Thanks. I'm planning a major update to this functionality in the near future.

Anyhow, I will fix this issue later today. You can also flag do.signatures=F.

chenv3 commented 5 years ago

Thanks for taking care of this so quickly. I look forward to any updates you have in the future.

dviraran commented 5 years ago

Not yet the major update I was implying, but I've planned for long to change the caculateSignatures to rely on the singscore package instead of ssGSEA in GSVA. The score are highly correlated, but much much faster. Just deployed that change, so it should work better now (and will not throw an error if non of the genes are available).

chenv3 commented 5 years ago

Thanks! All your work in maintaining and updating this package is appreciated.