From f6446054133249580e0e844d9d9b3ffa14481dda Mon Sep 17 00:00:00 2001 From: josschavezf Date: Mon, 12 Feb 2024 12:43:50 -0500 Subject: [PATCH 1/6] replace devtools::install_github -> pak::install_package --- vignettes/codex_mouse_spleen.Rmd | 15 ++-- vignettes/configuration.Rmd | 20 +---- vignettes/ecosystem.Rmd | 12 +-- vignettes/errorsfaqsandtips.Rmd | 29 ++++++++ vignettes/faqs.Rmd | 4 +- vignettes/image_alignment.Rmd | 4 +- vignettes/installation.Rmd | 22 +----- vignettes/interactive_selection.Rmd | 4 +- vignettes/interoperability_anndata.Rmd | 4 +- vignettes/merfish_mouse_hypothalamic.Rmd | 4 +- vignettes/mini_seqfish.Rmd | 4 +- vignettes/mouse_embryo_dbitseq.Rmd | 2 +- vignettes/nanostring_cosmx_lung_cancer.Rmd | 2 +- vignettes/object_creation.Rmd | 1 + vignettes/resolve_biosciences.Rmd | 9 +-- vignettes/saving_object.Rmd | 4 +- vignettes/saving_plots.Rmd | 4 +- vignettes/seqfish_cortex.Rmd | 10 +-- vignettes/seqscope_mouse_liver.rmd | 9 ++- vignettes/singlecell_lung_adenocarcinoma.Rmd | 14 ++-- vignettes/singlecell_prostate_integration.Rmd | 10 +-- vignettes/singlecell_prostate_standard.Rmd | 10 +-- vignettes/spatial_citeseq_human_skin.Rmd | 9 ++- vignettes/spatial_genomics_mouse_kidney.Rmd | 13 ++-- vignettes/spatial_transformations.Rmd | 17 +++-- .../visium_cytassist_human_glioblastoma.Rmd | 11 +-- vignettes/visium_cytassist_lungcancer.Rmd | 28 +++---- vignettes/visium_mouse_brain.Rmd | 40 ++++------ vignettes/visium_mouse_kidney.Rmd | 47 ++++++------ vignettes/visium_prostate_integration.Rmd | 49 ++++++------- vignettes/visualizations.Rmd | 15 ++-- vignettes/vizgen_mouse_brain.Rmd | 73 +++++++++---------- vignettes/xenium_breast_cancer.rmd | 14 ++-- 33 files changed, 246 insertions(+), 267 deletions(-) diff --git a/vignettes/codex_mouse_spleen.Rmd b/vignettes/codex_mouse_spleen.Rmd index 638025f41..f4134482b 100644 --- a/vignettes/codex_mouse_spleen.Rmd +++ b/vignettes/codex_mouse_spleen.Rmd @@ -11,20 +11,19 @@ vignette: > ```{r, eval=FALSE} # Ensure Giotto Suite is installed. if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") + pak::pkg_install("drieslab/Giotto") } # Ensure GiottoData, a small, helper module for tutorials, is installed. if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") + pak::pkg_install("drieslab/GiottoData") } -library(Giotto) # Ensure the Python environment for Giotto has been installed. -genv_exists = checkGiottoEnvironment() +genv_exists = Giotto::checkGiottoEnvironment() if(!genv_exists){ # The following command need only be run once to install the Giotto environment. - installGiottoEnvironment() + Giotto::installGiottoEnvironment() } ``` @@ -48,11 +47,9 @@ my_python_path = NULL # alternatively, "/local/python/path/python" if desired. # Dataset explanation -The CODEX data to run this tutorial can be found [here](https://github.com/drieslab/spatial-datasets/tree/master/data/2018_codex_spleen). Alternatively you can use the **getSpatialDataset** to automatically -download this dataset like we do in this example. +The CODEX data to run this tutorial can be found [here](https://github.com/drieslab/spatial-datasets/tree/master/data/2018_codex_spleen). Alternatively you can use the **getSpatialDataset** to automatically download this dataset like we do in this example. -[Goltsev et al.](https://www.cell.com/cell/pdf/S0092-8674(18)30904-8.pdf) created a multiplexed datasets of normal and lupus (MRL/lpr) murine spleens using CODEX technique. The dataset consists of 30 protein markers from 734,101 -single cells. In this tutorial, 83,787 cells from sample "BALBc-3" were +[Goltsev et al.](https://www.cell.com/cell/pdf/S0092-8674(18)30904-8.pdf) created a multiplexed datasets of normal and lupus (MRL/lpr) murine spleens using CODEX technique. The dataset consists of 30 protein markers from 734,101 single cells. In this tutorial, 83,787 cells from sample "BALBc-3" were selected for the analysis. diff --git a/vignettes/configuration.Rmd b/vignettes/configuration.Rmd index 4bd01b602..de2f01885 100644 --- a/vignettes/configuration.Rmd +++ b/vignettes/configuration.Rmd @@ -18,35 +18,19 @@ Giotto contains several functions that contain wrappers to Python code and thus ```{r, eval=FALSE} # Ensure Giotto Suite is installed if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto") + pak::pkg_install("drieslab/Giotto") } library(Giotto) # Ensure Giotto Data is installed if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") + pak::pkg_install("drieslab/GiottoData") } library(GiottoData) ``` -NOTE: With the most recent version of Giotto, the following error has been observed, particularly when installing the package from a terminal: - -![](images/installation/timeout.png) - - -This error is related to the time required for downloading the package. To solve the error, increase the limit of downloading time by running this code in your R console: - -```{r, eval=FALSE} -options(timeout = max(1000, getOption("timeout"))) -``` - -If you are doing the installation through a linux terminal, you can run instead this command to directly modify your R environment variable: - -``` -echo "R_DEFAULT_INTERNET_TIMEOUT = 1000" >> .Renviron -``` ```{r, eval=FALSE} diff --git a/vignettes/ecosystem.Rmd b/vignettes/ecosystem.Rmd index 578196ba9..4ef1a3253 100644 --- a/vignettes/ecosystem.Rmd +++ b/vignettes/ecosystem.Rmd @@ -29,7 +29,7 @@ Find more information [here](https://drieslab.github.io/GiottoClass/) To install GiottoClass run: ```{r, eval=FALSE} -devtools::install_github('drieslab/GiottoClass') +pak::pkg_install('drieslab/GiottoClass') ``` # 3. GiottoUtils @@ -41,7 +41,7 @@ Find more information [here](https://drieslab.github.io/GiottoUtils/) To install GiottoUtils run: ```{r, eval=FALSE} -devtools::install_github('drieslab/GiottoUtils') +pak::pkg_install('drieslab/GiottoUtils') ``` # 4. GiottoVisuals @@ -53,7 +53,7 @@ Find more information [here](https://drieslab.github.io/GiottoVisuals/) To install GiottoVisuals run: ```{r, eval=FALSE} -devtools::install_github('drieslab/GiottoVisuals') +pak::pkg_install('drieslab/GiottoVisuals') ``` # 5. GiottoData @@ -67,7 +67,7 @@ Find more information [here](https://drieslab.github.io/GiottoData/) To install GiottoData run: ```{r, eval=FALSE} -devtools::install_github('drieslab/GiottoData') +pak::pkg_install('drieslab/GiottoData') ``` @@ -79,14 +79,14 @@ The scripts used to create both the mini giotto objects and mini objects are ava ```{r, eval=FALSE} # Ensure Giotto Suite is installed if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto") + pak::pkg_install("drieslab/Giotto") } library(Giotto) # Ensure Giotto Data is installed if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") + pak::pkg_install("drieslab/GiottoData") } library(GiottoData) diff --git a/vignettes/errorsfaqsandtips.Rmd b/vignettes/errorsfaqsandtips.Rmd index ed484b4b7..563edb68b 100644 --- a/vignettes/errorsfaqsandtips.Rmd +++ b/vignettes/errorsfaqsandtips.Rmd @@ -303,3 +303,32 @@ installGiottoEnvironment(force_environment = TRUE, force_miniconda = TRUE) If the issue persists, please post an issue on the [GitHub](https://github.com/drieslab/Giotto/issues). +# Time out + +If you're installing Giotto using devtools or remote packages, with the most recent version of Giotto, the following error has been observed: + +![](images/installation/timeout.png) + + +This error is related to the time required for downloading the package. To solve the error, increase the limit of downloading time by running this code in your R console: + +```{r, eval=FALSE} +options(timeout = max(1000, getOption("timeout"))) +``` + +If you are doing the installation through a linux terminal, you can run instead this command to directly modify your R environment variable: + +``` +echo "R_DEFAULT_INTERNET_TIMEOUT = 1000" >> .Renviron +``` + +Alternatively, you can use the package pak to install Giotto + +```{r, eval=FALSE} +if(!"pak" %in% installed.packages()) { + install.packages("pak") +} + +pak::pkg_install("drieslab/Giotto") +``` + diff --git a/vignettes/faqs.Rmd b/vignettes/faqs.Rmd index 3f78be4d0..fbd62af18 100644 --- a/vignettes/faqs.Rmd +++ b/vignettes/faqs.Rmd @@ -34,14 +34,14 @@ Use `getSpatialDataset()` from GiottoData: ```{r, eval=FALSE} # Ensure Giotto Suite is installed if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") + pak::pkg_install("drieslab/Giotto") } library(Giotto) # Ensure Giotto Data is installed if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") + pak::pkg_install("drieslab/GiottoData") } library(GiottoData) diff --git a/vignettes/image_alignment.Rmd b/vignettes/image_alignment.Rmd index a12ab97fb..63db831ad 100644 --- a/vignettes/image_alignment.Rmd +++ b/vignettes/image_alignment.Rmd @@ -21,13 +21,13 @@ For an example of working with high definition images that may require ROI align ```{r, eval=FALSE} # Ensure Giotto Suite is installed if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") + pak::pkg_install("drieslab/Giotto") } library(Giotto) # Ensure Giotto Data is installed if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") + pak::pkg_install"drieslab/GiottoData") } library(GiottoData) diff --git a/vignettes/installation.Rmd b/vignettes/installation.Rmd index 5fe3a386f..623376566 100644 --- a/vignettes/installation.Rmd +++ b/vignettes/installation.Rmd @@ -25,29 +25,13 @@ Giotto Suite is installed via R **but there are required Python modules** which ```{r, eval=FALSE} # Necessary for installation from R -if(!"devtools" %in% installed.packages()) { - install.packages("devtools") +if(!"pak" %in% installed.packages()) { + install.packages("pak") } -devtools::install_github("drieslab/Giotto") +pak::pkg_install("drieslab/Giotto") ``` -NOTE: With the most recent version of Giotto, the following error has been observed, particularly when installing the package from a terminal: - -![](images/installation/timeout.png) - - -This error is related to the time required for downloading the package. To solve the error, increase the limit of downloading time by running this code in your R console: - -```{r, eval=FALSE} -options(timeout = max(1000, getOption("timeout"))) -``` - -If you are doing the installation through a linux terminal, you can run instead this command to directly modify your R environment variable: - -``` -echo "R_DEFAULT_INTERNET_TIMEOUT = 1000" >> .Renviron -``` ## 2.2 Install the Giotto Python Environment diff --git a/vignettes/interactive_selection.Rmd b/vignettes/interactive_selection.Rmd index 5710bfa15..8d13a2aa0 100644 --- a/vignettes/interactive_selection.Rmd +++ b/vignettes/interactive_selection.Rmd @@ -17,12 +17,12 @@ You can use as input either a ggplot2 object, a terra::rast image, or the output ```{r, eval=FALSE} # Ensure Giotto Suite is installed. if(!'Giotto' %in% installed.packages()) { - devtools::install_github('drieslab/Giotto@suite') + pak::pkg_install("drieslab/Giotto") } # Ensure GiottoData, a small, helper module for tutorials, is installed. if(!'GiottoData' %in% installed.packages()) { - devtools::install_github('drieslab/GiottoData') + pak::pkg_install('drieslab/GiottoData') } library(Giotto) diff --git a/vignettes/interoperability_anndata.Rmd b/vignettes/interoperability_anndata.Rmd index 3a455d072..0359a5daa 100644 --- a/vignettes/interoperability_anndata.Rmd +++ b/vignettes/interoperability_anndata.Rmd @@ -17,14 +17,14 @@ This tutorial details how to use the conversion functions `anndataToGiotto()` an ```{r, eval=FALSE} # Ensure Giotto Suite is installed if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") + pak::pkg_install("drieslab/Giotto") } library(Giotto) # Ensure Giotto Data is installed if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") + pak::pkg_install("drieslab/GiottoData") } library(GiottoData) diff --git a/vignettes/merfish_mouse_hypothalamic.Rmd b/vignettes/merfish_mouse_hypothalamic.Rmd index b4f3d66ef..2bf63155d 100644 --- a/vignettes/merfish_mouse_hypothalamic.Rmd +++ b/vignettes/merfish_mouse_hypothalamic.Rmd @@ -14,12 +14,12 @@ Clustering, 3D visualization, and cell type identification of clusters using mar ```{r, eval=FALSE} # Ensure Giotto Suite is installed. if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") + pak::pkg_install("drieslab/Giotto") } # Ensure GiottoData, a small, helper module for tutorials, is installed. if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") + pak::pkg_install("drieslab/GiottoData") } library(Giotto) diff --git a/vignettes/mini_seqfish.Rmd b/vignettes/mini_seqfish.Rmd index 29108997d..a1f95b691 100644 --- a/vignettes/mini_seqfish.Rmd +++ b/vignettes/mini_seqfish.Rmd @@ -12,12 +12,12 @@ vignette: > ```{r, eval=FALSE} # Ensure Giotto Suite is installed. if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto") + pak::pkg_install("drieslab/Giotto") } # Ensure GiottoData, a small, helper module for tutorials, is installed. if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") + pak::pkg_install("drieslab/GiottoData") } # Ensure the Python environment for Giotto has been installed. diff --git a/vignettes/mouse_embryo_dbitseq.Rmd b/vignettes/mouse_embryo_dbitseq.Rmd index f7c11adf5..2013a553c 100644 --- a/vignettes/mouse_embryo_dbitseq.Rmd +++ b/vignettes/mouse_embryo_dbitseq.Rmd @@ -17,7 +17,7 @@ The dataset was created by [Liu, et al 2020](https://www.sciencedirect.com/scien ```{r, eval=FALSE} # Ensure Giotto Suite is installed if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto") + pak::pkg_install("drieslab/Giotto") } library(Giotto) diff --git a/vignettes/nanostring_cosmx_lung_cancer.Rmd b/vignettes/nanostring_cosmx_lung_cancer.Rmd index ed4411936..64d31e446 100644 --- a/vignettes/nanostring_cosmx_lung_cancer.Rmd +++ b/vignettes/nanostring_cosmx_lung_cancer.Rmd @@ -14,7 +14,7 @@ This example uses subcellular data from Nanostring's CosMx Spatial Molecular Ima ```{r, eval=FALSE} # Ensure Giotto Suite is installed. if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto") + pak::pkg_install("drieslab/Giotto") } # Ensure the Python environment for Giotto has been installed. diff --git a/vignettes/object_creation.Rmd b/vignettes/object_creation.Rmd index c1111dc23..388838cea 100644 --- a/vignettes/object_creation.Rmd +++ b/vignettes/object_creation.Rmd @@ -18,6 +18,7 @@ To download this data, please ensure that [wget](https://www.gnu.org/software/wg ```{r, eval=FALSE} library(Giotto) +library(GiottoData) genv_exists = checkGiottoEnvironment() if(!genv_exists){ diff --git a/vignettes/resolve_biosciences.Rmd b/vignettes/resolve_biosciences.Rmd index 2c3a50f97..d29826625 100644 --- a/vignettes/resolve_biosciences.Rmd +++ b/vignettes/resolve_biosciences.Rmd @@ -11,20 +11,19 @@ vignette: > ```{r, eval=FALSE} # Ensure Giotto Suite is installed. if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") + pak::pkg_install("drieslab/Giotto") } # Ensure GiottoData, a small, helper module for tutorials, is installed. if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") + pak::pkg_install("drieslab/GiottoData") } -library(Giotto) # Ensure the Python environment for Giotto has been installed. -genv_exists = checkGiottoEnvironment() +genv_exists = Giotto::checkGiottoEnvironment() if(!genv_exists){ # The following command need only be run once to install the Giotto environment. - installGiottoEnvironment() + Giotto::installGiottoEnvironment() } ``` diff --git a/vignettes/saving_object.Rmd b/vignettes/saving_object.Rmd index 107e2916d..0bce034b6 100644 --- a/vignettes/saving_object.Rmd +++ b/vignettes/saving_object.Rmd @@ -20,14 +20,14 @@ Giotto instead implements the `saveGiotto()` and `loadGiotto()` functions that c ```{r, eval=FALSE} # Ensure Giotto Suite is installed if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") + pak::pkg_install("drieslab/Giotto") } library(Giotto) # Ensure Giotto Data is installed if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") + pak::pkg_install("drieslab/GiottoData") } library(GiottoData) diff --git a/vignettes/saving_plots.Rmd b/vignettes/saving_plots.Rmd index fb2c63d3f..23e80355d 100644 --- a/vignettes/saving_plots.Rmd +++ b/vignettes/saving_plots.Rmd @@ -19,14 +19,14 @@ R/Posit and Giotto provide different ways to save spatial data. Here, a **giotto ```{r, eval=FALSE} # Ensure Giotto Suite is installed if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") + pak::pkg_install("drieslab/Giotto") } library(Giotto) # Ensure Giotto Data is installed if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") + pak::pkg_install("drieslab/GiottoData") } library(GiottoData) diff --git a/vignettes/seqfish_cortex.Rmd b/vignettes/seqfish_cortex.Rmd index 4434cac6f..baef0703e 100644 --- a/vignettes/seqfish_cortex.Rmd +++ b/vignettes/seqfish_cortex.Rmd @@ -13,20 +13,19 @@ vignette: > ```{r, eval=FALSE} # Ensure Giotto Suite is installed. if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") + pak::pkg_install("drieslab/Giotto") } # Ensure GiottoData, a small, helper module for tutorials, is installed. if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") + pak::pkg_install("drieslab/GiottoData") } -library(Giotto) # Ensure the Python environment for Giotto has been installed. -genv_exists = checkGiottoEnvironment() +genv_exists = Giotto::checkGiottoEnvironment() if(!genv_exists){ # The following command need only be run once to install the Giotto environment. - installGiottoEnvironment() + Giotto::installGiottoEnvironment() } ``` @@ -43,6 +42,7 @@ image: # Download Data ```{r, eval=FALSE} +library(Giotto) library(GiottoData) my_working_dir = '/path/to/directory/' diff --git a/vignettes/seqscope_mouse_liver.rmd b/vignettes/seqscope_mouse_liver.rmd index 6d523a465..d23b97e11 100644 --- a/vignettes/seqscope_mouse_liver.rmd +++ b/vignettes/seqscope_mouse_liver.rmd @@ -46,15 +46,14 @@ You should now have the count matrix for Giotto Object. Note the Spatial Barcode ```{r, eval=FALSE} # Ensure Giotto Suite is installed. if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") + pak::pkg_install("drieslab/Giotto") } -library(Giotto) # Ensure the Python environment for Giotto has been installed. -genv_exists = checkGiottoEnvironment() +genv_exists = Giotto::checkGiottoEnvironment() if(!genv_exists){ # The following command need only be run once to install the Giotto environment. - installGiottoEnvironment() + Giotto::installGiottoEnvironment() } ``` @@ -63,6 +62,8 @@ if(!genv_exists){ ```{r, eval=FALSE} +library(Giotto) + # 1. set working directory results_folder = 'path/to/result' diff --git a/vignettes/singlecell_lung_adenocarcinoma.Rmd b/vignettes/singlecell_lung_adenocarcinoma.Rmd index 5e86a671a..9645e5485 100644 --- a/vignettes/singlecell_lung_adenocarcinoma.Rmd +++ b/vignettes/singlecell_lung_adenocarcinoma.Rmd @@ -11,20 +11,20 @@ vignette: > ```{r, eval=FALSE} # Ensure Giotto Suite is installed. if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto") - } + pak::pkg_install("drieslab/Giotto") +} # Ensure GiottoData, a small, helper module for tutorials, is installed. if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") - } + pak::pkg_install("drieslab/GiottoData") +} # Ensure the Python environment for Giotto has been installed. -genv_exists = checkGiottoEnvironment() +genv_exists = Giotto::checkGiottoEnvironment() if(!genv_exists){ # The following command need only be run once to install the Giotto environment. - installGiottoEnvironment() - } + Giotto::installGiottoEnvironment() +} ``` diff --git a/vignettes/singlecell_prostate_integration.Rmd b/vignettes/singlecell_prostate_integration.Rmd index cc828f7c1..4ddfb9841 100644 --- a/vignettes/singlecell_prostate_integration.Rmd +++ b/vignettes/singlecell_prostate_integration.Rmd @@ -10,19 +10,19 @@ vignette: > ``` {r, eval=FALSE} # Ensure Giotto Suite is installed. if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") + pak::pkg_install("drieslab/Giotto") } # Ensure GiottoData, a small, helper module for tutorials, is installed. if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") + pak::pkg_install("drieslab/GiottoData") } -library(Giotto) + # Ensure the Python environment for Giotto has been installed. -genv_exists = checkGiottoEnvironment() +genv_exists = Giotto::checkGiottoEnvironment() if(!genv_exists){ # The following command need only be run once to install the Giotto environment. - installGiottoEnvironment() + Giotto::installGiottoEnvironment() } ``` diff --git a/vignettes/singlecell_prostate_standard.Rmd b/vignettes/singlecell_prostate_standard.Rmd index f95a4a5f6..a5cf174c8 100644 --- a/vignettes/singlecell_prostate_standard.Rmd +++ b/vignettes/singlecell_prostate_standard.Rmd @@ -11,19 +11,19 @@ vignette: > ```{r, eval=FALSE} # Ensure Giotto Suite is installed. if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") + pak::pkg_install("drieslab/Giotto") } # Ensure GiottoData, a small, helper module for tutorials, is installed. if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") + pak::pkg_install("drieslab/GiottoData") } -library(Giotto) + # Ensure the Python environment for Giotto has been installed. -genv_exists = checkGiottoEnvironment() +genv_exists = Giotto::checkGiottoEnvironment() if(!genv_exists){ # The following command need only be run once to install the Giotto environment. - installGiottoEnvironment() + Giotto::installGiottoEnvironment() } ``` diff --git a/vignettes/spatial_citeseq_human_skin.Rmd b/vignettes/spatial_citeseq_human_skin.Rmd index 06982976b..6934f0e20 100644 --- a/vignettes/spatial_citeseq_human_skin.Rmd +++ b/vignettes/spatial_citeseq_human_skin.Rmd @@ -16,21 +16,22 @@ To run this example, we will use the Skin dataset from the article [High-plex pr ```{r, eval=FALSE} # Ensure Giotto Suite is installed if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto") + pak::pkg_install("drieslab/Giotto") } -library(Giotto) # Ensure the Python environment for Giotto has been installed -genv_exists = checkGiottoEnvironment() +genv_exists = Giotto::checkGiottoEnvironment() if(!genv_exists){ # The following command need only be run once to install the Giotto environment - installGiottoEnvironment() + Giotto::installGiottoEnvironment() } ``` # 3 Create Giotto object ```{r, eval=FALSE} +library(Giotto) + instrs <- createGiottoInstructions(save_plot = TRUE, save_dir = "results", show_plot = TRUE) diff --git a/vignettes/spatial_genomics_mouse_kidney.Rmd b/vignettes/spatial_genomics_mouse_kidney.Rmd index c2b752a01..ed8cf425e 100644 --- a/vignettes/spatial_genomics_mouse_kidney.Rmd +++ b/vignettes/spatial_genomics_mouse_kidney.Rmd @@ -18,21 +18,19 @@ This tutorial covers Giotto object creation and simple exploratory analysis with ```{r, eval=FALSE} # Ensure Giotto Suite is installed if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") + pak::pkg_install("drieslab/Giotto") } -library(Giotto) # Ensure Giotto Data is installed if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") + pak::pkg_install("drieslab/GiottoData") } -library(GiottoData) # Ensure the Python environment for Giotto has been installed -genv_exists = checkGiottoEnvironment() +genv_exists = Giotto::checkGiottoEnvironment() if(!genv_exists){ # The following command need only be run once to install the Giotto environment - installGiottoEnvironment() + Giotto::installGiottoEnvironment() } ``` @@ -41,6 +39,9 @@ if(!genv_exists){ ```{r, eval=FALSE} +library(Giotto) +library(GiottoData) + # Set path to folder containing spatial genomics data datadir = '/path/to/Spatial/Genomics/data/' diff --git a/vignettes/spatial_transformations.Rmd b/vignettes/spatial_transformations.Rmd index 74e8f5f9e..64489ff32 100644 --- a/vignettes/spatial_transformations.Rmd +++ b/vignettes/spatial_transformations.Rmd @@ -19,19 +19,20 @@ Spatial-omics data is defined both by the biological information that it contain ```{r, eval=FALSE} # Ensure Giotto Suite is installed -i_p = installed.packages() -if(!"Giotto" %in% i_p) devtools::install_github("drieslab/Giotto@suite") -library(Giotto) +if(!"Giotto" %in% installed.packages()) { + pak::pkg_install("drieslab/Giotto") +} # Ensure Giotto Data is installed -if(!"GiottoData" %in% i_p) devtools::install_github("drieslab/GiottoData") -library(GiottoData) +if(!"GiottoData" %in% installed.packages()) { + pak::pkg_install("drieslab/GiottoData") +} # Ensure the Python environment for Giotto has been installed -genv_exists = checkGiottoEnvironment() +genv_exists = Giotto::checkGiottoEnvironment() if(!genv_exists){ # The following command need only be run once to install the Giotto environment - installGiottoEnvironment() + Giotto::installGiottoEnvironment() } ``` @@ -42,6 +43,8 @@ First we will load in the a mini dataset put together from Vizgen's Mouse Brain ```{r, eval=FALSE} +library(Giotto) + viz <- GiottoData::loadGiottoMini(dataset = 'vizgen') activeSpatUnit(viz) <- 'aggregate' ``` diff --git a/vignettes/visium_cytassist_human_glioblastoma.Rmd b/vignettes/visium_cytassist_human_glioblastoma.Rmd index 65e4c40f9..df8604e21 100644 --- a/vignettes/visium_cytassist_human_glioblastoma.Rmd +++ b/vignettes/visium_cytassist_human_glioblastoma.Rmd @@ -18,19 +18,20 @@ More information about this dataset can be found [here](https://www.10xgenomics. ```{r, eval=FALSE} # Ensure Giotto Suite is installed if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto") + pak::pkg_install("drieslab/Giotto") } -library(Giotto) # Ensure the Python environment for Giotto has been installed -genv_exists = checkGiottoEnvironment() +genv_exists = Giotto::checkGiottoEnvironment() if(!genv_exists){ # The following command need only be run once to install the Giotto environment - installGiottoEnvironment() + Giotto::installGiottoEnvironment() } ``` ```{r, eval=FALSE} +library(Giotto) + # 1. set results directory results_directory = 'results' @@ -407,4 +408,4 @@ loaded via a namespace (and not attached): [19] fastmap_1.1.1 yaml_2.3.8 lifecycle_1.0.4 memoise_2.0.1 stringr_1.5.1 compiler_4.3.2 [25] miniUI_0.1.1.1 sessioninfo_1.2.2 fs_1.6.3 htmlwidgets_1.6.4 Rcpp_1.0.12 urlchecker_1.0.1 [31] rstudioapi_0.15.0 later_1.3.2 digest_0.6.34 R6_2.5.1 usethis_2.2.2 magrittr_2.0.3 -[37] tools_4.3.2 mime_0.12 devtools_2.4.5 profvis_0.3.8 remotes_2.4.2.1 cachem_1.0.8 \ No newline at end of file +[37] tools_4.3.2 mime_0.12 devtools_2.4.5 profvis_0.3.8 remotes_2.4.2.1 cachem_1.0.8 diff --git a/vignettes/visium_cytassist_lungcancer.Rmd b/vignettes/visium_cytassist_lungcancer.Rmd index 3d72d19ee..3d9c552e5 100644 --- a/vignettes/visium_cytassist_lungcancer.Rmd +++ b/vignettes/visium_cytassist_lungcancer.Rmd @@ -22,28 +22,15 @@ To run the current vignette you need to install the Giotto Suite branch. ```{r, eval=FALSE} # Ensure Giotto Suite and GiottoData packages are installed if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") + pak::pkg_install("drieslab/Giotto") } -if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") -} - -library(Giotto) -library(GiottoData) - # Ensure the Python environment for Giotto has been installed -genv_exists = checkGiottoEnvironment() +genv_exists = Giotto::checkGiottoEnvironment() if(!genv_exists){ # The following command need only be run once to install the Giotto environment. - installGiottoEnvironment() + Giotto::installGiottoEnvironment() } - -# to automatically save figures in save_dir set save_plot to TRUE -results_dir = '/path/to/results/directory' -myinstructions = createGiottoInstructions(save_dir = results_dir, - save_plot = TRUE, - show_plot = TRUE) ``` # 1. Create a Giotto object @@ -54,9 +41,18 @@ The minimum requirements are - x,y(,z) coordinates for cells or spots (or path to) ```{r, eval=FALSE} +library(Giotto) + # Provide path to visium folder data_path = '/path/to/data/directory' +# to automatically save figures in save_dir set save_plot to TRUE +results_dir = '/path/to/results/directory' + +myinstructions = createGiottoInstructions(save_dir = results_dir, + save_plot = TRUE, + show_plot = TRUE) + # Create Giotto object visium_lungcancer = createGiottoVisiumObject(visium_dir = data_path, expr_data = 'raw', diff --git a/vignettes/visium_mouse_brain.Rmd b/vignettes/visium_mouse_brain.Rmd index b62310170..96b047403 100644 --- a/vignettes/visium_mouse_brain.Rmd +++ b/vignettes/visium_mouse_brain.Rmd @@ -7,29 +7,6 @@ vignette: > %\VignetteEncoding{UTF-8} --- -# Set up Giotto Environment - -```{r, eval=FALSE} -# Ensure Giotto Suite is installed. -if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") -} - -# Ensure GiottoData, a small, helper module for tutorials, is installed. -if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") -} - -library(Giotto) - -# Ensure the Python environment for Giotto has been installed. -genv_exists = checkGiottoEnvironment() -if(!genv_exists){ - # The following command need only be run once to install the Giotto environment. - installGiottoEnvironment() -} -``` - # Dataset explanation [10X genomics](https://www.10xgenomics.com/spatial-transcriptomics/) recently launched a new platform to obtain spatial expression data using a Visium Spatial Gene Expression slide. @@ -44,11 +21,26 @@ High resolution png from original tissue: ![]images/general_figs/mouse_brain_highres.png) +# Set up Giotto Environment + +```{r, eval=FALSE} +# Ensure Giotto Suite is installed. +if(!"Giotto" %in% installed.packages()) { + pak::pkg_install("drieslab/Giotto") +} + +# Ensure the Python environment for Giotto has been installed. +genv_exists = Giotto::checkGiottoEnvironment() +if(!genv_exists){ + # The following command need only be run once to install the Giotto environment. + Giotto::installGiottoEnvironment() +} +``` + # Part 1: Create Giotto Visium Object and visualize ```{r, eval=FALSE} library(Giotto) -library(GiottoData) # 1. set working directory results_folder = 'path/to/result' diff --git a/vignettes/visium_mouse_kidney.Rmd b/vignettes/visium_mouse_kidney.Rmd index a4142460a..b1e764744 100644 --- a/vignettes/visium_mouse_kidney.Rmd +++ b/vignettes/visium_mouse_kidney.Rmd @@ -9,27 +9,40 @@ vignette: > Warning: This tutorial was written with Giotto version 2.0.0.9046.This is an older version and results could be slightly different +# Dataset explanation + +[10X genomics](https://www.10xgenomics.com/spatial-transcriptomics/) recently launched a new platform to obtain spatial expression data using a Visium Spatial Gene Expression slide. + +The Visium kidney data to run this tutorial can be found [here](https://support.10xgenomics.com/spatial-gene-expression/datasets/1.0.0/V1_Mouse_Kidney) + +Visium technology: + +![](images/general_figs/visium_technology.png) + +High resolution png from original tissue: + +![](images/general_figs/mouse_kidney_highres.png) + +# Set up Giotto Environment + ```{r, eval=FALSE} # Ensure Giotto Suite is installed. if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") + pak::pkg_install("drieslab/Giotto") } -# Ensure GiottoData, a small, helper module for tutorials, is installed. -if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") -} # Ensure the Python environment for Giotto has been installed. -library(Giotto) -genv_exists = checkGiottoEnvironment() +genv_exists = Giotto::checkGiottoEnvironment() if(!genv_exists){ # The following command need only be run once to install the Giotto environment. - installGiottoEnvironment() + Giotto::installGiottoEnvironment() } ``` +# 1. Giotto global instructions and preparations + ```{r, eval=FALSE} -library(GiottoData) +library(Giotto) # 1. set working directory results_folder = '/path/to/directory/' @@ -40,22 +53,6 @@ results_folder = '/path/to/directory/' python_path = NULL # alternatively, "/local/python/path/python" if desired. ``` -# Dataset explanation - -[10X genomics](https://www.10xgenomics.com/spatial-transcriptomics/) recently launched a new platform to obtain spatial expression data using a Visium Spatial Gene Expression slide. - -The Visium kidney data to run this tutorial can be found [here](https://support.10xgenomics.com/spatial-gene-expression/datasets/1.0.0/V1_Mouse_Kidney) - -Visium technology: - -![](images/general_figs/visium_technology.png) - -High resolution png from original tissue: - -![](images/general_figs/mouse_kidney_highres.png) - -# 1. Giotto global instructions and preparations - ```{r, eval=FALSE} ## create instructions instrs = createGiottoInstructions(save_dir = results_folder, diff --git a/vignettes/visium_prostate_integration.Rmd b/vignettes/visium_prostate_integration.Rmd index e6d3a3948..c65f95532 100644 --- a/vignettes/visium_prostate_integration.Rmd +++ b/vignettes/visium_prostate_integration.Rmd @@ -7,30 +7,42 @@ vignette: > %\VignetteEncoding{UTF-8} --- -# 1 Start Giotto +# 1 Dataset explanation + +[10X genomics](https://www.10xgenomics.com/spatial-transcriptomics/) recently launched a new platform to obtain spatial expression data using a Visium Spatial Gene Expression slide. + +The Visium Cancer Prostate data to run this tutorial can be found [here](https://www.10xgenomics.com/resources/datasets/human-prostate-cancer-adenocarcinoma-with-invasive-carcinoma-ffpe-1-standard-1-3-0) The Visium Normal Prostate data to run this tutorial can be found [here](https://www.10xgenomics.com/resources/datasets/normal-human-prostate-ffpe-1-standard-1-3-0) + +Visium technology: + +![](images/general_figs/visium_technology.png){width="50.0%"} + +High resolution png from original tissue: + +![](images/general_figs/Visium_FFPE_Human_Normal_Prostate_image.png){width="50.0%"} + +![](images/general_figs/Visium_FFPE_Human_Prostate_Cancer_image.png){width="50.0%"} + + +# 2 Start Giotto ```{r, eval=FALSE} # Ensure Giotto Suite is installed if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") -} -library(Giotto) - -# Ensure Giotto Data is installed -if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") + pak::pkg_install("drieslab/Giotto") } -library(GiottoData) # Ensure the Python environment for Giotto has been installed -genv_exists = checkGiottoEnvironment() +genv_exists = Giotto::checkGiottoEnvironment() if(!genv_exists){ # The following command need only be run once to install the Giotto environment - installGiottoEnvironment() + Giotto::installGiottoEnvironment() } ``` ```{r, eval=FALSE} +library(Giotto) + # 1. set working directory results_directory = getwd() @@ -51,21 +63,6 @@ instrs = createGiottoInstructions(save_dir = results_directory, python_path = python_path) ``` -# 2 Dataset explanation - -[10X genomics](https://www.10xgenomics.com/spatial-transcriptomics/) recently launched a new platform to obtain spatial expression data using a Visium Spatial Gene Expression slide. - -The Visium Cancer Prostate data to run this tutorial can be found [here](https://www.10xgenomics.com/resources/datasets/human-prostate-cancer-adenocarcinoma-with-invasive-carcinoma-ffpe-1-standard-1-3-0) The Visium Normal Prostate data to run this tutorial can be found [here](https://www.10xgenomics.com/resources/datasets/normal-human-prostate-ffpe-1-standard-1-3-0) - -Visium technology: - -![](images/general_figs/visium_technology.png){width="50.0%"} - -High resolution png from original tissue: - -![](images/general_figs/Visium_FFPE_Human_Normal_Prostate_image.png){width="50.0%"} - -![](images/general_figs/Visium_FFPE_Human_Prostate_Cancer_image.png){width="50.0%"} # 3 Create Giotto objects and join diff --git a/vignettes/visualizations.Rmd b/vignettes/visualizations.Rmd index 596b92453..9e67f6f02 100644 --- a/vignettes/visualizations.Rmd +++ b/vignettes/visualizations.Rmd @@ -21,23 +21,19 @@ This tutorial uses a merFISH dataset of mouse hypothalamic preoptic regions from ```{r, eval=FALSE} # Ensure Giotto Suite is installed if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") + pak::pkg_install("drieslab/Giotto") } -library(Giotto) - # Ensure Giotto Data is installed if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") + pak::pkg_install("drieslab/GiottoData") } -library(GiottoData) - # Ensure the Python environment for Giotto has been installed -genv_exists = checkGiottoEnvironment() +genv_exists = Giotto::checkGiottoEnvironment() if(!genv_exists){ # The following command need only be run once to install the Giotto environment - installGiottoEnvironment() + Giotto::installGiottoEnvironment() } ``` @@ -46,6 +42,9 @@ if(!genv_exists){ ```{r, eval=FALSE} +library(Giotto) +library(GiottoData) + # Specify path from which data may be retrieved/stored data_directory = paste0(getwd(),'/gobject_visual_data/') # alternatively, "/path/to/where/the/data/lives/" diff --git a/vignettes/vizgen_mouse_brain.Rmd b/vignettes/vizgen_mouse_brain.Rmd index cabf8bc6a..94647f294 100644 --- a/vignettes/vizgen_mouse_brain.Rmd +++ b/vignettes/vizgen_mouse_brain.Rmd @@ -9,43 +9,7 @@ vignette: > *Giotto* version `2.0.0.998`. Please check the version you are using to get the same results. - -```{r, eval=FALSE} -# Ensure Giotto Suite is installed. -if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") -} - -# Ensure GiottoData, a small, helper module for tutorials, is installed. -if(!"GiottoData" %in% installed.packages()) { - devtools::install_github("drieslab/GiottoData") -} - -library(Giotto) -# Ensure the Python environment for Giotto has been installed. -genv_exists = checkGiottoEnvironment() -if(!genv_exists){ - # The following command need only be run once to install the Giotto environment. - installGiottoEnvironment() -} -``` - -# 1. Set up Giotto - -```{r, eval=FALSE} -library(Giotto) -library(GiottoData) - -# 1. set working directory where project outputs will be saved to -results_folder = '/path/to/save/directory/' - -# Optional: Specify a path to a Python executable within a conda or miniconda -# environment. If set to NULL (default), the Python executable within the previously -# installed Giotto environment will be used. -my_python_path = NULL # alternatively, "/local/python/path/python" if desired. -``` - -# 2. Dataset explanation +# 1. Dataset explanation This vignette covers Giotto object creation and simple exploratory analysis with the subcellular [MERFISH Mouse Brain Receptor Map dataset](https://vizgen.com/applications/neuroscience-showcase/) provided by Vizgen with their MERSCOPE platform. @@ -104,6 +68,41 @@ kableExtra::kable(data.frame(V1 = c(110883424764611924400221639916314253469,1351 `Vizgen Data Release V1.0. May 2021` +# 2. Set up Giotto + +```{r, eval=FALSE} +# Ensure Giotto Suite is installed. +if(!"Giotto" %in% installed.packages()) { + pak::pkg_install("drieslab/Giotto") +} + +# Ensure GiottoData, a small, helper module for tutorials, is installed. +if(!"GiottoData" %in% installed.packages()) { + pak::pkg_install(("drieslab/GiottoData") +} + +# Ensure the Python environment for Giotto has been installed. +genv_exists = Giotto::checkGiottoEnvironment() +if(!genv_exists){ + # The following command need only be run once to install the Giotto environment. + Giotto::installGiottoEnvironment() +} +``` + +```{r, eval=FALSE} +library(Giotto) +library(GiottoData) + +# 1. set working directory where project outputs will be saved to +results_folder = '/path/to/save/directory/' + +# Optional: Specify a path to a Python executable within a conda or miniconda +# environment. If set to NULL (default), the Python executable within the previously +# installed Giotto environment will be used. +my_python_path = NULL # alternatively, "/local/python/path/python" if desired. +``` + + # 3. Giotto global instructions and preparations Define plot saving behavior and project data paths diff --git a/vignettes/xenium_breast_cancer.rmd b/vignettes/xenium_breast_cancer.rmd index 463d157b3..80979b5bd 100644 --- a/vignettes/xenium_breast_cancer.rmd +++ b/vignettes/xenium_breast_cancer.rmd @@ -7,27 +7,25 @@ vignette: > %\VignetteEncoding{UTF-8} --- +# 1. Set up Giotto environment ```{r, eval=FALSE} # Ensure Giotto Suite is installed. if(!"Giotto" %in% installed.packages()) { - devtools::install_github("drieslab/Giotto@suite") + pak::pkg_install("drieslab/Giotto") } -library(Giotto) # Ensure the Python environment for Giotto has been installed. -genv_exists = checkGiottoEnvironment() +genv_exists = Giotto::checkGiottoEnvironment() if(!genv_exists){ # The following command need only be run once to install the Giotto environment. - installGiottoEnvironment() + Giotto::installGiottoEnvironment() } ``` - -# 1. Set up Giotto environment - - ```{r, eval=FALSE} +library(Giotto) + # 1. ** SET WORKING DIRECTORY WHERE PROJECT OUPUTS WILL SAVE TO ** results_folder = '/path/to/save/directory/' From 300e76218054ce75b677fb821f633d3a4472f472 Mon Sep 17 00:00:00 2001 From: josschavezf Date: Mon, 12 Feb 2024 12:50:09 -0500 Subject: [PATCH 2/6] move 'Solutions to installation errors' to 'Giotto Installation' --- _pkgdown.yml | 3 - vignettes/errorsfaqsandtips.Rmd | 334 -------------------------------- vignettes/installation.Rmd | 330 +++++++++++++++++++++++++++++++ 3 files changed, 330 insertions(+), 337 deletions(-) delete mode 100644 vignettes/errorsfaqsandtips.Rmd diff --git a/_pkgdown.yml b/_pkgdown.yml index 125deeea8..caf6bd7e4 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -43,8 +43,6 @@ navbar: href: articles/ecosystem.html - text: Giotto Class Structure href: articles/structure.html - - text: Solutions to Installation Errors - href: articles/errorsfaqsandtips.html - text: FAQs href: articles/faqs.html - text: How to report a bug @@ -210,7 +208,6 @@ articles: - installation - ecosystem - structure - - errorsfaqsandtips - faqs - branches - github_issues diff --git a/vignettes/errorsfaqsandtips.Rmd b/vignettes/errorsfaqsandtips.Rmd deleted file mode 100644 index 563edb68b..000000000 --- a/vignettes/errorsfaqsandtips.Rmd +++ /dev/null @@ -1,334 +0,0 @@ ---- -title: "Solutions to Installation Errors" -output: rmarkdown::html_vignette -vignette: > - %\VignetteIndexEntry{Solutions to Installation Errors} - %\VignetteEngine{knitr::rmarkdown} - %\VignetteEncoding{UTF-8} ---- - -# Errors on MacOS - -## Packages not Found - -In the event that packages are inaccessible in the default installation of the Giotto miniconda environment, one troubleshooting method is provided here. - - -```{r, eval=FALSE} -# Restart the R session, while maintaining workspace variables. -# If using RStudio, the following command will do exactly that: -.rs.restartR() -# Direct reticulate to use Python within the Giotto Environment -reticulate::use_python(default_python_path) -# Check if packages exist again. Ensure function from above code block is defined. -missing_packages <- pkg_check() -retry_install <- length(missing_packages) > 0 -if(retry_install){ - - # Attempt to reinstall all packages. - pkgs_w_versions <- c('pandas==1.5.1', - 'networkx==2.8.8', - 'python-igraph==0.10.2', - 'leidenalg==0.9.0', - 'python-louvain==0.16', - 'python.app==1.4', - 'scikit-learn==1.1.3') - - python_version = "3.10.2" - - py_pkgs = c('pandas','networkx', - 'igraph', 'leidenalg', - 'python-louvain','scikit-learn','python.app') - - if(Sys.info()[['sysname']] != "Darwin"){ - pkgs_w_versions = pkgs_w_versions[!grepl(pattern = 'python.app', x = pkgs_w_versions)] - py_pkgs = py_pkgs[!grepl(pattern = 'python.app', x = py_pkgs)] - } - - env_location <- reticulate::py_discover_config()$pythonhome - partial_path_to_conda <- paste0(reticulate::miniconda_path(),'/envs/giotto_env') - - py_lou = pkgs_w_versions[grepl(pattern = 'python-louvain',x = pkgs_w_versions)] - pip_packages = c("smfishhmrf", py_lou) - pkgs_w_versions = pkgs_w_versions[!grepl(pattern = 'python-louvain',x = pkgs_w_versions)] - - if(.Platform[['OS.type']] == 'unix') { - - conda_full_path = paste0(partial_conda_path,'/','bin/conda') - - # Remove all previous installations - reticulate::conda_remove(envname = env_location, - packages = py_pkgs, - conda = conda_full_path) - - # Reinstall - reticulate::conda_install(packages = pkgs_w_versions, - envname = env_location, - method = 'conda', - conda = conda_full_path, - python_version = python_version) - - # Reinstall with pip - reticulate::conda_install(packages = pip_packages, - envname = env_location, - method = 'conda', - conda = conda_full_path, - pip = TRUE, - python_version = python_version) - } - else if(.Platform[['OS.type']] == 'windows'){ - conda_full_path = paste0(partial_conda_path,'/','condabin/conda.bat') - - # Remove all previous installations - reticulate::conda_remove(envname = env_location, - packages = py_pkgs, - conda = conda_full_path) - - # Reinstall - reticulate::conda_install(packages = pkgs_w_versions, - envname = env_location, - method = 'conda', - conda = conda_full_path, - python_version = python_version, - channel = c('conda-forge', 'vtraag')) - - # Reinstall with pip - reticulate::conda_install(packages = pip_packages, - envname = env_location, - method = 'conda', - conda = conda_full_path, - pip = TRUE, - python_version = python_version) - - } -} -``` - - -# Errors on Windows - -## Windows 11 OpenSSL Error - -*Please note that this troubleshooting workflow is for a Windows 11 64-bit machine.* - -Unfortunately, it is known that installing miniconda on Windows 11 can sometimes result in an [OpenSSL error](https://github.com/drieslab/Giotto/issues/425#issuecomment-1320499840). - -It should be noted that Conda developers are aware of this, and that this particular issue does not have to do with the configuration of the Giotto package. One workaround for this error is described below and on the conda repository, [here](https://github.com/conda/conda/issues/8273#issue-409800067). - -First, open a terminal and navigate to the folder in which miniconda lives on the machine. To find this, press the Windows Key and search for "Anaconda Prompt". If anaconda3 is installed on the machine, there may be multiple options for this terminal; choose the Anaconda Prompt with "R-MINI~1" in parenthesis. - -Output from the following commands will be provided as a comparative guide. Once the terminal is open, identify the Conda environments on the machine by running the following: - - -```{r, eval=FALSE} -(base) PS > conda info --envs - -# conda environments: -# -# base * C:\Users\matto\AppData\Local\R-MINI~1 -# giotto_env C:\Users\matto\AppData\Local\R-MINI~1\envs\giotto_env -# C:\Users\matto\AppData\Local\r-miniconda\envs\giotto_env -# C:\Users\matto\anaconda3 -``` - - -Change your current directory to the R-MINI\~1 subdirectory. Then, navigate to the Library/bin/ subdirectory within. Use the dir command to search bin for two groups of files. These files will be moved to a different directory, and should fix the issue. There may be more than two files per group here, and that is okay. All of the files with these names will be moved, regardless of the extension. - - -```{r, eval=FALSE} -(base) PS > cd C:\Users\matto\AppData\Local\R-MINI~1 -(base) PS > cd .\Library\bin -(base) PS > dir libssl-1_1-x64.* - -# Directory: C:\Users\matto\AppData\Local\r-miniconda\Library\bin - - -# Mode LastWriteTime Length Name -# ---- ------------- ------ ---- -# -a---- 11/4/2022 11:06 AM 686080 libssl-1_1-x64.dll -# -a---- 11/4/2022 11:06 AM 2338816 libssl-1_1-x64.pdbo - -(base) PS > dir libcrypto-1_1-x64.* - -# Directory: C:\Users\matto\AppData\Local\r-miniconda\Library\bin - - -# Mode LastWriteTime Length Name -# ---- ------------- ------ ---- -# -a---- 11/4/2022 11:06 AM 3416064 libcrypto-1_1-x64.dll -# -a---- 11/4/2022 11:06 AM 10219520 libcrypto-1_1-x64.pdb -``` - - -Once these files are located, they may be moved to R-MINI\~1/DLLs/, the proper directory for the search path. - - -```{r, eval=FALSE} -(base) PS > pwd - -# Path -# ---- -# C:\Users\matth\AppData\Local\r-miniconda\Library\bin - -(base) PS > mv libssl-1_1-x64.* ..\..\DLLs\ -(base) PS > mv libcrypto-1_1-x64.* ..\..\DLLs\ -``` - - -Finally, change to the DLLs directory within R-MINI\~1 and verify that the files now exist there. - - -```{r, eval=FALSE} -(base) PS > cd C:\Users\matth\AppData\Local\r-miniconda\DLLs\ -(base) PS > dir libssl-1_1-x64.* - -# Directory: C:\Users\matth\AppData\Local\r-miniconda\DLLs - - -# Mode LastWriteTime Length Name -# ---- ------------- ------ ---- -# -a---- 11/4/2022 11:07 AM 686080 libssl-1_1-x64.dll -# -a---- 11/4/2022 11:07 AM 2338816 libssl-1_1-x64.pdb - -(base) PS > dir libcrypto-1_1-x64.* - -# Directory: C:\Users\matto\AppData\Local\r-miniconda\DLLs - - -# Mode LastWriteTime Length Name -# ---- ------------- ------ ---- -# -a---- 11/4/2022 11:07 AM 3416064 libcrypto-1_1-x64.dll -# -a---- 11/4/2022 11:07 AM 10219520 libcrypto-1_1-x64.pdb -``` - - -Now that these files have moved, this error should disappear. Activate the Giotto environment, and run python within it to test a package import. The OpenSSL error should no longer occur. - - -```{r, eval=FALSE} -(base) PS > conda info --envs - -# conda environments: -# -# base * C:\Users\matto\AppData\Local\R-MINI~1 -# giotto_env C:\Users\matto\AppData\Local\R-MINI~1\envs\giotto_env -# C:\Users\matto\AppData\Local\r-miniconda\envs\giotto_env -# C:\Users\matto\anaconda3 - -(base) PS > conda activate giotto_env -(giotto_env) PS > cd C:\Users\matto\AppData\Local\R-MINI~1\envs\giotto_env -(giotto_env) PS > python -Python 3.10.2 | packaged by conda-forge | (main, Mar 8 2022, 15:47:33) [MSC v.1929 64 bit (AMD64)] on win32 -Type "help", "copyright", "credits" or "license" for more information. ->>> import pandas, networkx, igraph, leidenalg, community, sklearn ->>> -``` - - -# UnsatisfiableError - -This error results from conflicts within the anaconda and miniconda environment. This error presents itself when conflicting versions of conda live on the same machine; conda environments can only be so isolated from each other. To begin the troubleshooting workflow, open a terminal (macOS, Linux) or an Anaconda Prompt (Windows), and identify the environments on the machine. If anaconda3 is installed on the Windows machine, there may be multiple options for this terminal; choose the Anaconda Prompt with "anaconda3" in parenthesis. - -**NOTE:** The following commands will be shown as if within an Anaconda Prompt to emphasize the difference for Windows users; for these purposes, the only difference between terminals is the appearance of the message (i.e., (active_env) PS \>) preceding the textual entry. No output will be shown here as differences in OS, environments, and versions will vary. - -First, identify the environments on the machine: - - -```{r, eval=FALSE} -(base) PS > conda info --envs -``` - - -To proceed, any r-miniconda associated environments will be deleted, and the base environment will be updated. If **any** environment is frequently used for other analyses and a python version update is undesirable, it may be preserved by cloning the environment. The original environment, however, will be removed or updated, so ensure that files and workflows associated with this environment are redirected to the new, cloned environment. Ensure the path of the cloned environment is not associated with r-miniconda. - -**It is recommended that conda is updated within any cloned environment (see below).** - - -```{r, eval=FALSE} -(base) PS > conda create --name my_base_clone --clone base -``` - - -Verify that the clone exists to the proper specifications before proceeding by comparing packages and python versions: - - -```{r, eval=FALSE} -(base) PS > conda info --envs -(base) PS > conda activate my_base_clone -(my_base_clone) PS > conda update conda -(my_base_clone) PS > python -V -(my_base_clone) PS > conda list -(my_base_clone) PS > conda activate base -(base) PS > python -V -(base) PS > conda list -``` - - -Ensure the base environment is activated. If the r-miniconda environments are still on the machine, remove them. Specify the r-miniconda environments other than giotto_env, as these will be unique to the machine. This may be done at the command line: - - -```{r, eval=FALSE} -(base) PS > conda env remove --name giotto_env -(base) PS > conda env remove /path/to/r-miniconda/ -``` - - -Alternatively, in R, reticulate can uninstall miniconda and remove the associated environments: - - -```{r, eval=FALSE} -reticulate::miniconda_uninstall() -``` - - -It is advisable to remove any and all environments which are outdated and/or no longer used. - -Recall that by default, Giotto installs a miniconda environment with python v3.10.2 for interfacing with R. Older versions of conda in the base environment cannot handle a python version that high in a different environment. Therefore, the recommended troubleshooting method is to update conda and python within the base environment at a minimum. Updating to python v3.8.5 at a minimum is recommended. It is advisable to update conda and python within *each* environment on the machine if feasible. - - -```{r, eval=FALSE} -(base) PS > conda update conda -(base) PS > conda update python==3.8.5 -``` - - -Finally, close the terminal and open the RStudio, VSCode, or an alternative IDE. Running the following should ensure successful installation: - - -```{r, eval=FALSE} -library(Giotto) -installGiottoEnvironment(force_environment = TRUE, force_miniconda = TRUE) -``` - - -If the issue persists, please post an issue on the [GitHub](https://github.com/drieslab/Giotto/issues). - -# Time out - -If you're installing Giotto using devtools or remote packages, with the most recent version of Giotto, the following error has been observed: - -![](images/installation/timeout.png) - - -This error is related to the time required for downloading the package. To solve the error, increase the limit of downloading time by running this code in your R console: - -```{r, eval=FALSE} -options(timeout = max(1000, getOption("timeout"))) -``` - -If you are doing the installation through a linux terminal, you can run instead this command to directly modify your R environment variable: - -``` -echo "R_DEFAULT_INTERNET_TIMEOUT = 1000" >> .Renviron -``` - -Alternatively, you can use the package pak to install Giotto - -```{r, eval=FALSE} -if(!"pak" %in% installed.packages()) { - install.packages("pak") -} - -pak::pkg_install("drieslab/Giotto") -``` - diff --git a/vignettes/installation.Rmd b/vignettes/installation.Rmd index 623376566..8f7523fce 100644 --- a/vignettes/installation.Rmd +++ b/vignettes/installation.Rmd @@ -42,6 +42,336 @@ installGiottoEnvironment() ``` +## 2.3 Solutions to Installation Errors + +### Errors on MacOS + +#### Packages not Found + + +In the event that packages are inaccessible in the default installation of the Giotto miniconda environment, one troubleshooting method is provided here. + + +```{r, eval=FALSE} +# Restart the R session, while maintaining workspace variables. +# If using RStudio, the following command will do exactly that: +.rs.restartR() +# Direct reticulate to use Python within the Giotto Environment +reticulate::use_python(default_python_path) +# Check if packages exist again. Ensure function from above code block is defined. +missing_packages <- pkg_check() +retry_install <- length(missing_packages) > 0 +if(retry_install){ + + # Attempt to reinstall all packages. + pkgs_w_versions <- c('pandas==1.5.1', + 'networkx==2.8.8', + 'python-igraph==0.10.2', + 'leidenalg==0.9.0', + 'python-louvain==0.16', + 'python.app==1.4', + 'scikit-learn==1.1.3') + + python_version = "3.10.2" + + py_pkgs = c('pandas','networkx', + 'igraph', 'leidenalg', + 'python-louvain','scikit-learn','python.app') + + if(Sys.info()[['sysname']] != "Darwin"){ + pkgs_w_versions = pkgs_w_versions[!grepl(pattern = 'python.app', x = pkgs_w_versions)] + py_pkgs = py_pkgs[!grepl(pattern = 'python.app', x = py_pkgs)] + } + + env_location <- reticulate::py_discover_config()$pythonhome + partial_path_to_conda <- paste0(reticulate::miniconda_path(),'/envs/giotto_env') + + py_lou = pkgs_w_versions[grepl(pattern = 'python-louvain',x = pkgs_w_versions)] + pip_packages = c("smfishhmrf", py_lou) + pkgs_w_versions = pkgs_w_versions[!grepl(pattern = 'python-louvain',x = pkgs_w_versions)] + + if(.Platform[['OS.type']] == 'unix') { + + conda_full_path = paste0(partial_conda_path,'/','bin/conda') + + # Remove all previous installations + reticulate::conda_remove(envname = env_location, + packages = py_pkgs, + conda = conda_full_path) + + # Reinstall + reticulate::conda_install(packages = pkgs_w_versions, + envname = env_location, + method = 'conda', + conda = conda_full_path, + python_version = python_version) + + # Reinstall with pip + reticulate::conda_install(packages = pip_packages, + envname = env_location, + method = 'conda', + conda = conda_full_path, + pip = TRUE, + python_version = python_version) + } + else if(.Platform[['OS.type']] == 'windows'){ + conda_full_path = paste0(partial_conda_path,'/','condabin/conda.bat') + + # Remove all previous installations + reticulate::conda_remove(envname = env_location, + packages = py_pkgs, + conda = conda_full_path) + + # Reinstall + reticulate::conda_install(packages = pkgs_w_versions, + envname = env_location, + method = 'conda', + conda = conda_full_path, + python_version = python_version, + channel = c('conda-forge', 'vtraag')) + + # Reinstall with pip + reticulate::conda_install(packages = pip_packages, + envname = env_location, + method = 'conda', + conda = conda_full_path, + pip = TRUE, + python_version = python_version) + + } +} +``` + +### Errors on Windows + +#### Windows 11 OpenSSL Error + + +*Please note that this troubleshooting workflow is for a Windows 11 64-bit machine.* + +Unfortunately, it is known that installing miniconda on Windows 11 can sometimes result in an [OpenSSL error](https://github.com/drieslab/Giotto/issues/425#issuecomment-1320499840). + +It should be noted that Conda developers are aware of this, and that this particular issue does not have to do with the configuration of the Giotto package. One workaround for this error is described below and on the conda repository, [here](https://github.com/conda/conda/issues/8273#issue-409800067). + +First, open a terminal and navigate to the folder in which miniconda lives on the machine. To find this, press the Windows Key and search for "Anaconda Prompt". If anaconda3 is installed on the machine, there may be multiple options for this terminal; choose the Anaconda Prompt with "R-MINI~1" in parenthesis. + +Output from the following commands will be provided as a comparative guide. Once the terminal is open, identify the Conda environments on the machine by running the following: + + +```{r, eval=FALSE} +(base) PS > conda info --envs + +# conda environments: +# +# base * C:\Users\matto\AppData\Local\R-MINI~1 +# giotto_env C:\Users\matto\AppData\Local\R-MINI~1\envs\giotto_env +# C:\Users\matto\AppData\Local\r-miniconda\envs\giotto_env +# C:\Users\matto\anaconda3 +``` + + +Change your current directory to the R-MINI\~1 subdirectory. Then, navigate to the Library/bin/ subdirectory within. Use the dir command to search bin for two groups of files. These files will be moved to a different directory, and should fix the issue. There may be more than two files per group here, and that is okay. All of the files with these names will be moved, regardless of the extension. + + +```{r, eval=FALSE} +(base) PS > cd C:\Users\matto\AppData\Local\R-MINI~1 +(base) PS > cd .\Library\bin +(base) PS > dir libssl-1_1-x64.* + +# Directory: C:\Users\matto\AppData\Local\r-miniconda\Library\bin + + +# Mode LastWriteTime Length Name +# ---- ------------- ------ ---- +# -a---- 11/4/2022 11:06 AM 686080 libssl-1_1-x64.dll +# -a---- 11/4/2022 11:06 AM 2338816 libssl-1_1-x64.pdbo + +(base) PS > dir libcrypto-1_1-x64.* + +# Directory: C:\Users\matto\AppData\Local\r-miniconda\Library\bin + + +# Mode LastWriteTime Length Name +# ---- ------------- ------ ---- +# -a---- 11/4/2022 11:06 AM 3416064 libcrypto-1_1-x64.dll +# -a---- 11/4/2022 11:06 AM 10219520 libcrypto-1_1-x64.pdb +``` + + +Once these files are located, they may be moved to R-MINI\~1/DLLs/, the proper directory for the search path. + + +```{r, eval=FALSE} +(base) PS > pwd + +# Path +# ---- +# C:\Users\matth\AppData\Local\r-miniconda\Library\bin + +(base) PS > mv libssl-1_1-x64.* ..\..\DLLs\ +(base) PS > mv libcrypto-1_1-x64.* ..\..\DLLs\ +``` + + +Finally, change to the DLLs directory within R-MINI\~1 and verify that the files now exist there. + + +```{r, eval=FALSE} +(base) PS > cd C:\Users\matth\AppData\Local\r-miniconda\DLLs\ +(base) PS > dir libssl-1_1-x64.* + +# Directory: C:\Users\matth\AppData\Local\r-miniconda\DLLs + + +# Mode LastWriteTime Length Name +# ---- ------------- ------ ---- +# -a---- 11/4/2022 11:07 AM 686080 libssl-1_1-x64.dll +# -a---- 11/4/2022 11:07 AM 2338816 libssl-1_1-x64.pdb + +(base) PS > dir libcrypto-1_1-x64.* + +# Directory: C:\Users\matto\AppData\Local\r-miniconda\DLLs + + +# Mode LastWriteTime Length Name +# ---- ------------- ------ ---- +# -a---- 11/4/2022 11:07 AM 3416064 libcrypto-1_1-x64.dll +# -a---- 11/4/2022 11:07 AM 10219520 libcrypto-1_1-x64.pdb +``` + + +Now that these files have moved, this error should disappear. Activate the Giotto environment, and run python within it to test a package import. The OpenSSL error should no longer occur. + + +```{r, eval=FALSE} +(base) PS > conda info --envs + +# conda environments: +# +# base * C:\Users\matto\AppData\Local\R-MINI~1 +# giotto_env C:\Users\matto\AppData\Local\R-MINI~1\envs\giotto_env +# C:\Users\matto\AppData\Local\r-miniconda\envs\giotto_env +# C:\Users\matto\anaconda3 + +(base) PS > conda activate giotto_env +(giotto_env) PS > cd C:\Users\matto\AppData\Local\R-MINI~1\envs\giotto_env +(giotto_env) PS > python +Python 3.10.2 | packaged by conda-forge | (main, Mar 8 2022, 15:47:33) [MSC v.1929 64 bit (AMD64)] on win32 +Type "help", "copyright", "credits" or "license" for more information. +>>> import pandas, networkx, igraph, leidenalg, community, sklearn +>>> +``` + +### UnsatisfiableError + + +This error results from conflicts within the anaconda and miniconda environment. This error presents itself when conflicting versions of conda live on the same machine; conda environments can only be so isolated from each other. To begin the troubleshooting workflow, open a terminal (macOS, Linux) or an Anaconda Prompt (Windows), and identify the environments on the machine. If anaconda3 is installed on the Windows machine, there may be multiple options for this terminal; choose the Anaconda Prompt with "anaconda3" in parenthesis. + +**NOTE:** The following commands will be shown as if within an Anaconda Prompt to emphasize the difference for Windows users; for these purposes, the only difference between terminals is the appearance of the message (i.e., (active_env) PS \>) preceding the textual entry. No output will be shown here as differences in OS, environments, and versions will vary. + +First, identify the environments on the machine: + + +```{r, eval=FALSE} +(base) PS > conda info --envs +``` + + +To proceed, any r-miniconda associated environments will be deleted, and the base environment will be updated. If **any** environment is frequently used for other analyses and a python version update is undesirable, it may be preserved by cloning the environment. The original environment, however, will be removed or updated, so ensure that files and workflows associated with this environment are redirected to the new, cloned environment. Ensure the path of the cloned environment is not associated with r-miniconda. + +**It is recommended that conda is updated within any cloned environment (see below).** + + +```{r, eval=FALSE} +(base) PS > conda create --name my_base_clone --clone base +``` + + +Verify that the clone exists to the proper specifications before proceeding by comparing packages and python versions: + + +```{r, eval=FALSE} +(base) PS > conda info --envs +(base) PS > conda activate my_base_clone +(my_base_clone) PS > conda update conda +(my_base_clone) PS > python -V +(my_base_clone) PS > conda list +(my_base_clone) PS > conda activate base +(base) PS > python -V +(base) PS > conda list +``` + + +Ensure the base environment is activated. If the r-miniconda environments are still on the machine, remove them. Specify the r-miniconda environments other than giotto_env, as these will be unique to the machine. This may be done at the command line: + + +```{r, eval=FALSE} +(base) PS > conda env remove --name giotto_env +(base) PS > conda env remove /path/to/r-miniconda/ +``` + + +Alternatively, in R, reticulate can uninstall miniconda and remove the associated environments: + + +```{r, eval=FALSE} +reticulate::miniconda_uninstall() +``` + + +It is advisable to remove any and all environments which are outdated and/or no longer used. + +Recall that by default, Giotto installs a miniconda environment with python v3.10.2 for interfacing with R. Older versions of conda in the base environment cannot handle a python version that high in a different environment. Therefore, the recommended troubleshooting method is to update conda and python within the base environment at a minimum. Updating to python v3.8.5 at a minimum is recommended. It is advisable to update conda and python within *each* environment on the machine if feasible. + + +```{r, eval=FALSE} +(base) PS > conda update conda +(base) PS > conda update python==3.8.5 +``` + + +Finally, close the terminal and open the RStudio, VSCode, or an alternative IDE. Running the following should ensure successful installation: + + +```{r, eval=FALSE} +library(Giotto) +installGiottoEnvironment(force_environment = TRUE, force_miniconda = TRUE) +``` + + +If the issue persists, please post an issue on the [GitHub](https://github.com/drieslab/Giotto/issues). + +### Installation Time out + + +If you're installing Giotto using the devtools or remote packages, with the most recent version of Giotto, the following error has been observed: + +![](images/installation/timeout.png) + + +This error is related to the time required for downloading the package. To solve the error, increase the limit of downloading time by running this code in your R console: + +```{r, eval=FALSE} +options(timeout = max(1000, getOption("timeout"))) +``` + +If you are doing the installation through a linux terminal, you can run instead this command to directly modify your R environment variable: + +``` +echo "R_DEFAULT_INTERNET_TIMEOUT = 1000" >> .Renviron +``` + +Alternatively, you can use the package pak to install Giotto + +```{r, eval=FALSE} +if(!"pak" %in% installed.packages()) { + install.packages("pak") +} + +pak::pkg_install("drieslab/Giotto") +``` + + # 3. Try Giotto in the cloud You can also run analyses in Giotto on Terra.bio. Take a look on the [Terra tutorial]https://drieslab.github.io/Giotto/articles/terra.html). From c76dfcd0d5e19f01291a330fabc02946d532e29c Mon Sep 17 00:00:00 2001 From: josschavezf Date: Mon, 12 Feb 2024 12:50:54 -0500 Subject: [PATCH 3/6] fix typo --- vignettes/installation.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vignettes/installation.Rmd b/vignettes/installation.Rmd index 8f7523fce..85292e97a 100644 --- a/vignettes/installation.Rmd +++ b/vignettes/installation.Rmd @@ -374,7 +374,7 @@ pak::pkg_install("drieslab/Giotto") # 3. Try Giotto in the cloud -You can also run analyses in Giotto on Terra.bio. Take a look on the [Terra tutorial]https://drieslab.github.io/Giotto/articles/terra.html). +You can also run analyses in Giotto on Terra.bio. Take a look on the [Terra tutorial](https://drieslab.github.io/Giotto/articles/terra.html). Encountering errors? Checkout out the [Troubleshooting page](https://drieslab.github.io/Giotto/articles/errorsfaqsandtips.html) for help. Alternatively, post to an issue to the Giotto GitHub page [here](https://github.com/drieslab/Giotto). Please include the version numbers of R, Giotto, and the OS in use at the time of the issue. From 1caee503f97c37051d42de3933d3c877c1698b40 Mon Sep 17 00:00:00 2001 From: josschavezf Date: Mon, 12 Feb 2024 12:52:09 -0500 Subject: [PATCH 4/6] remove old link --- vignettes/installation.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vignettes/installation.Rmd b/vignettes/installation.Rmd index 85292e97a..3eaea9e2f 100644 --- a/vignettes/installation.Rmd +++ b/vignettes/installation.Rmd @@ -376,7 +376,7 @@ pak::pkg_install("drieslab/Giotto") You can also run analyses in Giotto on Terra.bio. Take a look on the [Terra tutorial](https://drieslab.github.io/Giotto/articles/terra.html). -Encountering errors? Checkout out the [Troubleshooting page](https://drieslab.github.io/Giotto/articles/errorsfaqsandtips.html) for help. Alternatively, post to an issue to the Giotto GitHub page [here](https://github.com/drieslab/Giotto). Please include the version numbers of R, Giotto, and the OS in use at the time of the issue. +Encountering errors? Post to an issue to the Giotto GitHub page [here](https://github.com/drieslab/Giotto). Please include the version numbers of R, Giotto, and the OS in use at the time of the issue. # 4. Session Info From b24baa85f3870606305024b3552bd0ec524cbb6b Mon Sep 17 00:00:00 2001 From: josschavezf Date: Mon, 12 Feb 2024 12:59:29 -0500 Subject: [PATCH 5/6] add contributing guide to Get started tab --- _pkgdown.yml | 5 +- vignettes/contributing.Rmd | 155 +++++++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 vignettes/contributing.Rmd diff --git a/_pkgdown.yml b/_pkgdown.yml index caf6bd7e4..4f9bbeb14 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -45,8 +45,10 @@ navbar: href: articles/structure.html - text: FAQs href: articles/faqs.html - - text: How to report a bug + - text: How to report a bug href: articles/github_issues.html + - text: Contributing guide + href: articles/contributing.html reference: text: Documentation href: reference/index.html @@ -211,6 +213,7 @@ articles: - faqs - branches - github_issues + - contributing - title: Giotto Object Creation navbar: ~ contents: diff --git a/vignettes/contributing.Rmd b/vignettes/contributing.Rmd new file mode 100644 index 000000000..20fd3ef92 --- /dev/null +++ b/vignettes/contributing.Rmd @@ -0,0 +1,155 @@ +--- +title: "How to Contribute?" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{How to Contribute?} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +We welcome contributions or suggestions from other developers. Please contact us if you have questions or would like to discuss an addition or major modifications to the Giotto main code. +The source code for Giotto Suite may be found on our [GitHub repository](https://github.com/drieslab/Giotto/). + + +# Coding Style + +Following a particular programming style will help programmers read and understand source code conforming to the style, and help to avoid introducing errors. Here we present a small list of guidelines on what is considered a good practice when writing R codes in Giotto package. Most of them are adapted from [Bioconductor - coding style](https://bioconductor.org/developers/how-to/coding-style/) or [Google's R Style Guide](https://google.github.io/styleguide/Rguide.xml). These guidelines are preferences and strongly encouraged! + +- **Naming** + - Use camelCase for Giotto user-facing exported function names. (`functionName()`) + - Use snake_case for non-user-facing exported functions, which are essentially any functions not directly related to commonly used data processing, analysis, and visualization. (`function_name()`) + - Use "." prefix and snake_case for internal non-exported functions. (`.function_name()`) + - Use snake_case for parameter names. + - Do not use "." as a separator in function naming. (in the S3 class system, some(x) where x is class A will dispatch to some.A) + +- **Use of space** + - Do not place a space before a comma, but always place one after a comma. This: `a, b, c`. + - Always use space around “=” when using named arguments to functions. This: `somefunc(a = 1, b = 2)`. + +- **Use of symbols** + - Do not use any non-UTF-8 characters unless provided as the escape code. For example: `'\u00F6'` for `ö` + +Beyond these guidelines, [*styler*](https://github.com/r-lib/styler) should be used in order to maintain code uniformity. + + +# Stat functions + +Most Giotto commands can accept several matrix classes (DelayedMatrix, SparseM, Matrix or base matrix). To +facilitate this we provide **flexible** wrappers that work on any type of matrix class. + +- **mean_flex**: analogous to mean() +- **rowSums_flex**: analogous to rowSums() +- **rowMeans_flex**: analogous to rowMeans() +- **colSums_flex**: analogous to colSums() +- **colMeans_flex**: analogous to colMeans() +- **t_flex**: analogous to t() +- **cor_flex**: analogous to cor() + + + +# Auxiliary functions + +Giotto has a number of auxiliary or convenience functions that might help you to adapt your code or write new code for Giotto. We encourage you to use these small functions to maintain uniformity throughout the code. + +- **lapply_flex**: analogous to lapply() and works for both windows and unix systems +- **all_plots_save_function**: compatible with Giotto instructions and helps to automatically save generated plots +- **plot_output_handler**: further wraps `all_plots_save_function` and includes handling for return_plot and show_plot and Giotto instructions checking +- **determine_cores**: to determine the number of cores to use if a user does not set this explicitly +- **get_os**: to identify the operating system +- **update_giotto_params**: will catch and store the parameters for each used command on a giotto object +- **wrap_txt** and **wrap_msg**: text and message formatting functions +- **vmsg**: framework for Giotto's verbosity-flagged messages +- **package_check**: to check if a package exists, works for packages on CRAN, Bioconductor and Github + +The last function should be used within your contribution code. It has the additional benefit that it will suggest the user how to download the package if it is not available. To keep the size of Giotto within limits we prefer not to add too many new dependencies. + + +# Package Imports + +Giotto tracks packages and functions to import in a centralized manner. When adding code that requires functions from another package, add the roxygen tags to the `package_imports.R` file for that Giotto module. + + +# Getters and Setters + +Giotto stores information in different [slots](articles/structure.html#giotto-object-structure), which can be accessed through these getters and setters functions. They can be found in the [accessors.R](https://github.com/drieslab/Giotto/blob/suite/R/accessors.R) file. + +- **getCellMetadata()**: Gets cell metadata +- **setCellMetadata()**: Sets cell metadata + +- **getFeatureMetadata()**: Gets feature metadata +- **getFeatureMetadata()**: Sets feature metadata + +- **getExpression()**: To select the expression matrix to use +- **setExpression()**: Sets a new expression matrix to the expression slot + +- **getSpatialLocations()**: Get spatial locations to use +- **setSpatialLocations()**: Sets new spatial locations + +- **getDimReduction()**: To select the dimension reduction values to use +- **setDimReduction()**: Sets new dimension reduction object + +- **getNearestNetwork()**: To select the nearest neighbor network (kNN or sNN) to use +- **setNearestNetwork()**: Sets a new nearest neighbor network (kNN or sNN) + +- **getSpatialNetwork()**: To select the spatial network to use +- **setSpatialNetwork()**: Sets a new spatial network + +- **getPolygonInfo()**: Gets spatial polygon information +- **setPolygonInfo()**: Set new spatial polygon information + +- **getFeatureInfo()**: Gets spatial feature information +- **setFeatureInfo()**: Sets new spatial feature information + +- **getSpatialEnrichment()**: Gets spatial enrichment information +- **setSpatialEnrichment()**: Sets new spatial enrichment information + +- **getMultiomics()**: Gets multiomics information +- **setMultiomics()**: Sets multiomics information + + +# Python code + +To use Python code we prefer to create a python wrapper/functions around the python code, which can then be sourced by reticulate. As an example we show the basic principles of how we implemented the Leiden clustering algorithm. + +1. write python wrapper and store as python_leiden.py in */inst/python*: + +``` +import igraph as ig +import leidenalg as la +import pandas as pd +import networkx as nx + +def python_leiden(df, partition_type, initial_membership=None, weights=None, n_iterations=2, seed=None, resolution_parameter = 1): + + # create networkx object + Gx = nx.from_pandas_edgelist(df = df, source = 'from', target = 'to', edge_attr = 'weight') + + # get weight attribute + myweights = nx.get_edge_attributes(Gx, 'weight') + + .... + + return(leiden_dfr) +``` + + +2. source python code with reticulate: + +``` +python_leiden_function = system.file("python", "python_leiden.py", package = 'Giotto') +reticulate::source_python(file = python_leiden_function) +``` + +3. use python code as if R code: +See **doLeidenCLuster** for more detailed information. + +``` + pyth_leid_result = python_leiden(df = network_edge_dt, + partition_type = partition_type, + initial_membership = init_membership, + weights = 'weight', + n_iterations = n_iterations, + seed = seed_number, + resolution_parameter = resolution) +``` + From 5f3bc4c57cfb4ee29694a39a737e35b302cbd4fb Mon Sep 17 00:00:00 2001 From: josschavezf Date: Mon, 12 Feb 2024 13:54:10 -0500 Subject: [PATCH 6/6] add Team section --- _pkgdown.yml | 9 ++++++++- vignettes/team.Rmd | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 vignettes/team.Rmd diff --git a/_pkgdown.yml b/_pkgdown.yml index 4f9bbeb14..1f90df58b 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -194,16 +194,24 @@ navbar: href: articles/presentations.html - text: Branches href: articles/branches.html + team: + - text: Team + href: articles/team.html github: icon: fab fa-github fa-lg href: https://github.com/drieslab/Giotto/ aria-label: github articles: +- title: Team + navbar: ~ + contents: + - team - title: News navbar: ~ contents: - presentations + - branches - title: Get started navbar: ~ contents: @@ -211,7 +219,6 @@ articles: - ecosystem - structure - faqs - - branches - github_issues - contributing - title: Giotto Object Creation diff --git a/vignettes/team.Rmd b/vignettes/team.Rmd new file mode 100644 index 000000000..9a6240587 --- /dev/null +++ b/vignettes/team.Rmd @@ -0,0 +1,22 @@ +--- +title: "Meet the team!" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{Meet the team!} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +# Members of the team + +- [Ruben Dries](https://www.drieslab.com/) +- [Jiaji George Chen] +- [Joselyn C. Chávez-Fuentes](https://josschavezf.github.io/) +- [Guo-Cheng Yuan](https://labs.icahn.mssm.edu/yuanlab/) +- [Edward Ruiz] +- [Wen Wang] +- [Junxiang Xu] +- [Iqra Amin] + + +