HelenaLC/muscat

pbHeatmap error because 't' is not implemented for 'Matrix'

Opened this issue · 3 comments

Hi,
Thanks for muscat.
Sorry for bringing this silly error, I don't think most people have it. But, I recently noticed my environment does not work well with equal named functions.
I got an error using pbHeatmap:

> pbHeatmap(sce, res, top_n = 3) Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 't': invalid or not-yet-implemented 'Matrix' subsetting

I think it will simply go away with calling the package xs <- Matrix::t(mapply(function(g, k) (line 118).

Best,

I am getting the same error and am happy to share my sce and res objects if that would help. Thank you.

kxu68 commented

Getting the same error from one sce and res but not from the other. Might be related to outdated packages?
Already tried Ana's method to call from the Matrix but still have the error
I am using the 1.8.2 version of muscat where I see this.

res=ds_pb
print(pbHeatmap(sce,res,sort_by="none"))
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'x' in selecting a method for function 't': invalid or not-yet-implemented 'Matrix' subsetting

traceback()
13: h(simpleError(msg, call))
12: .handleSimpleError(function (cond)
.Internal(C_tryCatchHelper(addr, 1L, cond)), "invalid or not-yet-implemented 'Matrix' subsetting",
base::quote(es[g, cs]))
11: stop("invalid or not-yet-implemented 'Matrix' subsetting")
10: es[g, cs]
9: es[g, cs]
8: fun(es[g, cs])
7: FUN(X[[i]], ...)
6: vapply(cells_by_ks[[k]], function(cs) fun(es[g, cs]), numeric(1))
5: (function (g, k)
vapply(cells_by_ks[[k]], function(cs) fun(es[g, cs]), numeric(1)))(g = dots[[1L]][[1L]],
k = dots[[2L]][[1L]])
4: mapply(function(g, k) vapply(cells_by_ks[[k]], function(cs) fun(es[g,
cs]), numeric(1)), g = y$gene, k = y$cluster_id)
3: t(mapply(function(g, k) vapply(cells_by_ks[[k]], function(cs) fun(es[g,
cs]), numeric(1)), g = y$gene, k = y$cluster_id))
2: pbHeatmap(sce, res, sort_by = "none")
1: print(pbHeatmap(sce, res, sort_by = "none"))

This is the successful sce info

sce
class: SingleCellExperiment
dim: 16121 287403
metadata(1): experiment_info
assays(2): counts logcounts
rownames(16121): A1BG A2M ... ZYX ZZEF1
rowData names(1): X
colnames(287403): AAACCTGAGAAGGTGA_LUNG_N18_1
AAACCTGAGACAAAGG_LUNG_N18_1 ... TTTGTTGGTGTTGAGG-1_1_6
TTTGTTGGTTCATCTT-1_1_6
colData names(3): sample_id cluster_id group_id
reducedDimNames(0):
mainExpName: NULL
altExpNames(0):

This is the failed sce info:

sce
class: SingleCellExperiment
dim: 28024 305739
metadata(1): experiment_info
assays(2): counts logcounts
rownames(28024): TSPAN6 TNMD ... RP11-107E5.4 RP11-299P2.2
rowData names(1): X
colnames(305739): GCGACCATCCCTAACC_SC22 P2_1_GCGCAACCAGTTAACC ...
CATTATCTCCATGAAC_F01639 AGGCCGTGTGTGACCC-SC56
colData names(3): sample_id cluster_id group_id
reducedDimNames(0):
mainExpName: NULL
altExpNames(0):

My R info:

sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.9 (Maipo)

Matrix products: default
BLAS/LAPACK: /home/unix/imonga/conda/scrnatools/lib/libopenblasp-r0.3.18.so

locale:
[1] C

attached base packages:
[1] grid stats4 stats graphics grDevices utils datasets
[8] methods base

other attached packages:
[1] org.Mm.eg.db_3.14.0 GO.db_3.14.0
[3] AnnotationDbi_1.56.2 scater_1.22.0
[5] scuttle_1.4.0 circlize_0.4.15
[7] ComplexHeatmap_2.10.0 SingleCellExperiment_1.16.0
[9] SummarizedExperiment_1.24.0 Biobase_2.54.0
[11] GenomicRanges_1.46.1 GenomeInfoDb_1.30.1
[13] IRanges_2.28.0 S4Vectors_0.32.4
[15] BiocGenerics_0.40.0 MatrixGenerics_1.6.0
[17] matrixStats_0.62.0 limma_3.50.1
[19] muscat_1.8.2 tidyr_1.2.0
[21] fgsea_1.20.0 ggrepel_0.9.1
[23] ggplot2_3.3.6 patchwork_1.1.1
[25] SeuratObject_4.0.4 Seurat_4.0.6
[27] dplyr_1.0.8

loaded via a namespace (and not attached):
[1] utf8_1.2.2 reticulate_1.24
[3] tidyselect_1.1.1 lme4_1.1-29
[5] RSQLite_2.2.14 htmlwidgets_1.5.4
[7] BiocParallel_1.28.3 Rtsne_0.16
[9] ScaledMatrix_1.2.0 munsell_0.5.0
[11] codetools_0.2-18 ica_1.0-2
[13] future_1.26.1 miniUI_0.1.1.1
[15] withr_2.5.0 colorspace_2.0-3
[17] ROCR_1.0-11 tensor_1.5
[19] listenv_0.8.0 labeling_0.4.2
[21] Rdpack_2.3.1 GenomeInfoDbData_1.2.7
[23] polyclip_1.10-0 farver_2.1.0
[25] bit64_4.0.5 glmmTMB_1.1.3
[27] parallelly_1.32.0 vctrs_0.3.8
[29] generics_0.1.2 R6_2.5.1
[31] doParallel_1.0.17 ggbeeswarm_0.6.0
[33] clue_0.3-61 rsvd_1.0.5
[35] locfit_1.5-9.5 bitops_1.0-7
[37] spatstat.utils_2.3-0 cachem_1.0.6
[39] DelayedArray_0.20.0 assertthat_0.2.1
[41] promises_1.2.0.1 scales_1.2.0
[43] beeswarm_0.4.0 gtable_0.3.0
[45] beachmat_2.10.0 globals_0.15.0
[47] goftest_1.2-3 rlang_1.0.0
[49] genefilter_1.76.0 GlobalOptions_0.1.2
[51] splines_4.1.1 TMB_1.9.0
[53] lazyeval_0.2.2 broom_0.8.0
[55] spatstat.geom_2.3-1 BiocManager_1.30.18
[57] reshape2_1.4.4 abind_1.4-5
[59] backports_1.4.1 httpuv_1.6.4
[61] tools_4.1.1 gplots_3.1.3
[63] ellipsis_0.3.2 spatstat.core_2.3-2
[65] RColorBrewer_1.1-3 ggridges_0.5.3
[67] Rcpp_1.0.8 plyr_1.8.7
[69] sparseMatrixStats_1.6.0 progress_1.2.2
[71] zlibbioc_1.40.0 purrr_0.3.4
[73] RCurl_1.98-1.7 prettyunits_1.1.1
[75] rpart_4.1.16 deldir_1.0-6
[77] viridis_0.6.2 pbapply_1.5-0
[79] GetoptLong_1.0.5 cowplot_1.1.1
[81] zoo_1.8-10 cluster_2.1.3
[83] variancePartition_1.24.1 magrittr_2.0.2
[85] data.table_1.14.2 scattermore_0.8
[87] lmerTest_3.1-3 lmtest_0.9-39
[89] RANN_2.6.1 fitdistrplus_1.1-8
[91] hms_1.1.1 mime_0.12
[93] xtable_1.8-4 pbkrtest_0.5.1
[95] RhpcBLASctl_0.21-247.1 XML_3.99-0.10
[97] gridExtra_2.3 shape_1.4.6
[99] compiler_4.1.1 tibble_3.1.6
[101] KernSmooth_2.23-20 crayon_1.5.1
[103] minqa_1.2.4 htmltools_0.5.2
[105] mgcv_1.8-39 later_1.3.0
[107] geneplotter_1.72.0 lubridate_1.8.0
[109] DBI_1.1.2 MASS_7.3-55
[111] boot_1.3-28 Matrix_1.4-0
[113] cli_3.1.1 rbibutils_2.2.8
[115] parallel_4.1.1 igraph_1.2.9
[117] pkgconfig_2.0.3 numDeriv_2016.8-1.1
[119] plotly_4.10.0 spatstat.sparse_2.1-0
[121] foreach_1.5.2 annotate_1.72.0
[123] vipor_0.4.5 blme_1.0-5
[125] XVector_0.34.0 stringr_1.4.0
[127] digest_0.6.29 sctransform_0.3.3
[129] RcppAnnoy_0.0.19 spatstat.data_2.2-0
[131] Biostrings_2.62.0 leiden_0.4.2
[133] fastmatch_1.1-3 uwot_0.1.11
[135] edgeR_3.36.0 DelayedMatrixStats_1.16.0
[137] gtools_3.9.2.1 shiny_1.7.1
[139] rjson_0.2.21 nloptr_1.2.1
[141] lifecycle_1.0.1 nlme_3.1-155
[143] jsonlite_1.7.3 aod_1.3.2
[145] BiocNeighbors_1.12.0 viridisLite_0.4.0
[147] fansi_0.5.0 pillar_1.7.0
[149] lattice_0.20-45 KEGGREST_1.34.0
[151] fastmap_1.1.0 httr_1.4.3
[153] survival_3.3-1 glue_1.5.1
[155] png_0.1-7 iterators_1.0.14
[157] bit_4.0.4 stringi_1.7.6
[159] blob_1.2.3 BiocSingular_1.10.0
[161] DESeq2_1.34.0 caTools_1.18.2
[163] memoise_2.0.1 irlba_2.3.5
[165] future.apply_1.9.0

Thanks all for pointing this out. Unfortunately, I am unable to reproduce the error at the moment. Would anyone be able to come up with a reproducible example? E.g., by altering the example data?