From 780e3322dadde1bd011b9e3c3a5a1f1b9623d9a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Mart=C3=ADnez?= Date: Tue, 5 Sep 2023 15:50:00 +0200 Subject: [PATCH] Update lofreq call & lofreq callparallel modules (#3812) * Update lofreq call module & tests. Now it takes intervals input. * Update lofreq callparallel module. Now it takes intervals as input. Also updated tests. * Fix linting where entry for keywords was too short in meta.yml. --- modules/nf-core/lofreq/call/main.nf | 4 +++- modules/nf-core/lofreq/call/meta.yml | 4 ++++ modules/nf-core/lofreq/callparallel/main.nf | 4 +++- modules/nf-core/lofreq/callparallel/meta.yml | 6 ++++++ tests/modules/nf-core/lofreq/call/main.nf | 13 ++++++++++++- tests/modules/nf-core/lofreq/call/test.yml | 12 ++++++++++++ .../nf-core/lofreq/callparallel/main.nf | 19 +++++++++++++++++-- .../nf-core/lofreq/callparallel/test.yml | 12 ++++++++++++ 8 files changed, 69 insertions(+), 5 deletions(-) diff --git a/modules/nf-core/lofreq/call/main.nf b/modules/nf-core/lofreq/call/main.nf index a1c6bd1c13f..43a0f906d84 100644 --- a/modules/nf-core/lofreq/call/main.nf +++ b/modules/nf-core/lofreq/call/main.nf @@ -8,7 +8,7 @@ process LOFREQ_CALL { 'biocontainers/lofreq:2.1.5--py38h588ecb2_4' }" input: - tuple val(meta), path(bam) + tuple val(meta), path(bam), path(intervals) path fasta output: @@ -21,10 +21,12 @@ process LOFREQ_CALL { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def options_intervals = intervals ? "-l ${intervals}" : "" """ lofreq \\ call \\ $args \\ + $options_intervals \\ -f $fasta \\ -o ${prefix}.vcf.gz \\ $bam diff --git a/modules/nf-core/lofreq/call/meta.yml b/modules/nf-core/lofreq/call/meta.yml index 972e286e46c..8797bbd8b7c 100644 --- a/modules/nf-core/lofreq/call/meta.yml +++ b/modules/nf-core/lofreq/call/meta.yml @@ -23,6 +23,10 @@ input: type: file description: BAM input file pattern: "*.{bam}" + - intervals: + type: file + description: BED file containing target regions for variant calling + pattern: "*.{bed}" - fasta: type: file description: The reference fasta file diff --git a/modules/nf-core/lofreq/callparallel/main.nf b/modules/nf-core/lofreq/callparallel/main.nf index 0ce3e2db4c8..047f7034dc9 100644 --- a/modules/nf-core/lofreq/callparallel/main.nf +++ b/modules/nf-core/lofreq/callparallel/main.nf @@ -8,7 +8,7 @@ process LOFREQ_CALLPARALLEL { 'biocontainers/lofreq:2.1.5--py38h588ecb2_4' }" input: - tuple val(meta), path(bam), path(bai) + tuple val(meta), path(bam), path(bai), path(intervals) path fasta path fai @@ -22,11 +22,13 @@ process LOFREQ_CALLPARALLEL { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def options_intervals = intervals ? "-l ${intervals}" : "" """ lofreq \\ call-parallel \\ --pp-threads $task.cpus \\ $args \\ + $options_intervals \\ -f $fasta \\ -o ${prefix}.vcf.gz \\ $bam diff --git a/modules/nf-core/lofreq/callparallel/meta.yml b/modules/nf-core/lofreq/callparallel/meta.yml index cd9d9fa6610..fedc14df921 100644 --- a/modules/nf-core/lofreq/callparallel/meta.yml +++ b/modules/nf-core/lofreq/callparallel/meta.yml @@ -1,6 +1,8 @@ name: lofreq_callparallel description: It predicts variants using multiple processors keywords: + - variant calling + - low frequency variant calling - call - variants tools: @@ -25,6 +27,10 @@ input: type: file description: BAM index file pattern: "*.{bai}" + - intervals: + type: file + description: BED file containing target regions for variant calling + pattern: "*.{bed}" - fasta: type: file description: Reference genome FASTA file diff --git a/tests/modules/nf-core/lofreq/call/main.nf b/tests/modules/nf-core/lofreq/call/main.nf index 0492da377e5..afd65a0dbee 100644 --- a/tests/modules/nf-core/lofreq/call/main.nf +++ b/tests/modules/nf-core/lofreq/call/main.nf @@ -7,7 +7,18 @@ include { LOFREQ_CALL } from '../../../../../modules/nf-core/lofreq/call/main.nf workflow test_lofreq_call { input = [ [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) ] + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true), + [] ] + fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + + LOFREQ_CALL ( input, fasta ) +} + +workflow test_lofreq_call_intervals { + + input = [ [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true), + file(params.test_data['sarscov2']['genome']['test_bed']) ] fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) LOFREQ_CALL ( input, fasta ) diff --git a/tests/modules/nf-core/lofreq/call/test.yml b/tests/modules/nf-core/lofreq/call/test.yml index dfff0370648..cde1b9465e8 100644 --- a/tests/modules/nf-core/lofreq/call/test.yml +++ b/tests/modules/nf-core/lofreq/call/test.yml @@ -9,3 +9,15 @@ [ '##INFO=', ] + +- name: lofreq call test_lofreq_call_intervals + command: nextflow run ./tests/modules/nf-core/lofreq/call -entry test_lofreq_call_intervals -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/lofreq/call/nextflow.config + tags: + - lofreq + - lofreq/call + files: + - path: output/lofreq/test.vcf.gz + contains: + [ + '##INFO=', + ] diff --git a/tests/modules/nf-core/lofreq/callparallel/main.nf b/tests/modules/nf-core/lofreq/callparallel/main.nf index dacc323854b..d37e439470f 100644 --- a/tests/modules/nf-core/lofreq/callparallel/main.nf +++ b/tests/modules/nf-core/lofreq/callparallel/main.nf @@ -5,10 +5,11 @@ nextflow.enable.dsl = 2 include { LOFREQ_CALLPARALLEL } from '../../../../../modules/nf-core/lofreq/callparallel/main.nf' workflow test_lofreq_callparallel { - + input = [ [ id:'test' ], // meta map file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) + file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true), + [] ] fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) @@ -16,3 +17,17 @@ workflow test_lofreq_callparallel { LOFREQ_CALLPARALLEL ( input, fasta, fai ) } + +workflow test_lofreq_callparallel_intervals { + + input = [ [ id:'test' ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true), + file(params.test_data['sarscov2']['genome']['test_bed']) + ] + + fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + fai = file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true) + + LOFREQ_CALLPARALLEL ( input, fasta, fai ) +} \ No newline at end of file diff --git a/tests/modules/nf-core/lofreq/callparallel/test.yml b/tests/modules/nf-core/lofreq/callparallel/test.yml index 525a7d8564a..da3078f4406 100644 --- a/tests/modules/nf-core/lofreq/callparallel/test.yml +++ b/tests/modules/nf-core/lofreq/callparallel/test.yml @@ -9,3 +9,15 @@ [ '##INFO=', ] + +- name: lofreq callparallel test_lofreq_callparallel_intervals + command: nextflow run ./tests/modules/nf-core/lofreq/callparallel -entry test_lofreq_callparallel_intervals -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/lofreq/callparallel/nextflow.config + tags: + - lofreq/callparallel + - lofreq + files: + - path: output/lofreq/test.vcf.gz + contains: + [ + '##INFO=', + ]