Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ testing/
testing*
*.pyc
null/
.nf-test*
.idea/
test_data
10 changes: 10 additions & 0 deletions modules/local/registerstudy/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
# TODO nf-core: List required Conda package(s).
# Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10").
# For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems.
- "bioconda::assembly_uploader=1.3.2"
55 changes: 55 additions & 0 deletions modules/local/registerstudy/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
process REGISTERSTUDY {
tag "$meta.id"
label 'process_single'

conda "${moduleDir}/environment.yml"
container "community.wave.seqera.io/library/pip_assembly-uploader:7e9461afbdd7a521"

input:
tuple val(meta), val(study), val(center), val(library)


output:
tuple val(meta), env(STUDY_ID), emit: study_accession
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
study_xmls \\
$args \\
--study ${study} \\
--library ${library} \\
--center ${center} \\


submit_study \\
$args2 \\
--directory ${study}_upload \\
--study ${study} 2>&1 | tee report.log

STUDY_ID=\$(grep 'A new study accession has been created' report.log | grep -oE '(PRJ|ERP)[[:alnum:]_]+[[:digit:]]+')

cat <<-END_VERSIONS > versions.yml
"${task.process}":
python: \$(python --version)
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.report

cat <<-END_VERSIONS > versions.yml
"${task.process}":
python: \$(python --version)
END_VERSIONS
"""
}
70 changes: 70 additions & 0 deletions modules/local/registerstudy/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "registerstudy"
description: This module registers a study and project and generates accessions that will be used for metagenomic assembly uploads in ENA. The study generated will reference reads from an already public project.
keywords:
- assembly
- register
- study
tools:
- "registerstudy":
description: "Nextflow module to register study/project to upload primary metagenome and metatranscriptome
assemblies to ENA on a per-study basis. The scripts generate xmls to register a new study and create manifests
necessary for submission of assemblies using webin-cli."
homepage: "https://github.com/EBI-Metagenomics/assembly_uploader"
documentation: "https://github.com/EBI-Metagenomics/assembly_uploader"
tool_dev_url: "None"
doi: ""
licence: ["Apache-2.0"]
identifier: null

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- study:
type: value
description: |
Study accession with raw reads public in ENA.
Example: "PRJNA312520"

- center:
type: value
description: |
Name of the sequencing or submitting center.
Example: "Wellcome Sanger Institute"

- library:
type: value
description: |
Library information associated with the study.
Example: "metagenome"
enum:
- metagenome
- metatranscriptome

output:
study_accession:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- study:
type: value
description: |
Study accession registered in ENA.
Example: "PRJEB312520"
versions:
- "versions.yml":
type: file
description: File containing software versions
pattern: "versions.yml"
ontologies:
- edam: "http://edamontology.org/format_3750" # YAML

authors:
- "@alisha246"
maintainers:
- "@alisha246"
5 changes: 5 additions & 0 deletions modules/local/registerstudy/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: REGISTERSTUDY {
ext.args2 = '--test'
}
}
63 changes: 63 additions & 0 deletions modules/local/registerstudy/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// TODO nf-core: Once you have added the required tests, please run the following command to build this file:
// nf-core modules test registerstudy
nextflow_process {
name "Test Process REGISTERSTUDY"
script "../main.nf"
config "../nextflow.config"
process "REGISTERSTUDY"


tag "modules"
tag "registerstudy"
/*
test("registerstudy - should register a study on ENA test server") {

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
"PRJNA318468",
"EMG",
"metagenome"
]
"""
}
}

then {
assertAll(
{ assert process.success },
//TODO improve assertions
)
}
}
*/

test("registerstudy - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
"PRJNA318468",
"EMG",
"metagenome"
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
//TODO improve assertions
)
}

}
}
72 changes: 72 additions & 0 deletions modules/local/registerstudy/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"registerstudy - report - stub": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
""
]
],
"1": [
"versions.yml:md5,ea872d341a2054fde3b2c8f06bbf8177"
],
"study_accession": [
[
{
"id": "test",
"single_end": false
},
""
]
],
"versions": [
"versions.yml:md5,ea872d341a2054fde3b2c8f06bbf8177"
]
}
],
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.0"
},
"timestamp": "2025-10-28T16:35:02.331026"
},
"registerstudy - stub": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
""
]
],
"1": [
"versions.yml:md5,049c28351d1fd639673904f17b95c213"
],
"study_accession": [
[
{
"id": "test",
"single_end": false
},
""
]
],
"versions": [
"versions.yml:md5,049c28351d1fd639673904f17b95c213"
]
}
],
"meta": {
"nf-test": "0.9.3",
"nextflow": "25.10.0"
},
"timestamp": "2025-10-29T10:59:32.499098"
}
}
2 changes: 1 addition & 1 deletion modules/nf-core/multiqc/tests/nextflow.config

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading