Giter Site home page Giter Site logo

Comments (8)

plger avatar plger commented on September 23, 2024

Hi,
I've never seen this error, but this could be a memory and/or multithreading issue.
I'd recommend to check the following:

  1. monitor your RAM usage when running scDblFinder (e.g. using htop).
  2. the package per se is not very memory hungry (it's been ran on much larger datasets), but the object itself can be, in particular earlier versions of as.SingleCellExperiment had a bug that made the object huge (although this should be solved in the version you're using). So check the size (e.g. using format(object.size(x), units="Gb") of both cell_bender_seurat and sce. If you see that sce is much bigger, you can always skip the conversion and run scDblFinder with something like:
sce <- scDblFinder(GetAssayData(cell_bender_seurat, slot="counts", assay="RNA3"), 
                   samples=cell_bender_seurat$orig.ident)
  1. If from htop it does seem to be memory-related, try reducing the number of threads (or eventually using a single one).

from scdblfinder.

IrinaVKuznetsova avatar IrinaVKuznetsova commented on September 23, 2024

thank you for the prompt response

  1. It looks normal (below 1%)
  2. seems ok
format(object.size(cell_bender_seurat), units="Gb") #  "8 Gb"
format(object.size(sce), units="Gb")   #  "2.9 Gb"

A) Could it be something to do with how Seurat v.5 has layers ( 8 sample 8 layers for counts for example), and when I convert it to Array v.3 it becomes one matrix 36601 x 75331?

B) Tried to run without threads:

sce.standard <- scDblFinder(sce, samples = "orig.ident")

Warning messages:
1: In rpois(nrow(x) * length(wAd), as.numeric(as.matrix(x[, wAd]))) :
  NAs produced
2: In value[[3L]](cond) :
  Error in calculating norm factors:Error in .local(x, ...): size factors should be positive

C) Tried this too

sce <- scDblFinder(GetAssayData(cell_bender_seurat, slot="counts", assay="RNA3"),
                   samples=cell_bender_seurat$orig.ident)
Error in .checkSCE(sce) :
  `sce` should be a SingleCellExperiment, a SummarizedExperiment, or an array (i.e. matrix, sparse matric, etc.) of counts.
In addition: Warning message:
The `slot` argument of `GetAssayData()` is deprecated as of SeuratObject 5.0.0.
ℹ Please use the `layer` argument instead.
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.

from scdblfinder.

plger avatar plger commented on September 23, 2024

Not sure I understand your question A, the original Seurat object also has dimensions 36601 x 75331...

  • Can you check class(GetAssayData(cell_bender_seurat, layer="counts", assay="RNA3"))?
  • Can you check quantile(colSums(counts(sce)))
  • Can you try this:
    sce.standard <- scDblFinder(sce[VariableFeatures(cell_bender_seurat),], samples = "orig.ident")

from scdblfinder.

IrinaVKuznetsova avatar IrinaVKuznetsova commented on September 23, 2024
class(GetAssayData(cell_bender_seurat, layer="counts", assay="RNA3"))
[1] "dgCMatrix"
attr(,"package")
[1] "Matrix"
quantile(colSums(counts(sce)))
   0%   25%   50%   75%  100%
  201   650  2209  5732 81977
  1. It is running since 1 hr - I hope it is a good sign
    sce.standard <- scDblFinder(sce[VariableFeatures(cell_bender_seurat),], samples = "orig.ident")

from scdblfinder.

plger avatar plger commented on September 23, 2024

I'm unsure what's the issue here, but it appears to be related to 1) the fact that you have cells with a very low library size (your 201 is crap, personally I'd have filtered out many) and 2) the feature selection internal to scDblFinder might have resulted in some cells not having reads in those features. This appears to have been solved by using the VariableFeatures (which is a perfectly decent way of doing things), or would most likely also be solved by filtering out cells with a low library size (e.g. taking >=400-500).

If you want you can try again with multithreading, user either of these 2 solutions.

from scdblfinder.

IrinaVKuznetsova avatar IrinaVKuznetsova commented on September 23, 2024

how long in average does it take to run scDblFinder ?

  1. its been ~5 hrs
  2. filtered out data, which eventually crashed
quantile(colSums(counts(sce)))
   0%   25%   50%   75%  100%
  451  1189  3332  6480 81977
sce.standard <- scDblFinder(sce, samples = "orig.ident", BPPARAM=MulticoreParam(8))
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth = TRUE,  :
  convergence criterion below machine epsilon
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth = TRUE,  :
  did not converge--results might be invalid!; try increasing work or maxit

Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth = TRUE,  :
  convergence criterion below machine epsilon
Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth = TRUE,  :
  did not converge--results might be invalid!; try increasing work or maxit

Stop worker failed with the error: wrong args for environment subassignment

from scdblfinder.

IrinaVKuznetsova avatar IrinaVKuznetsova commented on September 23, 2024

I figure out why I was getting that error, few steps back in my analysis:

I removed ambient RNA with Cell Bender v3, which generated negative values in the count matrix, that's why scDblFinder() was not able to process my data. The issue about cell bender generating a negative count matrix is discussed here htps://github.com/broadinstitute/CellBender/issues/306. To fix it run Cellbender v.2 re-run scDblFinder()

all works, quite quickly
Cheers.

from scdblfinder.

plger avatar plger commented on September 23, 2024

Hi,
Great that we have an explanation, thanks for coming back on this.
I've now added in the devel version a check of that so that a more useful error message is provided.
Best,
Pierre-Luc

from scdblfinder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.