Coder Social home page Coder Social logo

Error in if (isSparseMatrix(counts)) { : the condition has length > 1 Calls: subMonocle2 ... estimateSizeFactors -> .local -> estimateSizeFactorsForMatrix about monocle-release HOT 7 OPEN

weihuaguo avatar weihuaguo commented on August 16, 2024
Error in if (isSparseMatrix(counts)) { : the condition has length > 1 Calls: subMonocle2 ... estimateSizeFactors -> .local -> estimateSizeFactorsForMatrix

from monocle-release.

Comments (7)

Joleen457 avatar Joleen457 commented on August 16, 2024

Have you solved it? I have the same problem. T T

from monocle-release.

weihuaguo avatar weihuaguo commented on August 16, 2024

Nope. But when I downgrade the monocle 2 into 2.18.0, the bug disappears.

from monocle-release.

unlsysbioywl avatar unlsysbioywl commented on August 16, 2024

I also have the same problem:

cds <- estimateSizeFactors(cds)
Error in if (isSparseMatrix(counts) >= 1) { :
the condition has length > 1

Then I did the following steps and finally sovled it.

step1: download the sorce code package from https://www.bioconductor.org/packages/3.15/bioc/src/contrib/Archive/monocle/

step2: decompress the compressed package

step3: type ".libPaths()" in R console to check where the library are

.libPaths()
[1] "D:/Program Files/R/R-4.2.2/library"

step4: goto this director and find a directory of the same name "monocle"
image

step5: replace this directory with the one you just decompressed

step6: reload the sorce code package (maybe you need to install "devtools" first)
devtools::load_all("D:/Program Files/R/R-4.2.2/library/monocle")

step7: re-run "estimateSizeFactor(cds)"; it will return the error message and also "Return with Debug" button
image

step8: click "Return with Debug" button. It will show you at which line in which R script, the error comes from. Or, to be simple, you need to edit utils.R and expr_models.R

step9: edit utils.R
at line 35: chnage "isSparseMatrix(cellData)" into "isSparseMatrix(cellData)[1]"
at line 192: change "isSparseMatrix(exprs(X))" into "isSparseMatrix(exprs(X))[1]"
at line 438: change "isSparseMatrix(counts)" into "isSparseMatrix(counts)[1]"

all in all, it is because isSparseMatrix() should return one logical value-TRUE/FALSE but now it return two logical values and both them are FALSE
!!!remember to save the changes

step10: edit expr_modles.R
at line 454: change "isSparseMatrix(exprs(cds))" into "isSparseMatrix(exprs(cds))[1]"
!!!remember to save the change

step11: reload monocle
devtools::load_all("D:/Program Files/R/R-4.2.2/library/monocle")

Now, the problem is sovled

cds <- estimateSizeFactors(cds)
cds <- estimateDispersions(cds)
Removing 159 outliers

from monocle-release.

weihuaguo avatar weihuaguo commented on August 16, 2024

I also have the same problem:

cds <- estimateSizeFactors(cds) Error in if (isSparseMatrix(counts) >= 1) { : the condition has length > 1

Then I did the following steps and finally sovled it.

step1: download the sorce code package from https://www.bioconductor.org/packages/3.15/bioc/src/contrib/Archive/monocle/

step2: decompress the compressed package

step3: type ".libPaths()" in R console to check where the library are

.libPaths() [1] "D:/Program Files/R/R-4.2.2/library"

step4: goto this director and find a directory of the same name "monocle" image

step5: replace this directory with the one you just decompressed

step6: reload the sorce code package (maybe you need to install "devtools" first) devtools::load_all("D:/Program Files/R/R-4.2.2/library/monocle")

step7: re-run "estimateSizeFactor(cds)"; it will return the error message and also "Return with Debug" button image

step8: click "Return with Debug" button. It will show you at which line in which R script, the error comes from. Or, to be simple, you need to edit utils.R and expr_models.R

step9: edit utils.R at line 35: chnage "isSparseMatrix(cellData)" into "isSparseMatrix(cellData)[1]" at line 192: change "isSparseMatrix(exprs(X))" into "isSparseMatrix(exprs(X))[1]" at line 438: change "isSparseMatrix(counts)" into "isSparseMatrix(counts)[1]" all in all, it is because the return of isSparseMatrix() shoulde return one logical value-TRUE/FALSE but now it return two logical values and both them are FALSE !!!remember to save the changes

step10: edit expr_modles.R at line 454: change "isSparseMatrix(exprs(cds))" into "isSparseMatrix(exprs(cds))[1]" !!!remember to save the change

step11: reload monocle devtools::load_all("D:/Program Files/R/R-4.2.2/library/monocle")

Now, the problem is sovled

cds <- estimateSizeFactors(cds) cds <- estimateDispersions(cds) Removing 159 outliers

Thanks, @unlsysbioywl ! Hope the cole trapnell lab can change their source codes very soon instead of we change the source codes locally...

from monocle-release.

renqinzhan avatar renqinzhan commented on August 16, 2024

I also have the same problem:

cds <- estimateSizeFactors(cds) Error in if (isSparseMatrix(counts) >= 1) { : the condition has length > 1

Then I did the following steps and finally sovled it.

step1: download the sorce code package from https://www.bioconductor.org/packages/3.15/bioc/src/contrib/Archive/monocle/

step2: decompress the compressed package

step3: type ".libPaths()" in R console to check where the library are

.libPaths() [1] "D:/Program Files/R/R-4.2.2/library"

step4: goto this director and find a directory of the same name "monocle" image

step5: replace this directory with the one you just decompressed

step6: reload the sorce code package (maybe you need to install "devtools" first) devtools::load_all("D:/Program Files/R/R-4.2.2/library/monocle")

step7: re-run "estimateSizeFactor(cds)"; it will return the error message and also "Return with Debug" button image

step8: click "Return with Debug" button. It will show you at which line in which R script, the error comes from. Or, to be simple, you need to edit utils.R and expr_models.R

step9: edit utils.R at line 35: chnage "isSparseMatrix(cellData)" into "isSparseMatrix(cellData)[1]" at line 192: change "isSparseMatrix(exprs(X))" into "isSparseMatrix(exprs(X))[1]" at line 438: change "isSparseMatrix(counts)" into "isSparseMatrix(counts)[1]"

all in all, it is because isSparseMatrix() should return one logical value-TRUE/FALSE but now it return two logical values and both them are FALSE !!!remember to save the changes

step10: edit expr_modles.R at line 454: change "isSparseMatrix(exprs(cds))" into "isSparseMatrix(exprs(cds))[1]" !!!remember to save the change

step11: reload monocle devtools::load_all("D:/Program Files/R/R-4.2.2/library/monocle")

Now, the problem is sovled

cds <- estimateSizeFactors(cds) cds <- estimateDispersions(cds) Removing 159 outliers

Thanks, @unlsysbioywl ! Why did I get this error when I did step 11
image

from monocle-release.

unlsysbioywl avatar unlsysbioywl commented on August 16, 2024

from monocle-release.

qinqqqq avatar qinqqqq commented on August 16, 2024

@unlsysbioywl
step1: download the sorce code package from https://www.bioconductor.org/packages/3.15/bioc/src/contrib/Archive/monocle/
Sorry,the url is unavailable . Can you offer other ways to solve the problem?

from monocle-release.

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.