MarioniLab / miloR

R package implementation of Milo for testing for differential abundance in KNN graphs
https://bioconductor.org/packages/release/bioc/html/miloR.html
GNU General Public License v3.0
316 stars 20 forks source link

error in makeNhoods #307

Open GrigoriiNos opened 4 months ago

GrigoriiNos commented 4 months ago

Describe the bug

Hi I am trying to run makeNhoods with different parameters, and end u with the same error

Minimum code example

milo <- makeNhoods(milo, prop = 0.1, k = 15, d=30, refined = TRUE, refinement_scheme = 'graph') Checking valid object

Running refined sampling with graph Error in neighborhood(X_graph, order = 1, nodes = random_vertices[i]) : INTEGER() can only be applied to a 'integer', not a 'double'

milo <- makeNhoods(milo, prop = 0.1, k = 15, d=30, refined = TRUE) Checking valid object Running refined sampling with reduced_dim Error in h(simpleError(msg, call)) : error in evaluating the argument 'i' in selecting a method for function '[<-': INTEGER() can only be applied to a 'integer', not a 'double'

Session info Output of sessionInfo()

sessionInfo() R version 4.3.1 (2023-06-16) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 22.04.3 LTS

Matrix products: default BLAS: /opt/R-4.3.1/lib/libRblas.so LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

time zone: Europe/Copenhagen tzcode source: system (glibc)

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

other attached packages: [1] igraph_2.0.1.1 Seurat_4.4.0 patchwork_1.2.0 scuttle_1.10.3 SingleCellExperiment_1.22.0 [6] SummarizedExperiment_1.30.2 Biobase_2.60.0 GenomicRanges_1.52.1 GenomeInfoDb_1.36.4 IRanges_2.34.1
[11] S4Vectors_0.38.2 BiocGenerics_0.46.0 MatrixGenerics_1.12.3 matrixStats_1.2.0 miloR_1.8.1
[16] edgeR_3.42.4 limma_3.56.2 performance_0.10.8 selectiveInference_1.2.5 MASS_7.3-60
[21] adaptMCMC_1.5 coda_0.19-4.1 survival_3.5-8 intervals_0.15.4 boot_1.3-28.1
[26] glmnet_4.1-8 Matrix_1.6-5 ggrepel_0.9.4 harmony_1.2.0 Rcpp_1.0.12
[31] circlize_0.4.15 ComplexHeatmap_2.16.0 SeuratObject_4.1.4 lubridate_1.9.3 forcats_1.0.0
[36] stringr_1.5.1 dplyr_1.1.3 purrr_1.0.2 readr_2.1.5 tidyr_1.3.1
[41] tibble_3.2.1 ggplot2_3.4.4 tidyverse_2.0.0

loaded via a namespace (and not attached): [1] spatstat.sparse_3.0-3 bitops_1.0-7 httr_1.4.7 RColorBrewer_1.1-3 insight_0.19.8
[6] doParallel_1.0.17 tools_4.3.1 sctransform_0.4.1 backports_1.4.1 utf8_1.2.4
[11] R6_2.5.1 lazyeval_0.2.2 uwot_0.1.16 GetoptLong_1.0.5 withr_3.0.0
[16] sp_2.1-1 gridExtra_2.3 progressr_0.14.0 cli_3.6.2 spatstat.explore_3.2-5
[21] labeling_0.4.3 spatstat.data_3.0-4 ggridges_0.5.6 pbapply_1.7-2 pscl_1.5.9
[26] parallelly_1.36.0 readxl_1.4.3 rstudioapi_0.15.0 FNN_1.1.4 generics_0.1.3
[31] shape_1.4.6 gtools_3.9.5 ica_1.0-3 spatstat.random_3.2-1 car_3.1-2
[36] ggbeeswarm_0.7.2 fansi_1.0.5 abind_1.4-5 lifecycle_1.0.4 carData_3.0-5
[41] Rtsne_0.17 dqrng_0.3.2 promises_1.2.1 crayon_1.5.2 miniUI_0.1.1.1
[46] lattice_0.22-5 beachmat_2.16.0 cowplot_1.1.3 metapod_1.8.0 pillar_1.9.0
[51] rjson_0.2.21 future.apply_1.11.1 codetools_0.2-19 leiden_0.4.3.1 glue_1.7.0
[56] ggvenn_0.1.10 data.table_1.15.0 remotes_2.4.2.1 vctrs_0.6.4 png_0.1-8
[61] cellranger_1.1.0 gtable_0.3.4 S4Arrays_1.0.6 mime_0.12 tidygraph_1.3.1
[66] iterators_1.0.14 ramify_0.3.3 statmod_1.5.0 bluster_1.10.0 ellipsis_0.3.2
[71] fitdistrplus_1.1-11 ROCR_1.0-11 nlme_3.1-164 RcppAnnoy_0.0.22 irlba_2.3.5.1
[76] vipor_0.4.7 KernSmooth_2.23-22 colorspace_2.1-0 tidyselect_1.2.0 compiler_4.3.1
[81] BiocNeighbors_1.18.0 DelayedArray_0.26.7 plotly_4.10.4 scales_1.3.0 lmtest_0.9-40
[86] digest_0.6.34 goftest_1.2-3 spatstat.utils_3.0-4 XVector_0.40.0 htmltools_0.5.6.1
[91] pkgconfig_2.0.3 sparseMatrixStats_1.12.2 fastmap_1.1.1 rlang_1.1.3 GlobalOptions_0.1.2
[96] htmlwidgets_1.6.2 shiny_1.8.0 DelayedMatrixStats_1.22.6 farver_2.1.1 zoo_1.8-12
[101] jsonlite_1.8.8 BiocParallel_1.34.2 BiocSingular_1.16.0 RCurl_1.98-1.14 magrittr_2.0.3
[106] GenomeInfoDbData_1.2.10 munsell_0.5.0 viridis_0.6.5 reticulate_1.34.0 stringi_1.8.3
[111] ggalluvial_0.12.5 ggraph_2.1.0 zlibbioc_1.46.0 plyr_1.8.9 listenv_0.9.1
[116] deldir_2.0-2 graphlayouts_1.1.0 splines_4.3.1 tensor_1.5 hms_1.1.3
[121] locfit_1.5-9.8 ggpubr_0.6.0 spatstat.geom_3.2-7 ggsignif_0.6.4 reshape2_1.4.4
[126] ScaledMatrix_1.8.1 BiocManager_1.30.22 tzdb_0.4.0 foreach_1.5.2 tweenr_2.0.2
[131] httpuv_1.6.12 RANN_2.6.1 polyclip_1.10-6 future_1.33.1 clue_0.3-65
[136] scattermore_1.2 ggforce_0.4.1 rsvd_1.0.5 broom_1.0.5 xtable_1.8-4
[141] rstatix_0.7.2 later_1.3.2 viridisLite_0.4.2 beeswarm_0.4.0 cluster_2.1.4
[146] timechange_0.3.0 globals_0.16.2

Thanks!

MikeDMorgan commented 4 months ago

Hi @GrigoriiNos Can you check several things: 1) You have valid names for the colnames of your Milo object - i.e. they are all strings, and that they are unique., 2) What NN-graph did you use? Is this a kNN or is it something else, e.g. SNN or WNN graph?

Thanks

GrigoriiNos commented 4 months ago

Hi @MikeDMorgan

thanks a lot for a fast response, ues colnames are unique and valid I used buildGraph()with default setting, which I believe uses KNN

Thanks!

MikeDMorgan commented 4 months ago

OK, did you also use the same value of k as you are in makeNhoods()? This shouldn't be an issue per se, but just to rule out any discrepancies.

Also could you try updating all Bioc packages to 3.18 (this will update miloR to 1.10.0) and see if the error persists.