From 542f822ca68c9d9835e50092096150c7f97b73ab Mon Sep 17 00:00:00 2001 From: Sam Nicholls Date: Tue, 4 Jul 2023 10:13:05 +0000 Subject: [PATCH] Reconcile template --- .gitlab-ci.yml | 12 ++++++------ lib/CWUtil.groovy | 26 ++++++++++++++++++++++++++ nextflow.config | 12 ++++++------ 3 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 lib/CWUtil.groovy diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a7b7c80..33bb5a3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -77,7 +77,7 @@ docker-run: --de_analysis \ --ref_genome differential_expression/hg38_chr20.fa --transcriptome-source reference-guided \ --ref_annotation differential_expression/gencode.v22.annotation.chr20.gtf \ - --direct_rna --minimap_index_opts \\-k15" + --direct_rna --minimap_index_opts '-k 15'" NF_IGNORE_PROCESSES: preprocess_reads,merge_transcriptomes,decompress_annotation,decompress_ref - if: $MATRIX_NAME == "only_differential_expression" variables: @@ -87,7 +87,7 @@ docker-run: --de_analysis \ --ref_genome differential_expression/hg38_chr20.fa \ --ref_annotation differential_expression/gencode.v22.annotation.chr20.gff \ - --direct_rna --minimap_index_opts \\-k15 \ + --direct_rna --minimap_index_opts '-k 15' \ --ref_transcriptome differential_expression/ref_transcriptome.fasta \ --transcriptome_assembly false" NF_IGNORE_PROCESSES: > @@ -101,7 +101,7 @@ docker-run: --de_analysis \ --ref_genome differential_expression/hg38_chr20.fa \ --ref_annotation differential_expression/gencode.v22.annotation.chr20.gff3 \ - --direct_rna --minimap_index_opts \\-k15 \ + --direct_rna --minimap_index_opts '-k 15' \ --ref_transcriptome differential_expression/ref_transcriptome.fasta \ --transcriptome_assembly false" NF_IGNORE_PROCESSES: > @@ -110,14 +110,14 @@ docker-run: - if: $MATRIX_NAME == "ncbi_gzip" variables: NF_BEFORE_SCRIPT: wget -O differential_expression.tar.gz https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-isoforms/differential_expression.tar.gz && tar -xzvf differential_expression.tar.gz - NF_WORKFLOW_OPTS: "-executor.$$local.memory 16GB \ + NF_WORKFLOW_OPTS: "-executor.\\$$local.memory 16GB \ --fastq differential_expression/differential_expression_fastq \ --transcriptome-source precomputed \ --de_analysis \ --ref_genome differential_expression/GRCh38.p14.NCBI_test.fna.gz \ --ref_annotation differential_expression/GRCh38.p14_NCBI_test.gtf.gz \ - --direct_rna --minimap_index_opts \\-w25 \ + --direct_rna --minimap_index_opts '-w 25' \ --transcriptome_assembly false" NF_IGNORE_PROCESSES: > preprocess_reads,merge_transcriptomes,assemble_transcripts, - build_minimap_index,get_transcriptome,merge_gff_bundles,run_gffcompare,build_minimap_index,split_bam \ No newline at end of file + build_minimap_index,get_transcriptome,merge_gff_bundles,run_gffcompare,build_minimap_index,split_bam diff --git a/lib/CWUtil.groovy b/lib/CWUtil.groovy new file mode 100644 index 0000000..8a73759 --- /dev/null +++ b/lib/CWUtil.groovy @@ -0,0 +1,26 @@ +/* Miscellaneous utilities for workflows from the ONT Customer Workflows Group. + */ +class CWUtil { + + /* Mutate the global Nextflow params map + * + * Occasionally, we may wish to mutate the value of a parameter provided + * by the user. Typically, this leads to workflows with `params.my_param` + * and `params._my_param` which is ripe for confusion. Instead, we can + * mutate the parameter value in the Nextflow params ScriptMap itself + * with the following call: + * + * CWUtil.mutateParam(params, k, v) + * + * This is possible as Groovy actually has a surprisingly loose + * definition of "private", and allows us to call the private `allowNames` + * method on the ScriptMap which removes the read-only status for a key set. + * We can follow this up with a call to the private `put0` to reinsert + * the key and mark it as read-only again. + */ + public static void mutateParam(nf_params, key, value) { + Set s = [key] // must be a set to allow call to allowNames + nf_params.allowNames(s) + nf_params.put0(key, value) + } +} diff --git a/nextflow.config b/nextflow.config index 6dc6b57..e3d10aa 100644 --- a/nextflow.config +++ b/nextflow.config @@ -97,12 +97,12 @@ params { wf { example_cmd = [ - "--fastq test_data/fastq", - "--ref_genome test_data/SIRV_150601a.fasta", - "--ref_annotation test_data/SIRV_isofroms.gtf", - "--jaffal_refBase chr20/", - "--jaffal_genome hg38", - "--jaffal_annotation genCode22" + "--condition_sheet 'wf-transcriptomes-demo/condition_sheet.tsv'", + "--direct_rna", + "--fastq 'wf-transcriptomes-demo/differential_expression_fastq'", + "--minimap_index_opts '-k15'", + "--ref_annotation 'wf-transcriptomes-demo/gencode.v22.annotation.chr20.gtf'", + "--ref_genome 'wf-transcriptomes-demo/hg38_chr20.fa'", ] agent = null container_sha = "sha203915eb4b4dd444cb2e845d0b9f7814e26b7b5c"