Please download:
Additional information on possible errors during installation process can be found HERE
if(!require(monocle3))
{
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version = "3.10")
BiocManager::install(c('BiocGenerics', 'DelayedArray', 'DelayedMatrixStats',
'limma', 'S4Vectors', 'SingleCellExperiment',
'SummarizedExperiment', 'batchelor', 'Matrix.utils'))
install.packages("devtools")
devtools::install_github('cole-trapnell-lab/leidenbase')
devtools::install_github('cole-trapnell-lab/monocle3')
devtools::install_github('cole-trapnell-lab/monocle3', ref="develop")
library(monocle3)
}
# Load Tabula Muris dataset (already filterd)
mtx=readRDS("/path/to/emptyDroplets_doublet_filtered_tabulamuris_mtx.rds")
cell_metadata=read.table("/path/to/Tabulamuris_cmd.txt", header=T,row.names=1)
gene_metadata=read.table("/path/to/Tabulamuris_genes.txt", header=T, row.names=1)
Data normalization addresses the unwanted biases arisen by count depth variability while preserving true biological differences.
# Gene filtering and data normalization
cds <- new_cell_data_set(as(mtx, "sparseMatrix"),cell_metadata = cell_metadata,gene_metadata = gene_metadata)
rm(mtx);gc()
Dimensionality reduction aims to condense the complexity of the data into a lower-dimensional space by optimally preserving its key properties.
# PCA for data summarization
cds <- preprocess_cds(cds, num_dim = 50)
# Dimensionality reduction with UMAP
cds <- reduce_dimension(cds) #dimensionality reduction, default value is UMAP
As transcriptionally distinct populations of cells usually correspond to distinct cell types, a key goal of scRNA-seq consists in the identification of cell subpopulations based on their transcriptional similarity. Thus, organizing cells into groups (i.e. clusters) can allow for de novo detection of cell types or identification of different subpopulations in a single cell state.
# Identify clusters
cds = cluster_cells(cds, cluster_method="louvain") #cell clustering using louvain algorithm
plot_cells(cds)