Cellranger

Revision as of 14:36, 18 July 2024 by Daghrach (talk | contribs)


This article is a draft

This is not a complete article: This is a draft, a work in progress that is intended to be published into an article, which may or may not be ready for inclusion in the main wiki. It should not necessarily be considered factual or authoritative.



Cellranger Description

Cellranger is a set of analysis pipelines that process Chromium single-cell data to align reads, generate feature-barcode matrices, perform clustering and other secondary analysis, and more. Note: This page does not cover all features of Cellranger.

Please refer to the official documentation for the complete list of all subtools.

Availability and module loading

To access these modules, you need to add the following lines to your .bashrc file.

   ## GenPipes/MUGQIC genomes and modules
   export MUGQIC_INSTALL_HOME=/cvmfs/soft.mugqic/CentOS6
   module use $MUGQIC_INSTALL_HOME/modulefiles

To query all available versions of Cellranger on the Alliance stack

   [name@server ~]$ module spider mugqic/cellranger

You can load the version of your choice using module load. For example, to load cellranger/5.0.1, use the command

   [name@server ~]$ module load mugqic/cellranger/8.0.1

To load the default version of Cellranger use the command

   [name@server ~]$ module load mugqic/cellranger/8.0.1
   [name@server ~]$ cellranger
   cellranger cellranger-8.0.1 
   Process 10x Genomics Gene Expression, Feature Barcode, and Immune Profiling data
   USAGE: cellranger <SUBCOMMAND>

General usage

Demultiplexing

Cellranger mkfastq demultiplexes raw base call (BCL) files generated by Illumina sequencers into FASTQ files. It is a wrapper around Illumina's bcl2fastq, with additional features that are specific to 10x Genomics libraries and a simplified sample sheet format.

A simple csv sample sheet is recommended for most sequencing experiments. The simple csv format has only three columns (Lane, Sample, Index)

   Lane,Sample,Index
   1,test_sample,SI-TT-D9

If you have multiple library types (e.g., Gene Expression, Feature Barcode, and Cell Multiplexing) that all have the same type of indexing (e.g., dual-indexing), the samples can be demultiplexed together and the CSV could be formatted as follows

   Lane,Sample,Index
   1,GEX_sample,SI-TT-D9
   1,FB_sample,SI-NT-A1
   1,CMO_sample,SI-NN-A1

You can run the mkfastq pipeline as follows

   [name@server ~] cellranger mkfastq --id=$ID 
                            --run=/path/to/bcl 
                            --csv=test_sample.csv

Counting

Cellranger count takes FASTQ files from cellranger mkfastq and performs alignment, filtering, barcode counting, and UMI counting. It uses the Chromium cellular barcodes to generate feature-barcode matrices, determine clusters, and perform gene expression analysis. The count pipeline can take input from multiple sequencing runs on the same GEM well. Cellranger count also processes Feature Barcode data alongside Gene Expression reads.


   [name@server ~] cellranger count --id=$ID \
                   --transcriptome=refdata-gex-GRCh38-2020-A \
                   --fastqs=$FASTQS \
                   --sample=mysample \
                   --create-bam=true \
                   --localcores=8 \
                   --localmem=64

Cell Ranger provides a set of analysis pipelines that process Chromium Single Cell Gene Expression data to align reads, generate Feature Barcode matrices, perform clustering and other secondary analysis, and more. The required input files for running Cell Ranger vary depending on the chosen pipeline. To select the appropriate pipeline for your needs, please refer to the Choosing a pipeline page. Choosing a pipeline

Aggregating

Cellranger aggr aggregates outputs from multiple runs of cellranger count, normalizing those runs to the same sequencing depth and then recomputing the feature-barcode matrices and analysis on the combined data. The aggr pipeline can be used to combine data from multiple samples into an experiment-wide feature-barcode matrix and analysis.


To aggregate the datasets, you need to create a CSV containing the following columns

   sample_id,molecule_h5
   Sample1,/opt/runs/outs/per_sample_outs/Sample1/count/sample_molecule_info.h5
   Sample2,/opt/runs/outs/per_sample_outs/Sample2/count/sample_molecule_info.h5

You can run the aggr pipeline as follows

   [name@server ~] cellranger aggr --id=$ID --csv=aggr.csv

Running Cellranger in the alliance clusters

   #!/bin/bash
   #SBATCH --account=def-someprof
   #SBATCH -N 1
   #SBATCH --ntasks-per-node=8
   #SBATCH --mem=64g
   #SBATCH --time=24:00:00

   module load mugqic/cellranger/8.0.1
   FASTQS=$1
   ID=$2
   WORK_DIR=$3
   cd $WORK_DIR
   cellranger count --id=$ID \
                    --fastqs=$FASTQS \
                    --transcriptome=refdata-gex-GRCh38-2020-A \
                    --create-bam=true \
                    --localcores=8 \
                    --localmem=64

References

https://www.10xgenomics.com/support/software/cell-ranger/latest/analysis