ArchR icon indicating copy to clipboard operation
ArchR copied to clipboard

peakAnnoEnrichment fxn gives error "CRsparse_colSums" not resolved from current namespace (Matrix)

Open BartBryant opened this issue 1 year ago • 8 comments
trafficstars

Screenshot 2024-03-21 at 4 59 39 PM

running ArchR up to Ch12 and I get an error message with the peakAnnoEnrichment ( )

of note, I am using SeuratObject_4.1.3 and Seurat_4.3.0 as previous tutorial required these versions of Seurat

any help from anyone would be awesome!

danke barT

BartBryant avatar Mar 21 '24 21:03 BartBryant

Hi @BartBryant! Thanks for using ArchR! Lately, it has been very challenging for me to keep up with maintenance of this package and all of my other responsibilities as a PI. I have not been responding to issue posts and I have not been pushing updates to the software. We are actively searching to hire a computational biologist to continue to develop and maintain ArchR and related tools. If you know someone who might be a good fit, please let us know! In the meantime, your issue will likely go without a reply. Most issues with ArchR right not relate to compatibility. Try reverting to R 4.1 and Bioconductor 3.15. Newer versions of Seurat and Matrix also are causing issues. Sorry for not being able to provide active support for this package at this time.

rcorces avatar Mar 21 '24 21:03 rcorces

I managed to remedy this error by downgrading my Matrix package to version 1.5-0 from 1.6-5

shamer3 avatar Jun 06 '24 17:06 shamer3

If the Matrix version (greater than 1.6.0, such as 1.6.5) is too high (but Signal or Seurat depends on Matrix at least 1.63 or above), an error will be reported, indicating that the CRsparse_colSums class does not exist Solution: Download the source code packages for Matrix 1.6.0 and Matrix 1.6.5, and move some of the code related to the CRsparse_colSums class definition from Matrix 1.6.0 to version 1.6.5, Matrix1.6.0 is the last version that also includes the CPsparse_colSums class definition.

  1. Copy the following line and all the after lines of code in src/sparse. c in version Matrix1.6.0: SEXP CRsparse_colSums(SEXP obj, SEXP narm, SEXP mean, SEXP sparse) Paste the code to src/sparse. c in Matrix 1.6.5.
  2. Then copy the code related to the NEW-OBJECT OF CLASS definition from src/Mutils. c in Matrix 1.6.0 to src/sparse. c in Matrix 1.6.5, That is the following paragraph: SEXP NEW_OBJECT_OF_CLASS(const char *what) { SEXP class = PROTECT(MAKE_CLASS(what)), obj = NEW_OBJECT(class); UNPROTECT(1); return obj; }
  3. Add the following code before the last line of code in src/sparse. h in 1.6.5: #include "sparseVector.h" SEXP v2spV(SEXP);

# define NEW_OBJECT(class_def) R_do_new_object(class_def) # define MAKE_CLASS(what) R_do_MAKE_CLASS(what) SEXP NEW_OBJECT_OF_CLASS(const char *what);

SEXP CRsparse_colSums(SEXP obj, SEXP narm, SEXP mean, SEXP sparse); SEXP CRsparse_rowSums(SEXP obj, SEXP narm, SEXP mean, SEXP sparse); 4. In Matrix 1.6.5 of src/init. c, add the following code at the end of the code block defined by CallDEF: CALLDEF(CRsparse_colSums, 4), CALLDEF(CRsparse_rowSums, 4),

Then recompile the source code for Matrix 1.6.5

The Matrix website for version 1.6.0 is: https://github.com/r-wasm/Matrix The Matrix website for version 1.6.5 is: https://cran.r-project.org/web/packages/Matrix/index.html Test: Library (Matrix) then enter Matrix:: CRsparse_colSums to see if this class can load properly.

ZhangFuchang avatar Jun 29 '24 07:06 ZhangFuchang

Hi @BartBryant! Thanks for using ArchR! Lately, it has been very challenging for me to keep up with maintenance of this package and all of my other responsibilities as a PI. I have not been responding to issue posts and I have not been pushing updates to the software. We are actively searching to hire a computational biologist to continue to develop and maintain ArchR and related tools. If you know someone who might be a good fit, please let us know! In the meantime, your issue will likely go without a reply. Most issues with ArchR right not relate to compatibility. Try reverting to R 4.1 and Bioconductor 3.15. Newer versions of Seurat and Matrix also are causing issues. Sorry for not being able to provide active support for this package at this time.

