3A - Initialize R environment

Load Conda derived R environment.

options(stringsAsFactors = FALSE)

packages <- c(
  # Core data / plotting
  "svglite", "data.table", "dplyr", "ggplot2", "reshape2", "patchwork",
  "ggstatsplot", "ggpubr", "ggalluvial", "tibble",
  "scCustomize", "ggplotify", "gridExtra", "ggforce",

  # Genomics annotation
  "org.Mm.eg.db", "EnsDb.Mmusculus.v79", "BSgenome.Mmusculus.UCSC.mm10",
  "AnnotationHub",

  # Single-cell analysis
  "Seurat", "SeuratData", "SeuratDisk", "SeuratWrappers", "Seurat.utils",
  "Signac", "sctransform", "glmGamPoi", "harmony", "ComplexHeatmap", "Matrix",

  # Epigenomics
  "chromVAR", "JASPAR2024", "TFBSTools", "motifmatchr", "MotifDb",

  # Trajectory and GRN
  "monocle3", "cicero", "Pando", "xgboost", "universalmotif", "IReNA", "GENIE3",

  # Pathway scoring and gene sets
  "UCell", "SCPA", "GSEABase", "SiPSiC", "msigdbr",

  # Parallelization
  "BiocParallel", "parallelly",

  # Differential expression / statistics
  "presto", "pROC"
)

invisible(lapply(packages, function(x) {
  suppressMessages(suppressPackageStartupMessages(library(x, character.only = TRUE)))
}))

source("extra_functions.R")

set.seed(99)

Ren1c+/-or-/-;Ren1cCre;R26RmTmG

Set file paths to Cellranger outputs.

sample_name <- "ren1c"
processed_dir <- "/processed/ren1c/"

matrix_path_WT_1mo <- file.path(processed_dir,
    "ren1c_1mo/outs/filtered_feature_bc_matrix/")
matrix_path_KO_1mo <- file.path(processed_dir,
    "ren1cKO_1mo/outs/filtered_feature_bc_matrix/")