From b5825fe6b336352024aebccd274da1d131188bfc Mon Sep 17 00:00:00 2001 From: FriederikeHanssen Date: Fri, 25 Mar 2022 07:46:51 +0100 Subject: [PATCH] Mpileup also likes intervals (#1445) * Mpileup also likes intervals * Also update meta yml with inclusive input and intervals Co-authored-by: Sateesh Peri <33637490+sateeshperi@users.noreply.github.com> Co-authored-by: Maxime U. Garcia --- modules/samtools/mpileup/main.nf | 5 +++-- modules/samtools/mpileup/meta.yml | 6 +++++- tests/modules/samtools/mpileup/main.nf | 13 ++++++++++++- tests/modules/samtools/mpileup/test.yml | 19 ++++++++++++++++--- 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/modules/samtools/mpileup/main.nf b/modules/samtools/mpileup/main.nf index cea40321..474a2492 100644 --- a/modules/samtools/mpileup/main.nf +++ b/modules/samtools/mpileup/main.nf @@ -8,7 +8,7 @@ process SAMTOOLS_MPILEUP { 'quay.io/biocontainers/samtools:1.15--h1170115_1' }" input: - tuple val(meta), path(bam) + tuple val(meta), path(input), path(intervals) path fasta output: @@ -21,12 +21,13 @@ process SAMTOOLS_MPILEUP { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def intervals = intervals ? "-l ${intervals}" : "" """ samtools mpileup \\ --fasta-ref $fasta \\ --output ${prefix}.mpileup \\ $args \\ - $bam + $input cat <<-END_VERSIONS > versions.yml "${task.process}": samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') diff --git a/modules/samtools/mpileup/meta.yml b/modules/samtools/mpileup/meta.yml index c384f5c6..ae499e92 100644 --- a/modules/samtools/mpileup/meta.yml +++ b/modules/samtools/mpileup/meta.yml @@ -21,7 +21,7 @@ input: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] - - bam: + - input: type: file description: BAM/CRAM/SAM file pattern: "*.{bam,cram,sam}" @@ -29,6 +29,10 @@ input: type: file description: FASTA reference file pattern: "*.{fasta,fa}" + - intervals: + type: file + description: Interval FILE + pattern: "*.bed" output: - meta: type: map diff --git a/tests/modules/samtools/mpileup/main.nf b/tests/modules/samtools/mpileup/main.nf index dc58cc2c..f7fd4b43 100644 --- a/tests/modules/samtools/mpileup/main.nf +++ b/tests/modules/samtools/mpileup/main.nf @@ -6,7 +6,18 @@ include { SAMTOOLS_MPILEUP } from '../../../../modules/samtools/mpileup/main.nf' workflow test_samtools_mpileup { input = [ [ id:'test', single_end:false ], // 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'], checkIfExists: true), + [] + ] + fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + + SAMTOOLS_MPILEUP ( input, fasta ) +} + +workflow test_samtools_mpileup_intervals { + input = [ [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), + file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true) ] fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) diff --git a/tests/modules/samtools/mpileup/test.yml b/tests/modules/samtools/mpileup/test.yml index 53a9c142..405263d1 100644 --- a/tests/modules/samtools/mpileup/test.yml +++ b/tests/modules/samtools/mpileup/test.yml @@ -1,8 +1,21 @@ -- name: samtools mpileup - command: nextflow run ./tests/modules/samtools/mpileup -entry test_samtools_mpileup -c ./tests/config/nextflow.config -c ./tests/modules/samtools/mpileup/nextflow.config +- name: samtools mpileup test_samtools_mpileup + command: nextflow run tests/modules/samtools/mpileup -entry test_samtools_mpileup -c tests/config/nextflow.config tags: - samtools - samtools/mpileup files: - - path: ./output/samtools/test.mpileup + - path: output/samtools/test.mpileup md5sum: 958e6bead4103d72026f80153b6b5150 + - path: output/samtools/versions.yml + md5sum: 26350e1e145451f0b807911db029861e + +- name: samtools mpileup test_samtools_mpileup_intervals + command: nextflow run tests/modules/samtools/mpileup -entry test_samtools_mpileup_intervals -c tests/config/nextflow.config + tags: + - samtools + - samtools/mpileup + files: + - path: output/samtools/test.mpileup + md5sum: 958e6bead4103d72026f80153b6b5150 + - path: output/samtools/versions.yml + md5sum: 11d8118a558efb9db6798453862d719c