From 1b24005f072d0788f1b35ccf08ef5c1437529dbb Mon Sep 17 00:00:00 2001 From: Regina Hertfelder Reynolds <31013971+RHReynolds@users.noreply.github.com> Date: Tue, 25 Jan 2022 18:58:22 +0000 Subject: [PATCH 1/8] Add bcl2fastq2 to cellranger dockerfile (#1115) * refactor: add bcl2fastq to cellranger dockerfile bcl2fastq required for the cellranger mkfastq module and was therefore added to the cellranger dockerfile. Further, cellranger was updated to the latest version, 6.1.2., with naming and containers across cellranger modules updated accordingly. * chore: add bcl2fastq zip to .gitignore * style: fix code linting error * test(cellranger): Add tiles to mkfastq * additional dockerfile for mkfastq * update readme and dockerfiles * update readme * fix: update container for mkfastq * docs: correct typos in readme * test: update md5sum following cellranger update * test: update md5sum following cellranger update * fix: new line for external args in mkfastq * test: update mkfastq tiles argument * test: comment out mkfastq tests until smaller test data found * test: stub-run mkfastq test until smaller test data found * test: fix incorrect file path for mkfastq Co-authored-by: Edmund Miller Co-authored-by: ggabernet Co-authored-by: Gisela Gabernet --- modules/cellranger/.gitignore | 1 + modules/cellranger/Dockerfile | 13 ++++-- modules/cellranger/README.md | 16 +++++--- modules/cellranger/count/main.nf | 2 +- modules/cellranger/mkfastq/Dockerfile | 40 +++++++++++++++++++ modules/cellranger/mkfastq/README.md | 26 ++++++++++++ modules/cellranger/mkfastq/main.nf | 17 ++++++-- modules/cellranger/mkgtf/main.nf | 2 +- modules/cellranger/mkref/main.nf | 2 +- tests/modules/cellranger/count/test.yml | 4 +- .../cellranger/mkfastq/nextflow.config | 4 ++ tests/modules/cellranger/mkfastq/test.yml | 13 +++--- tests/modules/cellranger/mkref/test.yml | 2 +- 13 files changed, 120 insertions(+), 22 deletions(-) create mode 100644 modules/cellranger/mkfastq/Dockerfile create mode 100644 modules/cellranger/mkfastq/README.md diff --git a/modules/cellranger/.gitignore b/modules/cellranger/.gitignore index 9f8cb0f5..a283a282 100644 --- a/modules/cellranger/.gitignore +++ b/modules/cellranger/.gitignore @@ -1 +1,2 @@ cellranger-*.tar.gz +bcl2fastq2-*.zip diff --git a/modules/cellranger/Dockerfile b/modules/cellranger/Dockerfile index e9437bf6..3e52ca6a 100644 --- a/modules/cellranger/Dockerfile +++ b/modules/cellranger/Dockerfile @@ -1,15 +1,22 @@ +# Dockerfile to create container with Cell Ranger v6.1.2 +# Push to nfcore/cellranger: + FROM continuumio/miniconda3:4.8.2 LABEL authors="Gisela Gabernet " \ description="Docker image containing Cell Ranger" -# Disclaimer: this container is not provided nor supported by 10x Genomics. +# Disclaimer: this container is not provided nor supported by Illumina or 10x Genomics. # Install procps and clean apt cache RUN apt-get update --allow-releaseinfo-change \ - && apt-get install -y procps \ + && apt-get install -y \ + cpio \ + procps \ + rpm2cpio \ + unzip \ && apt-get clean -y && rm -rf /var/lib/apt/lists/* # Copy pre-downloaded cellranger file -ENV CELLRANGER_VER 6.0.2 +ENV CELLRANGER_VER=6.1.2 COPY cellranger-$CELLRANGER_VER.tar.gz /opt/cellranger-$CELLRANGER_VER.tar.gz # Install cellranger diff --git a/modules/cellranger/README.md b/modules/cellranger/README.md index ed8ccb73..d31735cb 100644 --- a/modules/cellranger/README.md +++ b/modules/cellranger/README.md @@ -1,18 +1,24 @@ # Updating the docker container and making a new module release -Cell Ranger is a commercial tool by 10X Genomics. The container provided for the cellranger nf-core module is not provided nor supported by 10x Genomics. Updating the Cell Ranger version in the container and pushing the update to Dockerhub needs to be done manually. +Cell Ranger is a commercial tool from 10X Genomics. The container provided for the cellranger nf-core module is not provided nor supported by 10x Genomics. Updating the Cell Ranger versions in the container and pushing the update to Dockerhub needs to be done manually. -1. Navigate to the [Cell Ranger download page](https://support.10xgenomics.com/single-cell-gene-expression/software/downloads/latest) and download the tar ball of the desired Cell Ranger version with `curl` or `wget`. Place this file in the same folder where the Dockerfile lies. +1. Navigate to the appropriate download page. + - [Cell Ranger](https://support.10xgenomics.com/single-cell-gene-expression/software/downloads/latest): download the tar ball of the desired Cell Ranger version with `curl` or `wget`. Place this file in the same folder where the Dockerfile lies. -2. Edit the Dockerfile: update the Cell Ranger version in this line: +2. Edit the Dockerfile. Update the Cell Ranger versions in this line: ```bash - ENV CELLRANGER_VER + ENV CELLRANGER_VER= ``` -3. Create the container: +3. Create and test the container: ```bash docker build . -t nfcore/cellranger: + ``` + +4. Access rights are needed to push the container to the Dockerhub nfcore organization, please ask a core team member to do so. + + ```bash docker push nfcore/cellranger: ``` diff --git a/modules/cellranger/count/main.nf b/modules/cellranger/count/main.nf index be3f512a..63fac709 100644 --- a/modules/cellranger/count/main.nf +++ b/modules/cellranger/count/main.nf @@ -5,7 +5,7 @@ process CELLRANGER_COUNT { if (params.enable_conda) { exit 1, "Conda environments cannot be used when using the Cell Ranger tool. Please use docker or singularity containers." } - container "nfcore/cellranger:6.0.2" + container "nfcore/cellranger:6.1.2" input: tuple val(meta), path(reads) diff --git a/modules/cellranger/mkfastq/Dockerfile b/modules/cellranger/mkfastq/Dockerfile new file mode 100644 index 00000000..8660293a --- /dev/null +++ b/modules/cellranger/mkfastq/Dockerfile @@ -0,0 +1,40 @@ +# Dockerfile to create container with Cell Ranger v6.1.2 and bcl2fastq v2.20.0 +# Push to nfcore/cellrangermkfastq: + +FROM continuumio/miniconda3:4.8.2 +LABEL authors="Regina Reynolds, Gisela Gabernet " \ + description="Docker image containing bcl2fastq2 and Cell Ranger" +# Disclaimer: this container is not provided nor supported by Illumina or 10x Genomics. + +# Install procps and clean apt cache +RUN apt-get update --allow-releaseinfo-change \ + && apt-get install -y \ + cpio \ + procps \ + rpm2cpio \ + unzip \ + && apt-get clean -y && rm -rf /var/lib/apt/lists/* + +# Copy pre-downloaded bcl2fastq2 and cellranger file +ENV BCL2FASTQ2_VER=v2-20-0-linux-x86-64 \ + CELLRANGER_VER=6.1.2 +COPY bcl2fastq2-$BCL2FASTQ2_VER.zip /tmp/bcl2fastq2-$BCL2FASTQ2_VER.zip +COPY cellranger-$CELLRANGER_VER.tar.gz /opt/cellranger-$CELLRANGER_VER.tar.gz + +# Install bcl2fastq2 +RUN \ + cd /tmp && \ + unzip bcl2fastq2-$BCL2FASTQ2_VER.zip && \ + mv *.rpm bcl2fastq2-$BCL2FASTQ2_VER.rpm && \ + rpm2cpio ./bcl2fastq2-$BCL2FASTQ2_VER.rpm | cpio -idmv && \ + export PATH=/tmp/usr/local/bin/:$PATH && \ + ln -s /tmp/usr/local/bin/bcl2fastq /usr/bin/bcl2fastq && \ + rm -rf bcl2fastq2-$BCL2FASTQ2_VER.* + +# Install cellranger +RUN \ + cd /opt && \ + tar -xzvf cellranger-$CELLRANGER_VER.tar.gz && \ + export PATH=/opt/cellranger-$CELLRANGER_VER:$PATH && \ + ln -s /opt/cellranger-$CELLRANGER_VER/cellranger /usr/bin/cellranger && \ + rm -rf /opt/cellranger-$CELLRANGER_VER.tar.gz diff --git a/modules/cellranger/mkfastq/README.md b/modules/cellranger/mkfastq/README.md new file mode 100644 index 00000000..07c3919b --- /dev/null +++ b/modules/cellranger/mkfastq/README.md @@ -0,0 +1,26 @@ +# Updating the docker container and making a new module release + +Bcl2fastq2 and Cell Ranger are commercial tools from Illumina and 10X Genomics, respectively. The container provided for the cellranger nf-core module is not provided nor supported by either Illumina or 10x Genomics. Updating the bcl2fastq2 or Cell Ranger versions in the container and pushing the update to Dockerhub needs to be done manually. + +1. Navigate to the appropriate download pages. + - [bcl2fastq2](https://emea.support.illumina.com/sequencing/sequencing_software/bcl2fastq-conversion-software.html): download the linux rpm installer of the desired bcl2fastq2 version with `curl` or `wget`. Place this file in the same folder where the Dockerfile lies. + - [Cell Ranger](https://support.10xgenomics.com/single-cell-gene-expression/software/downloads/latest): download the tar ball of the desired Cell Ranger version with `curl` or `wget`. Place this file in the same folder where the Dockerfile lies. + +2. Edit the Dockerfile. Update the bcl2fastq2 and Cell Ranger versions in this line: + + ```bash + ENV BCL2FASTQ2_VER= \ + CELLRANGER_VER= + ``` + +3. Create and test the container: + + ```bash + docker build . -t nfcore/cellrangermkfastq: + ``` + +4. Access rights are needed to push the container to the Dockerhub nfcore organization, please ask a core team member to do so. + + ```bash + docker push nfcore/cellrangermkfastq: + ``` diff --git a/modules/cellranger/mkfastq/main.nf b/modules/cellranger/mkfastq/main.nf index 14d68665..f47aa75c 100644 --- a/modules/cellranger/mkfastq/main.nf +++ b/modules/cellranger/mkfastq/main.nf @@ -5,7 +5,7 @@ process CELLRANGER_MKFASTQ { if (params.enable_conda) { exit 1, "Conda environments cannot be used when using the Cell Ranger tool. Please use docker or singularity containers." } - container "litd/docker-cellranger:v6.1.1" // FIXME Add bcl2fastq to nf-core docker image + container "nfcore/cellrangermkfastq:6.1.2" input: path bcl @@ -13,14 +13,14 @@ process CELLRANGER_MKFASTQ { output: path "versions.yml", emit: versions - path "*.fastq.gz" , emit: fastq + path "${bcl.getSimpleName()}/outs/fastq_path/*.fastq.gz" , emit: fastq script: def args = task.ext.args ?: '' """ cellranger mkfastq --id=${bcl.getSimpleName()} \ --run=$bcl \ - --csv=$csv + --csv=$csv \ $args cat <<-END_VERSIONS > versions.yml @@ -28,4 +28,15 @@ process CELLRANGER_MKFASTQ { cellranger: \$(echo \$( cellranger --version 2>&1) | sed 's/^.*[^0-9]\\([0-9]*\\.[0-9]*\\.[0-9]*\\).*\$/\\1/' ) END_VERSIONS """ + + stub: + """ + mkdir -p "${bcl.getSimpleName()}/outs/fastq_path/" + touch ${bcl.getSimpleName()}/outs/fastq_path/fake_file.fastq.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + cellranger: \$(echo \$( cellranger --version 2>&1) | sed 's/^.*[^0-9]\\([0-9]*\\.[0-9]*\\.[0-9]*\\).*\$/\\1/' ) + END_VERSIONS + """ } diff --git a/modules/cellranger/mkgtf/main.nf b/modules/cellranger/mkgtf/main.nf index 4db274d7..4342fd00 100644 --- a/modules/cellranger/mkgtf/main.nf +++ b/modules/cellranger/mkgtf/main.nf @@ -5,7 +5,7 @@ process CELLRANGER_MKGTF { if (params.enable_conda) { exit 1, "Conda environments cannot be used when using the Cell Ranger tool. Please use docker or singularity containers." } - container "nfcore/cellranger:6.0.2" + container "nfcore/cellranger:6.1.2" input: path gtf diff --git a/modules/cellranger/mkref/main.nf b/modules/cellranger/mkref/main.nf index c5d83ac9..d38d6809 100644 --- a/modules/cellranger/mkref/main.nf +++ b/modules/cellranger/mkref/main.nf @@ -5,7 +5,7 @@ process CELLRANGER_MKREF { if (params.enable_conda) { exit 1, "Conda environments cannot be used when using the Cell Ranger tool. Please use docker or singularity containers." } - container "nfcore/cellranger:6.0.2" + container "nfcore/cellranger:6.1.2" input: path fasta diff --git a/tests/modules/cellranger/count/test.yml b/tests/modules/cellranger/count/test.yml index 6b151a2a..121d9eea 100644 --- a/tests/modules/cellranger/count/test.yml +++ b/tests/modules/cellranger/count/test.yml @@ -8,12 +8,12 @@ - path: output/cellranger/sample-123/outs/metrics_summary.csv md5sum: 707df0f101d479d93f412ca74f9c4131 - path: output/cellranger/sample-123/outs/molecule_info.h5 - md5sum: cf03b2b3ca776a1c37aa3518e91268ba + md5sum: 0e56836ef0725f2ab05f56ca5a71e55b - path: output/cellranger/sample-123/outs/possorted_genome_bam.bam md5sum: 15441da9cfceea0bb48c8b66b1b860df - path: output/cellranger/sample-123/outs/possorted_genome_bam.bam.bai md5sum: 7c3d49c77016a09535aff61a027f750c - path: output/cellranger/sample-123/outs/raw_feature_bc_matrix - path: output/cellranger/sample-123/outs/raw_feature_bc_matrix.h5 - md5sum: 40c8df814eb8723b7317b234dc8222e9 + md5sum: cdad1cd7b215d7137cf92515e81a8525 - path: output/cellranger/sample-123/outs/web_summary.html diff --git a/tests/modules/cellranger/mkfastq/nextflow.config b/tests/modules/cellranger/mkfastq/nextflow.config index 8730f1c4..9cdfc075 100644 --- a/tests/modules/cellranger/mkfastq/nextflow.config +++ b/tests/modules/cellranger/mkfastq/nextflow.config @@ -2,4 +2,8 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + withName: CELLRANGER_MKFASTQ { + ext.args = "--tiles 1101" + } + } diff --git a/tests/modules/cellranger/mkfastq/test.yml b/tests/modules/cellranger/mkfastq/test.yml index bdd32187..890f2557 100644 --- a/tests/modules/cellranger/mkfastq/test.yml +++ b/tests/modules/cellranger/mkfastq/test.yml @@ -1,13 +1,16 @@ - name: cellranger mkfastq test_cellranger_mkfastq_simple - command: nextflow run tests/modules/cellranger/mkfastq -entry test_cellranger_mkfastq_simple -c tests/config/nextflow.config -c ./tests/modules/cellranger/mkfastq/nextflow.config + command: nextflow run tests/modules/cellranger/mkfastq -entry test_cellranger_mkfastq_simple -c tests/config/nextflow.config -c ./tests/modules/cellranger/mkfastq/nextflow.config -stub-run tags: - cellranger - cellranger/mkfastq - # files: - # - path: output/cellranger/genome.filtered.gtf - # md5sum: a8b8a7b5039e05d3a9cf9151ea138b5b + files: + - path: output/cellranger/cellranger-tiny-bcl-1/outs/fastq_path/fake_file.fastq.gz + md5sum: d41d8cd98f00b204e9800998ecf8427e - name: cellranger mkfastq test_cellranger_mkfastq_illumina - command: nextflow run tests/modules/cellranger/mkfastq -entry test_cellranger_mkfastq_illumina -c tests/config/nextflow.config -c ./tests/modules/cellranger/mkfastq/nextflow.config + command: nextflow run tests/modules/cellranger/mkfastq -entry test_cellranger_mkfastq_illumina -c tests/config/nextflow.config -c ./tests/modules/cellranger/mkfastq/nextflow.config -stub-run tags: - cellranger - cellranger/mkfastq + files: + - path: output/cellranger/cellranger-tiny-bcl-1/outs/fastq_path/fake_file.fastq.gz + md5sum: d41d8cd98f00b204e9800998ecf8427e diff --git a/tests/modules/cellranger/mkref/test.yml b/tests/modules/cellranger/mkref/test.yml index eb01e9e2..e40592bb 100644 --- a/tests/modules/cellranger/mkref/test.yml +++ b/tests/modules/cellranger/mkref/test.yml @@ -11,7 +11,7 @@ - path: output/cellranger/homo_sapiens_chr22_reference/genes/genes.gtf.gz md5sum: 6d9b5f409bfea95022bc25b9590e194e - path: output/cellranger/homo_sapiens_chr22_reference/reference.json - md5sum: a4e2b9bbf016c55b0d4d7bc1fa53896f + md5sum: 5d8d1669cd251433505f183e1c9ed6bc - path: output/cellranger/homo_sapiens_chr22_reference/star/Genome md5sum: 22102926fadf5890e905ca71b2da3f35 - path: output/cellranger/homo_sapiens_chr22_reference/star/SA From c3bacb9fdd8d35b26a4673ce3fd052d600817ad3 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Wed, 26 Jan 2022 15:19:16 +0100 Subject: [PATCH 2/8] Add `deeparg` (#1234) * Add deeparg download data * Tweak downloaddata test.yml * Add deeparg tests * Apply suggestions from code review * Fix output file paths in test * Fix tests again md5sum to string --- modules/deeparg/downloaddata/main.nf | 30 ++++++++ modules/deeparg/downloaddata/meta.yml | 33 +++++++++ modules/deeparg/predict/main.nf | 40 +++++++++++ modules/deeparg/predict/meta.yml | 68 +++++++++++++++++++ tests/config/pytest_modules.yml | 8 +++ tests/modules/deeparg/downloaddata/main.nf | 9 +++ .../deeparg/downloaddata/nextflow.config | 5 ++ tests/modules/deeparg/downloaddata/test.yml | 9 +++ tests/modules/deeparg/predict/main.nf | 19 ++++++ tests/modules/deeparg/predict/nextflow.config | 5 ++ tests/modules/deeparg/predict/test.yml | 17 +++++ 11 files changed, 243 insertions(+) create mode 100644 modules/deeparg/downloaddata/main.nf create mode 100644 modules/deeparg/downloaddata/meta.yml create mode 100644 modules/deeparg/predict/main.nf create mode 100644 modules/deeparg/predict/meta.yml create mode 100644 tests/modules/deeparg/downloaddata/main.nf create mode 100644 tests/modules/deeparg/downloaddata/nextflow.config create mode 100644 tests/modules/deeparg/downloaddata/test.yml create mode 100644 tests/modules/deeparg/predict/main.nf create mode 100644 tests/modules/deeparg/predict/nextflow.config create mode 100644 tests/modules/deeparg/predict/test.yml diff --git a/modules/deeparg/downloaddata/main.nf b/modules/deeparg/downloaddata/main.nf new file mode 100644 index 00000000..cc420e6a --- /dev/null +++ b/modules/deeparg/downloaddata/main.nf @@ -0,0 +1,30 @@ +def VERSION='1.0.2' + +process DEEPARG_DOWNLOADDATA { + label 'process_low' + + conda (params.enable_conda ? "bioconda::deeparg=1.0.2" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/deeparg:1.0.2--pyhdfd78af_1' : + 'quay.io/biocontainers/deeparg:1.0.2--pyhdfd78af_1' }" + + input: + + output: + path "db/" , emit: db + path "versions.yml" , emit: versions + + script: + def args = task.ext.args ?: '' + """ + deeparg \\ + download_data \\ + $args \\ + -o db/ + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + deeparg: $VERSION + END_VERSIONS + """ +} diff --git a/modules/deeparg/downloaddata/meta.yml b/modules/deeparg/downloaddata/meta.yml new file mode 100644 index 00000000..6cfa192e --- /dev/null +++ b/modules/deeparg/downloaddata/meta.yml @@ -0,0 +1,33 @@ +name: deeparg_downloaddata +description: A deep learning based approach to predict Antibiotic Resistance Genes (ARGs) from metagenomes +keywords: + - download + - database + - deeparg + - antimicrobial resistance genes + - deep learning + - prediction +tools: + - deeparg: + description: A deep learning based approach to predict Antibiotic Resistance Genes (ARGs) from metagenomes + homepage: https://bench.cs.vt.edu/deeparg + documentation: https://bitbucket.org/gusphdproj/deeparg-ss/src/master/ + tool_dev_url: https://bitbucket.org/gusphdproj/deeparg-ss/src/master/ + doi: "10.1186/s40168-018-0401-z" + licence: ['MIT'] + +input: + - none: There is no input. This module downloads a pre-built database for use with deepARG. + +output: + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - db: + type: directory + description: Directory containing database required for deepARG. + pattern: "db/" + +authors: + - "@jfy133" diff --git a/modules/deeparg/predict/main.nf b/modules/deeparg/predict/main.nf new file mode 100644 index 00000000..1af0fd40 --- /dev/null +++ b/modules/deeparg/predict/main.nf @@ -0,0 +1,40 @@ +def VERSION="1.0.2" + +process DEEPARG_PREDICT { + tag "$meta.id" + label 'process_medium' + + conda (params.enable_conda ? "bioconda::deeparg=1.0.2" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity//deeparg:1.0.2--pyhdfd78af_1' : + 'quay.io/biocontainers/deeparg:1.0.2--pyhdfd78af_1' }" + + input: + tuple val(meta), path(fasta), val(model) + tuple path(db) + + output: + tuple val(meta), path("*.align.daa") , emit: daa + tuple val(meta), path("*.align.daa.tsv") , emit: daa_tsv + tuple val(meta), path("*.mapping.ARG") , emit: arg + tuple val(meta), path("*.mapping.potential.ARG"), emit: potential_arg + path "versions.yml" , emit: versions + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + deeparg \\ + predict \\ + $args \\ + -i $fasta \\ + -o ${prefix} \\ + -d $db \\ + --model $model + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + deeparg: $VERSION + END_VERSIONS + """ +} diff --git a/modules/deeparg/predict/meta.yml b/modules/deeparg/predict/meta.yml new file mode 100644 index 00000000..244b9df7 --- /dev/null +++ b/modules/deeparg/predict/meta.yml @@ -0,0 +1,68 @@ +name: deeparg_predict +description: A deep learning based approach to predict Antibiotic Resistance Genes (ARGs) from metagenomes +keywords: + - deeparg + - antimicrobial resistance + - antimicrobial resistance genes + - arg + - deep learning + - prediction + - contigs + - metagenomes +tools: + - deeparg: + description: A deep learning based approach to predict Antibiotic Resistance Genes (ARGs) from metagenomes + homepage: https://bench.cs.vt.edu/deeparg + documentation: https://bitbucket.org/gusphdproj/deeparg-ss/src/master/ + tool_dev_url: https://bitbucket.org/gusphdproj/deeparg-ss/src/master/ + doi: "10.1186/s40168-018-0401-z" + licence: ['MIT'] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test' ] + - fasta: + type: file + description: FASTA file containing gene-like sequences + pattern: "*.{fasta,fa,fna}" + - model: + type: string + description: Which model to use, depending on input data. Either 'LS' or 'SS' for long or short sequences respectively + pattern: "LS|LS" + - db: + type: directory + description: Path to a directory containing the deepARG pre-built models + pattern: "*/" + +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" + - daa: + type: file + description: Sequences of ARG-like sequences from DIAMOND alignment + pattern: "*.align.daa" + - daa_tsv: + type: file + description: Alignments scores against ARG-like sequences from DIAMOND alignment + pattern: "*.align.daa.tsv" + - arg: + type: file + description: Table containing sequences with an ARG-like probability of more than specified thresholds + pattern: "*.mapping.ARG" + - potential_arg: + type: file + description: Table containing sequences with an ARG-like probability of less than specified thresholds, and requires manual inspection + pattern: "*.mapping.potential.ARG" + +authors: + - "@jfy133" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 967b7d9f..2321c918 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -380,6 +380,14 @@ dedup: - modules/dedup/** - tests/modules/dedup/** +deeparg/downloaddata: + - modules/deeparg/downloaddata/** + - tests/modules/deeparg/downloaddata/** + +deeparg/predict: + - modules/deeparg/predict/** + - tests/modules/deeparg/predict/** + deeptools/computematrix: - modules/deeptools/computematrix/** - tests/modules/deeptools/computematrix/** diff --git a/tests/modules/deeparg/downloaddata/main.nf b/tests/modules/deeparg/downloaddata/main.nf new file mode 100644 index 00000000..ed2d48bb --- /dev/null +++ b/tests/modules/deeparg/downloaddata/main.nf @@ -0,0 +1,9 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { DEEPARG_DOWNLOADDATA } from '../../../../modules/deeparg/downloaddata/main.nf' + +workflow test_deeparg_downloaddata { + DEEPARG_DOWNLOADDATA () +} diff --git a/tests/modules/deeparg/downloaddata/nextflow.config b/tests/modules/deeparg/downloaddata/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/deeparg/downloaddata/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/deeparg/downloaddata/test.yml b/tests/modules/deeparg/downloaddata/test.yml new file mode 100644 index 00000000..c5c99de2 --- /dev/null +++ b/tests/modules/deeparg/downloaddata/test.yml @@ -0,0 +1,9 @@ +- name: deeparg downloaddata test_deeparg_downloaddata + command: nextflow run tests/modules/deeparg/downloaddata -entry test_deeparg_downloaddata -c tests/config/nextflow.config + tags: + - deeparg + - deeparg/downloaddata + files: + - path: output/deeparg/db/ + - path: output/deeparg/db/data/gg13/dataset.rev.2.bt2 + md5sum: 99d90f132fc2795d5a527ce31f1c4d30 diff --git a/tests/modules/deeparg/predict/main.nf b/tests/modules/deeparg/predict/main.nf new file mode 100644 index 00000000..2758ab58 --- /dev/null +++ b/tests/modules/deeparg/predict/main.nf @@ -0,0 +1,19 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { DEEPARG_DOWNLOADDATA } from '../../../../modules/deeparg/downloaddata/main.nf' +include { DEEPARG_PREDICT } from '../../../../modules/deeparg/predict/main.nf' + +workflow test_deeparg_predict { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['bacteroides_fragilis']['genome']['genome_fna_gz'], checkIfExists: true), + 'LS' + ] + + DEEPARG_DOWNLOADDATA() + DEEPARG_PREDICT ( input, DEEPARG_DOWNLOADDATA.out.db ) + +} diff --git a/tests/modules/deeparg/predict/nextflow.config b/tests/modules/deeparg/predict/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/deeparg/predict/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/deeparg/predict/test.yml b/tests/modules/deeparg/predict/test.yml new file mode 100644 index 00000000..e3a15411 --- /dev/null +++ b/tests/modules/deeparg/predict/test.yml @@ -0,0 +1,17 @@ +- name: deeparg predict test_deeparg_predict + command: nextflow run tests/modules/deeparg/predict -entry test_deeparg_predict -c tests/config/nextflow.config + tags: + - deeparg/predict + - deeparg + files: + - path: output/deeparg/test.align.daa + md5sum: c52d0af8362244f214da25bc45f2bf42 + - path: output/deeparg/test.align.daa.tsv + md5sum: a4aa1da2db98274ede2b927fa8227e5a + - path: output/deeparg/test.mapping.ARG + md5sum: 0e049e99eab4c55666062df21707d5b9 + - path: output/deeparg/test.mapping.potential.ARG + contains: + - "#ARG" + - path: output/deeparg/versions.yml + md5sum: e848ddab324e8c6fd18eaa6b2656f195 From fc1e694e6e1879540987e4269adeaf8f1d507f98 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Thu, 27 Jan 2022 09:38:06 +0100 Subject: [PATCH 3/8] fix: remove left-over unnecessary code (#1235) --- modules/deeparg/predict/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/deeparg/predict/main.nf b/modules/deeparg/predict/main.nf index 1af0fd40..9408fa3d 100644 --- a/modules/deeparg/predict/main.nf +++ b/modules/deeparg/predict/main.nf @@ -11,7 +11,7 @@ process DEEPARG_PREDICT { input: tuple val(meta), path(fasta), val(model) - tuple path(db) + path(db) output: tuple val(meta), path("*.align.daa") , emit: daa From d70526c80665d412404e50708998b19cfb0dee7d Mon Sep 17 00:00:00 2001 From: Harshil Patel Date: Thu, 27 Jan 2022 12:53:14 +0000 Subject: [PATCH 4/8] Bump Nextclade version to 1.10.1 (#1236) --- modules/nextclade/datasetget/main.nf | 6 +++--- modules/nextclade/run/main.nf | 6 +++--- tests/modules/nextclade/datasetget/main.nf | 3 ++- tests/modules/nextclade/datasetget/test.yml | 8 +++++--- tests/modules/nextclade/run/main.nf | 3 ++- tests/modules/nextclade/run/test.yml | 6 +++--- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/modules/nextclade/datasetget/main.nf b/modules/nextclade/datasetget/main.nf index 55371168..00dc8ff9 100644 --- a/modules/nextclade/datasetget/main.nf +++ b/modules/nextclade/datasetget/main.nf @@ -2,10 +2,10 @@ process NEXTCLADE_DATASETGET { tag "$dataset" label 'process_low' - conda (params.enable_conda ? "bioconda::nextclade=1.9.0" : null) + conda (params.enable_conda ? "bioconda::nextclade=1.10.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/nextclade:1.9.0--h9ee0642_0' : - 'quay.io/biocontainers/nextclade:1.9.0--h9ee0642_0' }" + 'https://depot.galaxyproject.org/singularity/nextclade:1.10.1--h9ee0642_0' : + 'quay.io/biocontainers/nextclade:1.10.1--h9ee0642_0' }" input: val dataset diff --git a/modules/nextclade/run/main.nf b/modules/nextclade/run/main.nf index e29dd8ce..36e19aab 100644 --- a/modules/nextclade/run/main.nf +++ b/modules/nextclade/run/main.nf @@ -2,10 +2,10 @@ process NEXTCLADE_RUN { tag "$meta.id" label 'process_low' - conda (params.enable_conda ? "bioconda::nextclade=1.9.0" : null) + conda (params.enable_conda ? "bioconda::nextclade=1.10.1" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/nextclade:1.9.0--h9ee0642_0' : - 'quay.io/biocontainers/nextclade:1.9.0--h9ee0642_0' }" + 'https://depot.galaxyproject.org/singularity/nextclade:1.10.1--h9ee0642_0' : + 'quay.io/biocontainers/nextclade:1.10.1--h9ee0642_0' }" input: tuple val(meta), path(fasta) diff --git a/tests/modules/nextclade/datasetget/main.nf b/tests/modules/nextclade/datasetget/main.nf index 0fc38a5b..8f4fa87b 100644 --- a/tests/modules/nextclade/datasetget/main.nf +++ b/tests/modules/nextclade/datasetget/main.nf @@ -8,7 +8,8 @@ workflow test_nextclade_datasetget { dataset = 'sars-cov-2' reference = 'MN908947' - tag = '2022-01-05T19:54:31Z' + tag = '2022-01-18T12:00:00Z' NEXTCLADE_DATASETGET ( dataset, reference, tag ) + } diff --git a/tests/modules/nextclade/datasetget/test.yml b/tests/modules/nextclade/datasetget/test.yml index 7e798a11..d610b428 100644 --- a/tests/modules/nextclade/datasetget/test.yml +++ b/tests/modules/nextclade/datasetget/test.yml @@ -9,12 +9,14 @@ - path: output/nextclade/sars-cov-2/primers.csv md5sum: 5990c3483bf66ce607aeb90a44e7ef2e - path: output/nextclade/sars-cov-2/qc.json - md5sum: 018fa0c0b0d2e824954e37e01495d549 + md5sum: c512f51fda0212b21ffff05779180963 - path: output/nextclade/sars-cov-2/reference.fasta md5sum: c7ce05f28e4ec0322c96f24e064ef55c - path: output/nextclade/sars-cov-2/sequences.fasta md5sum: 41129d255b99e0e92bdf20e866b99a1b - path: output/nextclade/sars-cov-2/tag.json - md5sum: 2f6d8e806d9064571ee4188ef1304c9c + md5sum: 402ac2b87e2a6a64a3fbf5ad16497af3 - path: output/nextclade/sars-cov-2/tree.json - md5sum: f8fb33ed62b59142ac20998eb599df6c \ No newline at end of file + md5sum: b8f32f547ff9e2131d6fc66b68fc54b1 + - path: output/nextclade/sars-cov-2/virus_properties.json + md5sum: 5f2de3949e07cb633f3d9e4a7654dc81 diff --git a/tests/modules/nextclade/run/main.nf b/tests/modules/nextclade/run/main.nf index 35b52317..ed674a0d 100644 --- a/tests/modules/nextclade/run/main.nf +++ b/tests/modules/nextclade/run/main.nf @@ -9,7 +9,7 @@ workflow test_nextclade_run { dataset = 'sars-cov-2' reference = 'MN908947' - tag = '2022-01-05T19:54:31Z' + tag = '2022-01-18T12:00:00Z' NEXTCLADE_DATASETGET ( dataset, reference, tag ) @@ -20,3 +20,4 @@ workflow test_nextclade_run { NEXTCLADE_RUN ( input, NEXTCLADE_DATASETGET.out.dataset ) } + diff --git a/tests/modules/nextclade/run/test.yml b/tests/modules/nextclade/run/test.yml index 37f7d8ae..ea846378 100644 --- a/tests/modules/nextclade/run/test.yml +++ b/tests/modules/nextclade/run/test.yml @@ -6,8 +6,8 @@ files: - path: output/nextclade/test.json - path: output/nextclade/test.csv - md5sum: 3b87a4da190ba2e1fdc8418dc3a7ffdb + md5sum: 570c1aa2d5fd25c23d0042c1b06108e1 - path: output/nextclade/test.tsv - md5sum: 449393288e8734a02def139c550a8d9b + md5sum: dd76e1a4c760785489be4e4a860b4d00 - path: output/nextclade/test.tree.json - md5sum: 9c6e33cb7ff860bee6194847bd2c855c + md5sum: 3591b4dc1542995a7ffcffcb1f52b524 From 08db86093829d5752180c7a46f0cc11b9860a36a Mon Sep 17 00:00:00 2001 From: GCJMackenzie <43276267+GCJMackenzie@users.noreply.github.com> Date: Thu, 27 Jan 2022 15:30:27 +0000 Subject: [PATCH 5/8] Update mergebam syntax and sample specific unmapped channel (#1238) * initial commit to setup branch * workflow finished * Update nextflow.config * tumour to tumor, getpileup passed as nomral and tumor * paired_somatic renamed to tumor_normal_somatic * Apply suggestions from code review Co-authored-by: Maxime U. Garcia * Update subworkflows/nf-core/gatk_tumor_normal_somatic_variant_calling/main.nf Co-authored-by: Maxime U. Garcia * updated index names in meta.yml * changed index file names in main script and test * Apply suggestions from code review Co-authored-by: Maxime U. Garcia * Apply suggestions from code review * fixed bug from changes * Apply suggestions from code review * modified yml to allow new subworkflow testing * Update test.yml * Update test.yml * updated to follow the new mergebam syntax, also made unaligned input sample specific Co-authored-by: GCJMackenzie Co-authored-by: Maxime U. Garcia --- modules/gatk4/mergebamalignment/main.nf | 11 +++++------ tests/modules/gatk4/mergebamalignment/main.nf | 6 +++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/modules/gatk4/mergebamalignment/main.nf b/modules/gatk4/mergebamalignment/main.nf index b0b9daa1..0e294454 100644 --- a/modules/gatk4/mergebamalignment/main.nf +++ b/modules/gatk4/mergebamalignment/main.nf @@ -8,8 +8,7 @@ process GATK4_MERGEBAMALIGNMENT { 'quay.io/biocontainers/gatk4:4.2.4.1--hdfd78af_0' }" input: - tuple val(meta), path(aligned) - path unmapped + tuple val(meta), path(aligned), path(unmapped) path fasta path dict @@ -28,10 +27,10 @@ process GATK4_MERGEBAMALIGNMENT { } """ gatk --java-options "-Xmx${avail_mem}g" MergeBamAlignment \\ - ALIGNED=$aligned \\ - UNMAPPED=$unmapped \\ - R=$fasta \\ - O=${prefix}.bam \\ + -ALIGNED $aligned \\ + -UNMAPPED $unmapped \\ + -R $fasta \\ + -O ${prefix}.bam \\ $args cat <<-END_VERSIONS > versions.yml diff --git a/tests/modules/gatk4/mergebamalignment/main.nf b/tests/modules/gatk4/mergebamalignment/main.nf index 59bd833b..8a38c129 100644 --- a/tests/modules/gatk4/mergebamalignment/main.nf +++ b/tests/modules/gatk4/mergebamalignment/main.nf @@ -6,11 +6,11 @@ include { GATK4_MERGEBAMALIGNMENT } from '../../../../modules/gatk4/mergebamalig workflow test_gatk4_mergebamalignment { input = [ [ id:'test' ], // meta map - file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true) + file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_unaligned_bam'], checkIfExists: true) ] - unmapped = file(params.test_data['sarscov2']['illumina']['test_unaligned_bam'], checkIfExists: true) fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) dict = file(params.test_data['sarscov2']['genome']['genome_dict'], checkIfExists: true) - GATK4_MERGEBAMALIGNMENT ( input, unmapped, fasta, dict ) + GATK4_MERGEBAMALIGNMENT ( input, fasta, dict ) } From a45e03016632fe7dc2f48bfa73d9642c7f03e035 Mon Sep 17 00:00:00 2001 From: Antonia Schuster <56543138+AntoniaSchuster@users.noreply.github.com> Date: Fri, 28 Jan 2022 09:05:30 +0100 Subject: [PATCH 6/8] Allow compressed input for prodigal (#1200) * Allow compressed input for prodigal * use pigz instead of gzip * fix typo --- modules/prodigal/main.nf | 19 ++++++++++--------- modules/prodigal/meta.yml | 32 +++++++++++++++++++++++--------- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/modules/prodigal/main.nf b/modules/prodigal/main.nf index 184b17bb..63248931 100644 --- a/modules/prodigal/main.nf +++ b/modules/prodigal/main.nf @@ -2,27 +2,27 @@ process PRODIGAL { tag "$meta.id" label 'process_low' - conda (params.enable_conda ? "bioconda::prodigal=2.6.3" : null) + conda (params.enable_conda ? "prodigal=2.6.3 pigz=2.6" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/prodigal:2.6.3--h516909a_2' : - 'quay.io/biocontainers/prodigal:2.6.3--h516909a_2' }" + 'https://depot.galaxyproject.org/singularity/mulled-v2-2e442ba7b07bfa102b9cf8fac6221263cd746ab8:57f05cfa73f769d6ed6d54144cb3aa2a6a6b17e0-0' : + 'quay.io/biocontainers/mulled-v2-2e442ba7b07bfa102b9cf8fac6221263cd746ab8:57f05cfa73f769d6ed6d54144cb3aa2a6a6b17e0-0' }" input: tuple val(meta), path(genome) val(output_format) output: - tuple val(meta), path("${prefix}.${output_format}"), emit: gene_annotations - tuple val(meta), path("${prefix}.fna"), emit: nucleotide_fasta - tuple val(meta), path("${prefix}.faa"), emit: amino_acid_fasta - tuple val(meta), path("${prefix}_all.txt"), emit: all_gene_annotations - path "versions.yml" , emit: versions + tuple val(meta), path("${prefix}.${output_format}"), emit: gene_annotations + tuple val(meta), path("${prefix}.fna"), emit: nucleotide_fasta + tuple val(meta), path("${prefix}.faa"), emit: amino_acid_fasta + tuple val(meta), path("${prefix}_all.txt"), emit: all_gene_annotations + path "versions.yml", emit: versions script: def args = task.ext.args ?: '' prefix = task.ext.prefix ?: "${meta.id}" """ - prodigal -i "${genome}" \\ + pigz -cdf ${genome} | prodigal \\ $args \\ -f $output_format \\ -d "${prefix}.fna" \\ @@ -33,6 +33,7 @@ process PRODIGAL { cat <<-END_VERSIONS > versions.yml "${task.process}": prodigal: \$(prodigal -v 2>&1 | sed -n 's/Prodigal V\\(.*\\):.*/\\1/p') + pigz: \$(pigz -V 2>&1 | sed 's/pigz //g') END_VERSIONS """ } diff --git a/modules/prodigal/meta.yml b/modules/prodigal/meta.yml index 5bcc4e77..3062ccce 100644 --- a/modules/prodigal/meta.yml +++ b/modules/prodigal/meta.yml @@ -5,10 +5,10 @@ keywords: tools: - prodigal: description: Prodigal (Prokaryotic Dynamic Programming Genefinding Algorithm) is a microbial (bacterial and archaeal) gene finding program - homepage: {} - documentation: {} + homepage: {https://github.com/hyattpd/Prodigal} + documentation: {https://github.com/hyattpd/prodigal/wiki} tool_dev_url: {} - doi: "" + doi: "10.1186/1471-2105-11-119" licence: ["GPL v3"] input: @@ -17,10 +17,12 @@ input: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] - - bam: + - genome: type: file - description: BAM/CRAM/SAM file - pattern: "*.{bam,cram,sam}" + description: fasta/fasta.gz file + - output_format: + type: string + description: Output format ("gbk"/"gff"/"sqn"/"sco") output: - meta: @@ -32,10 +34,22 @@ output: type: file description: File containing software versions pattern: "versions.yml" - - bam: + - nucleotide_fasta: type: file - description: Sorted BAM/CRAM/SAM file - pattern: "*.{bam,cram,sam}" + description: nucleotide sequences file + pattern: "*.{fna}" + - amino_acid_fasta: + type: file + description: protein translations file + pattern: "*.{faa}" + - all_gene_annotations: + type: file + description: complete starts file + pattern: "*.{_all.txt}" + - gene_annotations: + type: file + description: gene annotations in output_format given as input + pattern: "*.{output_format}" authors: - "@grst" From f3a405e4f25b8ded2d6f3e5fe0262b3f0b3d9262 Mon Sep 17 00:00:00 2001 From: Chris Cheshire Date: Fri, 28 Jan 2022 09:32:36 +0000 Subject: [PATCH 7/8] Fix for version file output check when performing an expected error test (#1242) * hifiasm copied from fastqc * hifiasm tests init from fastqc * meta.yml init; test.yml and main.nf for printing version * Add hifiasm version printing * Removed spaced on an empty line * Reverted hifiasm from main * Ignores version file checking if testing for error * Added comment Co-authored-by: Sviatoslav Sidorov Co-authored-by: Svyatoslav Sidorov Co-authored-by: Tamara Hodgetts --- tests/test_versions_yml.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_versions_yml.py b/tests/test_versions_yml.py index 2f78ab2e..5d0bb39e 100644 --- a/tests/test_versions_yml.py +++ b/tests/test_versions_yml.py @@ -16,7 +16,10 @@ def _get_workflow_names(): # test_config = yaml.safe_load(f.read_text()) test_config = yaml.load(f.read_text(), Loader=yaml.BaseLoader) for workflow in test_config: - yield workflow["name"] + # https://github.com/nf-core/modules/pull/1242 - added to cover tests + # that expect an error and therefore will not generate a versions.yml + if 'exit_code' not in workflow: + yield workflow["name"] @pytest.mark.workflow(*_get_workflow_names()) From 080320765cf92be3f8ce31a3781fbed083465b79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Guizard?= Date: Fri, 28 Jan 2022 09:58:25 +0000 Subject: [PATCH 8/8] New module: `bamtools/convert` (#1219) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 📦 NEW: Add bamtools/convert module * 👌 IMPROVE: Update output channel name, Add tests for each output format * 👌 IMPROVE: Add error test * 🐛 FIX: Remove custom tags Co-authored-by: Chris Cheshire --- modules/bamtools/convert/main.nf | 38 +++++++ modules/bamtools/convert/meta.yml | 52 +++++++++ tests/config/pytest_modules.yml | 4 + tests/modules/bamtools/convert/main.nf | 104 ++++++++++++++++++ .../modules/bamtools/convert/nextflow.config | 41 +++++++ tests/modules/bamtools/convert/test.yml | 90 +++++++++++++++ 6 files changed, 329 insertions(+) create mode 100644 modules/bamtools/convert/main.nf create mode 100644 modules/bamtools/convert/meta.yml create mode 100644 tests/modules/bamtools/convert/main.nf create mode 100644 tests/modules/bamtools/convert/nextflow.config create mode 100644 tests/modules/bamtools/convert/test.yml diff --git a/modules/bamtools/convert/main.nf b/modules/bamtools/convert/main.nf new file mode 100644 index 00000000..141e762d --- /dev/null +++ b/modules/bamtools/convert/main.nf @@ -0,0 +1,38 @@ +process BAMTOOLS_CONVERT { + tag "$meta.id" + label 'process_low' + + conda (params.enable_conda ? "bioconda::bamtools=2.5.1" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/bamtools:2.5.1--h9a82719_9' : + 'quay.io/biocontainers/bamtools:2.5.1--h9a82719_9' }" + + input: + tuple val(meta), path(bam) + + output: + tuple val(meta), path("*.{bed,fasta,fastq,json,pileup,sam,yaml}"), emit: data + path "versions.yml" , emit: versions + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def test = args ==~ /-format (bed|fasta|fastq|json|pileup|sam|yaml)/ + if ( test == false ) error "-format option must be provided in args. Possible values: bed fasta fastq json pileup sam yaml" + m = args =~ /-format ([a-z]+)/ + ext = m[0][1] + + + """ + bamtools \\ + convert \\ + $args \\ + -in $bam \\ + -out ${prefix}.${ext} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + bamtools: \$( bamtools --version | grep -e 'bamtools' | sed 's/^.*bamtools //' ) + END_VERSIONS + """ +} diff --git a/modules/bamtools/convert/meta.yml b/modules/bamtools/convert/meta.yml new file mode 100644 index 00000000..acc7e4df --- /dev/null +++ b/modules/bamtools/convert/meta.yml @@ -0,0 +1,52 @@ +name: bamtools_convert +description: BamTools provides both a programmer's API and an end-user's toolkit for handling BAM files. +keywords: + - bamtools + - bamtools/convert + - bam + - convert + - bed + - fasta + - fastq + - json + - pileup + - sam + - yaml +tools: + - bamtools: + description: C++ API & command-line toolkit for working with BAM data + homepage: http://github.com/pezmaster31/bamtools + documentation: https://github.com/pezmaster31/bamtools/wiki + tool_dev_url: http://github.com/pezmaster31/bamtools + doi: "" + licence: ['MIT'] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - bam: + type: file + description: BAM file + pattern: "*.bam" + +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" + ## TODO nf-core: Delete / customise this example output + - out: + type: file + description: The data in the asked format (bed, fasta, fastq, json, pileup, sam, yaml) + pattern: "*.{bed,fasta,fastq,json,pileup,sam,yaml}" + +authors: + - "@sguizard" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 2321c918..7ed2cf53 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -46,6 +46,10 @@ bamaligncleaner: - modules/bamaligncleaner/** - tests/modules/bamaligncleaner/** +bamtools/convert: + - modules/bamtools/convert/** + - tests/modules/bamtools/convert/** + bamtools/split: - modules/bamtools/split/** - tests/modules/bamtools/split/** diff --git a/tests/modules/bamtools/convert/main.nf b/tests/modules/bamtools/convert/main.nf new file mode 100644 index 00000000..bf57f248 --- /dev/null +++ b/tests/modules/bamtools/convert/main.nf @@ -0,0 +1,104 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_EXT_ERROR } from '../../../../modules/bamtools/convert/main.nf' +include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_NOEXT_ERROR } from '../../../../modules/bamtools/convert/main.nf' +include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_BED } from '../../../../modules/bamtools/convert/main.nf' +include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_FASTA } from '../../../../modules/bamtools/convert/main.nf' +include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_FASTQ } from '../../../../modules/bamtools/convert/main.nf' +include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_JSON } from '../../../../modules/bamtools/convert/main.nf' +include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_PILEUP } from '../../../../modules/bamtools/convert/main.nf' +include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_SAM } from '../../../../modules/bamtools/convert/main.nf' +include { BAMTOOLS_CONVERT as BAMTOOLS_CONVERT_YAML } from '../../../../modules/bamtools/convert/main.nf' + +workflow test_bamtools_convert_ext_error { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + + BAMTOOLS_CONVERT_EXT_ERROR ( input ) +} + +workflow test_bamtools_convert_noext_error { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + + BAMTOOLS_CONVERT_NOEXT_ERROR ( input ) +} + +workflow test_bamtools_convert_bed { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + + BAMTOOLS_CONVERT_BED ( input ) +} + +workflow test_bamtools_convert_fasta { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + + BAMTOOLS_CONVERT_FASTA ( input ) +} + +workflow test_bamtools_convert_fastq { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + + BAMTOOLS_CONVERT_FASTQ ( input ) +} + +workflow test_bamtools_convert_json { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + + BAMTOOLS_CONVERT_JSON ( input ) +} + +workflow test_bamtools_convert_pileup { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + + BAMTOOLS_CONVERT_PILEUP ( input ) +} + +workflow test_bamtools_convert_sam { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + + BAMTOOLS_CONVERT_SAM ( input ) +} + +workflow test_bamtools_convert_yaml { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + + BAMTOOLS_CONVERT_YAML ( input ) +} + diff --git a/tests/modules/bamtools/convert/nextflow.config b/tests/modules/bamtools/convert/nextflow.config new file mode 100644 index 00000000..ae8fe345 --- /dev/null +++ b/tests/modules/bamtools/convert/nextflow.config @@ -0,0 +1,41 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName: BAMTOOLS_CONVERT_EXT_ERROR { + ext.args = "-format vcf" + } + + withName: BAMTOOLS_CONVERT_NOEXT_ERROR { + ext.args = "" + } + + withName: BAMTOOLS_CONVERT_BED { + ext.args = "-format bed" + } + + withName: BAMTOOLS_CONVERT_FASTA { + ext.args = "-format fasta" + } + + withName: BAMTOOLS_CONVERT_FASTQ { + ext.args = "-format fastq" + } + + withName: BAMTOOLS_CONVERT_JSON { + ext.args = "-format json" + } + + withName: BAMTOOLS_CONVERT_PILEUP { + ext.args = "-format pileup" + } + + withName: BAMTOOLS_CONVERT_SAM { + ext.args = "-format sam" + } + + withName: BAMTOOLS_CONVERT_YAML { + ext.args = "-format yaml" + } + +} diff --git a/tests/modules/bamtools/convert/test.yml b/tests/modules/bamtools/convert/test.yml new file mode 100644 index 00000000..3922ece2 --- /dev/null +++ b/tests/modules/bamtools/convert/test.yml @@ -0,0 +1,90 @@ +- name: bamtools convert test_bamtools_convert_ext_error + command: nextflow run tests/modules/bamtools/convert -entry test_bamtools_convert_ext_error -c tests/config/nextflow.config + tags: + - bamtools + - bamtools/convert + exit_code: 1 + +- name: bamtools convert test_bamtools_convert_noext_error + command: nextflow run tests/modules/bamtools/convert -entry test_bamtools_convert_noext_error -c tests/config/nextflow.config + tags: + - bamtools + - bamtools/convert + exit_code: 1 + +- name: bamtools convert test_bamtools_convert_bed + command: nextflow run tests/modules/bamtools/convert -entry test_bamtools_convert_bed -c tests/config/nextflow.config + tags: + - bamtools + - bamtools/convert + files: + - path: output/bamtools/test.bed + md5sum: 4e34cc15bf31e700f5f3a9f8fffb6c81 + - path: output/bamtools/versions.yml + md5sum: eb7a144b8a97965d3482f6f96b8a8243 + +- name: bamtools convert test_bamtools_convert_fasta + command: nextflow run tests/modules/bamtools/convert -entry test_bamtools_convert_fasta -c tests/config/nextflow.config + tags: + - bamtools + - bamtools/convert + files: + - path: output/bamtools/test.fasta + md5sum: 52aeacf78571862b7e97c7d44ac8f827 + - path: output/bamtools/versions.yml + md5sum: 42d19a2b2b07f05edb82b34369dfd754 + +- name: bamtools convert test_bamtools_convert_fastq + command: nextflow run tests/modules/bamtools/convert -entry test_bamtools_convert_fastq -c tests/config/nextflow.config + tags: + - bamtools + - bamtools/convert + files: + - path: output/bamtools/test.fastq + md5sum: e591c48daad2c56638e5d6f21f1f71c5 + - path: output/bamtools/versions.yml + md5sum: 13f0bf8a3e1f8f527f96dabaa5c8051e + +- name: bamtools convert test_bamtools_convert_json + command: nextflow run tests/modules/bamtools/convert -entry test_bamtools_convert_json -c tests/config/nextflow.config + tags: + - bamtools + - bamtools/convert + files: + - path: output/bamtools/test.json + md5sum: 04afed696f9f14da85a460353645d1f5 + - path: output/bamtools/versions.yml + md5sum: 33d633dbd6209cb93c9b071f8c0ed3b3 + +- name: bamtools convert test_bamtools_convert_pileup + command: nextflow run tests/modules/bamtools/convert -entry test_bamtools_convert_pileup -c tests/config/nextflow.config + tags: + - bamtools + - bamtools/convert + files: + - path: output/bamtools/test.pileup + md5sum: e5a3cb4a3e1bf980a575fafce6a2826f + - path: output/bamtools/versions.yml + md5sum: fd3ad0edd1e085b1a002e0593d1d5814 + +- name: bamtools convert test_bamtools_convert_sam + command: nextflow run tests/modules/bamtools/convert -entry test_bamtools_convert_sam -c tests/config/nextflow.config + tags: + - bamtools + - bamtools/convert + files: + - path: output/bamtools/test.sam + md5sum: 61ab3d0de16a9da8b651f9c692e19d5e + - path: output/bamtools/versions.yml + md5sum: 4be470ce3cc0143ae5ae415b612a4965 + +- name: bamtools convert test_bamtools_convert_yaml + command: nextflow run tests/modules/bamtools/convert -entry test_bamtools_convert_yaml -c tests/config/nextflow.config + tags: + - bamtools + - bamtools/convert + files: + - path: output/bamtools/test.yaml + md5sum: 68b56f198da036fef33e150eb773dc3b + - path: output/bamtools/versions.yml + md5sum: 1116abc088c5edf11bee393961c18b3e