From Reads to a Matrix
Every analysis in this section starts from a count matrix with one value per gene and cell. A pipeline builds it from the FASTQ files. It reads the cell barcode and the UMI of each read, aligns the read to a gene, and counts the unique molecules of each gene in each cell.
nf-core/scrnaseq
Section titled “nf-core/scrnaseq”nf-core/scrnaseq is the community Nextflow pipeline for this step. It takes a sample sheet of FASTQ files and returns a count matrix per sample. Release 4.2.0 offers six choices for --aligner: simpleaf, the default, which runs alevin-fry, star for STARsolo, kallisto for Kallisto Bustools, and cellranger, cellrangerarc and cellrangermulti for three Cell Ranger pipelines. Each tool runs from a pinned container, so the preprocessing is reproducible whichever aligner you choose.
nextflow run nf-core/scrnaseq \ -profile singularity \ --input samplesheet.csv \ --outdir results \ --genome GRCh38 \ --aligner cellrangerThe pipeline goes one step past the count matrix. Unless you pass --skip_cellbender, it runs CellBender remove-background, which separates cells from empty droplets and removes ambient RNA counts. It writes the matrices as h5ad files for Scanpy and rds files for Seurat. QC filtering, normalization, clustering and annotation happen afterward in Scanpy or Seurat.
Cell Ranger
Section titled “Cell Ranger”Cell Ranger is the 10x Genomics pipeline for Chromium data. cellranger count aligns, demultiplexes the barcodes and counts the UMIs of one sample in one command. Since Cell Ranger 8.0 the command requires --create-bam, set to true to write the BAM file or to false to skip it.
cellranger count \ --id=sample1 \ --transcriptome=/ref/refdata-gex-GRCh38 \ --fastqs=/data/fastqs \ --sample=sample1 \ --create-bam=trueThe run writes its results to outs/. The filtered matrix holds only the barcodes that Cell Ranger called as cells, and it is the usual starting point. The raw matrix keeps every barcode, empty droplets included, which is the input that empty droplet and ambient RNA tools need. web_summary.html is the QC report of the run.
sample1/├── outs/│ ├── filtered_feature_bc_matrix/ # Use this│ │ ├── barcodes.tsv.gz│ │ ├── features.tsv.gz│ │ └── matrix.mtx.gz│ ├── raw_feature_bc_matrix/ # Includes empty droplets│ ├── web_summary.html # QC report│ └── cloupe.cloupe # Loupe Browser fileThe count matrix
Section titled “The count matrix”The Cell Ranger matrix has one row per gene and one column per cell. The PBMC 3k reference has 32,738 genes, and a run can hold from about 1,000 to more than 100,000 cells. Most of the values are zero.
Cell_1 Cell_2 Cell_3 ...Gene_A 0 5 0Gene_B 12 0 3Gene_C 0 0 0...Scanpy turns the matrix around and stores cells as rows and genes as columns, as the AnnData Object page shows.
Datasets for practice
Section titled “Datasets for practice”PBMC 3k and PBMC 10k from 10x Genomics are the standard tutorial datasets, because peripheral blood mononuclear cells hold a few well-characterized cell types. Both ship in this section’s container, so the pages that run read them from /opt/data.
Tabula Muris is a mouse atlas of many organs, with both 10x and Smart-seq2 data, and it serves well as a reference for label transfer. The Human Cell Atlas collects human tissues and conditions, and it keeps growing.
Scientific references
Section titled “Scientific references”Di Tommaso and colleagues, 2017 describe Nextflow and its model for reproducible computational workflows.
Ewels and colleagues, 2020 describe nf-core and its community-curated bioinformatics pipelines, which include nf-core/scrnaseq.
10x Genomics names no paper for Cell Ranger, so the Cell Ranger documentation is the software reference.
Further reading
Section titled “Further reading”The nf-core/scrnaseq 4.2.0 usage guide defines the samplesheet and processing options. Its tagged inputs support the reference command on this page.
The nf-core/scrnaseq 4.2.0 parameter schema lists supported aligners and their defaults. Read the schema before choosing the quantification backend.
The shell command above does not select release 4.2.0 with a -r argument.