diff --git a/modules/mafft/main.nf b/modules/mafft/main.nf new file mode 100644 index 00000000..99485b61 --- /dev/null +++ b/modules/mafft/main.nf @@ -0,0 +1,35 @@ +process MAFFT { + tag "$meta.id" + label 'process_high' + + conda (params.enable_conda ? "bioconda::mafft=7.490" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/mafft:7.490--h779adbc_0': + 'quay.io/biocontainers/mafft:7.490--h779adbc_0' }" + + input: + tuple val(meta), path(fasta) + + output: + tuple val(meta), path("*.fas"), emit: fas + 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}" + """ + mafft \\ + --thread ${task.cpus} \\ + ${args} \\ + ${fasta} \\ + > ${prefix}.fas + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + mafft: \$(mafft --version 2>&1 | sed 's/^v//' | sed 's/ (.*)//') + END_VERSIONS + """ +} diff --git a/modules/mafft/meta.yml b/modules/mafft/meta.yml new file mode 100644 index 00000000..10c7f0c2 --- /dev/null +++ b/modules/mafft/meta.yml @@ -0,0 +1,42 @@ +name: mafft +description: Multiple sequence alignment using MAFFT +keywords: + - msa + - multiple sequence alignment +tools: + - mafft: + description: Multiple alignment program for amino acid or nucleotide sequences based on fast Fourier transform + homepage: https://mafft.cbrc.jp/alignment/software/ + documentation: https://mafft.cbrc.jp/alignment/software/manual/manual.html + tool_dev_url: https://mafft.cbrc.jp/alignment/software/source.html + doi: "10.1093/nar/gkf436" + licence: ['BSD'] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fasta: + type: file + description: FASTA file containing the sequences to align + pattern: "*.{fa,fasta}" + +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" + - fas: + type: file + description: Aligned sequences in FASTA format + pattern: "*.{fas}" + +authors: + - "@MillironX" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 93903a65..a71d282c 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -944,6 +944,10 @@ macs2/callpeak: - modules/macs2/callpeak/** - tests/modules/macs2/callpeak/** +mafft: + - modules/mafft/** + - tests/modules/mafft/** + malt/build: - modules/malt/build/** - tests/modules/malt/build_test/** diff --git a/tests/modules/mafft/main.nf b/tests/modules/mafft/main.nf new file mode 100644 index 00000000..7f50b35a --- /dev/null +++ b/tests/modules/mafft/main.nf @@ -0,0 +1,15 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { MAFFT } from '../../../modules/mafft/main.nf' + +workflow test_mafft { + + input = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['scaffolds_fasta'], checkIfExists: true) + ] + + MAFFT ( input ) +} diff --git a/tests/modules/mafft/nextflow.config b/tests/modules/mafft/nextflow.config new file mode 100644 index 00000000..46cc926e --- /dev/null +++ b/tests/modules/mafft/nextflow.config @@ -0,0 +1,6 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + ext.args = "--auto" + +} diff --git a/tests/modules/mafft/test.yml b/tests/modules/mafft/test.yml new file mode 100644 index 00000000..cd40caa7 --- /dev/null +++ b/tests/modules/mafft/test.yml @@ -0,0 +1,9 @@ +- name: mafft test_mafft + command: nextflow run tests/modules/mafft -entry test_mafft -c tests/config/nextflow.config + tags: + - mafft + files: + - path: output/mafft/test.fas + md5sum: 23426611f4a0df532b6708f072bd445b + - path: output/mafft/versions.yml + md5sum: b1b5ab3728ae17401808335f1c8f8215