From f434d0c671fe908552aa2064a8ae576059cfc39b Mon Sep 17 00:00:00 2001 From: Lucpen Date: Wed, 28 Sep 2022 09:50:11 +0200 Subject: [PATCH] Adding stubs to PicardLiftovervcf, GATK4_mergevcfs and filterMutectCalls (#1621) * feat added stubs to picard_liftovervcf * feat adding stubs to gatk4_mergevcfs * feat adding stubs to gatk4_filtermutectcalls * fix tests * fix output name filtermutectcalls * fix test * fix added missing [ * Update tests/modules/gatk4/mergevcfs/test.yml Co-authored-by: Ramprasad Neethiraj <20065894+ramprasadn@users.noreply.github.com> * Update tests/modules/gatk4/filtermutectcalls/test.yml Co-authored-by: Ramprasad Neethiraj <20065894+ramprasadn@users.noreply.github.com> * Update tests/modules/picard/liftovervcf/test.yml Co-authored-by: Ramprasad Neethiraj <20065894+ramprasadn@users.noreply.github.com> * Update modules/gatk4/filtermutectcalls/main.nf Co-authored-by: Ramprasad Neethiraj <20065894+ramprasadn@users.noreply.github.com> * Update modules/gatk4/filtermutectcalls/main.nf Co-authored-by: Ramprasad Neethiraj <20065894+ramprasadn@users.noreply.github.com> * Update modules/gatk4/mergevcfs/main.nf Co-authored-by: Ramprasad Neethiraj <20065894+ramprasadn@users.noreply.github.com> * Update modules/gatk4/mergevcfs/main.nf Co-authored-by: Ramprasad Neethiraj <20065894+ramprasadn@users.noreply.github.com> * Update modules/picard/liftovervcf/main.nf Co-authored-by: Ramprasad Neethiraj <20065894+ramprasadn@users.noreply.github.com> * Trying something on picard_liftovervcf * fix adding test data for stubs * fix added bracket and unindented workflow * fix picard 2.27.1 -> 2.27.0 to solve PaddingError * Update main.nf fix added tbi to stub Co-authored-by: Ramprasad Neethiraj <20065894+ramprasadn@users.noreply.github.com> Co-authored-by: Matthieu Muffato --- modules/gatk4/filtermutectcalls/main.nf | 13 ++++++++++++ modules/gatk4/mergevcfs/main.nf | 12 +++++++++++ modules/picard/liftovervcf/main.nf | 14 ++++++++++++- tests/modules/gatk4/filtermutectcalls/main.nf | 20 +++++++++++++++++++ .../modules/gatk4/filtermutectcalls/test.yml | 11 ++++++++++ tests/modules/gatk4/mergevcfs/main.nf | 9 +++++++++ tests/modules/gatk4/mergevcfs/test.yml | 9 +++++++++ tests/modules/picard/liftovervcf/main.nf | 12 +++++++++++ tests/modules/picard/liftovervcf/test.yml | 10 ++++++++++ 9 files changed, 109 insertions(+), 1 deletion(-) diff --git a/modules/gatk4/filtermutectcalls/main.nf b/modules/gatk4/filtermutectcalls/main.nf index 91f6defa..71de16f6 100644 --- a/modules/gatk4/filtermutectcalls/main.nf +++ b/modules/gatk4/filtermutectcalls/main.nf @@ -54,4 +54,17 @@ process GATK4_FILTERMUTECTCALLS { gatk4: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//') END_VERSIONS """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.vcf.gz + touch ${prefix}.vcf.gz.tbi + touch ${prefix}.vcf.gz.filteringStats.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + gatk4: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//') + END_VERSIONS + """ } diff --git a/modules/gatk4/mergevcfs/main.nf b/modules/gatk4/mergevcfs/main.nf index 35930a6e..c1ec942e 100644 --- a/modules/gatk4/mergevcfs/main.nf +++ b/modules/gatk4/mergevcfs/main.nf @@ -44,4 +44,16 @@ process GATK4_MERGEVCFS { gatk4: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//') END_VERSIONS """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.vcf.gz + touch ${prefix}.vcf.gz.tbi + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + gatk4: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//') + END_VERSIONS + """ } diff --git a/modules/picard/liftovervcf/main.nf b/modules/picard/liftovervcf/main.nf index 062f2086..334f68b0 100644 --- a/modules/picard/liftovervcf/main.nf +++ b/modules/picard/liftovervcf/main.nf @@ -43,7 +43,19 @@ process PICARD_LIFTOVERVCF { cat <<-END_VERSIONS > versions.yml "${task.process}": - picard: \$(picard LiftoverVcf --version 2>&1 | grep -o 'Version.*' | cut -f2- -d:) + picard: \$(echo \$(picard LiftoverVcf --version 2>&1) | grep -o 'Version:.*' | cut -f2- -d:) + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.lifted.vcf.gz + touch ${prefix}.unlifted.vcf.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + picard: \$(echo \$(picard LiftoverVcf --version 2>&1) | grep -o 'Version:.*' | cut -f2- -d:) END_VERSIONS """ } diff --git a/tests/modules/gatk4/filtermutectcalls/main.nf b/tests/modules/gatk4/filtermutectcalls/main.nf index d7d0dd8c..1a4ee377 100644 --- a/tests/modules/gatk4/filtermutectcalls/main.nf +++ b/tests/modules/gatk4/filtermutectcalls/main.nf @@ -63,3 +63,23 @@ workflow test_gatk4_filtermutectcalls_use_val { GATK4_FILTERMUTECTCALLS ( input, fasta, fai, dict ) } + +workflow test_gatk4_filtermutectcalls_base_stubs { + + input = [ + [ id:'test'], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_test2_paired_mutect2_calls_vcf_gz'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test_test2_paired_mutect2_calls_vcf_gz_tbi'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test_test2_paired_mutect2_calls_vcf_gz_stats'], checkIfExists: true), + [], + [], + [], + [] + ] + + fasta = file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) + fai = file(params.test_data['homo_sapiens']['genome']['genome_21_fasta_fai'], checkIfExists: true) + dict = file(params.test_data['homo_sapiens']['genome']['genome_21_dict'], checkIfExists: true) + + GATK4_FILTERMUTECTCALLS ( input, fasta, fai, dict ) +} diff --git a/tests/modules/gatk4/filtermutectcalls/test.yml b/tests/modules/gatk4/filtermutectcalls/test.yml index 6f650f32..35f23ca3 100644 --- a/tests/modules/gatk4/filtermutectcalls/test.yml +++ b/tests/modules/gatk4/filtermutectcalls/test.yml @@ -33,3 +33,14 @@ md5sum: 95cc3e37705bd3b97a292c5d46ab82f3 - path: output/gatk4/test.filtered.vcf.gz.tbi - path: output/gatk4/versions.yml + +- name: gatk4 filtermutectcalls test_gatk4_filtermutectcalls_base_stubs + command: nextflow run ./tests/modules/gatk4/filtermutectcalls -entry test_gatk4_filtermutectcalls_base_stubs -c ./tests/config/nextflow.config -c ./tests/modules/gatk4/filtermutectcalls/nextflow.config -stub-run + tags: + - gatk4 + - gatk4/filtermutectcalls + files: + - path: output/gatk4/test.filtered.vcf.gz + - path: output/gatk4/test.filtered.vcf.gz.filteringStats.tsv + - path: output/gatk4/test.filtered.vcf.gz.tbi + - path: output/gatk4/versions.yml diff --git a/tests/modules/gatk4/mergevcfs/main.nf b/tests/modules/gatk4/mergevcfs/main.nf index 99a2158d..32569bdf 100644 --- a/tests/modules/gatk4/mergevcfs/main.nf +++ b/tests/modules/gatk4/mergevcfs/main.nf @@ -24,3 +24,12 @@ workflow test_gatk4_mergevcfs_no_dict { GATK4_MERGEVCFS ( input, [] ) } + +workflow test_gatk4_mergevcfs_no_dict_stubs { + input = [ [ id:'test' ], // meta map + [ file(params.test_data['sarscov2']['illumina']['test_vcf'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test2_vcf'], checkIfExists: true) ] + ] + + GATK4_MERGEVCFS ( input, [] ) +} diff --git a/tests/modules/gatk4/mergevcfs/test.yml b/tests/modules/gatk4/mergevcfs/test.yml index eb43a184..57400748 100644 --- a/tests/modules/gatk4/mergevcfs/test.yml +++ b/tests/modules/gatk4/mergevcfs/test.yml @@ -19,3 +19,12 @@ - path: output/gatk4/test.vcf.gz md5sum: 5b289bda88d3a3504f2e19ee8cff177c - path: output/gatk4/versions.yml + +- name: gatk4 mergevcfs test_gatk4_mergevcfs_no_dict_stubs + command: nextflow run ./tests/modules/gatk4/mergevcfs -entry test_gatk4_mergevcfs_no_dict_stubs -c ./tests/config/nextflow.config -c ./tests/modules/gatk4/mergevcfs/nextflow.config -stub-run + tags: + - gatk4/mergevcfs + - gatk4 + files: + - path: output/gatk4/test.vcf.gz + - path: output/gatk4/versions.yml diff --git a/tests/modules/picard/liftovervcf/main.nf b/tests/modules/picard/liftovervcf/main.nf index 8aee8273..08181a8a 100644 --- a/tests/modules/picard/liftovervcf/main.nf +++ b/tests/modules/picard/liftovervcf/main.nf @@ -15,3 +15,15 @@ workflow test_picard_liftovervcf { PICARD_LIFTOVERVCF ( input_vcf, dict, chain, fasta ) } + +workflow test_picard_liftovervcf_stubs { + + input_vcf = [ [ id:'test' ], + file(params.test_data['homo_sapiens']['illumina']['test_genome_vcf'], checkIfExists: true) + ] + dict = file(params.test_data['homo_sapiens']['genome']['genome_dict'], checkIfExists: true) + chain = file(params.test_data['homo_sapiens']['genome']['genome_chain_gz'], checkIfExists: true) + fasta = [ file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) ] + + PICARD_LIFTOVERVCF ( input_vcf, dict, chain, fasta ) +} diff --git a/tests/modules/picard/liftovervcf/test.yml b/tests/modules/picard/liftovervcf/test.yml index b1b30d5d..436fcf21 100644 --- a/tests/modules/picard/liftovervcf/test.yml +++ b/tests/modules/picard/liftovervcf/test.yml @@ -9,3 +9,13 @@ - "chr22" - path: output/picard/test.unlifted.vcf.gz - path: output/picard/versions.yml + +- name: picard liftovervcf test_picard_liftovervcf_stubs + command: nextflow run tests/modules/picard/liftovervcf -entry test_picard_liftovervcf_stubs -c tests/config/nextflow.config -stub-run + tags: + - picard/liftovervcf + - picard + files: + - path: output/picard/test.lifted.vcf.gz + - path: output/picard/test.unlifted.vcf.gz + - path: output/picard/versions.yml