If the Matrix version (greater than 1.6.0, such as 1.6.5) is too high (but Signal or Seurat depends on Matrix at least 1.63 or above), an error will be reported, indicating that the CRsparse_colSums class does not exist Solution: Download the source code packages for Matrix 1.6.0 and Matrix 1.6.5, and move some of the code related to the CRsparse_colSums class definition from Matrix 1.6.0 to version 1.6.5, Matrix1.6.0 is the last version that also includes the CPsparse_colSums class definition.

  1. Copy the following line and all the after lines of code in src/sparse. c in version Matrix1.6.0: SEXP CRsparse_colSums(SEXP obj, SEXP narm, SEXP mean, SEXP sparse) Paste the code to src/sparse. c in Matrix 1.6.5.
  2. Then copy the code related to the NEW-OBJECT OF CLASS definition from src/Mutils. c in Matrix 1.6.0 to src/sparse. c in Matrix 1.6.5, That is the following paragraph: SEXP NEW_OBJECT_OF_CLASS(const char *what) { SEXP class = PROTECT(MAKE_CLASS(what)), obj = NEW_OBJECT(class); UNPROTECT(1); return obj; }
  3. Add the following code before the last line of code in src/sparse. h in 1.6.5: #include "sparseVector.h" SEXP v2spV(SEXP);

# define NEW_OBJECT(class_def) R_do_new_object(class_def) # define MAKE_CLASS(what) R_do_MAKE_CLASS(what) SEXP NEW_OBJECT_OF_CLASS(const char *what);

SEXP CRsparse_colSums(SEXP obj, SEXP narm, SEXP mean, SEXP sparse); SEXP CRsparse_rowSums(SEXP obj, SEXP narm, SEXP mean, SEXP sparse); 4. In Matrix 1.6.5 of src/init. c, add the following code at the end of the code block defined by CallDEF: CALLDEF(CRsparse_colSums, 4), CALLDEF(CRsparse_rowSums, 4),

Then recompile the source code for Matrix 1.6.5

The Matrix website for version 1.6.0 is: https://github.com/r-wasm/Matrix The Matrix website for version 1.6.5 is: https://cran.r-project.org/web/packages/Matrix/index.html Test: Library (Matrix) then enter Matrix:: CRsparse_colSums to see if this class can load properly.

ZhangFuchang avatar Jun 29 '24 07:06 ZhangFuchang

I managed to remedy this error by downgrading my Matrix package to version 1.5-0 from 1.6-5

If the Matrix version (greater than 1.6.0, such as 1.6.5) is too high (but Signal or Seurat depends on Matrix at least 1.63 or above), an error will be reported, indicating that the CRsparse_colSums class does not exist Solution: Download the source code packages for Matrix 1.6.0 and Matrix 1.6.5, and move some of the code related to the CRsparse_colSums class definition from Matrix 1.6.0 to version 1.6.5, Matrix1.6.0 is the last version that also includes the CPsparse_colSums class definition.

  1. Copy the following line and all the after lines of code in src/sparse. c in version Matrix1.6.0: SEXP CRsparse_colSums(SEXP obj, SEXP narm, SEXP mean, SEXP sparse) Paste the code to src/sparse. c in Matrix 1.6.5.
  2. Then copy the code related to the NEW-OBJECT OF CLASS definition from src/Mutils. c in Matrix 1.6.0 to src/sparse. c in Matrix 1.6.5, That is the following paragraph: SEXP NEW_OBJECT_OF_CLASS(const char *what) { SEXP class = PROTECT(MAKE_CLASS(what)), obj = NEW_OBJECT(class); UNPROTECT(1); return obj; }
  3. Add the following code before the last line of code in src/sparse. h in 1.6.5: #include "sparseVector.h" SEXP v2spV(SEXP);

# define NEW_OBJECT(class_def) R_do_new_object(class_def) # define MAKE_CLASS(what) R_do_MAKE_CLASS(what) SEXP NEW_OBJECT_OF_CLASS(const char *what);

SEXP CRsparse_colSums(SEXP obj, SEXP narm, SEXP mean, SEXP sparse); SEXP CRsparse_rowSums(SEXP obj, SEXP narm, SEXP mean, SEXP sparse); 4. In Matrix 1.6.5 of src/init. c, add the following code at the end of the code block defined by CallDEF: CALLDEF(CRsparse_colSums, 4), CALLDEF(CRsparse_rowSums, 4),

Then recompile the source code for Matrix 1.6.5

The Matrix website for version 1.6.0 is: https://github.com/r-wasm/Matrix The Matrix website for version 1.6.5 is: https://cran.r-project.org/web/packages/Matrix/index.html Test: Library (Matrix) then enter Matrix:: CRsparse_colSums to see if this class can load properly.

ZhangFuchang avatar Jun 29 '24 07:06 ZhangFuchang

same problem

motifsUp <- peakAnnoEnrichment(
    seMarker = markerTest,
    ArchRProj = projHeme5,
    peakAnnotation = "Motif",
    cutOff = "FDR <= 0.1 & Log2FC >= 0.5"
  )

