pachterlab / voyager

From geospatial to spatial -omics
https://pachterlab.github.io/voyager/
Artistic License 2.0
70 stars 8 forks source link

could not find function "calculateBivariate" #4

Closed gakabani closed 1 year ago

gakabani commented 1 year ago

I am learning Spatial Transcriptomics, and I am currently learning how to use the Package ‘Voyager.’ I am having issues with the routine "calculateBivariate" after running the example on page 6 of the manual. I am getting the following:

sfe <- sfe[,sfe$in_tissue] sfe <- logNormCounts(sfe) gs <- modelGeneVar(sfe) hvgs <- getTopHVGs(gs, fdr.threshold = 0.01) g <- colGraph(sfe, "visium") <- findVisiumGraph(sfe) mat <- logcounts(sfe)[hvgs[1:5],] df <- df2sf(spatialCoords(sfe), spatialCoordsNames(sfe)) out <- calculateBivariate(mat, type = "lee", listw = g) Error in calculateBivariate(mat, type = "lee", listw = g) : could not find function "calculateBivariate"

I am using RStudio Version 2023.03.0+386 (2023.03.0+386) on a mac.

Thank you

lambdamoses commented 1 year ago

Thank you for using Voyager! Which version of Voyager are you using? calculateBivariate was added in 1.2.0, or Bioconductor 3.17. If you are using the Bioconductor 3.16 version, then this function won't be found.

gakabani commented 1 year ago

Thank you for using Voyager! Which version of Voyager are you using? calculateBivariate was added in 1.2.0, or Bioconductor 3.17. If you are using the Bioconductor 3.16 version, then this function won't be found.

I see I am using Voyager version 1.0.10 and Biocversion 3.16

gakabani commented 1 year ago

I am encountering the following error after upgrading R and Bioconductor

Error: package or namespace load failed for ‘Voyager’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/BiocParallel/libs/BiocParallel.so': dlopen(/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/BiocParallel/libs/BiocParallel.so, 0x0006): Library not loaded: /Library/Frameworks/R.framework/Versions/4.3/Resources/lib/libR.dylib Referenced from: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/BiocParallel/libs/BiocParallel.so Reason: tried: '/Library/Frameworks/R.framework/Versions/4.3/Resources/lib/libR.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/R.framework/Versions/4.3/Resources/lib/libR.dylib' (no such file), '/Library/Frameworks/R.framework/Versions/4.3/Resources/lib/libR.dylib' (no such file), '/usr/local/lib/libR.dylib' (no such file), '/usr/lib/libR.dylib' (no

lambdamoses commented 1 year ago

I'm not sure how I can help, but these are some attempts: This error has been seen before: https://community.rstudio.com/t/rstudio-and-r-will-not-start-on-mac-m1-os-x-monterey/120055 Does your computer have arm64 (M1/M2) but you downloaded the x86_64 binary for Intel? Also, I have seen a similar error after compiling R from source without --enable-R-shlib. I wonder why this shows up in the pre-compiled version though. Also make sure your xcode command line tool is installed and up to date, as it's needed to compile packages from source. Are you able to compile BiocParallel from source? You can try BiocManager::install("BiocParallel", type = "source", force = TRUE) to compile it if you initially installed it from binary.

Last resort if nothing else works: Download R source code: https://cran.r-project.org/src/base/R-4/R-4.3.0.tar.gz

Then type these in the Terminal:

tar -xzvf R-4.3.0.tar.gz
cd R-4.3.0
./configure --enable-R-shlib \
--with-blas --with-lapack # Use Apple vecLib optimized BLAS for faster linear algebra
make
make install

Then the R you compiled from source will be installed at /usr/local/bin/R and you can delete the R in /Library/Frameworks/R.framework/, so RStudio will use /usr/local/bin/R.

lambdamoses commented 1 year ago

Please let me know if anything worked

gakabani commented 1 year ago

Thank you for your email. I was not able to fix the issue with the missing libraries under Bioconductor 3.17. I need to revert to Bioconductor version 3.16, as many other packages were affected. This is an issue with Bioconductor and not with Voyager.

lambdamoses commented 1 year ago

Are you on Bioconductor Slack (community-bioc.slack.com) or support channel? I think the core team is responsible for solving this kind of problems and they do respond on Slack.

gakabani commented 1 year ago

Thank you, I tried to register on Slack, but I need an invitation to join. Unfortunately, the community-bloc group only accepts certain email domains.

gakabani commented 1 year ago

Thank you very much! I finished establishing my profile and will post the issue in detail by tomorrow.

gakabani commented 1 year ago

Dear Moses, I was able to resolve some previous issues, but now I encountered another issue trying to duplicate your brief example. I loaded the library SFEData, but when I called for

library(SFEData) knitr::include_graphics("tissue_lowres_5a.jpeg") Error in knitr::include_graphics("tissue_lowres_5a.jpeg") : Cannot find the file(s): "tissue_lowres_5a.jpeg"

Let me know what extra info you may need to assess the problem.

I am using

packageVersion("BiocVersion")[,1:2] [1] ‘3.17’

lambdamoses commented 1 year ago

Download the image file here: https://github.com/pachterlab/voyager/blob/main/vignettes/tissue_lowres_5a.jpeg The code runs on GitHub Actions because the image is in the vignettes directory and the Rmd notebooks are built with vignettes as the working directory. I'll change that part of the vignette to explicitly download the image to avoid confusion.

lambdamoses commented 1 year ago

I just realized that you were using the vignette on Bioconductor. Because of the Bioconductor package size limits which includes the rendered vignettes, we have a much more comprehensive documentation website not on Bioconductor: https://pachterlab.github.io/voyager/index.html

gakabani commented 1 year ago

Dear Moses, Thank you very much for your help. I am duplicating your example "CODEX exploratory data analysis" and learning from it. It is indeed a very complex package, and it is worth the time and effort to learn from it.

lambdamoses commented 1 year ago

Let me know if you have more questions or concerns.