From 6c45773c0b7f4bdaa8c9716091b0e721a5ae96f3 Mon Sep 17 00:00:00 2001 From: louperelo <44900284+louperelo@users.noreply.github.com> Date: Wed, 20 Apr 2022 11:53:26 +0200 Subject: [PATCH] add module AMPlify (#1498) * add module AMPlify * Apply suggestions from code review Thanks for the review! Co-authored-by: Moritz E. Beber * removed trailing whitespaces * Apply suggestions from code review Thanks again! Co-authored-by: Moritz E. Beber * Apply suggestions from code review Thank you for the suggestions! Co-authored-by: Sateesh Peri <33637490+sateeshperi@users.noreply.github.com> Co-authored-by: James A. Fellows Yates * Apply suggestions from code review Co-authored-by: Sateesh Peri <33637490+sateeshperi@users.noreply.github.com> * including review suggestions * fix versions.yml * add model_dir input * add model_dir to meta.yml * complete faa pattern in meta.yml * add fa.gz to pattern Co-authored-by: Moritz E. Beber Co-authored-by: Sateesh Peri <33637490+sateeshperi@users.noreply.github.com> Co-authored-by: James A. Fellows Yates --- modules/amplify/predict/main.nf | 41 ++++++++++++++++ modules/amplify/predict/meta.yml | 47 +++++++++++++++++++ tests/config/pytest_modules.yml | 4 ++ tests/modules/amplify/predict/main.nf | 18 +++++++ tests/modules/amplify/predict/nextflow.config | 5 ++ tests/modules/amplify/predict/test.yml | 9 ++++ 6 files changed, 124 insertions(+) create mode 100644 modules/amplify/predict/main.nf create mode 100644 modules/amplify/predict/meta.yml create mode 100644 tests/modules/amplify/predict/main.nf create mode 100644 tests/modules/amplify/predict/nextflow.config create mode 100644 tests/modules/amplify/predict/test.yml diff --git a/modules/amplify/predict/main.nf b/modules/amplify/predict/main.nf new file mode 100644 index 00000000..d035516f --- /dev/null +++ b/modules/amplify/predict/main.nf @@ -0,0 +1,41 @@ +def VERSION = '1.0.3' // Version information not provided by tool + +process AMPLIFY_PREDICT { + tag "$meta.id" + label 'process_low' + + conda (params.enable_conda ? "bioconda::amplify=1.0.3" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/amplify:1.0.3--py36hdfd78af_0': + 'quay.io/biocontainers/amplify:1.0.3--py36hdfd78af_0' }" + + input: + tuple val(meta), path(faa) + path(model_dir) + + output: + tuple val(meta), path('*.tsv'), emit: tsv + 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 custom_model_dir = model_dir ? "-md ${model_dir}" : "" + """ + AMPlify \\ + $args \\ + ${custom_model_dir} \\ + -s '${faa}' + + #rename output, because tool includes date and time in name + mv *.tsv ${prefix}.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + AMPlify: $VERSION + END_VERSIONS + """ +} diff --git a/modules/amplify/predict/meta.yml b/modules/amplify/predict/meta.yml new file mode 100644 index 00000000..c9ffe8a4 --- /dev/null +++ b/modules/amplify/predict/meta.yml @@ -0,0 +1,47 @@ +name: "amplify_predict" +description: AMPlify is an attentive deep learning model for antimicrobial peptide prediction. +keywords: + - antimicrobial peptides + - AMPs + - prediction + - model +tools: + - "amplify": + description: "Attentive deep learning model for antimicrobial peptide prediction" + homepage: "https://github.com/bcgsc/AMPlify" + documentation: "https://github.com/bcgsc/AMPlify" + tool_dev_url: "https://github.com/bcgsc/AMPlify" + doi: "https://doi.org/10.1186/s12864-022-08310-4" + licence: "['GPL v3']" + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - faa: + type: file + description: amino acid sequences fasta + pattern: "*.{fa,fa.gz,faa,faa.gz,fasta,fasta.gz}" + - model_dir: + type: directory + description: Directory of where models are stored (optional) + +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" + - tsv: + type: file + description: amino acid sequences with prediction (AMP, non-AMP) and probability scores + pattern: "*.{tsv}" + +authors: + - "@louperelo" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 607981a0..f8db3e87 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -26,6 +26,10 @@ allelecounter: - modules/allelecounter/** - tests/modules/allelecounter/** +amplify/predict: + - modules/amplify/predict/** + - tests/modules/amplify/predict/** + amps: - modules/amps/** - tests/modules/amps/** diff --git a/tests/modules/amplify/predict/main.nf b/tests/modules/amplify/predict/main.nf new file mode 100644 index 00000000..05db4cdb --- /dev/null +++ b/tests/modules/amplify/predict/main.nf @@ -0,0 +1,18 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { PRODIGAL } from '../../../modules/prodigal/main.nf' addParams( options: [:] ) +include { AMPLIFY_PREDICT } from '../../../../modules/amplify/predict/main.nf' addParams( options: [:] ) + +workflow amplify_predict { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['contigs_fasta'], checkIfExists: true) + ] + model_dir = [] + + PRODIGAL ( input, "gff" ) + AMPLIFY_PREDICT ( PRODIGAL.out.amino_acid_fasta, model_dir) +} diff --git a/tests/modules/amplify/predict/nextflow.config b/tests/modules/amplify/predict/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/amplify/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/amplify/predict/test.yml b/tests/modules/amplify/predict/test.yml new file mode 100644 index 00000000..3bc92889 --- /dev/null +++ b/tests/modules/amplify/predict/test.yml @@ -0,0 +1,9 @@ +- name: amplify predict amplify_predict + command: nextflow run tests/modules/amplify/predict -entry amplify_predict -c tests/config/nextflow.config + tags: + - amplify/predict + - amplify + files: + - path: output/amplify/test.tsv + md5sum: 1951084ce1d410028be86754997e5852 + - path: output/amplify/versions.yml