From 1f3f2b18bb11be73b90d3a19e4f764aa88612f91 Mon Sep 17 00:00:00 2001 From: Anan Ibrahim <81744003+Darcy220606@users.noreply.github.com> Date: Thu, 9 Dec 2021 13:17:50 +0100 Subject: [PATCH] Add new module macrel/contigs (#1109) * Add new module macrel/contigs * removed trailing whitespace * removed whitespace * linting cleanup * Apply suggestions from code review Co-authored-by: James A. Fellows Yates * Updated the test.yml It didnt upload the updated version earlier for some reason :( * Update test.yml * Update test.yml * Update test.yml as generated by pytest * Update test.yml * updated the version issue * Update tests/modules/macrel/contigs/test.yml * Update modules/macrel/contigs/main.nf * Update modules/macrel/contigs/main.nf * Update pytest_modules.yml * Update pytest_modules.yml * Update modules/macrel/contigs/main.nf Co-authored-by: James A. Fellows Yates * Zipped all fasta outputs * Update main.nf * Update test.yml * Update test.yml * Update main.nf * Update main.nf (gzip -n) * Update test.yml * Update main.nf * Update main.nf * Update test.yml * Update tests/modules/macrel/contigs/test.yml * Update modules/macrel/contigs/main.nf * Apply suggestions from code review Co-authored-by: James A. Fellows Yates Co-authored-by: darcy220606 Co-authored-by: James A. Fellows Yates --- modules/macrel/contigs/main.nf | 40 +++++++++++++ modules/macrel/contigs/meta.yml | 61 ++++++++++++++++++++ tests/config/pytest_modules.yml | 4 ++ tests/modules/macrel/contigs/main.nf | 15 +++++ tests/modules/macrel/contigs/nextflow.config | 5 ++ tests/modules/macrel/contigs/test.yml | 16 +++++ 6 files changed, 141 insertions(+) create mode 100644 modules/macrel/contigs/main.nf create mode 100644 modules/macrel/contigs/meta.yml create mode 100644 tests/modules/macrel/contigs/main.nf create mode 100644 tests/modules/macrel/contigs/nextflow.config create mode 100644 tests/modules/macrel/contigs/test.yml diff --git a/modules/macrel/contigs/main.nf b/modules/macrel/contigs/main.nf new file mode 100644 index 00000000..558ef6e8 --- /dev/null +++ b/modules/macrel/contigs/main.nf @@ -0,0 +1,40 @@ +process MACREL_CONTIGS { + tag "$meta.id" + label 'process_medium' + + conda (params.enable_conda ? "bioconda::macrel=1.1.0" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/macrel:1.1.0--py36hc5360cc_0': + 'quay.io/biocontainers/macrel:1.1.0--py36hc5360cc_0' }" + + input: + tuple val(meta), path(fasta) + + output: + tuple val(meta), path("*/*.smorfs.faa.gz") , emit: smorfs + tuple val(meta), path("*/*.all_orfs.faa.gz") , emit: all_orfs + tuple val(meta), path("*/*.prediction.gz") , emit: amp_prediction + tuple val(meta), path("*/*.md") , emit: readme_file + tuple val(meta), path("*/*_log.txt") , emit: log_file + path "versions.yml" , emit: versions + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + macrel contigs \\ + $args \\ + --fasta $fasta \\ + --output ${prefix}/ \\ + --tag ${prefix} \\ + --log-file ${prefix}/${prefix}_log.txt \\ + --threads $task.cpus + + gzip --no-name ${prefix}/*.faa + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + macrel: \$(echo \$(macrel --version | sed 's/macrel //g')) + END_VERSIONS + """ +} diff --git a/modules/macrel/contigs/meta.yml b/modules/macrel/contigs/meta.yml new file mode 100644 index 00000000..e0b2fabd --- /dev/null +++ b/modules/macrel/contigs/meta.yml @@ -0,0 +1,61 @@ +name: macrel_contigs +description: A tool that mines antimicrobial peptides (AMPs) from (meta)genomes by predicting peptides from genomes (provided as contigs) and outputs all the predicted anti-microbial peptides found. +keywords: + - AMP + - antimicrobial peptides + - genome mining + - metagenomes + - peptide prediction +tools: + - macrel: + description: A pipeline for AMP (antimicrobial peptide) prediction + homepage: https://macrel.readthedocs.io/en/latest/ + documentation: https://macrel.readthedocs.io/en/latest/ + tool_dev_url: https://github.com/BigDataBiology/macrel + doi: "10.7717/peerj.10555" + licence: ['MIT'] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fasta: + type: file + description: A fasta file with nucleotide sequences. + pattern: "*.{fasta,fa,fna,fasta.gz,fa.gz,fna.gz}" + +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" + - amp_prediction: + type: file + description: A zipped file, with all predicted amps in a table format. + pattern: "*.prediction.gz" + - smorfs: + type: file + description: A zipped fasta file containing aminoacid sequences showing the general gene prediction information in the contigs. + pattern: "*.smorfs.faa.gz" + - all_orfs: + type: file + description: A zipped fasta file containing amino acid sequences showing the general gene prediction information in the contigs. + pattern: "*.all_orfs.faa.gz" + - readme_file: + type: file + description: A readme file containing tool specific information (e.g. citations, details about the output, etc.). + pattern: "*.md" + - log_file: + type: file + description: A log file containing the information pertaining to the run. + pattern: "*_log.txt" + +authors: + - "@darcy220606" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 6dbfc1fd..7601671b 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -842,6 +842,10 @@ lofreq/indelqual: - modules/lofreq/indelqual/** - tests/modules/lofreq/indelqual/** +macrel/contigs: + - modules/macrel/contigs/** + - tests/modules/macrel/contigs/** + macs2/callpeak: - modules/macs2/callpeak/** - tests/modules/macs2/callpeak/** diff --git a/tests/modules/macrel/contigs/main.nf b/tests/modules/macrel/contigs/main.nf new file mode 100644 index 00000000..a613dcc4 --- /dev/null +++ b/tests/modules/macrel/contigs/main.nf @@ -0,0 +1,15 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { MACREL_CONTIGS } from '../../../../modules/macrel/contigs/main.nf' + +workflow test_macrel_contigs { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['bacteroides_fragilis']['illumina']['test1_contigs_fa_gz'], checkIfExists: true) + ] + + MACREL_CONTIGS ( input ) +} diff --git a/tests/modules/macrel/contigs/nextflow.config b/tests/modules/macrel/contigs/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/macrel/contigs/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/macrel/contigs/test.yml b/tests/modules/macrel/contigs/test.yml new file mode 100644 index 00000000..af272605 --- /dev/null +++ b/tests/modules/macrel/contigs/test.yml @@ -0,0 +1,16 @@ +- name: macrel contigs test_macrel_contigs + command: nextflow run ./tests/modules/macrel/contigs -entry test_macrel_contigs -c ./tests/config/nextflow.config -c ./tests/modules/macrel/contigs/nextflow.config + tags: + - macrel/contigs + - macrel + files: + - path: output/macrel/test/README.md + md5sum: fa3706dfc95d0538a52c4d0d824be5fb + - path: output/macrel/test/test.all_orfs.faa.gz + - path: output/macrel/test/test.prediction.gz + - path: output/macrel/test/test.smorfs.faa.gz + md5sum: 79704c6120c2f794518301af6f9b963d + - path: output/macrel/test/test_log.txt + md5sum: 6fdba143dce759597eb9f80e5d968729 + - path: output/macrel/versions.yml + md5sum: be8bf0d0647751c635c3736655f29f85