This function takes FASTQ files from cellranger mkfastq and performs alignment, filtering, barcode counting, and UMI counting.

cellrangerCount(
  group = c("sudo", "docker"),
  transcriptome.folder,
  fastq.folder,
  sample = NULL,
  expect.cells = NULL,
  force.cells = NULL,
  nosecondary = TRUE,
  chemistry = "auto",
  r1.length = NULL,
  r2.length = NULL,
  lanes = NULL,
  localcores = NULL,
  localmem = NULL,
  scratch.folder,
  version = "5"
)

Arguments

group,

a character string. Two options: sudo or docker, depending to which group the user belongs

transcriptome.folder,

path to the Cell Ranger compatible transcriptome reference e.g. for a human and mouse mixture sample, use refdata-cellranger-hg19-and-mm10-1.2.0

fastq.folder,

path of the fastq path folder in fastq folder the fastq must have the format SAMPLENAME_S1_L001_R1_001.fastq.gz

sample,

fastq name, if fastq name is subject1_S1_L001_R1_001.fastq.gz sample is subject1

expect.cells,

optional setting the number of recovered cells. Default: 3000 cells.

force.cells,

optional to force pipeline to use this number of cells, bypassing the cell detection algorithm. Use this if the number of cells estimated by Cell Ranger is not consistent with the barcode rank plot.

nosecondary,

optional flag, default TRUE, to skip secondary analysis of the gene-barcode matrix (dimensionality reduction, clustering and visualization). Set this if you plan to use cellranger reanalyze or your own custom analysis.

chemistry,

optional assay configuration. One of: auto for autodetection (default), threeprime for Single Cell 3end, fiveprime for Single Cell 5end, SC3Pv1 for Single Cell 3end v1, SC3Pv2 for Single Cell 3end v2, SC5P-PE for Single Cell 5end paired-end (both R1 and R2 are used for alignment), SC5P-R2 for Single Cell 5end R2-only (where only R2 is used for alignment).

r1.length,

optional hard-trim the input R1 sequence to this length. Note that the length includes the Barcode and UMI sequences so do not set this below 26 for Single Cell 3end v2 or Single Cell 5end. This and --r2-length are useful for determining the optimal read length for sequencing.

r2.length,

optional hard-trim the input R2 sequence to this length.

lanes,

optional, lanes associated with this sample

localcores,

restricts cellranger to use specified number of cores to execute pipeline stages. By default, cellranger will use all of the cores available on your system.

localmem,

restricts cellranger to use specified amount of memory, in GB, to execute pipeline stages. By default, cellranger will use 90% of the memory available on your system. Please note that cellranger requires at least 16 GB of memory to run all pipeline stages.

scratch.folder,

a character string indicating the path of the scratch folder

version,

cellranger version: 2, 3 or 5.

Value

a folder called results_cellranger, more info on the structure of this folder at https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/output/overview . In /somewhewre_in_your_computer/results_cellranger/outs/filtered_gene_bc_matrices the cells counts matrices results_cellranger.cvs and results_cellranger.txt are saved for further use.

Author

Greta Romano, romano [dot] greta [at] gmail [dot] com, University of Torino

Examples

if (FALSE) {
home <- getwd()
library(rCASC)
setwd("/data/genomes/cellranger_hg19mm10")
#getting the human and mouse cellranger index
system("wget http://cf.10xgenomics.com/supp/cell-exp/refdata-cellranger-hg19-and-mm10-2.1.0.tar.gz")
untar("refdata-cellranger-hg19-and-mm10-2.1.0.tar.gz") 
setwd(home)
# 100 cells 1:1 Mixture of Fresh Frozen Human (HEK293T) and Mouse (NIH3T3) Cells
system("wget http://cf.10xgenomics.com/samples/cell-exp/2.1.0/hgmm_100/hgmm_100_fastqs.tar")
untar("hgmm_100_fastqs.tar")
home=paste(home,"/fastqs",sep="")
cellrangerCount(group="docker",  transcriptome.folder="/data/genomes/cellranger_hg19mm10/refdata-cellranger-hg19_and_mm10-2.1.0",  fastq.folder=getwd(),  expect.cells=100, nosecondary=TRUE, scratch.folder="/data/scratch", version="2")

sraDownload(group = "docker", sra.name = "SRR7762358", data.folder = getwd(), scratch.folder = "/data/scratch", threads = 8)
system("mv ./SRR7762358/SRR7762358.fastq.gz ./SRR7762358/SRR7762358_S1_L001_R1_001.fastq.gz")
cellrangerCount(group="docker",  transcriptome.folder="/data/genomes/refdata-cellranger-GRCh38-3.0.0",  fastq.folder=getwd(), sample="SRR7762358",  nosecondary=TRUE, scratch.folder="/data/scratch", version="3")

}