Newer
Older
* Copyright (c) 2023. The University of Texas Southwestern Medical Center
*
* This file is part of the BioHPC Workflow Platform
*
* This is a workflow package to run cellranger count on fastq files from single cell RNA data.
params.sample = "Brain_Tumor_3p_LT"
params.fastq = "${projectDir}/../test_data/Brain_Tumor_3p_LT_fastqs"
params.chemistry = "auto"
params.introns = true
params.noBam = false
params.outDir = "${projectDir}/output"
publishDir "${outDir}", mode: 'copy'
queue "256GB,256GBv1"
module 'cellranger/7.1.0'
val expectCells
val chemistry
val introns
val noBam
path outDir
if( expectCells == 0 )
if( noBam )
"""
cellranger count --id=$sample \
--transcriptome=$ref \
--sample=$sample \
--chemistry=$chemistry \
--include-introns=$introns \
--no-bam
"""
else
"""
cellranger count --id=$sample \
--transcriptome=$ref \
--sample=$sample \
--chemistry=$chemistry \
--include-introns=$introns
"""
else if( expectCells > 0)
if( noBam )
"""
cellranger count --id=$sample \
--transcriptome=$ref \
--sample=$sample \
--expect-cells=$expectCells \
--chemistry=$chemistry \
--include-introns=$introns \
--no-bam
"""
else
"""
cellranger count --id=$sample \
--transcriptome=$ref \
--sample=$sample \
--expect-cells=$expectCells \
--chemistry=$chemistry \
--include-introns=$introns
"""
// Download reference genome if missing
process get_reference {
queue "super"
module 'singularity/3.9.9'
input:
val ref_name
output:
wget -q https://cf.10xgenomics.com/supp/cell-exp/refdata-gex-GRCh38-2020-A.tar.gz
tar -zxf refdata-gex-GRCh38-2020-A.tar.gz
rm refdata-gex-GRCh38-2020-A.tar.gz
wget -q https://cf.10xgenomics.com/supp/cell-exp/refdata-gex-mm10-2020-A.tar.gz
tar -zxf refdata-gex-mm10-2020-A.tar.gz
rm refdata-gex-mm10-2020-A.tar.gz
if (file(params.reference).exists()) {
ref = file(params.reference)
}
else if (params.reference == "hg38") {
ref = file("/project/apps_database/cellranger/refdata-gex-GRCh38-2020-A")
}
else if (params.reference == "mm10") {
ref = file("/project/apps_database/cellranger/refdata-gex-mm10-2020-A")
}
else {
if( ref.isEmpty() ) {
ref = get_reference(params.reference)
}
// Define channels from variables
sample = Channel.value(params.sample)
fastq = Channel.fromPath(params.fastq).collect()
expectCells = Channel.value(params.expectCells)
chemistry = Channel.value(params.chemistry)
introns = Channel.value(params.introns)
noBam = Channel.value(params.noBam)
outDir = Channel.value(params.outDir)
// Run cellranger count
cr_count(sample, ref, fastq, expectCells, chemistry, introns, noBam, outDir)