Skip to content
Snippets Groups Projects
Commit abe9129c authored by John Lafin's avatar John Lafin
Browse files

Update test inputs

parent 203876e5
Branches
Tags
1 merge request!4Multisample
/*
* 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.
*
* @authors
* John Lafin
*
*/
// Parameters for input values
params.sample_sheet = "${projectDir}/../test_data/sample_sheet.csv"
params.fastq = "${projectDir}/../test_data"
params.outDir = "${projectDir}/output"
params.astrocyte = false
// Run cellranger count
process cr_count {
publishDir "${outDir}", mode: 'copy'
module 'cellranger/7.1.0'
module 'singularity/3.9.9'
errorStrategy 'ignore'
input:
tuple val(sample), val(ref), val(expectCells), val(chemistry), val(introns), val(noBam)
path(fastq)
path(outDir)
output:
tuple val(sample), path("${sample}/outs/**")
script:
// Check reference
if (params.astrocyte) {
switch (ref) {
case "hg38":
ref = file("/project/apps_database/cellranger/refdata-gex-GRCh38-2020-A")
break
case "mm10":
ref = file("/project/apps_database/cellranger/refdata-gex-mm10-2020-A")
break
default:
ref = file(ref)
}
}
if ( ref.isEmpty() ) {
error "Error: Missing reference. Please provide one of the options outlined in the documentation."
}
// Run Cell Ranger count
if( expectCells == 0 )
if( noBam )
"""
cellranger count --id=$sample \
--transcriptome=$ref \
--fastqs=. \
--sample=$sample \
--chemistry=$chemistry \
--include-introns=$introns \
--no-bam
"""
else
"""
cellranger count --id=$sample \
--transcriptome=$ref \
--fastqs=. \
--sample=$sample \
--chemistry=$chemistry \
--include-introns=$introns
"""
else if( expectCells > 0)
if( noBam )
"""
cellranger count --id=$sample \
--transcriptome=$ref \
--fastqs=. \
--sample=$sample \
--expect-cells=$expectCells \
--chemistry=$chemistry \
--include-introns=$introns \
--no-bam
"""
else
"""
cellranger count --id=$sample \
--transcriptome=$ref \
--fastqs=. \
--sample=$sample \
--expect-cells=$expectCells \
--chemistry=$chemistry \
--include-introns=$introns
"""
}
workflow {
// Parse sample sheet and run cellranger count
fastq = channel.fromPath(params.fastq).collect()
outDir = channel.value(params.outDir)
input = channel.fromPath(params.sample_sheet) \
| splitCsv(header: true) \
| map{ row -> tuple( row.sample, row.reference, row.expectCells, row.chemistry, row.introns, row.noBam ) }
cr_count(input, fastq, outDir)
}
\ No newline at end of file
/*
* 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.
*
* @authors
* John Lafin
*
*/
// Parameters for input values
params.sample_sheet = "${projectDir}/../test_data/sample_sheet.csv"
params.fastq = "${projectDir}/../test_data/fastqs"
params.outDir = "${projectDir}/output"
params.astrocyte = true
// Run cellranger count
process cr_count {
publishDir "${outDir}", mode: 'copy'
module 'cellranger/7.1.0'
module 'singularity/3.9.9'
errorStrategy 'ignore'
input:
tuple val(sample), val(ref), val(expectCells), val(chemistry), val(introns), val(noBam)
path(fastq)
path(outDir)
output:
tuple val(sample), path("${sample}/outs/**")
script:
// Check reference
if (params.astrocyte) {
switch (ref) {
case "hg38":
ref = file("/project/apps_database/cellranger/refdata-gex-GRCh38-2020-A")
break
case "mm10":
ref = file("/project/apps_database/cellranger/refdata-gex-mm10-2020-A")
break
default:
ref = file(ref)
}
}
if ( ref.isEmpty() ) {
error "Error: Missing reference. Please provide one of the options outlined in the documentation."
}
// Run Cell Ranger count
if( expectCells == 0 )
if( noBam )
"""
cellranger count --id=$sample \
--transcriptome=$ref \
--fastqs=. \
--sample=$sample \
--chemistry=$chemistry \
--include-introns=$introns \
--no-bam
"""
else
"""
cellranger count --id=$sample \
--transcriptome=$ref \
--fastqs=. \
--sample=$sample \
--chemistry=$chemistry \
--include-introns=$introns
"""
else if( expectCells > 0)
if( noBam )
"""
cellranger count --id=$sample \
--transcriptome=$ref \
--fastqs=. \
--sample=$sample \
--expect-cells=$expectCells \
--chemistry=$chemistry \
--include-introns=$introns \
--no-bam
"""
else
"""
cellranger count --id=$sample \
--transcriptome=$ref \
--fastqs=. \
--sample=$sample \
--expect-cells=$expectCells \
--chemistry=$chemistry \
--include-introns=$introns
"""
}
workflow {
// Parse sample sheet and run cellranger count
fastq = channel.fromPath(params.fastq).collect()
outDir = channel.value(params.outDir)
input = channel.fromPath(params.sample_sheet) \
| splitCsv(header: true) \
| map{ row -> tuple( row.sample, row.reference, row.expectCells, row.chemistry, row.introns, row.noBam ) }
cr_count(input, fastq, outDir)
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment