Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

A toolkit for quality control, analysis, and exploration of single cell RNA sequencing data. 'Seurat' aims to enable users to identify and interpret sources of heterogeneity from single cell transcriptomic measurements, and to integrate diverse types of single cell data.

Installing packages

Copy and paste (then run) this code into your R script (same with the code in all following sections as well).

Code Block
#### Installing required packages ####

# Create vector of required package names
bioconductor_packages <- c("clusterProfiler", "pathview", "AnnotationHub", "org.Mm.eg.db")
cran_packages <- c("Seurat", "patchwork", "ggplot2", "tidyverse", "viridis", "plyr", "readxl", "scales")

# Compares installed packages to above packages and returns a vector of missing packages
new_packages <- bioconductor_packages[!(bioconductor_packages %in% installed.packages()[,"Package"])]
new_cran_packages <- cran_packages[!(cran_packages %in% installed.packages()[,"Package"])]

# Install missing bioconductor packages
if (!requireNamespace("BiocManager", quietly = TRUE))
  install.packages("BiocManager")
BiocManager::install(new_packages)

# Install missing cran packages
if (length(new_cran_packages)) install.packages(new_cran_packages, repos = http://cran.us.r-project.org)

# Update all installed packages to the latest version
update.packages(bioconductor_packages, ask = FALSE)
update.packages(cran_packages, ask = FALSE, repos = http://cran.us.r-project.org)

Loading packages

Code Block
#### Loading required packages ####

# This section needs to be run every time
# Load packages
bioconductor_packages <- c("clusterProfiler", "pathview", "AnnotationHub", "org.Mm.eg.db")
cran_packages <- c("Seurat", "patchwork", "ggplot2", "tidyverse", "viridis", "plyr", "readxl", "scales")
lapply(cran_packages, require, character.only = TRUE)
lapply(bioconductor_packages, require, character.only = TRUE)

 

Cell Ranger (and nfcore/scrnaseq) generates a default directory and file output structure for each sample, which we’ll use in R to complete our analysis. Each sample will have a directory named after the sample, an ‘outs’ subdirectory under this. This ‘outs’ directory contains various files and subdirectories. The subdirectory that contains the count matrix data we need for Seurat analysis is called ‘filtered_feature_bc_matrix’.

...