From 76e3ac5dae875ab523cf16e5094dee456aafcdcd Mon Sep 17 00:00:00 2001 From: Luisa Santus Date: Thu, 10 Aug 2023 13:51:16 +0200 Subject: [PATCH] Add module famsa_align (#3697) * Add module famsa_align * remove trailing white space --- modules/nf-core/famsa/align/main.nf | 50 ++++++++++++++++ modules/nf-core/famsa/align/meta.yml | 59 +++++++++++++++++++ tests/config/pytest_modules.yml | 4 ++ tests/modules/nf-core/famsa/align/main.nf | 32 ++++++++++ .../nf-core/famsa/align/nextflow.config | 5 ++ tests/modules/nf-core/famsa/align/test.yml | 21 +++++++ 6 files changed, 171 insertions(+) create mode 100644 modules/nf-core/famsa/align/main.nf create mode 100644 modules/nf-core/famsa/align/meta.yml create mode 100644 tests/modules/nf-core/famsa/align/main.nf create mode 100644 tests/modules/nf-core/famsa/align/nextflow.config create mode 100644 tests/modules/nf-core/famsa/align/test.yml diff --git a/modules/nf-core/famsa/align/main.nf b/modules/nf-core/famsa/align/main.nf new file mode 100644 index 00000000000..4505232bb58 --- /dev/null +++ b/modules/nf-core/famsa/align/main.nf @@ -0,0 +1,50 @@ + + +process FAMSA_ALIGN { + tag "$meta.id" + label 'process_medium' + + conda "bioconda::famsa=2.2.2" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/famsa:2.2.2--h9f5acd7_0': + 'biocontainers/famsa:2.2.2--h9f5acd7_0' }" + + input: + tuple val(meta), path(fasta) + tuple val(meta2), path(tree) + + output: + tuple val(meta), path("*.aln"), emit: alignment + 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 options_tree = tree ? "-gt import $tree" : "" + """ + famsa $options_tree \\ + $args \\ + -t ${task.cpus} \\ + ${fasta} \\ + ${prefix}.aln + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + famsa: \$( famsa -help 2>&1 | head -n 2 | tail -n 1 | sed 's/ version //g' ) + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.aln + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + famsa: \$( famsa -help 2>&1 | head -n 2 | tail -n 1 | sed 's/ version //g' ) + END_VERSIONS + """ +} diff --git a/modules/nf-core/famsa/align/meta.yml b/modules/nf-core/famsa/align/meta.yml new file mode 100644 index 00000000000..48a5d67e3d1 --- /dev/null +++ b/modules/nf-core/famsa/align/meta.yml @@ -0,0 +1,59 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/yaml-schema.json +name: "famsa_align" +description: Aligns sequences using FAMSA +keywords: + - alignment + - MSA + - genomics +tools: + - "famsa": + description: "Algorithm for large-scale multiple sequence alignments" + homepage: "https://github.com/refresh-bio/FAMSA" + documentation: "https://github.com/refresh-bio/FAMSA" + tool_dev_url: "https://github.com/refresh-bio/FAMSA" + doi: "10.1038/srep33964" + licence: "['GPL v3']" + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test']` + + - fasta: + type: file + description: Input sequences in FASTA format + pattern: "*.{fa,fasta}" + + - meta2: + type: map + description: | + Groovy Map containing tree information + e.g. `[ id:'test_tree']` + + - tree: + type: file + description: Input guide tree in Newick format + pattern: "*.{dnd}" + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test']` + + - alignment: + type: file + description: Alignment file. + pattern: "*.{aln}" + + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@luisas" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 080b900735e..d14265d7563 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1110,6 +1110,10 @@ falco: - modules/nf-core/falco/** - tests/modules/nf-core/falco/** +famsa/align: + - modules/nf-core/famsa/align/** + - tests/modules/nf-core/famsa/align/** + famsa/guidetree: - modules/nf-core/famsa/guidetree/** - tests/modules/nf-core/famsa/guidetree/** diff --git a/tests/modules/nf-core/famsa/align/main.nf b/tests/modules/nf-core/famsa/align/main.nf new file mode 100644 index 00000000000..031ba259c92 --- /dev/null +++ b/tests/modules/nf-core/famsa/align/main.nf @@ -0,0 +1,32 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { FAMSA_GUIDETREE } from '../../../../../modules/nf-core/famsa/guidetree/main.nf' +include { FAMSA_ALIGN } from '../../../../../modules/nf-core/famsa/align/main.nf' + +workflow test_famsa_align { + + input = [ + [ id:'test' ], // meta map + file(params.test_data['sarscov2']['illumina']['contigs_fasta'], checkIfExists: true) + ] + + FAMSA_ALIGN ( input , [[:],[]] ) + +} + + +workflow test_famsa_align_with_tree { + + input = [ + [ id:'test' ], // meta map + file(params.test_data['sarscov2']['illumina']['contigs_fasta'], checkIfExists: true) + ] + + + ch_tree = FAMSA_GUIDETREE ( input ).tree + + FAMSA_ALIGN ( input , ch_tree ) + +} diff --git a/tests/modules/nf-core/famsa/align/nextflow.config b/tests/modules/nf-core/famsa/align/nextflow.config new file mode 100644 index 00000000000..50f50a7a357 --- /dev/null +++ b/tests/modules/nf-core/famsa/align/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/nf-core/famsa/align/test.yml b/tests/modules/nf-core/famsa/align/test.yml new file mode 100644 index 00000000000..d9f5dcbd224 --- /dev/null +++ b/tests/modules/nf-core/famsa/align/test.yml @@ -0,0 +1,21 @@ +- name: famsa align test_famsa_align + command: nextflow run ./tests/modules/nf-core/famsa/align -entry test_famsa_align -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/famsa/align/nextflow.config + tags: + - famsa/align + - famsa + files: + - path: output/famsa/test.aln + md5sum: 7cf7375f2ba360814ea978731838b972 + - path: output/famsa/versions.yml + +- name: famsa align test_famsa_align_with_tree + command: nextflow run ./tests/modules/nf-core/famsa/align -entry test_famsa_align_with_tree -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/famsa/align/nextflow.config + tags: + - famsa/align + - famsa + files: + - path: output/famsa/test.aln + md5sum: 7cf7375f2ba360814ea978731838b972 + - path: output/famsa/test.dnd + md5sum: f3ef8b16a7a16cb4548942ebf2e7bad6 + - path: output/famsa/versions.yml