2 Datasets & Packages

2.1 Datasets to download

Here we provide links to the original datasets that were used for this workshop. Some of the datasets were modified (e.g. downsampled or subsetted) for the purpose of this workshop. You can download them from their original source or download all of them - including intermediate files - from the following Zenodo repository:

2.1.1 Zenodo repository

https://zenodo.org/communities/gw2024/

2.1.2 10X Genomics Visium Mouse Brain Section (Coronal) dataset

https://support.10xgenomics.com/spatial-gene-expression/datasets/1.1.0/V1_Adult_Mouse_Brain

2.1.6 10X Genomics Human Prostate Cancer Adenocarcinoma with Invasive Carcinoma (FFPE)

https://www.10xgenomics.com/datasets/human-prostate-cancer-adenocarcinoma-with-invasive-carcinoma-ffpe-1-standard-1-3-0

2.1.10 Lunaphore IF dataset

https://zenodo.org/records/13175721

2.2 Needed packages

To run all the tutorials from this Giotto Suite workshop you will need to install additional R and Python packages. Here we provide detailed instructions and discuss some common difficulties with installing these packages. The easiest way would be to copy each code snippet into your R/Rstudio Console using fresh a R session.

2.2.1 CRAN dependencies:

cran_dependencies <-
    c("BiocManager",
      "devtools",
      "pak")

install.packages(cran_dependencies, Ncpus = 4)

2.2.2 terra installation

terra may have some additional steps when installing depending on which system you are on. Please see the terra repo for specifics. Installations of the CRAN release on Windows and Mac are expected to be simple, only requiring the code below.

For Linux, there are several prerequisite installs:

GDAL (>= 2.2.3), GEOS (>= 3.4.0), PROJ (>= 4.9.3), sqlite3

On our AlmaLinux 8 HPC, the following versions have been working well:

  • gdal/3.6.4

  • geos/3.11.1

  • proj/9.2.0

  • sqlite3/3.37.2

install.packages("terra")

2.2.3 Matrix installation

!! FOR R VERSIONS LOWER THAN 4.4.0 !!

Giotto requires Matrix 1.6-2 or greater, but when installing Giotto with pak on an R version lower than 4.4.0, the installation can fail asking for R 4.5 which doesn’t exist yet. We can solve this by installing the 1.6-5 version directly by un-commenting and running the line below.

# devtools::install_version("Matrix", version = "1.6-5")

2.2.4 Rtools installation

Before installing Giotto on a windows PC please make sure to install the relevant version of Rtools. If you have a Mac or linux PC, or have already installed Rtools, please ignore this step.

2.2.5 Giotto installation

pak::pak("drieslab/Giotto")
pak::pak("drieslab/GiottoData")

2.2.6 irlba install

Reinstall irlba from source. Avoids the common function 'as_cholmod_sparse' not provided by package 'Matrix' error. See this issue for more info.

install.packages("irlba", type = "source")

2.2.7 arrow install

arrow is a suggested package that we use here to open parquet files. The parquet files that 10X provides use zstd compression which the default arrow installation may not provide.

has_arrow <- requireNamespace("arrow", quietly = TRUE)
zstd <- TRUE
if (has_arrow) {
    zstd <- arrow::arrow_info()$capabilities[["zstd"]]
}
if (!has_arrow || !zstd) {
    Sys.setenv(ARROW_WITH_ZSTD = "ON") 
    install.packages("assertthat", "bit64")
    install.packages("arrow", repos = c("https://apache.r-universe.dev"))
}

2.2.8 Bioconductor dependencies:

bioc_dependencies <- c(
    "scran",
    "ComplexHeatmap",
    "SpatialExperiment",
    "ggspavis",
    "scater",
    "nnSVG"
)

2.2.9 CRAN packages:

needed_packages_cran <- c(
    "dplyr",
    "gstat",
    "hdf5r",
    "miniUI",
    "shiny",
    "xml2",
    "future",
    "future.apply",
    "exactextractr",
    "tidyr",
    "viridis",
    "quadprog",
    "Rfast",
    "pheatmap",
    "patchwork",
    "Seurat",
    "harmony",
    "scatterpie",
    "R.utils",
    "qs"
)

pak::pkg_install(c(bioc_dependencies,
                   needed_packages_cran))

2.2.10 Packages from GitHub

github_packages <- c(
    "satijalab/seurat-data"
)
pak::pkg_install(github_packages)

2.2.11 Python environments

# default giotto environment
Giotto::installGiottoEnvironment()

reticulate::py_install(
    pip = TRUE,
    envname = 'giotto_env',
    packages = c(
        "scanpy"
    )
)

# install another environment with py 3.8 for cellpose
reticulate::conda_create(envname = "giotto_cellpose",
                         python_version = 3.8)
#.re.restartR()
reticulate::use_condaenv('giotto_cellpose')
reticulate::py_install(
  pip = TRUE,
  envname = 'giotto_cellpose',
  packages = c(
    "pandas",
    "networkx",
    "python-igraph",
    "leidenalg",
    "scikit-learn",
    "cellpose",
    "smfishhmrf",
    'tifffile',
    'scikit-image'
  )
)