MarioniLab / scran

Clone of the Bioconductor repository for the scran package.
https://bioconductor.org/packages/devel/bioc/html/scran.html
40 stars 22 forks source link

Error in "Modeling the technical noise in gene expression" with trendVar() #49

Closed vyturing closed 4 years ago

vyturing commented 4 years ago

Hello,

I am reproducing the pipeline in my RStudio (v1.2.1335) (R 3.6) called "Analyzing single-cell RNAseq data containing read counts" and at Section 7 "Modeling the technical noise in gene expression" I get the following error though I executed all earlier commands necessary for trendVar, including computeSpikeFactors() and normalize(), without any hassle. That's indeed the first first bug I found the in the running pipeline so everything worked out pretty well up until now.

var.fit <- trendVar(sce, parametric=TRUE, block=sce$Plate,loess.args=list(span=0.3)) Error in seq_len(nrow(x)) : argument must be coercible to non-negative integer In addition: Warning message: In seq_len(nrow(x)) : first element used of 'length.out' argument

The sce object looks OK, too. I am guessing and NAs or zeros might be the leading cause but do not know how to fix this. Thank you so very much for the time and the effort!

LTLA commented 4 years ago

The error suggests that a seq_len is encountering a NULL somewhere. If you are following the code exactly, I don't know how this could be possible. But in any case, I suspect you're looking at an old version of the workflows that don't match up to the latest version of the package. The workflows were absorbed into the OSCA book, note the redirection mentioned here; the updated call is to modelGeneVar(), and you should have gotten a deprecation message to that effect.

vyturing commented 4 years ago

Just fixed it! When my local (Mac Majove 10.14.16) was turned off automatically due to low power and I charged the laptop to turn it on again, the RStudio session which was initially open with my half complete workflow became somewhat intrinsically corrupted though everything looked perfectly same as before. It started acting weird. I rebooted the computer and completed the entire workflow without hassle. That is good to know. The laptop does not seem to recover 100% from a low battery shutdown! I think this is worth publishing especially for people like me looking all over for hours to find the bug in a perfectly working pipeline.

LTLA commented 4 years ago

Ah, the good old "turn it off and on again"... literally!

I would doubt that any memory state remains valid after a hard shutdown like that, so it's best to assume that it is not... save frequently and reboot from the last saved state.

vyturing commented 4 years ago

Exactly! Thank you so very much again and again..