{ "name": "ERROR", "message": "Error in .Call("CRsparse_colSums", x, na.rm, FALSE, sparseResult): "CRsparse_colSums" not resolved from current namespace (Matrix) ", "stack": "Error in .Call("CRsparse_colSums", x, na.rm, FALSE, sparseResult): "CRsparse_colSums" not resolved from current namespace (Matrix) Traceback:

  1. peakAnnoEnrichment(seMarker = markerTest, ArchRProj = projHeme5, . peakAnnotation = "Motif", cutOff = "FDR <= 0.1 & Log2FC >= 0.5")
  2. lapply(seq_len(ncol(seMarker)), function(x) { . .logDiffTime(sprintf("Computing Enrichments %s of %s", x, . ncol(seMarker)), t1 = tstart, verbose = TRUE, logFile = logFile) . idx <- which(passMat[, x]) . if (method == "bgd") { . .computeEnrichment(matches, idx, c(idx, as.vector(bgdPeaks[idx, . ]))) . } . else { . .computeEnrichment(matches, idx, seq_len(nrow(matches))) . } . }) %>% SimpleList
  3. SimpleList(.)
  4. lapply(seq_len(ncol(seMarker)), function(x) { . .logDiffTime(sprintf("Computing Enrichments %s of %s", x, . ncol(seMarker)), t1 = tstart, verbose = TRUE, logFile = logFile) . idx <- which(passMat[, x]) . if (method == "bgd") { . .computeEnrichment(matches, idx, c(idx, as.vector(bgdPeaks[idx, . ]))) . } . else { . .computeEnrichment(matches, idx, seq_len(nrow(matches))) . } . })
  5. FUN(X[[i]], ...)
  6. .computeEnrichment(matches, idx, seq_len(nrow(matches)))
  7. Matrix::colSums(matchCompare)
  8. Matrix::colSums(matchCompare)
  9. .local(x, na.rm, dims, ...)" }

ArchR-peakAnnoEnrichment-1819e661f4a5e-Date-2024-10-22_Time-14-39-10.035534.log

alekseybelikov avatar Oct 22 '24 13:10 alekseybelikov

If the Matrix version (greater than 1.6.0, such as 1.6.5) is too high (but Signal or Seurat depends on Matrix at least 1.63 or above), an error will be reported, indicating that the CRsparse_colSums class does not exist Solution: Download the source code packages for Matrix 1.6.0 and Matrix 1.6.5, and move some of the code related to the CRsparse_colSums class definition from Matrix 1.6.0 to version 1.6.5, Matrix1.6.0 is the last version that also includes the CPsparse_colSums class definition.

  1. Copy the following line and all the after lines of code in src/sparse. c in version Matrix1.6.0: SEXP CRsparse_colSums(SEXP obj, SEXP narm, SEXP mean, SEXP sparse) Paste the code to src/sparse. c in Matrix 1.6.5.
  2. Then copy the code related to the NEW-OBJECT OF CLASS definition from src/Mutils. c in Matrix 1.6.0 to src/sparse. c in Matrix 1.6.5, That is the following paragraph: *SEXP NEW_OBJECT_OF_CLASS(const char what) { SEXP class = PROTECT(MAKE_CLASS(what)), obj = NEW_OBJECT(class); UNPROTECT(1); return obj; }
  3. Add the following code before the last line of code in src/sparse. h in 1.6.5: #include "sparseVector.h" SEXP v2spV(SEXP);

# define NEW_OBJECT(class_def) R_do_new_object(class_def) # define MAKE_CLASS(what) R_do_MAKE_CLASS(what) *SEXP NEW_OBJECT_OF_CLASS(const char what);

SEXP CRsparse_colSums(SEXP obj, SEXP narm, SEXP mean, SEXP sparse); SEXP CRsparse_rowSums(SEXP obj, SEXP narm, SEXP mean, SEXP sparse); 4. In Matrix 1.6.5 of src/init. c, add the following code at the end of the code block defined by CallDEF: CALLDEF(CRsparse_colSums, 4), CALLDEF(CRsparse_rowSums, 4),

Then recompile the source code for Matrix 1.6.5

The Matrix website for version 1.6.0 is: https://github.com/r-wasm/Matrix The Matrix website for version 1.6.5 is: https://cran.r-project.org/web/packages/Matrix/index.html Test: Library (Matrix) then enter Matrix:: CRsparse_colSums to see if this class can load properly.

even upon downgrading to Matrix_1.6-0 the problem persists ArchR-peakAnnoEnrichment-1819e324ac9fc-Date-2024-10-22_Time-15-27-31.258346.log

alekseybelikov avatar Oct 22 '24 14:10 alekseybelikov

Seems to be solved by

https://github.com/satijalab/seurat/issues/8202#issue-2047511055

alekseybelikov avatar Oct 22 '24 14:10 alekseybelikov