diff --git a/modules/ensembl/features/trf/environment.yml b/modules/ensembl/features/trf/environment.yml new file mode 100644 index 0000000..202c448 --- /dev/null +++ b/modules/ensembl/features/trf/environment.yml @@ -0,0 +1,5 @@ +channels: + - conda-forge + - bioconda +dependencies: + - trf=4.10.0rc2 \ No newline at end of file diff --git a/modules/ensembl/features/trf/main.nf b/modules/ensembl/features/trf/main.nf new file mode 100644 index 0000000..475dba6 --- /dev/null +++ b/modules/ensembl/features/trf/main.nf @@ -0,0 +1,45 @@ +// See the NOTICE file distributed with this work for additional information +// regarding copyright ownership. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +process FEATURES_TRF { + tag "${meta.id}" + label 'process_medium' + + conda "${moduleDir}/environment.yml" + container "quay.io/biocontainers/trf:4.10.0rc2--h7b50bb2_0" + + input: + tuple val(meta), path(fasta) + + output: + tuple val(meta), path("*.dat"), emit: dat + tuple val("${task.process}"), val('trf'), eval("trf -v 2>&1 | grep -oE '[0-9]+(\\.[0-9]+)+(rc[0-9]+)?(-[0-9]+)?' || echo 4.10.0"), emit: versions_trf, topic: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '2 7 7 80 10 100 500 -d' + """ + trf '${fasta}' ${args} -h + """ + + stub: + """ + cat > "${fasta.name}.dat" << 'EOF' + Sequence: ${fasta.name} + EOF + """ +} diff --git a/modules/ensembl/features/trf/meta.yml b/modules/ensembl/features/trf/meta.yml new file mode 100644 index 0000000..043433c --- /dev/null +++ b/modules/ensembl/features/trf/meta.yml @@ -0,0 +1,66 @@ +--- +name: "features_trf" +description: Detect tandem repeats in FASTA sequences with Tandem Repeats Finder. +keywords: + - fasta + - features + - repeats + - tandem repeats + - trf + - genomio +tools: + - "trf": + description: "Tandem Repeats Finder detects and reports tandem repeats in DNA sequences." + homepage: "https://tandem.bu.edu/trf/trf.html" + documentation: "https://tandem.bu.edu/trf/trf.html" + tool_dev_url: "https://tandem.bu.edu/trf/trf.html" + licence: ["custom"] + identifier: "biotools:trf" +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - fasta: + type: file + description: FASTA file containing DNA sequence(s) + pattern: "*.{fa,fasta,fna}" + ontologies: + - edam: "http://edamontology.org/format_1929" # FASTA +output: + dat: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*.dat": + type: file + description: TRF repeat annotations in DAT format + pattern: "*.dat" + versions_trf: + - - ${task.process}: + type: string + description: The process the versions were collected from + - trf: + type: string + description: The tool name + - trf -v 2>&1 | grep -oE '[0-9]+(\\.[0-9]+)+(rc[0-9]+)?(-[0-9]+)?' || echo 4.10.0: + type: eval + description: The expression to obtain the TRF version +topics: + versions: + - - ${task.process}: + type: string + description: The process the versions were collected from + - trf: + type: string + description: The tool name + - trf -v 2>&1 | grep -oE '[0-9]+(\\.[0-9]+)+(rc[0-9]+)?(-[0-9]+)?' || echo 4.10.0: + type: eval + description: The expression to obtain the TRF version +authors: + - "ensembl-dev@ebi.ac.uk" +maintainers: + - "ensembl-dev@ebi.ac.uk" diff --git a/modules/ensembl/features/trf/tests/main.nf.test b/modules/ensembl/features/trf/tests/main.nf.test new file mode 100644 index 0000000..348c575 --- /dev/null +++ b/modules/ensembl/features/trf/tests/main.nf.test @@ -0,0 +1,48 @@ +// See the NOTICE file distributed with this work for additional information +// regarding copyright ownership. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// nf-core modules test features/trf +nextflow_process { + + name "Test Process FEATURES_TRF" + script "../main.nf" + process "FEATURES_TRF" + + tag "features" + tag "features/trf" + + test("Stub: TRF") { + when { + options "-stub" + + process { + """ + input[0] = [[ id: 'test' ],file('dummy.fa') + ] + """ + } + } + + then { + assert process.success + assert snapshot(process.out).match() + assert process.out.dat.size() == 1 + assert process.out.dat[0][0] == [ id: 'test' ] + assert file(process.out.dat[0][1]).name == 'dummy.fa.dat' + assert file(process.out.dat[0][1]).size() > 0 + assert process.out.versions_trf.size() == 1 + } + } +} diff --git a/modules/ensembl/features/trf/tests/main.nf.test.snap b/modules/ensembl/features/trf/tests/main.nf.test.snap new file mode 100644 index 0000000..7325e37 --- /dev/null +++ b/modules/ensembl/features/trf/tests/main.nf.test.snap @@ -0,0 +1,43 @@ +{ + "Stub: TRF": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "dummy.fa.dat:md5,7afa5cc8da76212b28fe6a2c4db74917" + ] + ], + "1": [ + [ + "FEATURES_TRF", + "trf", + "4.10.0" + ] + ], + "dat": [ + [ + { + "id": "test" + }, + "dummy.fa.dat:md5,7afa5cc8da76212b28fe6a2c4db74917" + ] + ], + "versions_trf": [ + [ + "FEATURES_TRF", + "trf", + "4.10.0" + ] + ] + } + ], + "timestamp": "2026-06-25T13:50:41.590756", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.04.3" + } + } +} \ No newline at end of file