-
Notifications
You must be signed in to change notification settings - Fork 3
Module for running Red repeat detector #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
markquintontulloch
wants to merge
3
commits into
main
Choose a base branch
from
ENSGENOMIO-27_nf
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| channels: | ||
| - conda-forge | ||
| - bioconda | ||
|
|
||
| dependencies: | ||
| - red=2018.09.10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 <<EOF | ||
| ${meta.id}\t1\t100 | ||
| EOF | ||
| """ | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| --- | ||
| name: "features_red" | ||
| description: Detect repeats de novo in genome FASTA sequences with Red. | ||
| keywords: | ||
| - fasta | ||
| - features | ||
| - repeats | ||
| - de novo repeats | ||
| - red | ||
| - genomio | ||
| tools: | ||
| - "red": | ||
| description: "Red detects repeats de novo on the genomic scale." | ||
| homepage: "http://toolsmith.ens.utulsa.edu" | ||
| documentation: "http://toolsmith.ens.utulsa.edu" | ||
| tool_dev_url: "http://toolsmith.ens.utulsa.edu" | ||
| doi: "10.1186/s12859-015-0654-5" | ||
| licence: ["custom"] | ||
| identifier: "" | ||
| input: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. `[ id:'sample1' ]` | ||
| - fasta: | ||
| type: file | ||
| description: FASTA file containing genome sequence(s). | ||
| pattern: "*.{fa,fasta,fna}" | ||
| ontologies: | ||
| - edam: "http://edamontology.org/format_1929" # FASTA | ||
| output: | ||
| rpt: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. `[ id:'sample1' ]` | ||
| - "rpt/*.bed": | ||
| type: file | ||
| description: Red repeat report file. | ||
| pattern: "*.bed" | ||
| versions_red: | ||
| - - ${task.process}: | ||
| type: string | ||
| description: The process the versions were collected from | ||
| - red: | ||
| type: string | ||
| description: The tool name | ||
| - conda list red --json | python -c 'import sys,json; print(json.load(sys.stdin)[0]["version"])' || echo 2.0: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above if it works. |
||
| type: eval | ||
| description: The expression to obtain the Red version | ||
| topics: | ||
| versions: | ||
| - - ${task.process}: | ||
| type: string | ||
| description: The process the versions were collected from | ||
| - red: | ||
| type: string | ||
| description: The tool name | ||
| - conda list red --json | python -c 'import sys,json; print(json.load(sys.stdin)[0]["version"])' || echo 2.0: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above if it works. |
||
| type: eval | ||
| description: The expression to obtain the Red version | ||
| authors: | ||
| - "ensembl-dev@ebi.ac.uk" | ||
| maintainers: | ||
| - "ensembl-dev@ebi.ac.uk" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| // 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. | ||
|
|
||
| nextflow_process { | ||
|
|
||
| name "Test Process FEATURES_RED" | ||
| script "../main.nf" | ||
| process "FEATURES_RED" | ||
|
|
||
| tag "modules" | ||
| tag "modules_local" | ||
| tag "features" | ||
| tag "features/red" | ||
|
|
||
| test("Stub creates Red repeat report") { | ||
|
|
||
| when { | ||
| options "-stub" | ||
|
|
||
| process { | ||
| """ | ||
| def fasta = file("test.fa") | ||
| fasta.text = ">test\\nACGT\\n" | ||
|
|
||
| input[0] = [[ id:'test' ], fasta] | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assert process.success | ||
| assert snapshot(process.out).match() | ||
| assert process.out.bed.size() == 1 | ||
| assert process.out.bed[0][0] == [ id: 'test' ] | ||
| assert file(process.out.bed[0][1]).name == "test.bed" | ||
| assert file(process.out.bed[0][1]).size() > 0 | ||
| assert process.out.versions_red.size() == 1 | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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" | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this will work, but sounds less overkilling than loading Python to just extract the version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having looked into this, we could maybe use
jq -r '.[0].version'but I think I'm inclined to stick with Python unless you strongly feel otherwise. From what I can gather, many nf-core modules use small Python one-liners to parse JSON since it is considered part of the expected runtime environment, whereas jq is not. Therefore, this seems like the more portable option.