Skip to contents

Overview

This guide installs the R packages you may need for ADS 8192 — the shared development stack, the course reference package, and the dataset/analysis packages for all 12 homework projects. Running the code block below once on a fresh R installation will get you fully set up.

If you have already installed some of these packages, re-running install.packages() or BiocManager::install() will simply skip packages that are already up to date.

Prerequisites

  • R ≥ 4.5.0 — install from CRAN
  • If on Windows, install Rtools from CRAN - this is required to compile some packages with C/C++ code.
  • RStudio (recommended) or Positron
  • Bioconductor v3.22

Install All Packages

Copy and run the entire block below in your R console. It installs:

  1. BiocManager (needed to install Bioconductor packages)
  2. CRAN packages (development tools, Shiny stack, analysis dependencies)
  3. Bioconductor packages (data containers, datasets, annotation tools)
if (!requireNamespace("BiocManager", quietly = TRUE))
  install.packages("BiocManager")

cran_pkgs <- c(
  # Development & documentation
  "devtools", "usethis", "roxygen2", "testthat", "pkgdown",
  "knitr", "rmarkdown", "remotes",
  # Shiny
  "shiny", "bslib", "DT",
  # Core
  "ggplot2", "rlang",
  # CLI
  "Rapp",
  # Project-specific
  "uwot",
  "cluster",
  "msigdbr",
  "igraph"
)

install.packages(cran_pkgs)

bioc_pkgs <- c(
  # Data containers
  "SummarizedExperiment",
  "SingleCellExperiment",
  # Analysis
  "DESeq2",
  "batchelor",
  "scran",
  "scuttle",
  # Visualization
  "ComplexHeatmap",
  "dittoSeq",
  # Datasets
  "airway",
  "macrophage",
  "scRNAseq",
  "tximeta",
  "recount3",
  "fission",
  "TCGAutils",
  "TENxPBMCData",
  # Data access infrastructure
  "ExperimentHub",
  "AnnotationDbi",
  "org.Hs.eg.db",
  "org.Mm.eg.db"
)

BiocManager::install(bioc_pkgs, version = "3.22")

Verify Installation

After installation, run the following to confirm the key packages load without error:

If any package fails to load, re-run the relevant install.packages() or BiocManager::install() call for that package and check the error message.

Install the Course Reference Package

The ADS8192 reference package can be installed directly from GitHub:

remotes::install_github("St-Jude-MS-ABDS/ADS8192")

Set Up Github Access

To enable version control and easy sharing, we’ll be using Git and Github for the homework project. You should already have a Github account. Login to Github from the browser, and then run the following to add a personal access token (PAT) for R to use when pushing code from your local machine to Github:

usethis::create_github_token()

This will open the browser to the token generation page with proper settings already chosen. Add a use case for the token, e.g. “ADS8192” and click “Generate Token”.

Copy the resulting token to your clipboard, then run the following to add it to your local Git configuration:

gitcreds::gitcreds_set()

If you don’t have Git credentials set up, it will prompt your for your PAT. Paste it in and hit enter. If you already have credentials set up, it will ask if you want to overwrite them. Choose “Yes” to update your credentials with the new PAT.

You can test that your PAT is working by running the following code, which should return your Git config info Github username:

usethis::git_sitrep()

Which for me includes:

── GitHub user 
• Default GitHub host: "https://github.com"
• Personal access token for "https://github.com": <discovered>
• GitHub user: "j-andrews7"
• Token scopes: "gist", "repo", "user", and "workflow"
• Email(s): "jared.andrews07@gmail.com (primary)" and "jared.andrews@stjude.org"

Among other info. After that, you should be set for the rest of the unit.

Session Info