-
Notifications
You must be signed in to change notification settings - Fork 3
ENSGENOMIO-18 Chunking modules #34
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
base: main
Are you sure you want to change the base?
Changes from 38 commits
d830e16
f89d0b2
cfe0b4e
acfe54f
8a6adaa
1dbf7eb
2e62385
af21a08
ac505b8
1ee480d
66550dc
da555a1
ad779fd
1934c1f
225b68a
40ed523
410a944
7bfe4c6
e5bdeb2
13be40f
fda3137
b114773
824066c
1405de9
b00d0ac
78e789d
2883bc0
6c07eb1
4e6e53f
a4d4854
59e24c4
3d7c7ef
30961a3
b771306
b50cfba
adb281a
a14b6c5
ef8a3ea
b1d805f
7c4e733
ff7e3ef
b7061e3
08669d9
8391107
6906346
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,5 @@ | ||
| .nextflow* | ||
| .nf-test* | ||
| __pycache__/ | ||
| *.pyc | ||
| .python-version | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| channels: | ||
| - conda-forge | ||
| - bioconda | ||
| dependencies: | ||
| - ensembl-genomio=1.6.1 | ||
|
JAlvarezJarreta marked this conversation as resolved.
Outdated
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| // 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 FASTA_RECOMBINE { | ||
|
|
||
|
JAlvarezJarreta marked this conversation as resolved.
|
||
| tag "${meta.id}" | ||
| label 'process_medium' | ||
|
|
||
| conda "${moduleDir}/environment.yml" | ||
| container "${workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container | ||
| ? 'https://depot.galaxyproject.org/singularity/ensembl-genomio:1.6.1--pyhdfd78af_0' | ||
| : 'quay.io/biocontainers/ensembl-genomio:1.6.1--pyhdfd78af_0'}" | ||
|
|
||
| input: | ||
| tuple val(meta), path(fasta_manifest), path(agp) | ||
|
|
||
| output: | ||
| tuple val(meta), path("${meta.id}.fa"), emit: recombined_fasta | ||
| tuple val("${task.process}"), val('fasta_recombine'), eval("fasta_recombine --version"), emit: versions_fasta_recombine, topic: versions | ||
|
|
||
| when: | ||
| task.ext.when == null || task.ext.when | ||
|
|
||
| script: | ||
| def args = [] | ||
|
|
||
| if (params.chunk_id_regex) { | ||
| def rx = params.chunk_id_regex.replace("'", "'\"'\"'") | ||
| args << "--chunk-id-regex '${rx}'" | ||
| } | ||
|
|
||
| if (params.allow_revcomp) { | ||
| args << "--allow-revcomp" | ||
| } | ||
|
|
||
| def has_agp = agp && agp.baseName != 'NO_FILE' | ||
| if (has_agp) { | ||
| args << "--agp-file ${agp}" | ||
| } | ||
|
Comment on lines
+35
to
+49
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. Whilst I'm happy with using Nextflow's native language, I'm wondering how portable would this module be if we decided to move away from Nextflow compared to having this code in Bash inside the code block. In a way seeing this reminds me of our Perl code embedded inside eHive modules. More a shared thought than an action to be made, honestly. |
||
|
|
||
| def out_fasta = "${meta.id}.fa" | ||
| """ | ||
| fasta_recombine \\ | ||
| --fasta-manifest ${fasta_manifest} \\ | ||
| --out-fasta ${out_fasta} \\ | ||
| ${args.join(' ')} | ||
| """ | ||
|
|
||
| stub: | ||
| """ | ||
| out_fa="${meta.id}.fa" | ||
| touch "\$out_fa" | ||
|
JAlvarezJarreta marked this conversation as resolved.
Outdated
|
||
| """ | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| name: "fasta_recombine" | ||
| description: Recombine split FASTA sequences into a single FASTA file, | ||
| optionally using an AGP file. | ||
| keywords: | ||
| - ensembl | ||
| - fasta | ||
| - genomics | ||
| - genomio | ||
| - recombine | ||
| tools: | ||
| - "fasta_recombine": | ||
| description: "Recombine split FASTA sequences generated by ensembl-genomio." | ||
| homepage: "https://github.com/Ensembl/ensembl-genomio" | ||
| licence: | ||
| - "Apache License version 2.0" | ||
| identifier: "" | ||
| input: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing meta information | ||
| e.g. `[ id:'accession1' ]` | ||
| - fasta_manifest: | ||
| type: file | ||
| description: Manifest file listing split FASTA files to recombine. | ||
| pattern: "*.txt" | ||
| ontologies: [] | ||
| - agp: | ||
| type: file | ||
| description: | ||
| Optional AGP file describing how split sequence chunks should | ||
| be recombined. Use NO_FILE when not required. | ||
| pattern: "*.{agp,NO_FILE}" | ||
|
JAlvarezJarreta marked this conversation as resolved.
Outdated
|
||
| ontologies: [] | ||
|
JAlvarezJarreta marked this conversation as resolved.
Outdated
|
||
| output: | ||
| recombined_fasta: | ||
| - - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing meta information | ||
| e.g. `[ id:'accession1' ]` | ||
| - ${meta.id}.fa: | ||
| type: file | ||
| description: Recombined FASTA file. | ||
| pattern: "*.fa" | ||
| ontologies: [] | ||
|
JAlvarezJarreta marked this conversation as resolved.
Outdated
|
||
| versions_fasta_recombine: | ||
| - - ${task.process}: | ||
| type: string | ||
| description: The name of the process. | ||
| - fasta_recombine: | ||
| type: string | ||
| description: The name of the tool. | ||
| - ? fasta_recombine --version | ||
| : type: eval | ||
|
JAlvarezJarreta marked this conversation as resolved.
Outdated
|
||
| description: The expression to obtain the version of the tool | ||
| topics: | ||
| versions: | ||
| - - ${task.process}: | ||
| type: string | ||
| description: The name of the process. | ||
| - fasta_recombine: | ||
| type: string | ||
| description: The name of the tool. | ||
| - ? fasta_recombine --version | ||
| : type: eval | ||
|
JAlvarezJarreta marked this conversation as resolved.
Outdated
|
||
| description: The expression to obtain the version of the tool | ||
| authors: | ||
| - "ensembl-dev@ebi.ac.uk" | ||
| maintainers: | ||
| - "ensembl-dev@ebi.ac.uk" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| // 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 fasta/recombine | ||
| nextflow_process { | ||
|
|
||
| name "Test Process FASTA_RECOMBINE" | ||
| script "../main.nf" | ||
| process "FASTA_RECOMBINE" | ||
|
|
||
| tag "modules" | ||
| tag "modules_ensembl" | ||
|
JAlvarezJarreta marked this conversation as resolved.
|
||
| tag "fasta" | ||
| tag "fasta/recombine" | ||
|
|
||
| test("stub outputs: header mode") { | ||
|
|
||
| when { | ||
| options "-stub" | ||
|
|
||
| process { | ||
| """ | ||
| def manifest = file("manifest.txt") | ||
| manifest.text = "x\\n" | ||
|
|
||
| def no_file = file("NO_FILE") | ||
| no_file.text = "" | ||
|
|
||
| input[0] = [ | ||
| [ id: 'test' ], | ||
| manifest, | ||
| no_file | ||
| ] | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assert process.trace.tasks().size() == 1 | ||
| assert process.out.recombined_fasta.size() == 1 | ||
| assert process.success | ||
| assert snapshot(process.out).match() | ||
| } | ||
| } | ||
|
|
||
| test("stub outputs: AGP mode") { | ||
|
|
||
| when { | ||
| options "-stub" | ||
|
|
||
| process { | ||
| """ | ||
| def manifest = file("manifest.txt") | ||
| manifest.text = "x\\n" | ||
|
|
||
| def agp = file("test.agp") | ||
| agp.text = "" | ||
| input[0] = [ | ||
| [ id: 'test' ], | ||
| manifest, | ||
| agp | ||
| ] | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assert process.trace.tasks().size() == 1 | ||
| assert process.out.recombined_fasta.size() == 1 | ||
| assert process.success | ||
| assert snapshot(process.out).match() | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| { | ||
| "stub outputs: AGP mode": { | ||
| "content": [ | ||
| { | ||
| "0": [ | ||
| [ | ||
| { | ||
| "id": "test" | ||
| }, | ||
| "test.fa:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
| ] | ||
| ], | ||
| "1": [ | ||
| [ | ||
| "FASTA_RECOMBINE", | ||
| "fasta_recombine", | ||
| "1.6.3" | ||
| ] | ||
| ], | ||
| "recombined_fasta": [ | ||
| [ | ||
| { | ||
| "id": "test" | ||
| }, | ||
| "test.fa:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
| ] | ||
| ], | ||
| "versions_fasta_recombine": [ | ||
| [ | ||
| "FASTA_RECOMBINE", | ||
| "fasta_recombine", | ||
| "1.6.3" | ||
| ] | ||
| ] | ||
| } | ||
| ], | ||
| "timestamp": "2026-05-14T14:39:11.350698", | ||
| "meta": { | ||
| "nf-test": "0.9.4", | ||
| "nextflow": "25.10.3" | ||
| } | ||
| }, | ||
| "stub outputs: header mode": { | ||
| "content": [ | ||
| { | ||
| "0": [ | ||
| [ | ||
| { | ||
| "id": "test" | ||
| }, | ||
| "test.fa:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
| ] | ||
| ], | ||
| "1": [ | ||
| [ | ||
| "FASTA_RECOMBINE", | ||
| "fasta_recombine", | ||
| "1.6.3" | ||
| ] | ||
| ], | ||
| "recombined_fasta": [ | ||
| [ | ||
| { | ||
| "id": "test" | ||
| }, | ||
| "test.fa:md5,d41d8cd98f00b204e9800998ecf8427e" | ||
| ] | ||
| ], | ||
| "versions_fasta_recombine": [ | ||
| [ | ||
| "FASTA_RECOMBINE", | ||
| "fasta_recombine", | ||
| "1.6.3" | ||
| ] | ||
| ] | ||
| } | ||
| ], | ||
| "timestamp": "2026-05-14T14:39:09.216174", | ||
| "meta": { | ||
| "nf-test": "0.9.4", | ||
| "nextflow": "25.10.3" | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| channels: | ||
| - conda-forge | ||
| - bioconda | ||
| dependencies: | ||
| - ensembl-genomio=1.6.1 | ||
|
JAlvarezJarreta marked this conversation as resolved.
Outdated
|
||
Uh oh!
There was an error while loading. Please reload this page.