From 9194fb845e1ec6a92ac340a15a22e47f3ad22781 Mon Sep 17 00:00:00 2001 From: Mahesh Binzer-Panchal Date: Fri, 6 May 2022 07:54:10 +0000 Subject: [PATCH 01/12] Add module kat hist --- modules/kat/hist/main.nf | 42 +++++++++++++++++ modules/kat/hist/meta.yml | 64 ++++++++++++++++++++++++++ tests/config/pytest_modules.yml | 4 ++ tests/modules/kat/hist/main.nf | 28 +++++++++++ tests/modules/kat/hist/nextflow.config | 9 ++++ tests/modules/kat/hist/test.yml | 30 ++++++++++++ 6 files changed, 177 insertions(+) create mode 100644 modules/kat/hist/main.nf create mode 100644 modules/kat/hist/meta.yml create mode 100644 tests/modules/kat/hist/main.nf create mode 100644 tests/modules/kat/hist/nextflow.config create mode 100644 tests/modules/kat/hist/test.yml diff --git a/modules/kat/hist/main.nf b/modules/kat/hist/main.nf new file mode 100644 index 00000000..e9a486f9 --- /dev/null +++ b/modules/kat/hist/main.nf @@ -0,0 +1,42 @@ +process KAT_HIST { + tag "$meta.id" + label 'process_medium' + + conda (params.enable_conda ? "bioconda::kat=2.4.2" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/kat:2.4.2--py38hfc5f9d8_2': + 'quay.io/biocontainers/kat:2.4.2--py38hfc5f9d8_2' }" + + input: + tuple val(meta), path(reads) + + output: + tuple val(meta), path("*.hist") , emit: hist + tuple val(meta), path("*.hist.dist_analysis.json"), emit: json + tuple val(meta), path("*.png") , emit: png , optional: true + tuple val(meta), path("*.ps") , emit: ps , optional: true + tuple val(meta), path("*.pdf") , emit: pdf , optional: true + tuple val(meta), path("*-hash.jf*") , emit: jellyfish_hash, optional: true + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + kat hist \\ + --threads $task.cpus \\ + --output_prefix ${prefix}.hist \\ + $args \\ + $reads + + ls -l + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + kat: \$( kat hist --version | sed 's/kat //' ) + END_VERSIONS + """ +} diff --git a/modules/kat/hist/meta.yml b/modules/kat/hist/meta.yml new file mode 100644 index 00000000..a7b45347 --- /dev/null +++ b/modules/kat/hist/meta.yml @@ -0,0 +1,64 @@ +name: "kat_hist" +description: Creates a histogram of the number of distinct k-mers having a given frequency. +keywords: + - k-mer + - histogram + - count +tools: + - "kat": + description: "KAT is a suite of tools that analyse jellyfish hashes or sequence files (fasta or fastq) using kmer counts" + homepage: https://www.earlham.ac.uk/kat-tools + documentation: https://kat.readthedocs.io/en/latest/index.html + tool_dev_url: https://github.com/TGAC/KAT + doi: http://bioinformatics.oxfordjournals.org/content/early/2016/10/20/bioinformatics.btw663.abstract + licence: "['GPL v3']" + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - reads: + type: file + description: | + List of input FastQ files of size 1 and 2 for single-end and paired-end data, + respectively. + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - hist: + type: file + description: KAT histogram of k-mer counts + pattern: "*.hist" + - json: + type: file + description: KAT histogram summary of distance analysis + pattern: "*.hist.dist_analysis.json" + - png: + type: file + description: KAT plot of k-mer histogram in PNG format + pattern: "*.png" + - ps: + type: file + description: KAT plot of k-mer histogram in PS format + pattern: "*.ps" + - pdf: + type: file + description: KAT plot of k-mer histogram in PDF format + pattern: "*.pdf" + - jellyfish_hash: + type: file + description: Jellyfish hash file + pattern: "*-hist.jf*" + +authors: + - "@mahesh-panchal" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 32a28477..21b112d0 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1041,6 +1041,10 @@ kallistobustools/ref: - modules/kallistobustools/ref/** - tests/modules/kallistobustools/ref/** +kat/hist: + - modules/kat/hist/** + - tests/modules/kat/hist/** + khmer/normalizebymedian: - modules/khmer/normalizebymedian/** - tests/modules/khmer/normalizebymedian/** diff --git a/tests/modules/kat/hist/main.nf b/tests/modules/kat/hist/main.nf new file mode 100644 index 00000000..06be6150 --- /dev/null +++ b/tests/modules/kat/hist/main.nf @@ -0,0 +1,28 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { KAT_HIST } from '../../../../modules/kat/hist/main.nf' + +workflow test_kat_hist_single_end { + + input = [ + [ id:'test', single_end:true ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_1_fastq_gz'], checkIfExists: true) + ] + + KAT_HIST ( input ) +} + +workflow test_kat_hist_paired_end { + + input = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.test_data['homo_sapiens']['illumina']['test_1_fastq_gz'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test_2_fastq_gz'], checkIfExists: true), + ] + ] + + KAT_HIST ( input ) +} diff --git a/tests/modules/kat/hist/nextflow.config b/tests/modules/kat/hist/nextflow.config new file mode 100644 index 00000000..a2af9dff --- /dev/null +++ b/tests/modules/kat/hist/nextflow.config @@ -0,0 +1,9 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName: 'test_kat_hist_single_end:KAT_HIST' { + ext.args = '-d' + } + +} diff --git a/tests/modules/kat/hist/test.yml b/tests/modules/kat/hist/test.yml new file mode 100644 index 00000000..994cffa4 --- /dev/null +++ b/tests/modules/kat/hist/test.yml @@ -0,0 +1,30 @@ +- name: kat hist test_kat_hist_single_end + command: nextflow run tests/modules/kat/hist -entry test_kat_hist_single_end -c tests/config/nextflow.config + tags: + - kat/hist + - kat + files: + - path: output/kat/test.hist + md5sum: 1aceb823b6774f14f5cca15954138efd + - path: output/kat/test.hist-hash.jf27 + - path: output/kat/test.hist.dist_analysis.json + md5sum: ec4317d510f752855411d13c0f24dea9 + - path: output/kat/test.hist.png + md5sum: 30daaf4d2dd4b1574e387df973c39d03 + - path: output/kat/versions.yml + md5sum: 296f28c007bc55f8f5490702cf3f81d4 + +- name: kat hist test_kat_hist_paired_end + command: nextflow run tests/modules/kat/hist -entry test_kat_hist_paired_end -c tests/config/nextflow.config + tags: + - kat/hist + - kat + files: + - path: output/kat/test.hist + md5sum: c4e8e01996bd8f676e02690220e1def7 + - path: output/kat/test.hist.dist_analysis.json + md5sum: 954a3d1c3fc56f80f0929315ed299824 + - path: output/kat/test.hist.png + md5sum: 8a21ce0965342234f5982f947f4f10b0 + - path: output/kat/versions.yml + md5sum: 3a07329af7ce78e76b021996cd08eacb From c19e7da59decb430b3e57c5d2b5175005850b0af Mon Sep 17 00:00:00 2001 From: Mahesh Binzer-Panchal Date: Fri, 6 May 2022 10:55:48 +0200 Subject: [PATCH 02/12] Apply suggestions from code review Remove versions md5sum Co-authored-by: FriederikeHanssen --- tests/modules/kat/hist/test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/modules/kat/hist/test.yml b/tests/modules/kat/hist/test.yml index 994cffa4..131e8a3a 100644 --- a/tests/modules/kat/hist/test.yml +++ b/tests/modules/kat/hist/test.yml @@ -12,7 +12,6 @@ - path: output/kat/test.hist.png md5sum: 30daaf4d2dd4b1574e387df973c39d03 - path: output/kat/versions.yml - md5sum: 296f28c007bc55f8f5490702cf3f81d4 - name: kat hist test_kat_hist_paired_end command: nextflow run tests/modules/kat/hist -entry test_kat_hist_paired_end -c tests/config/nextflow.config @@ -27,4 +26,3 @@ - path: output/kat/test.hist.png md5sum: 8a21ce0965342234f5982f947f4f10b0 - path: output/kat/versions.yml - md5sum: 3a07329af7ce78e76b021996cd08eacb From 9b4923dcd5334ad44590180abfc73b0dee387874 Mon Sep 17 00:00:00 2001 From: Mahesh Binzer-Panchal Date: Tue, 10 May 2022 15:02:37 +0000 Subject: [PATCH 03/12] Change test files --- tests/modules/kat/hist/main.nf | 6 +++--- tests/modules/kat/hist/test.yml | 14 ++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/modules/kat/hist/main.nf b/tests/modules/kat/hist/main.nf index 06be6150..88136749 100644 --- a/tests/modules/kat/hist/main.nf +++ b/tests/modules/kat/hist/main.nf @@ -8,7 +8,7 @@ workflow test_kat_hist_single_end { input = [ [ id:'test', single_end:true ], // meta map - file(params.test_data['homo_sapiens']['illumina']['test_1_fastq_gz'], checkIfExists: true) + file(params.test_data['homo_sapiens']['illumina']['test2_1_fastq_gz'], checkIfExists: true) ] KAT_HIST ( input ) @@ -19,8 +19,8 @@ workflow test_kat_hist_paired_end { input = [ [ id:'test', single_end:false ], // meta map [ - file(params.test_data['homo_sapiens']['illumina']['test_1_fastq_gz'], checkIfExists: true), - file(params.test_data['homo_sapiens']['illumina']['test_2_fastq_gz'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test2_1_fastq_gz'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test2_2_fastq_gz'], checkIfExists: true), ] ] diff --git a/tests/modules/kat/hist/test.yml b/tests/modules/kat/hist/test.yml index 131e8a3a..94f545e6 100644 --- a/tests/modules/kat/hist/test.yml +++ b/tests/modules/kat/hist/test.yml @@ -5,13 +5,14 @@ - kat files: - path: output/kat/test.hist - md5sum: 1aceb823b6774f14f5cca15954138efd + md5sum: c6eba52b3a2653a684577a8ae20b74c1 - path: output/kat/test.hist-hash.jf27 - path: output/kat/test.hist.dist_analysis.json - md5sum: ec4317d510f752855411d13c0f24dea9 + md5sum: 52a5a2d91c71b940f36f1f0a7fd5ef10 - path: output/kat/test.hist.png - md5sum: 30daaf4d2dd4b1574e387df973c39d03 + md5sum: 49861ef1a265e0edde3550b39c64a274 - path: output/kat/versions.yml + md5sum: 296f28c007bc55f8f5490702cf3f81d4 - name: kat hist test_kat_hist_paired_end command: nextflow run tests/modules/kat/hist -entry test_kat_hist_paired_end -c tests/config/nextflow.config @@ -20,9 +21,10 @@ - kat files: - path: output/kat/test.hist - md5sum: c4e8e01996bd8f676e02690220e1def7 + md5sum: 91429091e74b1718051591d83a1ccb5d - path: output/kat/test.hist.dist_analysis.json - md5sum: 954a3d1c3fc56f80f0929315ed299824 + md5sum: 8b0dabeaff4ba706b33aa8964d687e13 - path: output/kat/test.hist.png - md5sum: 8a21ce0965342234f5982f947f4f10b0 + md5sum: e20774d0d2b979cb6ead7b7fb5ad36d9 - path: output/kat/versions.yml + md5sum: 3a07329af7ce78e76b021996cd08eacb From 7a16ece747c402c23cf1a8b36b2edf0ee468dad3 Mon Sep 17 00:00:00 2001 From: Mahesh Binzer-Panchal Date: Tue, 10 May 2022 15:13:25 +0000 Subject: [PATCH 04/12] Change md5sum to contains --- tests/modules/kat/hist/test.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/modules/kat/hist/test.yml b/tests/modules/kat/hist/test.yml index 94f545e6..19d92ee2 100644 --- a/tests/modules/kat/hist/test.yml +++ b/tests/modules/kat/hist/test.yml @@ -8,7 +8,14 @@ md5sum: c6eba52b3a2653a684577a8ae20b74c1 - path: output/kat/test.hist-hash.jf27 - path: output/kat/test.hist.dist_analysis.json - md5sum: 52a5a2d91c71b940f36f1f0a7fd5ef10 + # md5sum: 52a5a2d91c71b940f36f1f0a7fd5ef10 # This is variable for an unknown reason + contains: + - "nb_peaks" + - "global_minima" + - "global_maxima" + - "mean_freq" + - "est_genome_size" + - "est_het_rate" - path: output/kat/test.hist.png md5sum: 49861ef1a265e0edde3550b39c64a274 - path: output/kat/versions.yml @@ -23,7 +30,14 @@ - path: output/kat/test.hist md5sum: 91429091e74b1718051591d83a1ccb5d - path: output/kat/test.hist.dist_analysis.json - md5sum: 8b0dabeaff4ba706b33aa8964d687e13 + # md5sum: 8b0dabeaff4ba706b33aa8964d687e13 # This is variable for an unknown reason + contains: + - "nb_peaks" + - "global_minima" + - "global_maxima" + - "mean_freq" + - "est_genome_size" + - "est_het_rate" - path: output/kat/test.hist.png md5sum: e20774d0d2b979cb6ead7b7fb5ad36d9 - path: output/kat/versions.yml From c70b169f61620f35bd6633426f4b236ced9e067d Mon Sep 17 00:00:00 2001 From: Ramprasad Neethiraj <20065894+ramprasadn@users.noreply.github.com> Date: Fri, 20 May 2022 13:34:54 +0200 Subject: [PATCH 05/12] create modules --- modules/bcftools/rhocall/main.nf | 75 +++++++++++++++++++ modules/bcftools/rhocall/meta.yml | 51 +++++++++++++ tests/config/pytest_modules.yml | 4 + tests/modules/bcftools/rhocall/main.nf | 15 ++++ .../modules/bcftools/rhocall/nextflow.config | 5 ++ tests/modules/bcftools/rhocall/test.yml | 14 ++++ 6 files changed, 164 insertions(+) create mode 100644 modules/bcftools/rhocall/main.nf create mode 100644 modules/bcftools/rhocall/meta.yml create mode 100644 tests/modules/bcftools/rhocall/main.nf create mode 100644 tests/modules/bcftools/rhocall/nextflow.config create mode 100644 tests/modules/bcftools/rhocall/test.yml diff --git a/modules/bcftools/rhocall/main.nf b/modules/bcftools/rhocall/main.nf new file mode 100644 index 00000000..7036963e --- /dev/null +++ b/modules/bcftools/rhocall/main.nf @@ -0,0 +1,75 @@ +// TODO nf-core: If in doubt look at other nf-core/modules to see how we are doing things! :) +// https://github.com/nf-core/modules/tree/master/modules +// You can also ask for help via your pull request or on the #modules channel on the nf-core Slack workspace: +// https://nf-co.re/join +// TODO nf-core: A module file SHOULD only define input and output files as command-line parameters. +// All other parameters MUST be provided using the "task.ext" directive, see here: +// https://www.nextflow.io/docs/latest/process.html#ext +// where "task.ext" is a string. +// Any parameters that need to be evaluated in the context of a particular sample +// e.g. single-end/paired-end data MUST also be defined and evaluated appropriately. +// TODO nf-core: Software that can be piped together SHOULD be added to separate module files +// unless there is a run-time, storage advantage in implementing in this way +// e.g. it's ok to have a single module for bwa to output BAM instead of SAM: +// bwa mem | samtools view -B -T ref.fasta +// TODO nf-core: Optional inputs are not currently supported by Nextflow. However, using an empty +// list (`[]`) instead of a file can be used to work around this issue. + +process BCFTOOLS_RHOCALL { + tag "$meta.id" + label 'process_medium' + + // TODO nf-core: List required Conda package(s). + // Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). + // For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. + // TODO nf-core: See section in main README for further information regarding finding and adding container addresses to the section below. + conda (params.enable_conda ? "bioconda::bcftools=1.15.1" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/bcftools:1.15.1--h0ea216a_0': + 'quay.io/biocontainers/bcftools:1.15.1--h0ea216a_0' }" + + input: + // TODO nf-core: Where applicable all sample-specific information e.g. "id", "single_end", "read_group" + // MUST be provided as an input via a Groovy Map called "meta". + // This information may not be required in some instances e.g. indexing reference genome files: + // https://github.com/nf-core/modules/blob/master/modules/bwa/index/main.nf + // TODO nf-core: Where applicable please provide/convert compressed files as input/output + // e.g. "*.fastq.gz" and NOT "*.fastq", "*.bam" and NOT "*.sam" etc. + tuple val(meta), path(bam) + + output: + // TODO nf-core: Named file extensions MUST be emitted for ALL output channels + tuple val(meta), path("*.bam"), emit: bam + // TODO nf-core: List additional required output channels/values here + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + // TODO nf-core: Where possible, a command MUST be provided to obtain the version number of the software e.g. 1.10 + // If the software is unable to output a version number on the command-line then it can be manually specified + // e.g. https://github.com/nf-core/modules/blob/master/modules/homer/annotatepeaks/main.nf + // Each software used MUST provide the software name and version number in the YAML version file (versions.yml) + // TODO nf-core: It MUST be possible to pass additional parameters to the tool as a command-line string via the "task.ext.args" directive + // TODO nf-core: If the tool supports multi-threading then you MUST provide the appropriate parameter + // using the Nextflow "task" variable e.g. "--threads $task.cpus" + // TODO nf-core: Please replace the example samtools command below with your module's command + // TODO nf-core: Please indent the command appropriately (4 spaces!!) to help with readability ;) + """ + samtools \\ + sort \\ + $args \\ + -@ $task.cpus \\ + -o ${prefix}.bam \\ + -T $prefix \\ + $bam + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + bcftools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' )) + END_VERSIONS + """ +} diff --git a/modules/bcftools/rhocall/meta.yml b/modules/bcftools/rhocall/meta.yml new file mode 100644 index 00000000..fa7baf2a --- /dev/null +++ b/modules/bcftools/rhocall/meta.yml @@ -0,0 +1,51 @@ +name: "bcftools_rhocall" +## TODO nf-core: Add a description of the module and list keywords +description: write your description here +keywords: + - sort +tools: + - "bcftools": + ## TODO nf-core: Add a description and other details for the software below + description: "BCFtools is a set of utilities that manipulate variant calls in the Variant Call Format (VCF) and its binary counterpart BCF. All commands work transparently with both VCFs and BCFs, both uncompressed and BGZF-compressed. Most commands accept VCF, bgzipped VCF and BCF with filetype detected automatically even when streaming from a pipe. Indexed VCF and BCF will work in all situations. Un-indexed VCF and BCF and streams will work in most, but not all situations." + homepage: "None" + documentation: "None" + tool_dev_url: "None" + doi: "" + licence: "['GPL']" + +## TODO nf-core: Add a description of all of the variables used as input +input: + # Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + # + ## TODO nf-core: Delete / customise this example input + - bam: + type: file + description: BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + +## TODO nf-core: Add a description of all of the variables used as output +output: + #Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + # + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + ## TODO nf-core: Delete / customise this example output + - bam: + type: file + description: Sorted BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + +authors: + - "@ramprasadn" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 16411798..858cbd47 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -166,6 +166,10 @@ bcftools/reheader: - modules/bcftools/reheader/** - tests/modules/bcftools/reheader/** +bcftools/rhocall: + - modules/bcftools/rhocall/** + - tests/modules/bcftools/rhocall/** + bcftools/sort: - modules/bcftools/sort/** - tests/modules/bcftools/sort/** diff --git a/tests/modules/bcftools/rhocall/main.nf b/tests/modules/bcftools/rhocall/main.nf new file mode 100644 index 00000000..2630e4f7 --- /dev/null +++ b/tests/modules/bcftools/rhocall/main.nf @@ -0,0 +1,15 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { BCFTOOLS_RHOCALL } from '../../../../modules/bcftools/rhocall/main.nf' + +workflow test_bcftools_rhocall { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + + BCFTOOLS_RHOCALL ( input ) +} diff --git a/tests/modules/bcftools/rhocall/nextflow.config b/tests/modules/bcftools/rhocall/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/bcftools/rhocall/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} \ No newline at end of file diff --git a/tests/modules/bcftools/rhocall/test.yml b/tests/modules/bcftools/rhocall/test.yml new file mode 100644 index 00000000..5d5f44f6 --- /dev/null +++ b/tests/modules/bcftools/rhocall/test.yml @@ -0,0 +1,14 @@ +## TODO nf-core: Please run the following command to build this file: +# nf-core modules create-test-yml bcftools/rhocall +- name: "bcftools rhocall" + command: nextflow run ./tests/modules/bcftools/rhocall -entry test_bcftools_rhocall -c ./tests/config/nextflow.config -c ./tests/modules/bcftools/rhocall/nextflow.config + tags: + - "bcftools" + # + - "bcftools/rhocall" + # + files: + - path: "output/bcftools/test.bam" + md5sum: e667c7caad0bc4b7ac383fd023c654fc + - path: output/bcftools/versions.yml + md5sum: a01fe51bc4c6a3a6226fbf77b2c7cf3b From 2542c9d1767dbb374c6fb07583eda166f5287e18 Mon Sep 17 00:00:00 2001 From: Ramprasad Neethiraj <20065894+ramprasadn@users.noreply.github.com> Date: Fri, 20 May 2022 16:46:19 +0200 Subject: [PATCH 06/12] add tests --- modules/bcftools/rhocall/main.nf | 75 ------------------- modules/bcftools/rhocall/meta.yml | 51 ------------- modules/bcftools/roh/main.nf | 61 +++++++++++++++ modules/bcftools/roh/meta.yml | 56 ++++++++++++++ tests/config/pytest_modules.yml | 6 +- tests/modules/bcftools/rhocall/main.nf | 15 ---- tests/modules/bcftools/rhocall/test.yml | 14 ---- tests/modules/bcftools/roh/main.nf | 20 +++++ .../bcftools/{rhocall => roh}/nextflow.config | 0 tests/modules/bcftools/roh/test.yml | 8 ++ 10 files changed, 148 insertions(+), 158 deletions(-) delete mode 100644 modules/bcftools/rhocall/main.nf delete mode 100644 modules/bcftools/rhocall/meta.yml create mode 100644 modules/bcftools/roh/main.nf create mode 100644 modules/bcftools/roh/meta.yml delete mode 100644 tests/modules/bcftools/rhocall/main.nf delete mode 100644 tests/modules/bcftools/rhocall/test.yml create mode 100644 tests/modules/bcftools/roh/main.nf rename tests/modules/bcftools/{rhocall => roh}/nextflow.config (100%) create mode 100644 tests/modules/bcftools/roh/test.yml diff --git a/modules/bcftools/rhocall/main.nf b/modules/bcftools/rhocall/main.nf deleted file mode 100644 index 7036963e..00000000 --- a/modules/bcftools/rhocall/main.nf +++ /dev/null @@ -1,75 +0,0 @@ -// TODO nf-core: If in doubt look at other nf-core/modules to see how we are doing things! :) -// https://github.com/nf-core/modules/tree/master/modules -// You can also ask for help via your pull request or on the #modules channel on the nf-core Slack workspace: -// https://nf-co.re/join -// TODO nf-core: A module file SHOULD only define input and output files as command-line parameters. -// All other parameters MUST be provided using the "task.ext" directive, see here: -// https://www.nextflow.io/docs/latest/process.html#ext -// where "task.ext" is a string. -// Any parameters that need to be evaluated in the context of a particular sample -// e.g. single-end/paired-end data MUST also be defined and evaluated appropriately. -// TODO nf-core: Software that can be piped together SHOULD be added to separate module files -// unless there is a run-time, storage advantage in implementing in this way -// e.g. it's ok to have a single module for bwa to output BAM instead of SAM: -// bwa mem | samtools view -B -T ref.fasta -// TODO nf-core: Optional inputs are not currently supported by Nextflow. However, using an empty -// list (`[]`) instead of a file can be used to work around this issue. - -process BCFTOOLS_RHOCALL { - tag "$meta.id" - label 'process_medium' - - // TODO nf-core: List required Conda package(s). - // Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). - // For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. - // TODO nf-core: See section in main README for further information regarding finding and adding container addresses to the section below. - conda (params.enable_conda ? "bioconda::bcftools=1.15.1" : null) - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/bcftools:1.15.1--h0ea216a_0': - 'quay.io/biocontainers/bcftools:1.15.1--h0ea216a_0' }" - - input: - // TODO nf-core: Where applicable all sample-specific information e.g. "id", "single_end", "read_group" - // MUST be provided as an input via a Groovy Map called "meta". - // This information may not be required in some instances e.g. indexing reference genome files: - // https://github.com/nf-core/modules/blob/master/modules/bwa/index/main.nf - // TODO nf-core: Where applicable please provide/convert compressed files as input/output - // e.g. "*.fastq.gz" and NOT "*.fastq", "*.bam" and NOT "*.sam" etc. - tuple val(meta), path(bam) - - output: - // TODO nf-core: Named file extensions MUST be emitted for ALL output channels - tuple val(meta), path("*.bam"), emit: bam - // TODO nf-core: List additional required output channels/values here - path "versions.yml" , emit: versions - - when: - task.ext.when == null || task.ext.when - - script: - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - // TODO nf-core: Where possible, a command MUST be provided to obtain the version number of the software e.g. 1.10 - // If the software is unable to output a version number on the command-line then it can be manually specified - // e.g. https://github.com/nf-core/modules/blob/master/modules/homer/annotatepeaks/main.nf - // Each software used MUST provide the software name and version number in the YAML version file (versions.yml) - // TODO nf-core: It MUST be possible to pass additional parameters to the tool as a command-line string via the "task.ext.args" directive - // TODO nf-core: If the tool supports multi-threading then you MUST provide the appropriate parameter - // using the Nextflow "task" variable e.g. "--threads $task.cpus" - // TODO nf-core: Please replace the example samtools command below with your module's command - // TODO nf-core: Please indent the command appropriately (4 spaces!!) to help with readability ;) - """ - samtools \\ - sort \\ - $args \\ - -@ $task.cpus \\ - -o ${prefix}.bam \\ - -T $prefix \\ - $bam - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - bcftools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' )) - END_VERSIONS - """ -} diff --git a/modules/bcftools/rhocall/meta.yml b/modules/bcftools/rhocall/meta.yml deleted file mode 100644 index fa7baf2a..00000000 --- a/modules/bcftools/rhocall/meta.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: "bcftools_rhocall" -## TODO nf-core: Add a description of the module and list keywords -description: write your description here -keywords: - - sort -tools: - - "bcftools": - ## TODO nf-core: Add a description and other details for the software below - description: "BCFtools is a set of utilities that manipulate variant calls in the Variant Call Format (VCF) and its binary counterpart BCF. All commands work transparently with both VCFs and BCFs, both uncompressed and BGZF-compressed. Most commands accept VCF, bgzipped VCF and BCF with filetype detected automatically even when streaming from a pipe. Indexed VCF and BCF will work in all situations. Un-indexed VCF and BCF and streams will work in most, but not all situations." - homepage: "None" - documentation: "None" - tool_dev_url: "None" - doi: "" - licence: "['GPL']" - -## TODO nf-core: Add a description of all of the variables used as input -input: - # Only when we have meta - - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] - # - ## TODO nf-core: Delete / customise this example input - - bam: - type: file - description: BAM/CRAM/SAM file - pattern: "*.{bam,cram,sam}" - -## TODO nf-core: Add a description of all of the variables used as output -output: - #Only when we have meta - - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] - # - - versions: - type: file - description: File containing software versions - pattern: "versions.yml" - ## TODO nf-core: Delete / customise this example output - - bam: - type: file - description: Sorted BAM/CRAM/SAM file - pattern: "*.{bam,cram,sam}" - -authors: - - "@ramprasadn" diff --git a/modules/bcftools/roh/main.nf b/modules/bcftools/roh/main.nf new file mode 100644 index 00000000..55d8c4a3 --- /dev/null +++ b/modules/bcftools/roh/main.nf @@ -0,0 +1,61 @@ +process BCFTOOLS_ROH { + tag "$meta.id" + label 'process_medium' + + conda (params.enable_conda ? "bioconda::bcftools=1.15.1" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/bcftools:1.15.1--h0ea216a_0': + 'quay.io/biocontainers/bcftools:1.15.1--h0ea216a_0' }" + + input: + tuple val(meta), path(vcf), path(tbi) + path af_file + path genetic_map + path regions_file + path samples_file + path targets_file + + output: + tuple val(meta), path("*.roh"), emit: roh + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def af_read = af_file ? "--AF-file ${af_file}" : '' + def gen_map = genetic_map ? "--genetic-map ${genetic_map}" : '' + def reg_file = regions_file ? "--regions-file ${regions_file}" : '' + def samp_file = samples_file ? "--samples-file ${samples_file}" : '' + def targ_file = targets_file ? "--targets-file ${targets_file}" : '' + """ + bcftools \\ + roh \\ + $args \\ + $af_read \\ + $gen_map \\ + $reg_file \\ + $samp_file \\ + $targ_file \\ + -o ${prefix}.roh.gz \\ + $vcf + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//') + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.roh + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//') + END_VERSIONS + """ +} diff --git a/modules/bcftools/roh/meta.yml b/modules/bcftools/roh/meta.yml new file mode 100644 index 00000000..09535fe8 --- /dev/null +++ b/modules/bcftools/roh/meta.yml @@ -0,0 +1,56 @@ +name: "bcftools_roh" +## TODO nf-core: Add a description of the module and list keywords +description: write your description here +keywords: + - sort +tools: + - "roh": + description: "A program for detecting runs of homo/autozygosity. Only bi-allelic sites are considered." + homepage: https://www.htslib.org/ + documentation: http://www.htslib.org/doc/bcftools.html + doi: 10.1093/bioinformatics/btp352 + licence: ["MIT"] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - vcf: + type: file + description: VCF file + pattern: "*.{vcf,.vcf.gz}" + - af_file: + type: file + description: "Read allele frequencies from a tab-delimited file containing the columns: CHROM\tPOS\tREF,ALT\tAF." + - genetic_map: + type: file + description: "Genetic map in the format required also by IMPUTE2." + - regions_file: + type: file + description: "Regions can be specified either on command line or in a VCF, BED, or tab-delimited file (the default)." + - samples_file: + type: file + description: "File of sample names to include or exclude if prefixed with '^'." + - targets_file: + type: file + description: "Targets can be specified either on command line or in a VCF, BED, or tab-delimited file (the default)." + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - roh: + type: file + description: Contains site-specific and/or per-region runs of homo/autozygosity calls. + pattern: "*.{roh}" + +authors: + - "@ramprasadn" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 858cbd47..e15315e9 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -166,9 +166,9 @@ bcftools/reheader: - modules/bcftools/reheader/** - tests/modules/bcftools/reheader/** -bcftools/rhocall: - - modules/bcftools/rhocall/** - - tests/modules/bcftools/rhocall/** +bcftools/roh: + - modules/bcftools/roh/** + - tests/modules/bcftools/roh/** bcftools/sort: - modules/bcftools/sort/** diff --git a/tests/modules/bcftools/rhocall/main.nf b/tests/modules/bcftools/rhocall/main.nf deleted file mode 100644 index 2630e4f7..00000000 --- a/tests/modules/bcftools/rhocall/main.nf +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { BCFTOOLS_RHOCALL } from '../../../../modules/bcftools/rhocall/main.nf' - -workflow test_bcftools_rhocall { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) - ] - - BCFTOOLS_RHOCALL ( input ) -} diff --git a/tests/modules/bcftools/rhocall/test.yml b/tests/modules/bcftools/rhocall/test.yml deleted file mode 100644 index 5d5f44f6..00000000 --- a/tests/modules/bcftools/rhocall/test.yml +++ /dev/null @@ -1,14 +0,0 @@ -## TODO nf-core: Please run the following command to build this file: -# nf-core modules create-test-yml bcftools/rhocall -- name: "bcftools rhocall" - command: nextflow run ./tests/modules/bcftools/rhocall -entry test_bcftools_rhocall -c ./tests/config/nextflow.config -c ./tests/modules/bcftools/rhocall/nextflow.config - tags: - - "bcftools" - # - - "bcftools/rhocall" - # - files: - - path: "output/bcftools/test.bam" - md5sum: e667c7caad0bc4b7ac383fd023c654fc - - path: output/bcftools/versions.yml - md5sum: a01fe51bc4c6a3a6226fbf77b2c7cf3b diff --git a/tests/modules/bcftools/roh/main.nf b/tests/modules/bcftools/roh/main.nf new file mode 100644 index 00000000..5dd6f897 --- /dev/null +++ b/tests/modules/bcftools/roh/main.nf @@ -0,0 +1,20 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { BCFTOOLS_ROH } from '../../../../modules/bcftools/roh/main.nf' + +workflow test_bcftools_roh { + + input = [ [ id:'out' ], // meta map + file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_vcf_gz_tbi'], checkIfExists: true)] + + af_file = [] + gen_map = [] + regions = [] + targets = [] + samples = [] + + BCFTOOLS_ROH ( input, af_file, gen_map, regions, samples, targets ) +} diff --git a/tests/modules/bcftools/rhocall/nextflow.config b/tests/modules/bcftools/roh/nextflow.config similarity index 100% rename from tests/modules/bcftools/rhocall/nextflow.config rename to tests/modules/bcftools/roh/nextflow.config diff --git a/tests/modules/bcftools/roh/test.yml b/tests/modules/bcftools/roh/test.yml new file mode 100644 index 00000000..7a8c754b --- /dev/null +++ b/tests/modules/bcftools/roh/test.yml @@ -0,0 +1,8 @@ +- name: "bcftools roh" + command: nextflow run ./tests/modules/bcftools/roh -entry test_bcftools_roh -c ./tests/config/nextflow.config -c ./tests/modules/bcftools/roh/nextflow.config + tags: + - "bcftools" + - "bcftools/rhoh" + files: + - path: "output/bcftools/test.roh" + - path: output/bcftools/versions.yml From 635edc0022a39acd295a65f14dec482c6a36b9d1 Mon Sep 17 00:00:00 2001 From: Ramprasad Neethiraj <20065894+ramprasadn@users.noreply.github.com> Date: Fri, 20 May 2022 17:07:42 +0200 Subject: [PATCH 07/12] fix typo --- modules/bcftools/roh/main.nf | 2 +- tests/modules/bcftools/roh/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/bcftools/roh/main.nf b/modules/bcftools/roh/main.nf index 55d8c4a3..890b6fad 100644 --- a/modules/bcftools/roh/main.nf +++ b/modules/bcftools/roh/main.nf @@ -39,7 +39,7 @@ process BCFTOOLS_ROH { $reg_file \\ $samp_file \\ $targ_file \\ - -o ${prefix}.roh.gz \\ + -o ${prefix}.roh \\ $vcf cat <<-END_VERSIONS > versions.yml diff --git a/tests/modules/bcftools/roh/test.yml b/tests/modules/bcftools/roh/test.yml index 7a8c754b..2387ee39 100644 --- a/tests/modules/bcftools/roh/test.yml +++ b/tests/modules/bcftools/roh/test.yml @@ -2,7 +2,7 @@ command: nextflow run ./tests/modules/bcftools/roh -entry test_bcftools_roh -c ./tests/config/nextflow.config -c ./tests/modules/bcftools/roh/nextflow.config tags: - "bcftools" - - "bcftools/rhoh" + - "bcftools/roh" files: - path: "output/bcftools/test.roh" - path: output/bcftools/versions.yml From 995bf88327b5f4dad1af9abbe3a2d8d24968fb72 Mon Sep 17 00:00:00 2001 From: Ramprasad Neethiraj <20065894+ramprasadn@users.noreply.github.com> Date: Fri, 20 May 2022 17:10:09 +0200 Subject: [PATCH 08/12] add stub --- tests/modules/bcftools/roh/main.nf | 17 ++++++++++++++++- tests/modules/bcftools/roh/test.yml | 11 ++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/tests/modules/bcftools/roh/main.nf b/tests/modules/bcftools/roh/main.nf index 5dd6f897..3eb534b6 100644 --- a/tests/modules/bcftools/roh/main.nf +++ b/tests/modules/bcftools/roh/main.nf @@ -6,7 +6,22 @@ include { BCFTOOLS_ROH } from '../../../../modules/bcftools/roh/main.nf' workflow test_bcftools_roh { - input = [ [ id:'out' ], // meta map + input = [ [ id:'test' ], // meta map + file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_vcf_gz_tbi'], checkIfExists: true)] + + af_file = [] + gen_map = [] + regions = [] + targets = [] + samples = [] + + BCFTOOLS_ROH ( input, af_file, gen_map, regions, samples, targets ) +} + +workflow test_bcftools_roh_stub { + + input = [ [ id:'test' ], // meta map file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true), file(params.test_data['sarscov2']['illumina']['test_vcf_gz_tbi'], checkIfExists: true)] diff --git a/tests/modules/bcftools/roh/test.yml b/tests/modules/bcftools/roh/test.yml index 2387ee39..9cc50a66 100644 --- a/tests/modules/bcftools/roh/test.yml +++ b/tests/modules/bcftools/roh/test.yml @@ -5,4 +5,13 @@ - "bcftools/roh" files: - path: "output/bcftools/test.roh" - - path: output/bcftools/versions.yml + - path: "output/bcftools/versions.yml" + +- name: "bcftools roh stub" + command: nextflow run ./tests/modules/bcftools/roh -entry test_bcftools_roh_stub -c ./tests/config/nextflow.config -c ./tests/modules/bcftools/roh/nextflow.config + tags: + - "bcftools" + - "bcftools/roh" + files: + - path: "output/bcftools/test.roh" + - path: "output/bcftools/versions.yml" From b40b147004d02af5c4c0fb7ae17986d8727514db Mon Sep 17 00:00:00 2001 From: Mahesh Binzer-Panchal Date: Mon, 23 May 2022 08:51:29 +0200 Subject: [PATCH 09/12] Update tests/modules/kat/hist/test.yml Co-authored-by: Sateesh Peri <105730406+sateeshblue@users.noreply.github.com> --- tests/modules/kat/hist/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/modules/kat/hist/test.yml b/tests/modules/kat/hist/test.yml index 19d92ee2..90502485 100644 --- a/tests/modules/kat/hist/test.yml +++ b/tests/modules/kat/hist/test.yml @@ -19,7 +19,6 @@ - path: output/kat/test.hist.png md5sum: 49861ef1a265e0edde3550b39c64a274 - path: output/kat/versions.yml - md5sum: 296f28c007bc55f8f5490702cf3f81d4 - name: kat hist test_kat_hist_paired_end command: nextflow run tests/modules/kat/hist -entry test_kat_hist_paired_end -c tests/config/nextflow.config From d7c1fe14778375e0751372b553e77fc84efb0541 Mon Sep 17 00:00:00 2001 From: Mahesh Binzer-Panchal Date: Mon, 23 May 2022 08:51:49 +0200 Subject: [PATCH 10/12] Update tests/modules/kat/hist/test.yml Co-authored-by: Sateesh Peri <105730406+sateeshblue@users.noreply.github.com> --- tests/modules/kat/hist/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/modules/kat/hist/test.yml b/tests/modules/kat/hist/test.yml index 90502485..391a3a21 100644 --- a/tests/modules/kat/hist/test.yml +++ b/tests/modules/kat/hist/test.yml @@ -40,4 +40,3 @@ - path: output/kat/test.hist.png md5sum: e20774d0d2b979cb6ead7b7fb5ad36d9 - path: output/kat/versions.yml - md5sum: 3a07329af7ce78e76b021996cd08eacb From 06a3bff20135aa898d373ef410fa96809fd78aef Mon Sep 17 00:00:00 2001 From: Ramprasad Neethiraj <20065894+ramprasadn@users.noreply.github.com> Date: Mon, 23 May 2022 12:59:48 +0200 Subject: [PATCH 11/12] fix lint error --- tests/modules/bcftools/roh/nextflow.config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/modules/bcftools/roh/nextflow.config b/tests/modules/bcftools/roh/nextflow.config index 50f50a7a..8730f1c4 100644 --- a/tests/modules/bcftools/roh/nextflow.config +++ b/tests/modules/bcftools/roh/nextflow.config @@ -1,5 +1,5 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} \ No newline at end of file + +} From b0dba3ee7543dc89a00575fb619408de97cd889d Mon Sep 17 00:00:00 2001 From: Ramprasad Neethiraj <20065894+ramprasadn@users.noreply.github.com> Date: Tue, 24 May 2022 16:17:15 +0200 Subject: [PATCH 12/12] update description --- modules/bcftools/roh/meta.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/bcftools/roh/meta.yml b/modules/bcftools/roh/meta.yml index 09535fe8..fd03d4ce 100644 --- a/modules/bcftools/roh/meta.yml +++ b/modules/bcftools/roh/meta.yml @@ -1,8 +1,7 @@ name: "bcftools_roh" -## TODO nf-core: Add a description of the module and list keywords -description: write your description here +description: A program for detecting runs of homo/autozygosity. Only bi-allelic sites are considered. keywords: - - sort + - roh tools: - "roh": description: "A program for detecting runs of homo/autozygosity. Only bi-allelic sites are considered."