-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rescaleByNeighbors errors when input matrix is DelayedMatrix #5
Comments
FWIW in my case, I ended up with a DelayedMatrix as the ADT logcounts after using suppressPackageStartupMessages(library(scater))
sce <- mockSCE()
sce <- logNormCounts(sce)
sce <- runPCA(sce)
adt_sce <- mockSCE(ngenes=20)
adt_sce <- logNormCounts(adt_sce)
altExp(sce, "ADT") <- adt_sce
sce2 <- combineCols(sce, sce, delayed = FALSE, fill = 0)
class(logcounts(sce2))
#> [1] "matrix" "array"
class(logcounts(altExp(sce2, "ADT")))
#> [1] "DelayedMatrix"
#> attr(,"package")
#> [1] "DelayedArray" Session infosessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.2.2 Patched (2022-11-10 r83330)
#> os Ubuntu 22.04.2 LTS
#> system x86_64, linux-gnu
#> ui X11
#> language en_AU:en
#> collate en_AU.UTF-8
#> ctype en_AU.UTF-8
#> tz Australia/Melbourne
#> date 2023-03-13
#> pandoc 2.19.2 @ /usr/lib/rstudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> beachmat 2.14.0 2022-11-01 [1] Bioconductor
#> beeswarm 0.4.0 2021-06-01 [1] CRAN (R 4.2.2)
#> Biobase * 2.58.0 2022-11-01 [1] Bioconductor
#> BiocGenerics * 0.44.0 2022-11-01 [1] Bioconductor
#> BiocNeighbors 1.16.0 2022-11-01 [1] Bioconductor
#> BiocParallel 1.32.5 2022-12-23 [1] Bioconductor
#> BiocSingular 1.14.0 2022-11-01 [1] Bioconductor
#> bitops 1.0-7 2021-04-24 [1] CRAN (R 4.2.2)
#> cli 3.6.0 2023-01-09 [1] CRAN (R 4.2.2)
#> codetools 0.2-19 2023-02-01 [1] CRAN (R 4.2.2)
#> colorspace 2.1-0 2023-01-23 [1] CRAN (R 4.2.2)
#> DelayedArray 0.24.0 2022-11-01 [1] Bioconductor
#> DelayedMatrixStats 1.20.0 2022-11-01 [1] Bioconductor
#> digest 0.6.31 2022-12-11 [1] CRAN (R 4.2.2)
#> dplyr 1.1.0 2023-01-29 [1] CRAN (R 4.2.2)
#> evaluate 0.20 2023-01-17 [1] CRAN (R 4.2.2)
#> fansi 1.0.4 2023-01-22 [1] CRAN (R 4.2.2)
#> fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.2.2)
#> fs 1.6.1 2023-02-06 [1] CRAN (R 4.2.2)
#> generics 0.1.3 2022-07-05 [1] CRAN (R 4.2.2)
#> GenomeInfoDb * 1.34.9 2023-02-02 [1] Bioconductor
#> GenomeInfoDbData 1.2.9 2022-11-04 [1] Bioconductor
#> GenomicRanges * 1.50.2 2022-12-16 [1] Bioconductor
#> ggbeeswarm 0.7.1 2022-12-16 [1] CRAN (R 4.2.2)
#> ggplot2 * 3.4.1 2023-02-10 [1] CRAN (R 4.2.2)
#> ggrepel 0.9.3 2023-02-03 [1] CRAN (R 4.2.2)
#> glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.2)
#> gridExtra 2.3 2017-09-09 [1] CRAN (R 4.2.2)
#> gtable 0.3.1 2022-09-01 [1] CRAN (R 4.2.2)
#> htmltools 0.5.4 2022-12-07 [1] CRAN (R 4.2.2)
#> IRanges * 2.32.0 2022-11-01 [1] Bioconductor
#> irlba 2.3.5.1 2022-10-03 [1] CRAN (R 4.2.2)
#> knitr 1.42 2023-01-25 [1] CRAN (R 4.2.2)
#> lattice 0.20-45 2021-09-22 [1] CRAN (R 4.2.2)
#> lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.2.2)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.2)
#> Matrix 1.5-3 2022-11-11 [1] CRAN (R 4.2.2)
#> MatrixGenerics * 1.10.0 2022-11-01 [1] Bioconductor
#> matrixStats * 0.63.0 2022-11-18 [1] CRAN (R 4.2.2)
#> munsell 0.5.0 2018-06-12 [1] CRAN (R 4.2.2)
#> pillar 1.8.1 2022-08-19 [1] CRAN (R 4.2.2)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.2)
#> purrr 1.0.1 2023-01-10 [1] CRAN (R 4.2.2)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.2)
#> Rcpp 1.0.10 2023-01-22 [1] CRAN (R 4.2.2)
#> RCurl 1.98-1.10 2023-01-27 [1] CRAN (R 4.2.2)
#> reprex 2.0.2 2022-08-17 [1] CRAN (R 4.2.2)
#> rlang 1.0.6 2022-09-24 [1] CRAN (R 4.2.2)
#> rmarkdown 2.20 2023-01-19 [1] CRAN (R 4.2.2)
#> rstudioapi 0.14 2022-08-22 [1] CRAN (R 4.2.2)
#> rsvd 1.0.5 2021-04-16 [1] CRAN (R 4.2.2)
#> S4Vectors * 0.36.2 2023-02-26 [1] Bioconductor
#> ScaledMatrix 1.6.0 2022-11-01 [1] Bioconductor
#> scales 1.2.1 2022-08-20 [1] CRAN (R 4.2.2)
#> scater * 1.26.1 2022-11-13 [1] Bioconductor
#> scuttle * 1.8.4 2023-01-19 [1] Bioconductor
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.2)
#> SingleCellExperiment * 1.20.0 2022-11-01 [1] Bioconductor
#> sparseMatrixStats 1.10.0 2022-11-01 [1] Bioconductor
#> SummarizedExperiment * 1.28.0 2022-11-01 [1] Bioconductor
#> tibble 3.2.0 2023-03-08 [1] CRAN (R 4.2.2)
#> tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.2.2)
#> utf8 1.2.3 2023-01-31 [1] CRAN (R 4.2.2)
#> vctrs 0.5.2 2023-01-23 [1] CRAN (R 4.2.2)
#> vipor 0.4.5 2017-03-22 [1] CRAN (R 4.2.2)
#> viridis 0.6.2 2021-10-13 [1] CRAN (R 4.2.2)
#> viridisLite 0.4.1 2022-08-22 [1] CRAN (R 4.2.2)
#> withr 2.5.0 2022-03-03 [1] CRAN (R 4.2.2)
#> xfun 0.37 2023-01-31 [1] CRAN (R 4.2.2)
#> XVector 0.38.0 2022-11-01 [1] Bioconductor
#> yaml 2.3.7 2023-01-23 [1] CRAN (R 4.2.2)
#> zlibbioc 1.44.0 2022-11-01 [1] Bioconductor
#>
#> [1] /home/peter/R/x86_64-pc-linux-gnu-library/4.2
#> [2] /usr/local/lib/R/site-library
#> [3] /usr/lib/R/site-library
#> [4] /usr/lib/R/library
#>
#> ────────────────────────────────────────────────────────────────────────────── |
#> Error in (function (classes, fdef, mtable) : unable to find an inherited method for function 'bindCOLS' for signature '"matrix"' I'm... not sure. I don't even see a class(logcounts(altExp(sce2, "ADT")))
#> [1] "DelayedMatrix"
#> attr(,"package")
#> [1] "DelayedArray" Probably forgot to forward Could post an issue there. Or make a PR. |
> traceback()
20: stop(gettextf("unable to find an inherited method for function %s for signature %s",
sQuote(fdef@generic), sQuote(cnames)), domain = NA)
19: (function (classes, fdef, mtable)
{
methods <- .findInheritedMethods(classes, fdef, mtable)
if (length(methods) == 1L)
return(methods[[1L]])
else if (length(methods) == 0L) {
cnames <- paste0("\"", vapply(classes, as.character,
""), "\"", collapse = ", ")
stop(gettextf("unable to find an inherited method for function %s for signature %s",
sQuote(fdef@generic), sQuote(cnames)), domain = NA)
}
else stop("Internal error in finding inherited methods; didn't return a unique method",
domain = NA)
})(list("matrix"), new("standardGeneric", .Data = function (x,
objects = list(), use.names = TRUE, ignore.mcols = FALSE,
check = TRUE)
standardGeneric("bindCOLS"), generic = structure("bindCOLS", package = "S4Vectors"),
package = "S4Vectors", group = list(), valueClass = character(0),
signature = "x", default = NULL, skeleton = (function (x,
objects = list(), use.names = TRUE, ignore.mcols = FALSE,
...
18: bindCOLS(objects[[1L]], objects = objects[-1L])
17: cbind(deparse.level, ...)
16: cbind(...)
15: eval(mc, env)
14: eval(mc, env)
13: eval(mc, env)
12: standardGeneric("cbind")
11: (new("standardGeneric", .Data = function (..., deparse.level = 1)
standardGeneric("cbind"), generic = structure("cbind", package = "BiocGenerics"),
package = "BiocGenerics", group = list(), valueClass = character(0),
signature = "...", default = new("derivedDefaultMethod",
.Data = function (..., deparse.level = 1)
.Internal(cbind(deparse.level, ...)), target = new("signature",
.Data = "ANY", names = "...", package = "methods"),
defined = new("signature", .Data = "ANY", names = "...",
package = "methods"), generic = structure("cbind", package = "base")),
skeleton = (new("derivedDefaultMethod", .Data = function (...,
deparse.level = 1)
.Internal(cbind(deparse.level, ...)), target = new("signature",
.Data = "ANY", names = "...", package = "methods"), defined = new("signature",
.Data = "ANY", names = "...", package = "methods"), generic = structure("cbind", package = "base")))(...,
deparse.level = deparse.level)))(structure(c(-0.189998917271939,
-0.0868457985158096, -0.0175665386822309, 0.051007506575224,
-0.079684254813382, 0.231026123993908, -0.0513426734347379, 0.00486179440517301,
0.0296294770372357, 0.146588831282046, 0.154727337375575, 0.149423773225478,
0.0125237799710574, -0.337186010692366, 0.202961678245827, 0.157990351312671,
0.0844648312825455, 0.102287825158096, -0.0648798900378344, 0.190372783013001,
...
10: do.call(cbind, x)
9: .rescale_modal_matrices(c(targets, extras), ...)
8: .local(x, ...)
7: .nextMethod(x, assays = assays, extras = c(targets, extras),
...)
6: eval(call, callEnv)
5: eval(call, callEnv)
4: callNextMethod(x, assays = assays, extras = c(targets, extras),
...)
3: .local(x, ...)
2: rescaleByNeighbors(sce, dimreds = "PCA", altexps = "ADT")
1: rescaleByNeighbors(sce, dimreds = "PCA", altexps = "ADT") Root cause to be a DelayedArray issue: dim(reducedDim(sce, "PCA"))
#> 200 50
dim(t(logcounts(altExp(sce, "ADT"))))
#> 200 20
cbind(reducedDim(sce, "PCA"), t(logcounts(altExp(sce, "ADT"))))
#> Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘bindCOLS’ for signature ‘"matrix"’ |
In my quick look earlier I didn't see where |
Possibly related: Bioconductor/DelayedArray#100 |
Anyway, just pushed a workaround to |
Will do. |
Can confirm that 6d61b52 is a workaround for the headline issue. |
Yes, that's correct. In this case, I suspect it doesn't matter, because BiocNeighbors will probably coerce things to a matrix internally anyway, but that's a different issue. |
This ensures that the treatment of the alternative experiment's assays is consistent with that of the main experiment. Identified in LTLA/mumosa#5 (comment)
This ensures that the treatment of the alternative experiment's assays is consistent with that of the main experiment. Identified in LTLA/mumosa#5 (comment)
Should this work?
Session info
The text was updated successfully, but these errors were encountered: