Hello!
I am trying to use miloR to test for differential abundance of Lymphocyte subsets upon several treatments in a tumour model.
I was wondering if I can ask you a couple of questions about using miloR.
- Do you have any advice for assigning the d and k values for making neighbourhoods. I have a small dataset with 2157 lymphoid cells (subsetted from a much larger dataset).
I have 12 PC reductions, so I have assigned the d to be 12. I played with a few values of k.
I have 24 samples, and I think we are advised to set the d and k values so that in the end the average neighbourhood size is 5xsample number. For this dataset, only a k value of 60 achieves that.
In general, do you think this value is okay for such a small dataset?
- I am trying to produce the plotDAbeeswarm. In the tutorial, the y axis has "character" values. I also have similar character as "subtype" of the lymphocytes. When I try to plot this, R gives me the classic error
Converting group.by to factor...
Error: Discrete value supplied to continuous scale
Even if I change the value to as.numeric, (even though it doesn't make sense), I get this error:
Error in plotDAbeeswarm(da_results, group.by = "lymphoid_subcluster_vers1") :
lymphoid_subcluster_vers1 is a numeric variable. Please bin to use for grouping.
The error is not resolved even if the variable in the da.res data frame is set as a factor.
May I know how to solve this?
Thank you again in advance!
My apologies for such a long message.
Thank you, Dorothy
sessionInfo( ) R version 4.0.4 (2021-02-15) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Catalina 10.15.7
Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages: [1] parallel stats4 stats graphics grDevices utils datasets methods base
other attached packages:
[1] SeuratObject_4.0.3 Seurat_4.0.5 MouseGastrulationData_1.4.0
[4] patchwork_1.1.1 dplyr_1.0.7 scran_1.18.7
[7] scater_1.18.6 ggplot2_3.3.5 SingleCellExperiment_1.12.0
[10] SummarizedExperiment_1.20.0 Biobase_2.50.0 GenomicRanges_1.42.0
[13] GenomeInfoDb_1.26.7 IRanges_2.24.1 S4Vectors_0.28.1
[16] BiocGenerics_0.36.1 MatrixGenerics_1.2.1 matrixStats_0.61.0
[19] miloR_1.1.0 edgeR_3.32.1 limma_3.46.0
loaded via a namespace (and not attached):
[1] utf8_1.2.2 reticulate_1.22
[3] tidyselect_1.1.1 AnnotationDbi_1.52.0
[5] RSQLite_2.2.8 htmlwidgets_1.5.4
[7] grid_4.0.4 BiocParallel_1.24.1
[9] Rtsne_0.15 devtools_2.4.2
[11] munsell_0.5.0 codetools_0.2-18
[13] ica_1.0-2 statmod_1.4.36
[15] future_1.23.0 miniUI_0.1.1.1
[17] withr_2.4.2 colorspace_2.0-2
[19] ROCR_1.0-11 tensor_1.5
[21] listenv_0.8.0 labeling_0.4.2
[23] GenomeInfoDbData_1.2.4 polyclip_1.10-0
[25] bit64_4.0.5 farver_2.1.0
[27] rprojroot_2.0.2 parallelly_1.28.1
[29] vctrs_0.3.8 generics_0.1.1
[31] xfun_0.28 BiocFileCache_1.14.0
[33] R6_2.5.1 ggbeeswarm_0.6.0
[35] graphlayouts_0.7.1 rsvd_1.0.5
[37] locfit_1.5-9.4 bitops_1.0-7
[39] spatstat.utils_2.2-0 cachem_1.0.6
[41] DelayedArray_0.16.3 assertthat_0.2.1
[43] promises_1.2.0.1 scales_1.1.1
[45] ggraph_2.0.5 beeswarm_0.4.0
[47] gtable_0.3.0 beachmat_2.6.4
[49] globals_0.14.0 processx_3.5.2
[51] goftest_1.2-3 tidygraph_1.2.0
[53] rlang_0.4.12 splines_4.0.4
[55] lazyeval_0.2.2 spatstat.geom_2.3-0
[57] BiocManager_1.30.16 yaml_2.2.1
[59] reshape2_1.4.4 abind_1.4-5
[61] httpuv_1.6.3 tools_4.0.4
[63] usethis_2.1.3 ellipsis_0.3.2
[65] spatstat.core_2.3-1 RColorBrewer_1.1-2
[67] sessioninfo_1.2.1 ggridges_0.5.3
[69] Rcpp_1.0.7 plyr_1.8.6
[71] sparseMatrixStats_1.2.1 zlibbioc_1.36.0
[73] purrr_0.3.4 RCurl_1.98-1.5
[75] ps_1.6.0 prettyunits_1.1.1
[77] rpart_4.1-15 deldir_1.0-6
[79] pbapply_1.5-0 viridis_0.6.2
[81] cowplot_1.1.1 zoo_1.8-9
[83] ggrepel_0.9.1 cluster_2.1.2
[85] fs_1.5.0 tinytex_0.35
[87] magrittr_2.0.1 data.table_1.14.2
[89] scattermore_0.7 lmtest_0.9-39
[91] RANN_2.6.1 fitdistrplus_1.1-6
[93] pkgload_1.2.3 mime_0.12
[95] xtable_1.8-4 gridExtra_2.3
[97] testthat_3.1.0 compiler_4.0.4
[99] tibble_3.1.6 KernSmooth_2.23-20
[101] crayon_1.4.2 htmltools_0.5.2
[103] mgcv_1.8-38 later_1.3.0
[105] tidyr_1.1.4 DBI_1.1.1
[107] ExperimentHub_1.16.1 tweenr_1.0.2
[109] dbplyr_2.1.1 rappdirs_0.3.3
[111] MASS_7.3-54 Matrix_1.3-4
[113] cli_3.1.0 igraph_1.2.8
[115] pkgconfig_2.0.3 plotly_4.10.0
[117] scuttle_1.0.4 spatstat.sparse_2.0-0
[119] vipor_0.4.5 dqrng_0.3.0
[121] XVector_0.30.0 stringr_1.4.0
[123] callr_3.7.0 digest_0.6.28
[125] sctransform_0.3.2 RcppAnnoy_0.0.19
[127] spatstat.data_2.1-0 leiden_0.3.9
[129] uwot_0.1.10 DelayedMatrixStats_1.12.3
[131] curl_4.3.2 shiny_1.7.1
[133] gtools_3.9.2 lifecycle_1.0.1
[135] nlme_3.1-153 jsonlite_1.7.2
[137] BiocNeighbors_1.8.2 desc_1.4.0
[139] viridisLite_0.4.0 fansi_0.5.0
[141] pillar_1.6.4 lattice_0.20-45
[143] fastmap_1.1.0 httr_1.4.2
[145] pkgbuild_1.2.0 survival_3.2-13
[147] interactiveDisplayBase_1.28.0 glue_1.5.0
[149] remotes_2.4.1 png_0.1-7
[151] BiocVersion_3.12.0 bit_4.0.4
[153] bluster_1.0.0 ggforce_0.3.3
[155] stringi_1.7.5 blob_1.2.2
[157] AnnotationHub_2.22.1 BiocSingular_1.6.0
[159] memoise_2.0.0 irlba_2.3.3
[161] future.apply_1.8.1
```
(Hope you have solved it ;) I came into the same problem!
Figured out in my result data frame, Spatial FDR values are larger than usual. And the parameter related to it is
alpha
I tried
alpha = 1
, a looser cut-off, and it worked for me:plotDAbeeswarm(da_results, group.by = "seurat_clusters", alpha = 1) #alpha: significance level for Spatial FDR (default: 0.1)