Skip to content
Draft
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ nextflow run nf-core/seqsubmit \
-profile <docker/singularity/...> \
--mode <mags|bins|metagenomic_assemblies|reads> \
--input <samplesheet.csv> \
--centre_name <your_centre> \
--center_name <your_organisation> \
--submission_study <your_study> \
--outdir <outdir>
```
Expand Down
65 changes: 56 additions & 9 deletions bin/submit_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,9 @@ def build_submission_xml(
hold_until: str | None = None,
action: str = "ADD",
test: bool = False,
center_name: str | None = None,
submission_tool: str | None = None,
submission_tool_version: str | None = None,
) -> ET.Element:
"""Build a ``<WEBIN>`` XML document for submitting studies.

Expand All @@ -319,6 +322,12 @@ def build_submission_xml(
or ``"MODIFY"`` to update existing ones.
test: If ``True``, append a timestamp-based hash to aliases
for uniqueness in test submissions.
center_name: Optional submitting center name, set as the
``center_name`` attribute of each ``<PROJECT>``.
submission_tool: Optional name of the tool used for submission,
added as ``SUBMISSION_TOOL`` project attribute.
submission_tool_version: Optional version of the submission tool,
added as ``SUBMISSION_TOOL_VERSION`` project attribute.

Returns:
Root ``<WEBIN>`` element.
Expand All @@ -342,14 +351,23 @@ def build_submission_xml(
# PROJECT_SET
project_set = ET.SubElement(webin, "PROJECT_SET")
for study in studies:
_add_project_element(project_set, study, test=test)
_add_project_element(
project_set, study,
test=test,
center_name=center_name,
submission_tool=submission_tool,
submission_tool_version=submission_tool_version,
)
return webin


def _add_project_element(
project_set: ET.Element,
study: dict[str, Any],
test: bool = False,
center_name: str | None = None,
submission_tool: str | None = None,
submission_tool_version: str | None = None,
) -> None:
"""Append a ``<PROJECT>`` element to *project_set*."""
alias = study.get("alias", "")
Expand All @@ -362,6 +380,8 @@ def _add_project_element(

project = ET.SubElement(project_set, "PROJECT")
project.set("alias", alias)
if center_name:
project.set("center_name", center_name)

name_text = study.get("project_name", study.get("study_title", ""))
if name_text:
Expand All @@ -381,19 +401,25 @@ def _add_project_element(

sp = ET.SubElement(project, "SUBMISSION_PROJECT")
ET.SubElement(sp, "SEQUENCING_PROJECT")

project_attributes: list[tuple[str, str]] = []
study_type = study.get("existing_study_type")
if study_type:
project_attributes.append(("existing_study_type", study_type))
new_type = study.get("new_study_type")
if new_type and study_type == "Other":
project_attributes.append(("new_study_type", new_type))
if submission_tool:
project_attributes.append(("SUBMISSION_TOOL", submission_tool))
if submission_tool_version:
project_attributes.append(("SUBMISSION_TOOL_VERSION", submission_tool_version))

if project_attributes:
attrs = ET.SubElement(
project, "PROJECT_ATTRIBUTES",
)
_add_project_attribute(
attrs, "existing_study_type", study_type,
)
new_type = study.get("new_study_type")
if new_type and study_type == "Other":
_add_project_attribute(
attrs, "new_study_type", new_type,
)
for tag_text, value_text in project_attributes:
_add_project_attribute(attrs, tag_text, value_text)


def _add_project_attribute(
Expand Down Expand Up @@ -559,6 +585,21 @@ def _do_submission(
default=None,
help="Path to write JSON accession results (default: stdout)",
)
@click.option(
"--center-name",
default=None,
help="Submitting center name, added as center_name to each study",
)
@click.option(
"--submission-tool",
default=None,
help="Name of the tool used for submission, added as SUBMISSION_TOOL study attribute",
)
@click.option(
"--submission-tool-version",
default=None,
help="Version of the submission tool, added as SUBMISSION_TOOL_VERSION study attribute",
)
@click.option(
"--validate",
is_flag=True, default=False,
Expand All @@ -569,6 +610,9 @@ def main(
use_test: bool,
hold_until: str | None,
output: Path | None,
center_name: str | None,
submission_tool: str | None,
submission_tool_version: str | None,
validate: bool,
) -> None:
"""Submit studies to ENA via the Webin REST API v2."""
Expand Down Expand Up @@ -606,6 +650,9 @@ def main(
hold_until=hold_until,
action="ADD",
test=use_test,
center_name=center_name,
submission_tool=submission_tool,
submission_tool_version=submission_tool_version,
)
xml_bytes = xml_to_bytes(xml_root)
logger.info("XML document size: %d bytes", len(xml_bytes))
Expand Down
4 changes: 4 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ process {
]
}

withName: 'REGISTERSTUDY' {
ext.args = { "--submission-tool '${workflow.manifest.name}' --submission-tool-version '${workflow.manifest.version}'" }
}

withName: 'GENERATE_ASSEMBLY_MANIFEST' {
errorStrategy = { task.exitStatus in (1 + (130..145) + 104 + (175..177)) ? 'retry' : 'finish' }
maxRetries = 3
Expand Down
2 changes: 1 addition & 1 deletion conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ params {
mode = "mags"
submission_study = null
study_metadata = params.pipelines_testdata_base_path + 'seqsubmit/test_data/study_metadata/study_metadata.json'
centre_name = "TEST_CENTER"
center_name = "TEST_CENTER"

test_upload = true

Expand Down
2 changes: 1 addition & 1 deletion conf/test_assembly_complete_metadata.config
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ params {
mode = "metagenomic_assemblies"
submission_study = null
study_metadata = params.pipelines_testdata_base_path + 'seqsubmit/test_data/study_metadata/study_metadata.json'
centre_name = "TEST_CENTER"
center_name = "TEST_CENTER"

test_upload = true
}
2 changes: 1 addition & 1 deletion conf/test_assembly_complete_metadata_existing_study.config
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ params {

mode = "metagenomic_assemblies"
submission_study = "PRJEB98843"
centre_name = "TEST_CENTER"
center_name = "TEST_CENTER"

test_upload = true
}
2 changes: 1 addition & 1 deletion conf/test_assembly_no_coverage_paired_reads.config
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ params {
mode = "metagenomic_assemblies"
submission_study = null
study_metadata = params.pipelines_testdata_base_path + 'seqsubmit/test_data/study_metadata/study_metadata.json'
centre_name = "TEST_CENTER"
center_name = "TEST_CENTER"

test_upload = true
}
2 changes: 1 addition & 1 deletion conf/test_assembly_no_coverage_single_reads.config
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ params {
mode = "metagenomic_assemblies"
submission_study = null
study_metadata = params.pipelines_testdata_base_path + 'seqsubmit/test_data/study_metadata/study_metadata.json'
centre_name = "TEST_CENTER"
center_name = "TEST_CENTER"

test_upload = true
}
2 changes: 1 addition & 1 deletion conf/test_assembly_one_contig.config
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ params {
mode = "metagenomic_assemblies"
submission_study = null
study_metadata = params.pipelines_testdata_base_path + 'seqsubmit/test_data/study_metadata/study_metadata.json'
centre_name = "TEST_CENTER"
center_name = "TEST_CENTER"

test_upload = true
}
2 changes: 1 addition & 1 deletion conf/test_full.config
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ params {
mode = "mags"
submission_study = null
study_metadata = params.pipelines_testdata_base_path + 'seqsubmit/test_data/study_metadata/study_metadata.json'
centre_name = "TEST_CENTER"
center_name = "TEST_CENTER"

test_upload = true

Expand Down
2 changes: 1 addition & 1 deletion conf/test_mag_complete_metadata.config
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ params {
mode = "mags"
submission_study = null
study_metadata = params.pipelines_testdata_base_path + 'seqsubmit/test_data/study_metadata/study_metadata.json'
centre_name = "TEST_CENTER"
center_name = "TEST_CENTER"

test_upload = true

Expand Down
2 changes: 1 addition & 1 deletion conf/test_mag_complete_metadata_existing_study.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ params {

mode = "mags"
submission_study = "PRJEB98843"
centre_name = "TEST_CENTER"
center_name = "TEST_CENTER"

test_upload = true

Expand Down
2 changes: 1 addition & 1 deletion conf/test_mag_no_coverage_paired_reads.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ params {
mode = "mags"
submission_study = null
study_metadata = params.pipelines_testdata_base_path + 'seqsubmit/test_data/study_metadata/study_metadata.json'
centre_name = "TEST_CENTER"
center_name = "TEST_CENTER"

test_upload = true

Expand Down
2 changes: 1 addition & 1 deletion conf/test_mag_no_coverage_single_reads.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ params {
mode = "mags"
submission_study = null
study_metadata = params.pipelines_testdata_base_path + 'seqsubmit/test_data/study_metadata/study_metadata.json'
centre_name = "TEST_CENTER"
center_name = "TEST_CENTER"

test_upload = true

Expand Down
2 changes: 1 addition & 1 deletion conf/test_mag_no_quality.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ params {
mode = "mags"
submission_study = null
study_metadata = params.pipelines_testdata_base_path + 'seqsubmit/test_data/study_metadata/study_metadata.json'
centre_name = "TEST_CENTER"
center_name = "TEST_CENTER"

test_upload = true

Expand Down
2 changes: 1 addition & 1 deletion conf/test_mag_no_rna_presence.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ params {
mode = "mags"
submission_study = null
study_metadata = params.pipelines_testdata_base_path + 'seqsubmit/test_data/study_metadata/study_metadata.json'
centre_name = "TEST_CENTER"
center_name = "TEST_CENTER"

test_upload = true

Expand Down
2 changes: 1 addition & 1 deletion conf/test_mag_no_taxonomy.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ params {
mode = "mags"
submission_study = null
study_metadata = params.pipelines_testdata_base_path + 'seqsubmit/test_data/study_metadata/study_metadata.json'
centre_name = "TEST_CENTER"
center_name = "TEST_CENTER"

test_upload = true

Expand Down
2 changes: 1 addition & 1 deletion conf/test_mag_one_contig.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ params {
mode = "mags"
submission_study = null
study_metadata = params.pipelines_testdata_base_path + 'seqsubmit/test_data/study_metadata/study_metadata.json'
centre_name = "TEST_CENTER"
center_name = "TEST_CENTER"

test_upload = true

Expand Down
2 changes: 1 addition & 1 deletion conf/test_reads_long_bam.config
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ params {
webincli_mode = "submit"
submission_study = null
study_metadata = params.pipelines_testdata_base_path + 'seqsubmit/test_data/study_metadata/study_metadata.json'
centre_name = "TEST_CENTER"
center_name = "TEST_CENTER"

test_upload = true
}
2 changes: 1 addition & 1 deletion conf/test_reads_long_bam_validate.config
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ params {
mode = "reads"
webincli_mode = "validate"
submission_study = "PRJEB98843"
centre_name = "TEST_CENTER"
center_name = "TEST_CENTER"

test_upload = true
}
2 changes: 1 addition & 1 deletion conf/test_reads_paired.config
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ params {
mode = "reads"
submission_study = null
study_metadata = params.pipelines_testdata_base_path + 'seqsubmit/test_data/study_metadata/study_metadata.json'
centre_name = "TEST_CENTER"
center_name = "TEST_CENTER"

test_upload = true
}
8 changes: 4 additions & 4 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ In addition to the [common parameters](#running-the-pipeline):

| Parameter | Required | Description |
| -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--upload_tpa` | No | Mark assemblies as [third party assemblies (TPA)](#third-party-assemblies-tpa) when required. Default: `false`. |
| `--upload_tpa` | No | Mark submission as [third party assemblies (TPA)](#third-party-assemblies-tpa) when required. Default: `false`. |
| `--checkm2_db` | No | Path to a pre-downloaded CheckM2 database. If omitted, downloads the version set by `--checkm2_db_download_id`. Default: `14897628` (Zenodo accession). |
| `--cat_db` | No | Path to a local CAT_pack database. If omitted, builds CAT_pack DB from NCBI non-redundant protein database (`nr`). |

Expand All @@ -366,7 +366,7 @@ nextflow run nf-core/seqsubmit \
--mode mags \
--input samplesheet_genomes.csv \
--submission_study <your_study> \
--centre_name <your_centre> \
--center_name <your_organisation> \
--webincli_mode submit \
--test_upload \
--outdir mags_submission/
Expand Down Expand Up @@ -403,7 +403,7 @@ nextflow run nf-core/seqsubmit \
-profile <docker/singularity/...> \
--mode <mags|bins|metagenomic_assemblies|reads> \
--input <samplesheet.csv> \
--centre_name <your_centre> \
--center_name <your_organisation> \
--submission_study <your_study> \
--outdir <outdir>
```
Expand All @@ -416,7 +416,7 @@ Parameters common to all modes:
| `--input` | Yes | Path to samplesheet describing the data to be submitted (supported formats: csv, tsv, yaml, yml, json). Columns/fields depend on the pipeline mode. See [usage docs](https://nf-co.re/seqsubmit/usage#samplesheet-input). |
| `--outdir` | Yes | Path to the output directory for pipeline results. You have to use absolute paths to storage on Cloud infrastructure. |
| `--submission_study` OR `--study_metadata` | Yes (one of) | ENA study accession (PRJ/ERP) to submit the data to OR metadata file in JSON/TSV/CSV format to register a new study. |
| `--centre_name` | Yes | Name of the submitter's organisation (mandatory for broker accounts). |
| `--center_name` | Yes | Name of the submitter's organisation (mandatory for broker accounts). |
| `--test_upload` | No | Submit to the ENA TEST server instead of the LIVE server. Use that flag for development purposes or for validation of your submissions. Submission would be done to TEST ENA server instead of LIVE server. TEST server holds data 24h and removes afterwords. LIVE server does not have option to modify your submission, you can only suppress data and re-upload. Default: `true`. |
| `--webincli_mode` | No | Webin-CLI mode for ENA interaction: `submit` uploads data, `validate` performs validation only. `validate` mode checks correctness of manifest files, data access and validity. `submit` mode does validation and push data to ENA server. Default: `submit`. |
| `--is_private` | No | Use if you are referencing private data accessions in your submission. Set to true when the referenced project/reads/assembly are still private in ENA, so metadata is fetched via authenticated access. Does NOT affect the privacy of your own submission, use --release_date for that. Default: `false`. |
Expand Down
8 changes: 5 additions & 3 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ workflow NFCORE_SEQSUBMIT {
params.checkm2_db,
params.checkm2_db_download_id,
params.cat_db,
params.centre_name,
params.center_name,
params.upload_tpa,
params.test_upload,
params.webincli_mode,
Expand All @@ -76,7 +76,8 @@ workflow NFCORE_SEQSUBMIT {
params.test_upload,
params.webincli_mode,
params.is_private,
params.release_date ? channel.value(params.release_date): channel.value(false)
params.release_date ? channel.value(params.release_date): channel.value(false),
params.center_name
)
ch_multiqc_report = ASSEMBLYSUBMIT.out.multiqc_report
} else if (params.mode == "reads") {
Expand All @@ -90,7 +91,8 @@ workflow NFCORE_SEQSUBMIT {
params.study_metadata,
params.test_upload,
params.webincli_mode,
params.release_date ? channel.value(params.release_date): channel.value(false)
params.release_date ? channel.value(params.release_date): channel.value(false),
params.center_name
)
ch_multiqc_report = READSUBMIT.out.multiqc_report
}
Expand Down
Loading
Loading