Answers to common questions
The Orchestrating Single Cell Analysis eBook from bioconductor provides detailed discussion of the analysis approaches used for single cell sequencing analysis.
There are many tools, the python package cellphonedb is popular. However there are R packages as well (scTensor, SCA-IRCM, liana, CellChat).
Use both, or either. The fellows use a mix of both and also the scanpy
python single cell toolkit. Spend time exploring your data with whatever platform feels most intuitive. Inevitably you will gain experience in with multiple platforms due to the large # of tools that you will want to try out for your analysis.
If you need to convert between R and python you can use the R package zellkonverter.
If you need to convert between Seurat or SingleCellExperiment, you can use the as.SingleCellExperiment()
or as.Seurat()
functions. It is also sometimes easiest to simply create the objects manually using the SingleCellExperiment
or CreateSeuratObject
functions.
If you have multiple samples you can load these into Seurat using the Read10X
and CreateSeuratObject
functions. If you provide a name for each dataset (using names()
), these names can be extracted and placed into the orig.ident
column in the meta.data
.
# vector of paths to each sample
<- c('path/to/dataset1/', 'path/to/dataset2/')
data_dirs
# give each sample a name
names(data_dirs) <- c("expt1", "extp2")
# read in the matrices
<- Read10X(data_dirs)
mats
# the cells will now be renamed to include the "expt1/2" prefixes
# e.g.
# "expt1_cellbarcode1
# "expt1_cellbarcode2
# ...
# "expt2_cellbarcode1
# "expt2_cellbarcode2
# ...
# CreateSeuratObject can now be used to pull out part of the cell
# barcode and add it to the meta.data as the orig.ident
<- CreateSeuratObject(mats, names.field = 1, names.delim = "_")
seurat_object
# expt1 and expt2 should now be listed in the orig.ident
head(seurat_object@meta.data$orig.ident)
Organization is key to managing multiple analysis projects. We recommend making a new Rstudio project for each data analysis project. This helps with navigate to the relevant files for each project, and makes it easy to quickly jump between projects.
Managing R package versions can be challenging if you work on many projects, because you may need to use different versions of packages for different projects. This is especially important if you need to return to an analysis 6 months or a year later. If you constantly update the packages, you can run into problems with reproducing the original analysis. The renv R package is a package manager for R built by the Rstudio organization. When you set up an R project, you can select use renv with project
to set up renv
to track dependencies for each project separately.