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
1 change: 1 addition & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ process {
//

withName: 'GENOME_UPLOAD' {
ext.args = "--force" // ensures that ENA metadata is re-downloaded even if cache exists
publishDir = [
path: { "${params.outdir}/${params.mode}/upload/manifests" },
mode: params.publish_dir_mode,
Expand Down
6 changes: 4 additions & 2 deletions modules/local/count_rna/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ process COUNT_RNA {

input:
tuple val(meta), path(trnas_stats), path(rrna_gff)
val min_trna_count
val min_rrna_percentage

output:
tuple val(meta), path("*rna_decision.tsv"), emit: rna_decision
Expand All @@ -22,8 +24,8 @@ process COUNT_RNA {
--trna ${trnas_stats} \\
--rrna ${rrna_gff} \\
--name ${meta.id} \\
--trna-limit ${params.trna_limit} \\
--rrna-limit ${params.rrna_limit} \\
--trna-limit ${min_trna_count} \\
--rrna-limit ${min_rrna_percentage} \\
--output ${meta.id}_rna_decision.tsv

cat <<-END_VERSIONS > versions.yml
Expand Down
6 changes: 6 additions & 0 deletions modules/local/count_rna/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ input:
type: file
description: rRNA annotation file from barrnap (GFF3 format)
pattern: "*.gff"
- min_trna_count:
type: value
description: Minimum required number of tRNA genes.
- min_rrna_percentage:
type: value
description: Minimum required percentage coverage for each rRNA subunit.

output:
- meta:
Expand Down
4 changes: 4 additions & 0 deletions modules/local/count_rna/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ nextflow_process {
file("$moduleDir/tests/data/ecoli.stats", checkIfExists: true),
file("$moduleDir/tests/data/ecoli_bac.gff", checkIfExists: true)
]
input[1] = 18
input[2] = 80
"""
}
}
Expand Down Expand Up @@ -49,6 +51,8 @@ nextflow_process {
file("$moduleDir/tests/data/ecoli.stats", checkIfExists: true),
file("$moduleDir/tests/data/ecoli_bac.gff", checkIfExists: true)
]
input[1] = 18
input[2] = 80
"""
}
}
Expand Down
10 changes: 6 additions & 4 deletions modules/local/ena_webin_cli_wrapper/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ process ENA_WEBIN_CLI_WRAPPER {
input:
tuple val(meta), path(submission_item), path(manifest)
path(webin_cli_jar)
val test_upload
val webincli_submit

output:
tuple val(meta), path("*_accessions.tsv"), emit: accessions
path "versions.yml", emit: versions

script:
def args = task.ext.args ?: ""
def prefix = task.ext.prefix ?: "${meta.id}"
def test_flag = params.test_upload ? "--test" : ""
def submit_or_validate = params.webincli_submit ? "--mode submit": "--mode validate"
def args = task.ext.args ?: ""
def prefix = task.ext.prefix ?: "${meta.id}"
def test_flag = test_upload ? "--test" : ""
def submit_or_validate = webincli_submit ? "--mode submit": "--mode validate"

"""
# change FASTA path in manifest to current workdir
Expand Down
35 changes: 24 additions & 11 deletions modules/local/ena_webin_cli_wrapper/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,32 @@ input:
type: file
description: |
The Webin-CLI JAR file downloaded by ena_webin_cli_download.
pattern: "webin-cli-*.jar"
pattern: "webin-cli-*.jar"
- - test_upload:
type: value
description: Whether to run ENA Webin-CLI in test mode.
- - webincli_submit:
type: value
description: Whether to submit (`true`) or only validate (`false`).

output:
- - accessions:
type: file
description: |
TSV file containing the accession assigned by ENA for the submitted item.
File has two columns: "alias" and "accession".
- - versions:
- "versions.yml":
type: file
description: File containing software versions.
pattern: "versions.yml"
- accessions:
- meta:
type: map
description: |
Groovy Map containing sample information.
e.g. `[ id:'sample1' ]`
- "*_accessions.tsv":
type: file
description: |
TSV file containing the accession assigned by ENA for the submitted item.
File has two columns: "alias" and "accession".
pattern: "*_accessions.tsv"
- versions:
- "versions.yml":
type: file
description: File containing software versions.
pattern: "versions.yml"

authors:
- "@KateSakharova"
Expand Down
3 changes: 2 additions & 1 deletion modules/local/generate_assembly_manifest/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ process GENERATE_ASSEMBLY_MANIFEST {
input:
tuple val(meta), path(assembly_fasta), path(data_csv)
val(assembly_study)
val(is_tpa)

output:
tuple val(meta), path("${assembly_study}_upload/*.manifest") , emit: manifest
Expand All @@ -18,7 +19,7 @@ process GENERATE_ASSEMBLY_MANIFEST {
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def tpa = params.upload_tpa ? "--tpa" : ""
def tpa = is_tpa ? "--tpa" : ""
"""
assembly_manifest \\
--study ${assembly_study} \\
Expand Down
3 changes: 3 additions & 0 deletions modules/local/generate_assembly_manifest/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ input:
description: |
Pre-existing study ID to submit to if available.
Must exist in the webin account.
- is_tpa:
type: value
description: Whether assembly being submitted is a TPA (Third Party Annotation).

output:
- meta:
Expand Down
2 changes: 2 additions & 0 deletions modules/local/generate_assembly_manifest/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ nextflow_process {
file(params.pipelines_testdata_base_path + "/samplesheets/samplesheet_generatemanifest.csv", checkIfExists: true)
]
input[1] = "PRJ12345"
input[2] = false
"""

}
Expand Down Expand Up @@ -62,6 +63,7 @@ nextflow_process {
file('test_samplesheet_generatemanifest.csv')
]
input[1] = "PRJ12345"
input[2] = false
"""
}
}
Expand Down
15 changes: 8 additions & 7 deletions modules/local/genome_upload/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ process GENOME_UPLOAD {
path(table_for_upload)
val(mags_or_bins_flag)
val(submission_study)
val(centre_name)
val(is_tpa)
val(test_upload)

output:
path "results/{MAG,bin}_upload/manifests*/*.manifest" , emit: manifests
Expand All @@ -22,19 +25,17 @@ process GENOME_UPLOAD {
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def tpa = params.upload_tpa ? "--tpa" : ""
def force = params.upload_force ? "--force" : ""
def mode = (!params.test_upload) ? "--live" : ""
def args = task.ext.args ?: ''
def tpa = is_tpa ? "--tpa" : ""
def mode = (!test_upload) ? "--live" : ""

"""
genome_upload \\
-u $submission_study \\
-u ${submission_study} \\
--genome_info ${table_for_upload} \\
--centre_name $params.centre_name \\
--centre_name ${centre_name} \\
--${mags_or_bins_flag} \\
${tpa} \\
${force} \\
${mode} \\
--out results \\
${args}
Expand Down
27 changes: 16 additions & 11 deletions modules/local/genome_upload/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ tools:
documentation: https://github.com/EBI-Metagenomics/genome_uploader
licence: ["Apache License"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information.
e.g. [ id:'test', single_end:false ]
- table_for_upload:
type: file
description: |
Expand All @@ -26,16 +21,26 @@ input:
type: file
description: File in FASTA format containing targeted mag/bin/assembly for submission
pattern: "*.{fasta,fna,fas,fa}*"
- mags_or_bins_flag:
type: value
description: Upload mode selector. Expected values are `mags` or `bins`.
- submission_study:
type: value
description: ENA study accession used for submission.
- centre_name:
type: value
description: Submitting centre name required by ENA.
- is_tpa:
type: value
description: Whether genomes are submitted as TPA (Third Party Annotation).
- test_upload:
type: value
description: Whether to run in ENA test mode.

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- manifests:
type: file
description: Maniseft file required for submission with webin-cli
description: Manifest file required for submission with webin-cli
pattern: "*.manifest"
- ena_upload_backup_json:
type: file
Expand Down
2 changes: 0 additions & 2 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ params {
submission_study = null
centre_name = null
upload_tpa = false
// TODO: remove this parameter because it will never be used, and update the genome_uploader module accordingly
upload_force = true
test_upload = true
webincli_submit = true
webin_cli_version = "9.0.3"
Expand Down
8 changes: 1 addition & 7 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,6 @@
"default": true,
"help": "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"
},
"upload_force": {
"type": "boolean",
"description": "Enables force mode for genome_uploader (used for MAGs/BINs submission)",
"default": true,
"help": "Forces reset of bin/MAG sample xmls generation. This is useful if you changed something in your tsv table, or if ENA metadata haven't been downloaded correctly (you can check this in ENA_backup.json). Default: true"
},
"submission_study": {
"type": "string",
"description": "ENA study accession (PRJ/ERP) to submit the data to",
Expand All @@ -319,7 +313,7 @@
},
"webin_cli_version": {
"type": "string",
"description": "Version of webon-cli.jar to use for submission",
"description": "Version of webin-cli.jar to use for submission",
"default": "9.0.3",
"help": "Check version https://github.com/enasequence/webin-cli"
}
Expand Down
37 changes: 18 additions & 19 deletions subworkflows/local/genome_evaluation.nf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ include { CHECKM2_PREDICT } from '../../modules/nf-core/checkm2/predict
workflow GENOME_EVALUATION {

take:
ch_fasta // channel: [ val(meta), path(fasta) ]
ch_fasta // channel: [ val(meta), path(fasta) ]
ch_checkm2_db // channel: [ val(meta), path(db) ] - pre-built db as directory
// provide channel.empty() to trigger automatic download via ch_checkm2_db_zenodo_id
ch_checkm2_db_zenodo_id // channel: [ val(meta), val(db_id) ] - db ID for CHECKM2_DATABASEDOWNLOAD (e.g. '1234567')
// only used if ch_checkm2_db is empty

main:
ch_versions = channel.empty()
Expand All @@ -29,32 +33,27 @@ workflow GENOME_EVALUATION {
// Database preparation
//

if (!params.checkm2_db || !file(params.checkm2_db).exists()) {
// Conditional download: only trigger if ch_fasta has items
ch_download_trigger = ch_fasta
.map { _meta, _fasta -> params.checkm2_db_zenodo_id }
.first() // Only need one trigger regardless of how many fasta files
// Download and prepare db from scratch if no pre-built db provided
// Only trigger if ch_fasta has items
ch_download_trigger = ch_checkm2_db
.count()
.filter { count -> count == 0 } // Only proceed if ch_checkm2_db is empty
.combine(ch_fasta.first())
.combine(ch_checkm2_db_zenodo_id)
.map { _count, _meta, _fasta, db_meta, db_id -> [db_meta, db_id] }

CHECKM2_DATABASEDOWNLOAD(ch_download_trigger)
ch_checkm2_db = CHECKM2_DATABASEDOWNLOAD.out.database
}
else {
// Use existing database
ch_checkm2_db = channel.of(
[
[id: "checkm2_db"],
file(params.checkm2_db),
]
)
}
CHECKM2_DATABASEDOWNLOAD(ch_download_trigger)

// Combine db sources - one of these channels will be empty depending on inputs
ch_db = ch_checkm2_db.mix(CHECKM2_DATABASEDOWNLOAD.out.database).first()

//
// Genome evaluation
//

CHECKM2_PREDICT(
ch_fasta,
ch_checkm2_db,
ch_db,
)

emit:
Expand Down
8 changes: 6 additions & 2 deletions subworkflows/local/rna_detection.nf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ include { TRNASCANSE } from '../../modules/nf-core/trnascanse'

workflow RNA_DETECTION {
take:
fasta
fasta // channel: [ val(meta), path(fasta) ]
min_trna_count // val: int - minimum number of tRNAs required to pass MIMAG standard (e.g. 18)
min_rrna_percentage // val: float - minimum percentage of rRNA genes required to pass MIMAG standard (e.g. 75)

main:

Expand All @@ -36,7 +38,9 @@ workflow RNA_DETECTION {
ch_versions = ch_versions.mix( TRNASCANSE.out.versions )

COUNT_RNA(
TRNASCANSE.out.stats.join(BARRNAP.out.gff)
TRNASCANSE.out.stats.join(BARRNAP.out.gff),
min_trna_count,
min_rrna_percentage
)
ch_versions = ch_versions.mix( COUNT_RNA.out.versions )

Expand Down
7 changes: 5 additions & 2 deletions workflows/assemblysubmit.nf
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ workflow ASSEMBLYSUBMIT {
// Generate assembly manifest files and submit them to ENA
GENERATE_ASSEMBLY_MANIFEST(
assemblies_with_coverage.join(assembly_metadata_csv),
study_accession_ch.first()
study_accession_ch.first(),
params.upload_tpa
)

ENA_WEBIN_CLI_DOWNLOAD (
Expand All @@ -174,7 +175,9 @@ workflow ASSEMBLYSUBMIT {

SUBMIT (
assemblies_with_coverage.join(GENERATE_ASSEMBLY_MANIFEST.out.manifest),
ENA_WEBIN_CLI_DOWNLOAD.out.webin_cli_jar
ENA_WEBIN_CLI_DOWNLOAD.out.webin_cli_jar,
params.test_upload,
params.webincli_submit
)

//
Expand Down
Loading
Loading