Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Bypass "object 'Dim_validate' not found" error #691

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ycl6
Copy link

@ycl6 ycl6 commented Sep 11, 2023

This PR converts numeric matrices from the Matrix package to (R base) matrices to resolve error that arises when manipulating R base matrices with non-R-base matrices. This seem to become an issue with Matrix >= v1.6.

This PR update the R versions and R package versions (specifically Seurat and Matrix) in DESCRIPTION so that the packages are compatible.

More testing revealed the error is not specific to CellChat and Matrix, but with Seurat and Matrix when Seurat is loaded via namespace when using its plot functions.
Seurat 4.0.0 is not compatible with Matrix >= v1.6. It will be good to state in the next CellChat release to use a more recent version of Seurat and R.

I also added .error_if_no_Seurat() to some plot functions that requires Seurat to be available.


When running computeNetSimilarity() and computeNetSimilarityPairwise() and involving dgCMatrix class objects:

Error in isTRUE(r <- .Call(Dim_validate, object, "Matrix")): object 'Dim_validate' not found
Traceback:

1. computeNetSimilarity(cellchat, type = "functional")
2. as.matrix(S_signalings * SNN)
3. S_signalings * SNN
4. S_signalings * SNN
5. callGeneric(Matrix(e1), e2)
6. eval(call, parent.frame())
7. eval(call, parent.frame())
8. Matrix(e1) * e2
9. Matrix(e1) * e2
10. callGeneric(.M2gen(.M2kind(e1, "d")), .M2gen(.M2kind(e2, "d")))
11. eval(call, parent.frame())
12. eval(call, parent.frame())
13. .M2gen(.M2kind(e1, "d")) * .M2gen(.M2kind(e2, "d"))
14. .M2gen(.M2kind(e1, "d")) * .M2gen(.M2kind(e2, "d"))
15. .Arith.Csparse(e1, e2, .Generic, class. = "dgCMatrix")
16. .M2C(newTMat(i = ij[, 1], j = ij[, 2], x = e1@x[ii[[1]]] * e2@x[ii[[2]]]))
17. newTMat(i = ij[, 1], j = ij[, 2], x = e1@x[ii[[1]]] * e2@x[ii[[2]]])
18. new("dgTMatrix", Dim = d, Dimnames = dn, i = i, j = j, x = x)
19. initialize(value, ...)
20. initialize(value, ...)
21. callNextMethod()
22. .nextMethod(.Object = .Object, ... = ...)
23. validObject(.Object)
24. anyStrings(validityMethod(as(object, superClass)))
25. isTRUE(x)
26. validityMethod(as(object, superClass))
27. isTRUE(r <- .Call(Dim_validate, object, "Matrix"))

When running netClustering() and involving dsyMatrix and dsCMatrix class objects:

Error in isTRUE(r <- .Call(Dim_validate, object, "Matrix")): object 'Dim_validate' not found
Traceback:

1. netClustering(cellchat, type = "functional", do.parallel = FALSE)
2. Reduce("+", adjMat)
3. f(init, x[[i]])
4. f(init, x[[i]])
5. callGeneric(e1, as(e2, "denseMatrix"))
6. eval(call, parent.frame())
7. eval(call, parent.frame())
8. e1 + as(e2, "denseMatrix")
9. e1 + as(e2, "denseMatrix")
10. new(paste0(kr, Mclass), x = r, Dim = d, Dimnames = e1@Dimnames, 
  .     uplo = e1@uplo)
11. initialize(value, ...)
12. initialize(value, ...)
13. callNextMethod()
14. .nextMethod(.Object = .Object, ... = ...)
15. validObject(.Object)
16. anyStrings(validityMethod(as(object, superClass)))
17. isTRUE(x)
18. validityMethod(as(object, superClass))
19. isTRUE(r <- .Call(Dim_validate, object, "Matrix"))

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant