From bea0bb6dd402c3b4f93ab461dd1d87ff4f42a975 Mon Sep 17 00:00:00 2001 From: "Gervaise H. Henry" <gervaise.henry@utsouthwestern.edu> Date: Thu, 7 Feb 2019 20:14:25 -0600 Subject: [PATCH] Implement VM cellranger version handling for #1 --- astrocyte_pkg.yml | 11 ++++++ test_data/design.csv | 8 ++-- workflow/conf/biohpc.config | 5 ++- workflow/main.nf | 78 +++++++++++++++++++++++++++++-------- 4 files changed, 80 insertions(+), 22 deletions(-) diff --git a/astrocyte_pkg.yml b/astrocyte_pkg.yml index 095101c..8181364 100755 --- a/astrocyte_pkg.yml +++ b/astrocyte_pkg.yml @@ -41,6 +41,7 @@ documentation_files: workflow_modules: - 'python/3.6.1-2-anaconda' - 'cellranger/2.1.1' + - 'cellranger/3.0.1' - 'bcl2fastq/2.17.1.14' # A list of parameters used by the workflow, defining how to present them, @@ -122,6 +123,16 @@ workflow_parameters: description: | 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. A value of 0 ignores this option. Any value other than 0 overrides expect-cells. + - id: version + type: select + default: 3.0.1 + choices: + - [ 3, '3.0.1'] + - [ 2, '2.0.1'] + required: true + description: | + 10x cellranger version. + # ----------------------------------------------------------------------------- # SHINY APP CONFIGURATION # ----------------------------------------------------------------------------- diff --git a/test_data/design.csv b/test_data/design.csv index 9f80938..f7087ee 100755 --- a/test_data/design.csv +++ b/test_data/design.csv @@ -1,4 +1,4 @@ -Sample,fastq_R1,fastq_R2 -D17PrPzF_BE,/work/urology/ghenry/Grimoire/Astrocyte/cellranger_count/test_data/D17PrPzF_BE_S1_L001_R1_001.fastq.gz,/work/urology/ghenry/Grimoire/Astrocyte/cellranger_count/test_data/D17PrPzF_BE_S1_L001_R2_001.fastq.gz -D17PrPzF_BE,/work/urology/ghenry/Grimoire/Astrocyte/cellranger_count/test_data/D17PrPzF_BE_S1_L002_R1_001.fastq.gz,/work/urology/ghenry/Grimoire/Astrocyte/cellranger_count/test_data/D17PrPzF_BE_S1_L002_R2_001.fastq.gz -D17PrPzF_LE,/work/urology/ghenry/Grimoire/Astrocyte/cellranger_count/test_data/D17PrPzF_LE_S3_L001_R1_001.fastq.gz,/work/urology/ghenry/Grimoire/Astrocyte/cellranger_count/test_data/D17PrPzF_LE_S3_L001_R2_001.fastq.gz +Sample,fastq_R1,fastq_R2 +D17PrPzF_BE,D17PrPzF_BE_S1_L001_R1_001.fastq.gz,D17PrPzF_BE_S1_L001_R2_001.fastq.gz +D17PrPzF_BE,D17PrPzF_BE_S1_L002_R1_001.fastq.gz,D17PrPzF_BE_S1_L002_R2_001.fastq.gz +D17PrPzF_LE,D17PrPzF_LE_S3_L001_R1_001.fastq.gz,D17PrPzF_LE_S3_L001_R2_001.fastq.gz diff --git a/workflow/conf/biohpc.config b/workflow/conf/biohpc.config index fbaca91..0b515ec 100755 --- a/workflow/conf/biohpc.config +++ b/workflow/conf/biohpc.config @@ -7,9 +7,12 @@ process { module = ['python/3.6.1-2-anaconda'] executor = 'local' } - $count { + $count2 { module = ['cellranger/2.1.1'] } + $count3 { + module = ['cellranger/3.0.1'] + } } trace { diff --git a/workflow/main.nf b/workflow/main.nf index 71cb08c..1772db4 100755 --- a/workflow/main.nf +++ b/workflow/main.nf @@ -41,7 +41,6 @@ process checkDesignFile { script: """ - module load python/3.6.1-2-anaconda python3 $baseDir/scripts/check_design.py -d $designLocation -f $fastqList """ } @@ -53,33 +52,78 @@ samples = designPaths .groupTuple() //.subscribe { println it } +// Duplicate variables +samples.into { + samples2 + samples3 +} +refLocation.into { + refLocation2 + refLocation3 +} +expectCells2 = expectCells +expectCells3 = expectCells +forceCells2 = forceCells +forceCells3 = forceCells + +process count2 { + tag "count2-$sample" + + publishDir "$baseDir/output", mode: 'copy' + + input: + + set sample, file("${sample}_S1_L00?_R1_001.fastq.gz"), file("${sample}_S1_L00?_R2_001.fastq.gz") from samples2 + file ref from refLocation2.first() + expectCells2 + forceCells2 + + output: + + file("**/outs/**") into outPaths2 -process count { - tag "$sample" + when: + version == 2 + + script: + if (forceCells2 == 0){ + """ + cellranger count --id="$sample" --transcriptome="./$ref" --fastqs=. --sample="$sample" --expect-cells=$expectCells2 + """ + } else { + """ + cellranger count --id="$sample" --transcriptome="./$ref" --fastqs=. --sample="$sample" --force-cells=$forceCells2 + """ + } +} + +process count3 { + tag "count3-$sample" publishDir "$baseDir/output", mode: 'copy' input: - set sample, file("${sample}_S1_L00?_R1_001.fastq.gz"), file("${sample}_S1_L00?_R2_001.fastq.gz") from samples - file ref from refLocation.first() - expectCells - forceCells + set sample, file("${sample}_S1_L00?_R1_001.fastq.gz"), file("${sample}_S1_L00?_R2_001.fastq.gz") from samples3 + file ref from refLocation3.first() + expectCells3 + forceCells3 output: - file("**/outs/**") into outPaths + file("**/outs/**") into outPaths3 + + when: + version == 3 script: - if (forceCells == 0){ - """ - module load cellranger/2.1.1 - cellranger count --id="$sample" --transcriptome="./$ref" --fastqs=. --sample="$sample" --expect-cells=$expectCells - """ + if (forceCells3 == 0){ + """ + cellranger count --id="$sample" --transcriptome="./$ref" --fastqs=. --sample="$sample" --expect-cells=$expectCells3 + """ } else { - """ - module load cellranger/2.1.1 - cellranger count --id="$sample" --transcriptome="./$ref" --fastqs=. --sample="$sample" --force-cells=$forceCells - """ + """ + cellranger count --id="$sample" --transcriptome="./$ref" --fastqs=. --sample="$sample" --force-cells=$forceCells3 + """ } } -- GitLab