diff --git a/modules/ensembl/features/red/environment.yml b/modules/ensembl/features/red/environment.yml new file mode 100644 index 0000000..4189acf --- /dev/null +++ b/modules/ensembl/features/red/environment.yml @@ -0,0 +1,7 @@ +--- +channels: + - conda-forge + - bioconda + +dependencies: + - red=2018.09.10 \ No newline at end of file diff --git a/modules/ensembl/features/red/main.nf b/modules/ensembl/features/red/main.nf new file mode 100644 index 0000000..063ffa1 --- /dev/null +++ b/modules/ensembl/features/red/main.nf @@ -0,0 +1,67 @@ +// 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_RED { + tag "${meta.id}" + label 'process_medium' + + conda "${moduleDir}/environment.yml" + container "quay.io/biocontainers/red:2018.09.10--h9948957_3" + + input: + tuple val(meta), path(fasta) + + output: + tuple val(meta), path("rpt/*.bed"), emit: bed + tuple val("${task.process}"), val('red'), eval("conda list red --json | python -c 'import sys,json; print(json.load(sys.stdin)[0][\"version\"])' || echo 2.0"), emit: versions_red, topic: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + + def reserved = ['-gnm', '-rpt', '-msk', '-frm', '-cor'] + def supplied = args.tokenize() + + supplied.each { opt -> + if (opt in reserved) { + error "FEATURES_RED: ${opt} is managed by the module and must not be supplied via task.ext.args." + } + } + + """ + mkdir -p genome rpt + + # Red only processes .fa files in the genome directory + ln -snf \$(realpath "${fasta}") genome/${meta.id}.fa + + Red \ + -gnm genome \ + -rpt rpt \ + -cor ${task.cpus} \ + -frm 2 \ + ${args} + """ + + stub: + """ + mkdir -p rpt + + cat > rpt/${meta.id}.bed < 0 + assert process.out.versions_red.size() == 1 + } + } +} diff --git a/modules/ensembl/features/red/tests/main.nf.test.snap b/modules/ensembl/features/red/tests/main.nf.test.snap new file mode 100644 index 0000000..3414eb0 --- /dev/null +++ b/modules/ensembl/features/red/tests/main.nf.test.snap @@ -0,0 +1,43 @@ +{ + "Stub creates Red repeat report": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.bed:md5,aa604b48150afc506072a1f9656b6bb7" + ] + ], + "1": [ + [ + "FEATURES_RED", + "red", + "2.0" + ] + ], + "bed": [ + [ + { + "id": "test" + }, + "test.bed:md5,aa604b48150afc506072a1f9656b6bb7" + ] + ], + "versions_red": [ + [ + "FEATURES_RED", + "red", + "2.0" + ] + ] + } + ], + "timestamp": "2026-07-14T16:03:16.866216", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.04.3" + } + } +} \ No newline at end of file