Skip to content

Commit

Permalink
Add module: Clustalo align (#3734)
Browse files Browse the repository at this point in the history
* Add modules - test and linting to be fied when guidetree gets merged to main

* Fix tests

* Remove trailing whitespace

* Update modules/nf-core/clustalo/align/main.nf

Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com>

* Update modules/nf-core/clustalo/align/meta.yml

Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com>

* Add options tree directly in args

---------

Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com>
  • Loading branch information
luisas and sateeshperi authored Aug 12, 2023
1 parent 43ef680 commit 5c73153
Show file tree
Hide file tree
Showing 6 changed files with 165 additions and 0 deletions.
48 changes: 48 additions & 0 deletions modules/nf-core/clustalo/align/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
process CLUSTALO_ALIGN {
tag "$meta.id"
label 'process_medium'

conda "bioconda::clustalo=1.2.4"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/clustalo:1.2.4--h87f3376_5':
'biocontainers/clustalo:1.2.4--h87f3376_5' }"

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}"
"""
clustalo \\
-i ${fasta} \\
--threads=${task.cpus} \\
$args \\
-o ${prefix}.aln
cat <<-END_VERSIONS > versions.yml
"${task.process}":
clustalo: \$( clustalo --version )
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.aln
cat <<-END_VERSIONS > versions.yml
"${task.process}":
clustalo: \$( clustalo --version )
END_VERSIONS
"""
}
57 changes: 57 additions & 0 deletions modules/nf-core/clustalo/align/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: "clustalo_align"
description: Align sequences using Clustal Omega
keywords:
- alignment
- MSA
- genomics
tools:
- "clustalo":
description: "Latest version of Clustal: a multiple sequence alignment program for DNA or proteins"
homepage: "http://www.clustal.org/omega/"
documentation: "http://www.clustal.org/omega/"
tool_dev_url: "http://www.clustal.org/omega/"
doi: "10.1038/msb.2011.75"
licence: "['GPL v2']"

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"
4 changes: 4 additions & 0 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,10 @@ clonalframeml:
- modules/nf-core/clonalframeml/**
- tests/modules/nf-core/clonalframeml/**

clustalo/align:
- modules/nf-core/clustalo/align/**
- tests/modules/nf-core/clustalo/align/**

clustalo/guidetree:
- modules/nf-core/clustalo/guidetree/**
- tests/modules/nf-core/clustalo/guidetree/**
Expand Down
30 changes: 30 additions & 0 deletions tests/modules/nf-core/clustalo/align/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env nextflow

nextflow.enable.dsl = 2

include { CLUSTALO_GUIDETREE } from '../../../../../modules/nf-core/clustalo/guidetree/main.nf'
include { CLUSTALO_ALIGN } from '../../../../../modules/nf-core/clustalo/align/main.nf'

workflow test_clustalo_align {

input = [
[ id:'test' ], // meta map
file(params.test_data['sarscov2']['illumina']['contigs_fasta'], checkIfExists: true)
]

CLUSTALO_ALIGN ( input, [[:],[]] )
}


workflow test_clustalo_align_with_tree {

input = [
[ id:'test' ], // meta map
file(params.test_data['sarscov2']['illumina']['contigs_fasta'], checkIfExists: true)
]

ch_tree = CLUSTALO_GUIDETREE ( input ).tree

CLUSTALO_ALIGN ( input , ch_tree )

}
5 changes: 5 additions & 0 deletions tests/modules/nf-core/clustalo/align/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
ext.args = { tree ? "--guidetree-in=$tree" : "" }
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }

}
21 changes: 21 additions & 0 deletions tests/modules/nf-core/clustalo/align/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
- name: clustalo align test_clustalo_align
command: nextflow run ./tests/modules/nf-core/clustalo/align -entry test_clustalo_align -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/clustalo/align/nextflow.config
tags:
- clustalo/align
- clustalo
files:
- path: output/clustalo/test.aln
md5sum: 74bb9a2820a91cf68db94dbd46787722
- path: output/clustalo/versions.yml

- name: clustalo align test_clustalo_align_with_tree
command: nextflow run ./tests/modules/nf-core/clustalo/align -entry test_clustalo_align_with_tree -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/clustalo/align/nextflow.config
tags:
- clustalo/align
- clustalo
files:
- path: output/clustalo/test.aln
md5sum: 74bb9a2820a91cf68db94dbd46787722
- path: output/clustalo/test.dnd
md5sum: 5428bad500a0a0bd985744bec1a12a70
- path: output/clustalo/versions.yml

0 comments on commit 5c73153

Please sign in to comment.