From 38ffbfdb63454d20c56cd16e9b8b489165fea0c9 Mon Sep 17 00:00:00 2001 From: Mei Wu <25568561+projectoriented@users.noreply.github.com> Date: Mon, 28 Feb 2022 16:16:29 +0100 Subject: [PATCH] bcftools/annotate follow up corrections (#1359) * bcf annotate ready2go * edited output name * fixed output * updated bcftools ver * changed contain output string * removed contain key entirely * fixed md5sum for test.yml * using match instead of find * bcftools/annotate refactored with complete test * rm trailing white space Co-authored-by: Robert A. Petit III --- modules/bcftools/annotate/main.nf | 4 ++-- tests/config/test_data.config | 2 ++ tests/modules/bcftools/annotate/main.nf | 15 ++++++++++++--- tests/modules/bcftools/annotate/test.yml | 18 ++++++++++++++---- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/modules/bcftools/annotate/main.nf b/modules/bcftools/annotate/main.nf index 437baaf3..40e32047 100644 --- a/modules/bcftools/annotate/main.nf +++ b/modules/bcftools/annotate/main.nf @@ -22,7 +22,7 @@ process BCFTOOLS_ANNOTATE { def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def matcher = input =~ /vcf/ + def matcher = input ==~ /\S+\.*vcf\.\S*/ def output_suffix = matcher ? "vcf.gz" : "bcf" def output_type_compressed = matcher ? "z" : "b" """ @@ -36,7 +36,7 @@ process BCFTOOLS_ANNOTATE { cat <<-END_VERSIONS > versions.yml "${task.process}": - bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//') + bcftools: \$( bcftools --version |& sed '1!d; s/^.*bcftools //' ) END_VERSIONS """ } diff --git a/tests/config/test_data.config b/tests/config/test_data.config index e28b0cb0..7c3e183c 100644 --- a/tests/config/test_data.config +++ b/tests/config/test_data.config @@ -67,6 +67,8 @@ params { test_computematrix_mat_gz = "${test_data_dir}/genomics/sarscov2/illumina/deeptools/test.computeMatrix.mat.gz" + test_bcf = "${test_data_dir}/genomics/sarscov2/illumina/vcf/test.bcf" + test_vcf = "${test_data_dir}/genomics/sarscov2/illumina/vcf/test.vcf" test_vcf_gz = "${test_data_dir}/genomics/sarscov2/illumina/vcf/test.vcf.gz" test_vcf_gz_tbi = "${test_data_dir}/genomics/sarscov2/illumina/vcf/test.vcf.gz.tbi" diff --git a/tests/modules/bcftools/annotate/main.nf b/tests/modules/bcftools/annotate/main.nf index 2f2b66c9..0d096ca9 100644 --- a/tests/modules/bcftools/annotate/main.nf +++ b/tests/modules/bcftools/annotate/main.nf @@ -4,11 +4,20 @@ nextflow.enable.dsl = 2 include { BCFTOOLS_ANNOTATE } from '../../../../modules/bcftools/annotate/main.nf' -workflow test_bcftools_annotate { - +workflow test_bcftools_annotate_out_vcf { + input = [ - [ id:'test_compressed', single_end:false ], // meta map + [ id:'test_compressed_vcf', single_end:false ], // meta map file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true) ] BCFTOOLS_ANNOTATE ( input ) } + +workflow test_bcftools_annotate_out_bcf { + + input = [ + [ id:'test_compressed_bcf', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_bcf'], checkIfExists: true) ] + + BCFTOOLS_ANNOTATE ( input ) +} diff --git a/tests/modules/bcftools/annotate/test.yml b/tests/modules/bcftools/annotate/test.yml index 43537180..e8cdcc4b 100644 --- a/tests/modules/bcftools/annotate/test.yml +++ b/tests/modules/bcftools/annotate/test.yml @@ -1,9 +1,19 @@ -- name: bcftools annotate test_bcftools_annotate - command: nextflow run tests/modules/bcftools/annotate -entry test_bcftools_annotate -c tests/config/nextflow.config +- name: bcftools annotate test_bcftools_annotate_out_vcf + command: nextflow run tests/modules/bcftools/annotate -entry test_bcftools_annotate_out_vcf -c tests/config/nextflow.config tags: - bcftools/annotate - bcftools files: - - path: output/bcftools/test_compressed_annotated.vcf.gz + - path: output/bcftools/test_compressed_vcf_annotated.vcf.gz - path: output/bcftools/versions.yml - md5sum: b647b465acc221f6fe6fbcc319724eed + md5sum: de86d4d411baef1aaee0e72f519dbe1f + +- name: bcftools annotate test_bcftools_annotate_out_bcf + command: nextflow run tests/modules/bcftools/annotate -entry test_bcftools_annotate_out_bcf -c tests/config/nextflow.config + tags: + - bcftools/annotate + - bcftools + files: + - path: output/bcftools/test_compressed_bcf_annotated.bcf + - path: output/bcftools/versions.yml + md5sum: a57e62a5a189fe85aabd52c010d88ca6