diff --git a/modules/nf-core/nanomonsv/get/main.nf b/modules/nf-core/nanomonsv/get/main.nf new file mode 100644 index 000000000000..cda2227ad2d5 --- /dev/null +++ b/modules/nf-core/nanomonsv/get/main.nf @@ -0,0 +1,61 @@ +// 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/nf-core/ +// 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 NANOMONSV_GET { + tag "$meta.id" + label 'process_high' + + conda "bioconda::nanomonsv=0.5.0" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/nanomonsv:0.5.0--pyhdfd78af_0': + 'quay.io/biocontainers/nanomonsv:0.5.0--pyhdfd78af_0' }" + + input: + tuple val(meta), path(bam), path(bai), path(parse_intermediates), path(control_bam), path(control_bai), path(control_parse_intermediates) + path reference_fasta + + output: + tuple val(meta), path("${prefix}.nanomonsv.result.vcf") , emit: vcf + tuple val(meta), path("${prefix}.nanomonsv.result.txt") , emit: text_report + tuple val(meta), path("${prefix}.nanomonsv.supporting_read.txt"), emit: supp_read + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + prefix = task.ext.prefix ?: "${meta.id}" + def args = task.ext.args ?: '' + def control_prefix = task.ext.control_prefix ?: "${meta.id}" + if (control_prefix) { + args += " --control_prefix ${control_prefix} --control_bam ${control_bam}" + } + """ + nanomonsv get ${args} ${prefix} \ + ${bam} ${reference_fasta} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + nanomonsv: \$(echo \$(nanomonsv --version 2>&1) | sed 's/^nanomonsv //') + mafft: \$(echo \$(mafft --version 2>&1) | sed 's/^v//; s/ (.*//') + racon: \$(echo \$(racon --version 2>&1) | sed 's/^v//') + tabix: \$(echo \$(tabix --version 2>&1) | sed 's/^tabix (htslib) //; s/ Copyright.*//') + bgzip: \$(echo \$(bgzip --version 2>&1) | sed 's/^bgzip (htslib) //; s/ Copyright.*//') + python: \$(python3 --version | sed 's/Python //g') + END_VERSIONS + """ +} diff --git a/modules/nf-core/nanomonsv/get/meta.yml b/modules/nf-core/nanomonsv/get/meta.yml new file mode 100644 index 000000000000..650b7e79f13c --- /dev/null +++ b/modules/nf-core/nanomonsv/get/meta.yml @@ -0,0 +1,51 @@ +name: "nanomonsv_get" +## TODO nf-core: Add a description of the module and list keywords +description: write your description here +keywords: + - sort +tools: + - "nanomonsv": + ## TODO nf-core: Add a description and other details for the software below + description: "Python tools for detecting structural variation from nanopore sequence data" + homepage: "None" + documentation: "None" + tool_dev_url: "None" + doi: "" + licence: "['GPL v3']" + +## 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: + - "@awgymer" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index e746e9a11bc4..70c242a9e7c5 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -2151,6 +2151,10 @@ nanolyse: - modules/nf-core/nanolyse/** - tests/modules/nf-core/nanolyse/** +nanomonsv/get: + - modules/nf-core/nanomonsv/get/** + - tests/modules/nf-core/nanomonsv/get/** + nanomonsv/parse: - modules/nf-core/nanomonsv/parse/** - tests/modules/nf-core/nanomonsv/parse/** diff --git a/tests/modules/nf-core/nanomonsv/get/main.nf b/tests/modules/nf-core/nanomonsv/get/main.nf new file mode 100644 index 000000000000..65cf8f2a389f --- /dev/null +++ b/tests/modules/nf-core/nanomonsv/get/main.nf @@ -0,0 +1,22 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { NANOMONSV_GET } from '../../../../../modules/nf-core/nanomonsv/get/main.nf' + +workflow test_nanomonsv_get { + + def data_path = 'https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/nanomonsv' + input = channel.of([ + [ id:'test' ], // meta map + file("${data_path}/input_bam/test_tumor.bam", checkIfExists: true), + file("${data_path}/input_bam/test_tumor.bam.bai", checkIfExists: true), + file("${data_path}/parse_output/test_tumor/*.gz*"), + file("${data_path}/input_bam/test_ctrl.bam", checkIfExists: true), + file("${data_path}/input_bam/test_ctrl.bam.bai", checkIfExists: true), + file("${data_path}/parse_output/test_ctrl/*.gz*"), + ]) + ref = file('s3://ngi-igenomes/igenomes/Homo_sapiens/NCBI/GRCh38/Sequence/WholeGenomeFasta/genome.fa') + + NANOMONSV_GET ( input, ref ) +} diff --git a/tests/modules/nf-core/nanomonsv/get/nextflow.config b/tests/modules/nf-core/nanomonsv/get/nextflow.config new file mode 100644 index 000000000000..b7c87af88633 --- /dev/null +++ b/tests/modules/nf-core/nanomonsv/get/nextflow.config @@ -0,0 +1,9 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName: 'NANOMONSV_GET' { + ext.prefix = { "${meta.id}_tumor" } + ext.control_prefix = { "${meta.id}_ctrl" } + } +} diff --git a/tests/modules/nf-core/nanomonsv/get/test.yml b/tests/modules/nf-core/nanomonsv/get/test.yml new file mode 100644 index 000000000000..801ea696f7bd --- /dev/null +++ b/tests/modules/nf-core/nanomonsv/get/test.yml @@ -0,0 +1,15 @@ +- name: nanomonsv get test_nanomonsv_get + command: nextflow run ./tests/modules/nf-core/nanomonsv/get -entry test_nanomonsv_get -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/nanomonsv/get/nextflow.config + tags: + - nanomonsv + - nanomonsv/get + files: + - path: output/nanomonsv/test_tumor.nanomonsv.result.txt + md5sum: 4093bd514c334059b91d77b084de961d + - path: output/nanomonsv/test_tumor.nanomonsv.result.vcf + contains: + - "chr18\t68712223\td_2\tC\t\t.\tPASS\tEND=68715588;SVTYPE=DEL;SVLEN=-3365\tTR:VR\t25:4\t24:0\n" + - path: output/nanomonsv/test_tumor.nanomonsv.supporting_read.txt + contains: + - "chr10\t87940538\t+\tchr10\t87952584\t-\tATAGAGATTATACTTTGTGTA\tr_0\t37b0700e-96e1-4d0c-9299-18eabf25515d\t13944\t+" + - path: output/nanomonsv/versions.yml