diff --git a/README.md b/README.md index e3e201a..f94503b 100644 --- a/README.md +++ b/README.md @@ -21,14 +21,6 @@ ## Introduction -**nf-core/seqsubmit** is a Nextflow pipeline for submitting sequence data to [ENA](https://www.ebi.ac.uk/ena/browser/home). -Currently, the pipeline supports four submission modes, each routed to a dedicated workflow and requiring its own input samplesheet structure: - -- `mags` for Metagenome Assembled Genomes (MAGs) submission with `GENOMESUBMIT` workflow -- `bins` for bins submission with `GENOMESUBMIT` workflow -- `metagenomic_assemblies` for assembly submission with `ASSEMBLYSUBMIT` workflow -- `reads` for raw sequencing reads submission with `READSUBMIT` workflow - ![seqsubmit workflow diagram](docs/images/seqsubmit_schema.png) **nf-core/seqsubmit** is a Nextflow pipeline for submitting sequence data to [ENA](https://www.ebi.ac.uk/ena/browser/home). @@ -68,7 +60,7 @@ Each workflow has its own samplesheet structure, prerequisites, and limitations Example: ```csv -sample,sample_accession,fastq_1,fastq_2,platform,instrument,library_source,library_selection,library_strategy,insert_size,library_name,description +id,sample_accession,fastq_1,fastq_2,platform,instrument,library_source,library_selection,library_strategy,insert_size,library_name,description illumina_run_001,SAMEA1234567,data/reads_R1.fastq.gz,data/reads_R2.fastq.gz,ILLUMINA,Illumina HiSeq 2000,GENOMIC,RANDOM,WGS,500,HiSeq_library_001,Illumina sequencing of sample XYZ ``` @@ -79,7 +71,7 @@ See the [`reads` mode section](docs/usage.md#samplesheet-input) of the usage doc Example: ```csv -sample,fasta,fastq_1,fastq_2,coverage,run_accession,assembler,assembler_version +id,fasta,fastq_1,fastq_2,coverage,run_accession,assembler,assembler_version assembly_1,data/contigs_1.fasta.gz,data/reads_1.fastq.gz,data/reads_2.fastq.gz,,ERR011322,SPAdes,3.15.5 assembly_2,data/contigs_2.fasta.gz,,,42.7,ERR011323,MEGAHIT,1.2.9 ``` @@ -91,8 +83,8 @@ See the [`metagenomic_assemblies` mode section](docs/usage.md#samplesheet-input- Example: ```csv -sample,fasta,accession,fastq_1,fastq_2,assembly_software,binning_software,binning_parameters,stats_generation_software,completeness,contamination,genome_coverage,metagenome,co-assembly,broad_environment,local_environment,environmental_medium,RNA_presence,NCBI_lineage -lachnospira_eligens,data/bin_lachnospira_eligens.fa.gz,SRR24458089,,,spades_v3.15.5,metabat2_v2.6,default,CheckM2_v1.0.1,61.0,0.21,32.07,sediment metagenome,No,marine,cable_bacteria,marine_sediment,No,d__Bacteria;p__Proteobacteria;s__unclassified_Proteobacteria +id,fasta,accession,fastq_1,fastq_2,assembly_software,binning_software,binning_parameters,stats_generation_software,completeness,contamination,genome_coverage,metagenome,co-assembly,broad_environment,local_environment,environmental_medium,RNA_presence,NCBI_lineage +lachnospira_eligens,data/bin_lachnospira_eligens.fa.gz,SRR24458089,,,spades_v3.15.5,metabat2_v2.6,default,CheckM2_v1.0.1,61.0,0.21,32.07,sediment metagenome,false,marine,cable_bacteria,marine_sediment,false,d__Bacteria;p__Proteobacteria;s__unclassified_Proteobacteria ``` See the [`mags` and `bins` modes section](docs/usage.md#samplesheet-input-2) of the usage documentation for the full list of required and optional columns. diff --git a/assets/multiqc_config.yml b/assets/multiqc_config.yml index eb16eaf..5df001f 100644 --- a/assets/multiqc_config.yml +++ b/assets/multiqc_config.yml @@ -28,7 +28,7 @@ sp: genome_metadata: fn_re: ".*genomes_metadata.tsv$" sample_registration: - fn_re: '.*registered\.*\.tsv$' + fn_re: '.*registered.*\.tsv$' submission_results_genomes: fn_re: 'genomes_accessions\.tsv$' submission_results_assemblies: diff --git a/assets/schema_input_assembly.json b/assets/schema_input_assembly.json index 6123501..4a767ca 100644 --- a/assets/schema_input_assembly.json +++ b/assets/schema_input_assembly.json @@ -7,10 +7,11 @@ "items": { "type": "object", "properties": { - "sample": { + "id": { "type": "string", "pattern": "^\\S+$", - "errorMessage": "Sample must be provided and cannot contain spaces", + "description": "Unique assembly identifier", + "errorMessage": "ID must be provided and cannot contain spaces", "meta": ["id"] }, "fasta": { @@ -50,6 +51,7 @@ "maxLength": 0 } ], + "default": null, "errorMessage": "FASTQ file for reverse reads must have extension '.fq' or '.fastq' (optionally gzipped)", "description": "Reverse reads FASTQ file if paired-end. Leave empty for single-end reads" }, @@ -57,36 +59,41 @@ "anyOf": [ { "type": "number", - "minimum": 0 + "exclusiveMinimum": 0 }, { "type": "string", "maxLength": 0 } ], + "default": null, "errorMessage": "Coverage must be a positive number or empty", - "description": "Estimated value of assembly coverage" + "description": "Estimated value of assembly coverage", + "meta": ["coverage"] }, "run_accession": { "type": "string", "pattern": "^\\S+$", "errorMessage": "Accession must be provided and cannot contain spaces", - "description": "Accession of the run used to generate the assembly" + "description": "Accession of the run used to generate the assembly", + "meta": ["run_accession"] }, "assembler": { "type": "string", "pattern": "^\\S+$", "errorMessage": "Assembler must be provided and cannot contain spaces", - "description": "Name of the assembler software used to generate the assembly, e.g. MEGAHIT, SPAdes, metaSPAdes, Flye, etc" + "description": "Name of the assembler software used to generate the assembly, e.g. MEGAHIT, SPAdes, metaSPAdes, Flye, etc", + "meta": ["assembler"] }, "assembler_version": { "anyOf": [{ "type": "string" }, { "type": "number" }], "pattern": "^\\S+$", "errorMessage": "Assembler version must be provided and cannot contain spaces", - "description": "Version of the assembler software used to generate the assembly, e.g 1.0.0" + "description": "Version of the assembler software used to generate the assembly, e.g 1.0.0", + "meta": ["assembler_version"] } }, - "required": ["sample", "fasta", "run_accession", "assembler", "assembler_version"], + "required": ["id", "fasta", "run_accession", "assembler", "assembler_version"], "anyOf": [ { "properties": { @@ -101,7 +108,7 @@ "properties": { "coverage": { "type": "number", - "minimum": 0 + "exclusiveMinimum": 0 } }, "required": ["coverage"] diff --git a/assets/schema_input_genome.json b/assets/schema_input_genome.json index a603b2c..28c4d69 100644 --- a/assets/schema_input_genome.json +++ b/assets/schema_input_genome.json @@ -7,10 +7,11 @@ "items": { "type": "object", "properties": { - "sample": { + "id": { "type": "string", "pattern": "^\\S+$", - "errorMessage": "Sample name must be provided and cannot contain spaces", + "description": "Unique mag/bin identifier", + "errorMessage": "ID must be provided and cannot contain spaces", "meta": ["id"] }, "fasta": { @@ -23,7 +24,8 @@ }, "accession": { "type": "string", - "description": "Run or assembly ENA accession" + "description": "Run or assembly ENA accession", + "meta": ["accession"] }, "fastq_1": { "anyOf": [ @@ -38,6 +40,7 @@ "maxLength": 0 } ], + "default": null, "errorMessage": "FASTQ file must have extension '.fq' or '.fastq' (optionally gzipped)", "description": "Forward reads if paired-end or single-end reads FASTQ file" }, @@ -54,74 +57,126 @@ "maxLength": 0 } ], + "default": null, "errorMessage": "FASTQ file for reverse reads must have extension '.fq' or '.fastq' (optionally gzipped)", "description": "Reverse reads FASTQ file if paired-end. Leave empty for single-end reads" }, "assembly_software": { "type": "string", - "description": "Tool name and version that was used to assemble data, e.g. MEGAHIT_v1.0, SPAdes_v4.0.0, metaSPAdes_v3.15.0" + "description": "Tool name and version that was used to assemble data, e.g. MEGAHIT_v1.0, SPAdes_v4.0.0, metaSPAdes_v3.15.0", + "meta": ["assembly_software"] }, "binning_software": { "type": "string", - "description": "Tool name and version that was used to bin data, e.g. MetaBAT2, VAMB, MaxBin2, CONCOCT, SemiBin2, COMEBin, etc" + "description": "Tool name and version that was used to bin data, e.g. MetaBAT2, VAMB, MaxBin2, CONCOCT, SemiBin2, COMEBin, etc", + "meta": ["binning_software"] }, "binning_parameters": { "type": "string", - "description": "Arguments used to bin data different from default, e.g. -min_contig_length 1000" + "description": "Arguments used to bin data different from default, e.g. -min_contig_length 1000", + "meta": ["binning_parameters"] }, "stats_generation_software": { "type": "string", - "description": "Tool(s) used to estimate completeness and contamination" + "default": null, + "description": "Tool(s) used to estimate completeness and contamination", + "meta": ["stats_generation_software"] }, "completeness": { - "type": "number", + "anyOf": [ + { + "type": "number", + "minimum": 0, + "maximum": 100 + }, + { + "type": "string", + "maxLength": 0 + } + ], + "default": null, "description": "MAG/bin completeness score: the ratio of observed single-copy marker genes to total single-copy marker genes in chosen marker gene set (%). ENA docs: https://ena-docs.readthedocs.io/en/latest/faq/metagenomes.html#how-is-the-quality-of-a-metagenomic-assembly-defined", - "exclusiveMinimum": 0, - "exclusiveMaximum": 100 + "meta": ["completeness"] }, "contamination": { - "type": "number", + "anyOf": [ + { + "type": "number", + "minimum": 0, + "maximum": 100 + }, + { + "type": "string", + "maxLength": 0 + } + ], + "default": null, "description": "MAG/bin contamination score: the ratio of observed single-copy marker genes in ≥2 copies to total single-copy marker genes in chosen marker gene set (%). ENA docs: https://ena-docs.readthedocs.io/en/latest/faq/metagenomes.html#how-is-the-quality-of-a-metagenomic-assembly-defined", - "exclusiveMinimum": 0, - "exclusiveMaximum": 100 + "meta": ["contamination"] }, "genome_coverage": { - "type": "number", - "description": "MAG/bin coverage value" + "anyOf": [ + { + "type": "number", + "exclusiveMinimum": 0 + }, + { + "type": "string", + "maxLength": 0 + } + ], + "default": null, + "description": "MAG/bin coverage value", + "meta": ["genome_coverage"] }, "metagenome": { "type": "string", - "description": "ENA accepted metagenome name. It needs to be listed in the taxonomy tree https://www.ebi.ac.uk/ena/browser/view/408169?show=tax-tree (you might need to press \"Tax tree - Show\" in the right most section of the page). Full list can also be found https://github.com/EBI-Metagenomics/genome_uploader/blob/main/genomeuploader/constants.py#L22" + "description": "ENA accepted metagenome name. It needs to be listed in the taxonomy tree https://www.ebi.ac.uk/ena/browser/view/408169?show=tax-tree (you might need to press \"Tax tree - Show\" in the right most section of the page). Full list can also be found https://github.com/EBI-Metagenomics/genome_uploader/blob/main/genomeuploader/constants.py#L22", + "meta": ["metagenome"] }, "co-assembly": { - "type": "string", - "description": "'Yes' if data was co-assembled, 'No' otherwise. Options: 'Yes' or 'No'", - "enum": ["Yes", "No"] + "type": "boolean", + "description": "'true' if data was co-assembled, 'false' otherwise", + "meta": ["co_assembly"] }, "broad_environment": { "type": "string", - "description": "Broad ecological context of the sample, for example 'marine biome', 'desert biome'. It is recommended to use subclasses of EnvO 'biome' class (http://purl.obolibrary.org/obo/ENVO_00000428). Documentation: https://github.com/EnvironmentOntology/envo/wiki/Using-ENVO-with-MIxS" + "description": "Broad ecological context of the sample, for example 'marine biome', 'desert biome'. It is recommended to use subclasses of EnvO 'biome' class (http://purl.obolibrary.org/obo/ENVO_00000428). Documentation: https://github.com/EnvironmentOntology/envo/wiki/Using-ENVO-with-MIxS", + "meta": ["broad_environment"] }, "local_environment": { "type": "string", - "description": "Local environmental context of the sample, for example 'tropical dry broadleaf forest biome', 'marine abyssal zone biome'. It is recommended to use EnvO terms which are of smaller spatial grain than your entry for \"broad-scale environmental context\". Documentation: https://github.com/EnvironmentOntology/envo/wiki/Using-ENVO-with-MIxS" + "description": "Local environmental context of the sample, for example 'tropical dry broadleaf forest biome', 'marine abyssal zone biome'. It is recommended to use EnvO terms which are of smaller spatial grain than your entry for \"broad-scale environmental context\". Documentation: https://github.com/EnvironmentOntology/envo/wiki/Using-ENVO-with-MIxS", + "meta": ["local_environment"] }, "environmental_medium": { "type": "string", - "description": "Material displaced by the sample, or the material in which the sample was embedded before sampling, for example 'mucus', 'lake water'. It is recommended to use subclasses of EnvO 'environmental material' class (http://purl.obolibrary.org/obo/ENVO_00010483). Documentation: https://github.com/EnvironmentOntology/envo/wiki/Using-ENVO-with-MIxS" + "description": "Material displaced by the sample, or the material in which the sample was embedded before sampling, for example 'mucus', 'lake water'. It is recommended to use subclasses of EnvO 'environmental material' class (http://purl.obolibrary.org/obo/ENVO_00010483). Documentation: https://github.com/EnvironmentOntology/envo/wiki/Using-ENVO-with-MIxS", + "meta": ["environmental_medium"] }, "RNA_presence": { - "type": "string", - "description": "Presence or absence of the 23S, 16S, and 5S rRNA genes and at least 18 tRNAs. This is used for MISAG/MIMAG assembly quality classification. Options: 'Yes' or 'No'.", - "enum": ["Yes", "No"] + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "string", + "maxLength": 0 + } + ], + "default": null, + "description": "Presence or absence of the 23S, 16S, and 5S rRNA genes and at least 18 tRNAs. This is used for MISAG/MIMAG assembly quality classification. Options: true/false", + "meta": ["RNA_presence"] }, "NCBI_lineage": { "type": "string", - "description": "full NCBI lineage - format: x;y;z. For example, the lineage for E. coli can be: 'Bacteria;Pseudomonadati;Pseudomonadota;Gammaproteobacteria;Enterobacterales;Enterobacteriaceae;Escherichia' or '2;1224;1236;91347;543;561;562'. For more info check https://www.ncbi.nlm.nih.gov/datasets/docs/v2/data-processing/taxonomy-processing/taxonomy/" + "default": null, + "description": "Full NCBI lineage - format: x;y;z. For example, the lineage for E. coli can be: 'Bacteria;Pseudomonadati;Pseudomonadota;Gammaproteobacteria;Enterobacterales;Enterobacteriaceae;Escherichia' or '2;1224;1236;91347;543;561;562'. For more info check https://www.ncbi.nlm.nih.gov/datasets/docs/v2/data-processing/taxonomy-processing/taxonomy/", + "meta": ["NCBI_lineage"] } }, "required": [ - "sample", + "id", "fasta", "accession", "assembly_software", @@ -147,7 +202,7 @@ "properties": { "genome_coverage": { "type": "number", - "minimum": 0 + "exclusiveMinimum": 0 } }, "required": ["genome_coverage"] diff --git a/assets/schema_input_reads.json b/assets/schema_input_reads.json index 25dfb31..e39c89e 100644 --- a/assets/schema_input_reads.json +++ b/assets/schema_input_reads.json @@ -7,10 +7,10 @@ "items": { "type": "object", "properties": { - "sample": { + "id": { "type": "string", "pattern": "^\\S+$", - "errorMessage": "Sample must be provided and cannot contain spaces", + "errorMessage": "ID must be provided and cannot contain spaces", "meta": ["id"], "description": "Unique experiment/run name" }, @@ -18,7 +18,8 @@ "type": "string", "pattern": "^\\S+$", "errorMessage": "Sample accession must be provided and cannot contain spaces", - "description": "ENA sample accession of the sample used to generate the reads" + "description": "ENA sample accession of the sample used to generate the reads", + "meta": ["sample_accession"] }, "fastq_1": { "type": "string", @@ -41,6 +42,7 @@ "maxLength": 0 } ], + "default": null, "errorMessage": "FASTQ file for reverse reads must have extension '.fq' or '.fastq' (optionally gzipped)", "description": "Reverse reads FASTQ file if paired-end. Leave empty for single-end reads" }, @@ -63,13 +65,15 @@ "ULTIMA", "VELA_DIAGNOSTICS" ], - "description": "Sequencing platform. Must be one of the ENA controlled vocabulary values listed in the enum." + "description": "Sequencing platform. Must be one of the ENA controlled vocabulary values listed in the enum.", + "meta": ["platform"] }, "instrument": { "type": "string", "pattern": "^[^\\n]+$", "errorMessage": "Instrument must be provided and cannot span multiple lines", - "description": "Sequencer model (e.g., 'Illumina HiSeq 2000', 'PacBio Sequel')" + "description": "Sequencer model (e.g., 'Illumina HiSeq 2000', 'PacBio Sequel')", + "meta": ["instrument"] }, "library_source": { "type": "string", @@ -84,7 +88,8 @@ "VIRAL RNA", "OTHER" ], - "description": "Library source. Must be one of the ENA controlled vocabulary values listed in the enum." + "description": "Library source. Must be one of the ENA controlled vocabulary values listed in the enum.", + "meta": ["library_source"] }, "library_selection": { "type": "string", @@ -121,7 +126,8 @@ "other", "unspecified" ], - "description": "Library selection. Must be one of the ENA controlled vocabulary values listed in the enum." + "description": "Library selection. Must be one of the allowed ENA controlled vocabulary values (e.g. PCR, ChIP-Seq, other, etc).", + "meta": ["library_selection"] }, "library_strategy": { "type": "string", @@ -168,7 +174,8 @@ "Tethered Chromatin Conformation Capture", "OTHER" ], - "description": "Library strategy. Must be one of the ENA controlled vocabulary values listed in the enum." + "description": "Library strategy. Must be one of the ENA controlled vocabulary values listed in the enum.", + "meta": ["library_strategy"] }, "insert_size": { "anyOf": [ @@ -182,7 +189,8 @@ } ], "errorMessage": "Insert size must be a positive number or empty", - "description": "Fragment/insert size for paired-end reads (optional)" + "description": "Fragment/insert size for paired-end reads (optional)", + "meta": ["insert_size"] }, "library_name": { "anyOf": [ @@ -194,7 +202,8 @@ "maxLength": 0 } ], - "description": "Descriptive library name (optional)" + "description": "Descriptive library name (optional)", + "meta": ["library_name"] }, "description": { "anyOf": [ @@ -206,11 +215,12 @@ "maxLength": 0 } ], - "description": "Free-text description of the experiment (optional)" + "description": "Free-text description of the experiment (optional)", + "meta": ["description"] } }, "required": [ - "sample", + "id", "sample_accession", "fastq_1", "platform", diff --git a/bin/count_rna.py b/bin/count_rna.py index a514d37..8f34011 100755 --- a/bin/count_rna.py +++ b/bin/count_rna.py @@ -151,7 +151,7 @@ def main(): logging.info(f"Found {rrna_count} rRNA subunit types in total") # rrna_count should be 3 to make sure all 3 rRNA genes are present - decision = "Yes" if trna_count >= args.trna_limit and rrna_count == 3 else "No" + decision = "True" if trna_count >= args.trna_limit and rrna_count == 3 else "False" logging.info(f"RNA presented: {decision}") with open(args.output, 'w') as file_out: diff --git a/conf/containers_docker_arm64.config b/conf/containers_docker_arm64.config index 369f743..11a7ab9 100644 --- a/conf/containers_docker_arm64.config +++ b/conf/containers_docker_arm64.config @@ -1 +1,2 @@ +process { withName: 'FALINT' { container = 'community.wave.seqera.io/library/fa-lint:1.2.0--9dec293ee366e2bd' } } process { withName: 'MULTIQC' { container = 'community.wave.seqera.io/library/multiqc:1.35--5c84a5000a226ab5' } } diff --git a/docs/methods.md b/docs/methods.md index 67e5488..567e19a 100644 --- a/docs/methods.md +++ b/docs/methods.md @@ -108,10 +108,10 @@ The total number of predicted tRNAs is compared against `params.trna_limit`. The The final decision stored in `RNA_presence` is: -- `Yes` when at least 18 tRNAs are detected and all three required rRNA subunits pass the recovery threshold -- `No` otherwise +- `True` when at least 18 tRNAs are detected and all three required rRNA subunits pass the recovery threshold +- `False` otherwise -The final `Yes`/`No` decision is then merged back into the submission metadata. +The final `True`/`False` decision is then merged back into the submission metadata. ### Genome coverage calculation diff --git a/docs/usage.md b/docs/usage.md index ea3a386..353a906 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -156,17 +156,14 @@ You will need to create a samplesheet with information about the raw reads you w Example: ```csv title="samplesheet_reads.csv" -sample,sample_accession,fastq_1,fastq_2,platform,instrument,library_source,library_selection,library_strategy,insert_size,library_name,description +id,sample_accession,fastq_1,fastq_2,platform,instrument,library_source,library_selection,library_strategy,insert_size,library_name,description illumina_run_001,SAMEA1234567,data/reads_R1.fastq.gz,data/reads_R2.fastq.gz,ILLUMINA,Illumina HiSeq 2000,GENOMIC,RANDOM,WGS,500,HiSeq_library_001,Illumina sequencing of sample XYZ pacbio_run_001,SAMEA7654321,data/pacbio_reads.fastq.gz,,PACBIO_SMRT,PacBio Sequel,GENOMIC,RANDOM,WGS,,PacBio_library_002,Long-read sequencing ``` -> [!IMPORTANT] -> **Samplesheet column requirements**: All columns shown in the example above must be present in your samplesheet, even if some values are empty. Columns must be in exactly the same order as shown. - | Column | Required | Description | | ------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `sample` | Yes | Unique identifier of this particular data entry. Used as an experiment name. | +| `id` | Yes | Unique identifier of this particular data entry. Used as an experiment name. | | `sample_accession` | Yes | ENA sample accession (starting with SAMEA) of the sample used to generate raw reads. | | `fastq_1` | Yes | Path to forward reads in FASTQ format (optionally gzipped). | | `fastq_2` | No | Path to reverse reads for paired-end data. Leave empty for single-end reads. | @@ -217,17 +214,14 @@ You will need to create a samplesheet with information about the metagenomic ass Example: ```csv title="samplesheet_assembly.csv" -sample,fasta,fastq_1,fastq_2,coverage,run_accession,assembler,assembler_version +id,fasta,fastq_1,fastq_2,coverage,run_accession,assembler,assembler_version assembly_001,data/assembly_001.fasta.gz,data/assembly_001_R1.fastq.gz,data/assembly_001_R2.fastq.gz,,ERR011322,SPAdes,3.15.5 assembly_002,data/assembly_002.fasta.gz,,,42.7,ERR011323,MEGAHIT,1.2.9 ``` -> [!IMPORTANT] -> **Samplesheet column requirements**: All columns shown in the example above must be present in your samplesheet, even if some values are empty. Columns must be in exactly the same order as shown. - | Column | Required | Description | | ------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -| `sample` | Yes | A unique identifier for this data entry. Must be globally unique within the input dataset. | +| `id` | Yes | A unique identifier for this data entry. Must be globally unique within the input dataset. | | `fasta` | Yes | Path to assembly contigs in FASTA format compressed with `gzip`. | | `fastq_1` | Conditional | Path to the read file in FASTQ format used to generate the metagenomic assembly. Required if `coverage` is not provided. | | `fastq_2` | No | Path to the second read file in FASTQ format for paired-end data used to generate the source metagenomic assembly. Leave empty for single-end reads. | @@ -299,16 +293,13 @@ You will need to create a samplesheet with information about the MAGs/bins you w Example: ```csv title="samplesheet_genomes.csv" -sample,fasta,accession,fastq_1,fastq_2,assembly_software,binning_software,binning_parameters,stats_generation_software,completeness,contamination,genome_coverage,metagenome,co-assembly,broad_environment,local_environment,environmental_medium,RNA_presence,NCBI_lineage -mag_001,data/mag_001.fasta.gz,SRR24458089,,,SPAdes 3.15.5,MetaBAT2 2.15,default,CheckM2 1.0.1,92.81,1.09,66.04,sediment metagenome,No,marine,cable bacteria,marine sediment,No,d__Bacteria;p__Proteobacteria;s__ +id,fasta,accession,fastq_1,fastq_2,assembly_software,binning_software,binning_parameters,stats_generation_software,completeness,contamination,genome_coverage,metagenome,co-assembly,broad_environment,local_environment,environmental_medium,RNA_presence,NCBI_lineage +mag_001,data/mag_001.fasta.gz,SRR24458089,,,SPAdes 3.15.5,MetaBAT2 2.15,default,CheckM2 1.0.1,92.81,1.09,66.04,sediment metagenome,false,marine,cable bacteria,marine sediment,false,d__Bacteria;p__Proteobacteria;s__ ``` -> [!IMPORTANT] -> **Samplesheet column requirements**: All columns shown in the example above must be present in your samplesheet, even if some values are empty. Columns must be in exactly the same order as shown. - | Column | Required | Description | | --------------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `sample` | Yes | A unique identifier for this data entry. Must be globally unique within the input dataset. | +| `id` | Yes | A unique identifier for this data entry. Must be globally unique within the input dataset. | | `fasta` | Yes | Path to MAG/bin contigs in FASTA format compressed with `gzip`. All names of the FASTA files must be unique to prevent pipeline errors. | | `accession` | Yes | ENA accession of the run or metagenomic assembly used to generate the MAG/bin. | | `fastq_1` | Conditional | Path to the read file in FASTQ format used to generate the source metagenomic assembly. Required if `genome_coverage` is not provided. | @@ -321,11 +312,11 @@ mag_001,data/mag_001.fasta.gz,SRR24458089,,,SPAdes 3.15.5,MetaBAT2 2.15,default, | `contamination` | No | Genome contamination value. | | `genome_coverage` | Conditional | Estimated average sequencing depth across the genome. If the value is missing, it is computed automatically during pipeline execution when reads are provided. | | `metagenome` | Yes | Registered metagenome taxonomic identifier or name that matches an existing ENA taxonomy entry. For more details see https://ena-docs.readthedocs.io/en/latest/faq/taxonomy.html | -| `co-assembly` | Yes | Whether a co-assembly strategy was used for the initial metagenomic assembly generation. Options: Yes or No. | +| `co-assembly` | Yes | Whether a co-assembly strategy was used for the initial metagenomic assembly generation. Options: true or false. | | `broad_environment` | Yes | Broad ecological context of the sample, for example 'marine biome', 'desert biome'. It is recommended to use subclasses of EnvO 'biome' class (http://purl.obolibrary.org/obo/ENVO_00000428) | | `local_environment` | Yes | Local environmental context of the sample, for example 'tropical dry broadleaf forest biome', 'marine abyssal zone biome'. It is recommended to use EnvO terms which are of smaller spatial grain than your entry for "broad-scale environmental context". | | `environmental_medium` | Yes | Material displaced by the sample, or the material in which the sample was embedded before sampling, for example 'mucus', 'lake water'. It is recommended to use subclasses of EnvO 'environmental material' class (http://purl.obolibrary.org/obo/ENVO_00010483). | -| `RNA_presence` | No | Presence or absence of the 23S, 16S, and 5S rRNA genes and at least 18 tRNAs. This is used for MISAG/MIMAG assembly quality classification. Options: Yes or No. | +| `RNA_presence` | No | Presence or absence of the 23S, 16S, and 5S rRNA genes and at least 18 tRNAs. This is used for MISAG/MIMAG assembly quality classification. Options: true or false. | | `NCBI_lineage` | No | NCBI taxonomy lineage of the genome. Can be composted of either numerical IDs or official NCBI taxon names separated by ";". | > [!NOTE] diff --git a/modules/local/count_rna/tests/main.nf.test b/modules/local/count_rna/tests/main.nf.test index d621839..657d437 100644 --- a/modules/local/count_rna/tests/main.nf.test +++ b/modules/local/count_rna/tests/main.nf.test @@ -31,7 +31,7 @@ nextflow_process { { assert process.out.rna_decision.size() == 1 }, { def rnaDecisionContent = path(process.out.rna_decision[0][1]).text - assert rnaDecisionContent.contains("Yes") + assert rnaDecisionContent.contains("True") } ) } diff --git a/modules/local/count_rna/tests/main.nf.test.snap b/modules/local/count_rna/tests/main.nf.test.snap index 46ab55a..047809f 100644 --- a/modules/local/count_rna/tests/main.nf.test.snap +++ b/modules/local/count_rna/tests/main.nf.test.snap @@ -6,11 +6,11 @@ { "id": "test" }, - "test_rna_decision.tsv:md5,8162813732f3a353edb6fc3e37e950e1" + "test_rna_decision.tsv:md5,b760b5d61d0c140d55e97a2fd6c25471" ] ] ], - "timestamp": "2026-06-25T21:38:21.745168", + "timestamp": "2026-07-22T17:43:41.374272", "meta": { "nf-test": "0.9.5", "nextflow": "26.04.0" diff --git a/modules/local/create_genome_metadata_tsv/main.nf b/modules/local/create_genome_metadata_tsv/main.nf index e78a7af..d3313f9 100644 --- a/modules/local/create_genome_metadata_tsv/main.nf +++ b/modules/local/create_genome_metadata_tsv/main.nf @@ -18,8 +18,8 @@ process CREATE_GENOME_METADATA_TSV { task.ext.when == null || task.ext.when script: - def co_assembly_value = meta.co_assembly == 'Yes' ? 'True' : 'False' - def rna_presence_value = meta.RNA_presence == 'Yes' ? 'True' : 'False' + def co_assembly_value = meta.co_assembly ? 'True' : 'False' + def rna_presence_value = meta.RNA_presence ? 'True' : 'False' def header = [ 'genome_name', 'genome_path', diff --git a/modules/local/create_genome_metadata_tsv/tests/main.nf.test b/modules/local/create_genome_metadata_tsv/tests/main.nf.test index eab3015..72516f5 100644 --- a/modules/local/create_genome_metadata_tsv/tests/main.nf.test +++ b/modules/local/create_genome_metadata_tsv/tests/main.nf.test @@ -24,11 +24,50 @@ nextflow_process { contamination: '1.2', genome_coverage: '42.7', metagenome: 'marine metagenome', - co_assembly: 'No', + co_assembly: false, broad_environment: 'marine biome', local_environment: 'coastal water', environmental_medium: 'seawater', - RNA_presence: 'Yes', + RNA_presence: true, + NCBI_lineage: 'Bacteria;Proteobacteria;Gammaproteobacteria' + ], + file('https://raw.githubusercontent.com/nf-core/test-datasets/viralrecon/genome/NC_045512.2/GCF_009858895.2_ASM985889v3_genomic.200409.fna.gz') + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("test_create_genome_metadata_tsv_bool_reversed") { + + when { + process { + """ + input[0] = [ + [ + id: 'test_genome', + accession: 'SRR123456', + assembly_software: 'SPAdes_v3.15.5', + binning_software: 'MetaBAT2_v2.15', + binning_parameters: '--minContig 1500', + stats_generation_software: 'CheckM2_v1.0.0', + completeness: '98.4', + contamination: '1.2', + genome_coverage: '42.7', + metagenome: 'marine metagenome', + co_assembly: true, + broad_environment: 'marine biome', + local_environment: 'coastal water', + environmental_medium: 'seawater', + RNA_presence: false, NCBI_lineage: 'Bacteria;Proteobacteria;Gammaproteobacteria' ], file('https://raw.githubusercontent.com/nf-core/test-datasets/viralrecon/genome/NC_045512.2/GCF_009858895.2_ASM985889v3_genomic.200409.fna.gz') @@ -65,11 +104,11 @@ nextflow_process { contamination: '1.2', genome_coverage: '42.7', metagenome: 'marine metagenome', - co_assembly: 'No', + co_assembly: true, broad_environment: 'marine biome', local_environment: 'coastal water', environmental_medium: 'seawater', - RNA_presence: 'Yes', + RNA_presence: false, NCBI_lineage: 'Bacteria;Proteobacteria;Gammaproteobacteria' ], file('https://raw.githubusercontent.com/nf-core/test-datasets/viralrecon/genome/NC_045512.2/GCF_009858895.2_ASM985889v3_genomic.200409.fna.gz') diff --git a/modules/local/create_genome_metadata_tsv/tests/main.nf.test.snap b/modules/local/create_genome_metadata_tsv/tests/main.nf.test.snap index a073053..1de783c 100644 --- a/modules/local/create_genome_metadata_tsv/tests/main.nf.test.snap +++ b/modules/local/create_genome_metadata_tsv/tests/main.nf.test.snap @@ -1,4 +1,68 @@ { + "test_create_genome_metadata_tsv_bool_reversed": { + "content": [ + { + "0": [ + [ + { + "id": "test_genome", + "accession": "SRR123456", + "assembly_software": "SPAdes_v3.15.5", + "binning_software": "MetaBAT2_v2.15", + "binning_parameters": "--minContig 1500", + "stats_generation_software": "CheckM2_v1.0.0", + "completeness": "98.4", + "contamination": "1.2", + "genome_coverage": "42.7", + "metagenome": "marine metagenome", + "co_assembly": true, + "broad_environment": "marine biome", + "local_environment": "coastal water", + "environmental_medium": "seawater", + "RNA_presence": false, + "NCBI_lineage": "Bacteria;Proteobacteria;Gammaproteobacteria" + }, + "test_genome_genome_metadata.tsv:md5,0f955fb3bbf7da09ce9f449884693806" + ] + ], + "1": [ + [ + "CREATE_GENOME_METADATA_TSV", + "bash", + "5.2.37(1)-release" + ] + ], + "tsv": [ + [ + { + "id": "test_genome", + "accession": "SRR123456", + "assembly_software": "SPAdes_v3.15.5", + "binning_software": "MetaBAT2_v2.15", + "binning_parameters": "--minContig 1500", + "stats_generation_software": "CheckM2_v1.0.0", + "completeness": "98.4", + "contamination": "1.2", + "genome_coverage": "42.7", + "metagenome": "marine metagenome", + "co_assembly": true, + "broad_environment": "marine biome", + "local_environment": "coastal water", + "environmental_medium": "seawater", + "RNA_presence": false, + "NCBI_lineage": "Bacteria;Proteobacteria;Gammaproteobacteria" + }, + "test_genome_genome_metadata.tsv:md5,0f955fb3bbf7da09ce9f449884693806" + ] + ] + } + ], + "timestamp": "2026-07-23T14:00:57.58563", + "meta": { + "nf-test": "0.9.5", + "nextflow": "26.04.0" + } + }, "test_create_genome_metadata_tsv - stub": { "content": [ { @@ -15,11 +79,11 @@ "contamination": "1.2", "genome_coverage": "42.7", "metagenome": "marine metagenome", - "co_assembly": "No", + "co_assembly": true, "broad_environment": "marine biome", "local_environment": "coastal water", "environmental_medium": "seawater", - "RNA_presence": "Yes", + "RNA_presence": false, "NCBI_lineage": "Bacteria;Proteobacteria;Gammaproteobacteria" }, "test_genome_genome_metadata.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" @@ -45,11 +109,11 @@ "contamination": "1.2", "genome_coverage": "42.7", "metagenome": "marine metagenome", - "co_assembly": "No", + "co_assembly": true, "broad_environment": "marine biome", "local_environment": "coastal water", "environmental_medium": "seawater", - "RNA_presence": "Yes", + "RNA_presence": false, "NCBI_lineage": "Bacteria;Proteobacteria;Gammaproteobacteria" }, "test_genome_genome_metadata.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" @@ -57,7 +121,7 @@ ] } ], - "timestamp": "2026-07-07T13:49:45.599115", + "timestamp": "2026-07-22T23:11:26.015229", "meta": { "nf-test": "0.9.5", "nextflow": "26.04.0" @@ -79,11 +143,11 @@ "contamination": "1.2", "genome_coverage": "42.7", "metagenome": "marine metagenome", - "co_assembly": "No", + "co_assembly": false, "broad_environment": "marine biome", "local_environment": "coastal water", "environmental_medium": "seawater", - "RNA_presence": "Yes", + "RNA_presence": true, "NCBI_lineage": "Bacteria;Proteobacteria;Gammaproteobacteria" }, "test_genome_genome_metadata.tsv:md5,64562a85d19fe5893cad0e89e894058a" @@ -109,11 +173,11 @@ "contamination": "1.2", "genome_coverage": "42.7", "metagenome": "marine metagenome", - "co_assembly": "No", + "co_assembly": false, "broad_environment": "marine biome", "local_environment": "coastal water", "environmental_medium": "seawater", - "RNA_presence": "Yes", + "RNA_presence": true, "NCBI_lineage": "Bacteria;Proteobacteria;Gammaproteobacteria" }, "test_genome_genome_metadata.tsv:md5,64562a85d19fe5893cad0e89e894058a" @@ -121,7 +185,7 @@ ] } ], - "timestamp": "2026-07-07T13:49:37.674712", + "timestamp": "2026-07-22T23:11:19.939886", "meta": { "nf-test": "0.9.5", "nextflow": "26.04.0" diff --git a/modules/local/generate_assembly_manifest/tests/main.nf.test b/modules/local/generate_assembly_manifest/tests/main.nf.test index 7e9c3bf..e16d278 100644 --- a/modules/local/generate_assembly_manifest/tests/main.nf.test +++ b/modules/local/generate_assembly_manifest/tests/main.nf.test @@ -12,17 +12,16 @@ nextflow_process { when { process { """ - input[0] = [ + input[0] = Channel.of([ [ id:'test' ], file(params.pipelines_testdata_base_path + "/test_data/assembly/contigs.fasta.gz", checkIfExists: true), file(params.pipelines_testdata_base_path + "/samplesheets/samplesheet_generatemanifest.csv", checkIfExists: true) - ] + ]) input[1] = "PRJ12345" input[2] = false input[3] = true input[4] = false """ - } } @@ -30,9 +29,6 @@ nextflow_process { assert process.success assertAll( // Only snapshot versions, not the manifest because it contains a timestamp - { assert snapshot( - path(process.out.versions[0]).yaml - ).match() }, { assert process.out.manifest.size() == 1 }, { assert process.out.manifest[0][1].toString().endsWith(".manifest") }, { @@ -76,8 +72,7 @@ nextflow_process { assert process.success assertAll( { assert snapshot( - process.out, - path(process.out.versions[0]).yaml + process.out ).match() } ) } diff --git a/modules/local/generate_assembly_manifest/tests/main.nf.test.snap b/modules/local/generate_assembly_manifest/tests/main.nf.test.snap index 7d4d1ef..5a6e766 100644 --- a/modules/local/generate_assembly_manifest/tests/main.nf.test.snap +++ b/modules/local/generate_assembly_manifest/tests/main.nf.test.snap @@ -11,7 +11,11 @@ ] ], "1": [ - "versions.yml:md5,5f33d074e4f7f7ddf4b3865973cb9157" + [ + "GENERATE_ASSEMBLY_MANIFEST", + "assembly_uploader", + "1.3.5" + ] ], "manifest": [ [ @@ -20,18 +24,10 @@ }, "test.manifest:md5,d41d8cd98f00b204e9800998ecf8427e" ] - ], - "versions": [ - "versions.yml:md5,5f33d074e4f7f7ddf4b3865973cb9157" ] - }, - { - "GENERATE_ASSEMBLY_MANIFEST": { - "assembly_uploader": "1.3.5" - } } ], - "timestamp": "2026-06-25T22:01:14.155809", + "timestamp": "2026-07-22T21:23:02.99938", "meta": { "nf-test": "0.9.5", "nextflow": "26.04.0" diff --git a/modules/local/genome_upload/main.nf b/modules/local/genome_upload/main.nf index 095d9ca..a0abb62 100644 --- a/modules/local/genome_upload/main.nf +++ b/modules/local/genome_upload/main.nf @@ -4,8 +4,8 @@ process GENOME_UPLOAD { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/genome-uploader:3.0.1--pyhdfd78af_0': - 'quay.io/biocontainers/genome-uploader:3.0.1--pyhdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/genome-uploader:3.0.4--pyhdfd78af_0': + 'quay.io/biocontainers/genome-uploader:3.0.4--pyhdfd78af_0' }" input: path(mags) // required for validation diff --git a/subworkflows/local/genome_evaluation/main.nf b/subworkflows/local/genome_evaluation/main.nf index 4c477ee..e6862e1 100644 --- a/subworkflows/local/genome_evaluation/main.nf +++ b/subworkflows/local/genome_evaluation/main.nf @@ -29,13 +29,16 @@ workflow GENOME_EVALUATION { // // Database preparation // + ch_do_download = ch_fasta + .first() + .map { _meta_fasta -> ch_checkm2_db_download_id } // Download and prepare db from scratch if no pre-built db provided if (ch_checkm2_db) { - ch_checkm2_db = channel.value([[id: 'checkm2_db'], file(params.checkm2_db, checkIfExists: true)]) + ch_checkm2_db_ready = channel.value([[id: 'checkm2_db'], file(params.checkm2_db, checkIfExists: true)]) } else { - CHECKM2_DATABASEDOWNLOAD(ch_checkm2_db_download_id) - ch_checkm2_db = CHECKM2_DATABASEDOWNLOAD.out.database + CHECKM2_DATABASEDOWNLOAD(ch_do_download) + ch_checkm2_db_ready = CHECKM2_DATABASEDOWNLOAD.out.database } // @@ -44,7 +47,7 @@ workflow GENOME_EVALUATION { CHECKM2_PREDICT( ch_fasta, - ch_checkm2_db, + ch_checkm2_db_ready, ) emit: diff --git a/tests/default.nf.test.snap b/tests/default.nf.test.snap index 9968b79..4aadca3 100644 --- a/tests/default.nf.test.snap +++ b/tests/default.nf.test.snap @@ -35,7 +35,7 @@ "bash": "5.2.37(1)-release" }, "CREATE_MANIFESTS": { - "genome_uploader": "3.0.1" + "genome_uploader": "3.0.4" }, "FALINT": { "falint": "1.2.0" diff --git a/tests/mag_complete_metadata.nf.test.snap b/tests/mag_complete_metadata.nf.test.snap index 7c7f539..5495759 100644 --- a/tests/mag_complete_metadata.nf.test.snap +++ b/tests/mag_complete_metadata.nf.test.snap @@ -17,7 +17,7 @@ "bash": "5.2.37(1)-release" }, "CREATE_MANIFESTS": { - "genome_uploader": "3.0.1" + "genome_uploader": "3.0.4" }, "FALINT": { "falint": "1.2.0" diff --git a/tests/mag_no_coverage_paired_reads.nf.test.snap b/tests/mag_no_coverage_paired_reads.nf.test.snap index 894e756..0725d60 100644 --- a/tests/mag_no_coverage_paired_reads.nf.test.snap +++ b/tests/mag_no_coverage_paired_reads.nf.test.snap @@ -20,7 +20,7 @@ "bash": "5.2.37(1)-release" }, "CREATE_MANIFESTS": { - "genome_uploader": "3.0.1" + "genome_uploader": "3.0.4" }, "FALINT": { "falint": "1.2.0" diff --git a/tests/mag_no_coverage_single_reads.nf.test.snap b/tests/mag_no_coverage_single_reads.nf.test.snap index 767748f..3a43261 100644 --- a/tests/mag_no_coverage_single_reads.nf.test.snap +++ b/tests/mag_no_coverage_single_reads.nf.test.snap @@ -20,7 +20,7 @@ "bash": "5.2.37(1)-release" }, "CREATE_MANIFESTS": { - "genome_uploader": "3.0.1" + "genome_uploader": "3.0.4" }, "FALINT": { "falint": "1.2.0" diff --git a/tests/mag_no_rna_presence.nf.test.snap b/tests/mag_no_rna_presence.nf.test.snap index 8a7d21c..5541956 100644 --- a/tests/mag_no_rna_presence.nf.test.snap +++ b/tests/mag_no_rna_presence.nf.test.snap @@ -23,7 +23,7 @@ "bash": "5.2.37(1)-release" }, "CREATE_MANIFESTS": { - "genome_uploader": "3.0.1" + "genome_uploader": "3.0.4" }, "FALINT": { "falint": "1.2.0" diff --git a/tests/mag_no_study_complete_metadata.nf.test.snap b/tests/mag_no_study_complete_metadata.nf.test.snap index 1aea1e8..b838f6b 100644 --- a/tests/mag_no_study_complete_metadata.nf.test.snap +++ b/tests/mag_no_study_complete_metadata.nf.test.snap @@ -17,7 +17,7 @@ "bash": "5.2.37(1)-release" }, "CREATE_MANIFESTS": { - "genome_uploader": "3.0.1" + "genome_uploader": "3.0.4" }, "FALINT": { "falint": "1.2.0" diff --git a/tests/mag_no_taxonomy.nf.test.snap b/tests/mag_no_taxonomy.nf.test.snap index 1563d4b..0aa4bc4 100644 --- a/tests/mag_no_taxonomy.nf.test.snap +++ b/tests/mag_no_taxonomy.nf.test.snap @@ -26,7 +26,7 @@ "bash": "5.2.37(1)-release" }, "CREATE_MANIFESTS": { - "genome_uploader": "3.0.1" + "genome_uploader": "3.0.4" }, "FALINT": { "falint": "1.2.0" diff --git a/workflows/assemblysubmit.nf b/workflows/assemblysubmit.nf index b209609..90273ab 100644 --- a/workflows/assemblysubmit.nf +++ b/workflows/assemblysubmit.nf @@ -50,38 +50,20 @@ workflow ASSEMBLYSUBMIT { // --------- Create assembly channel with proper metadata structure assembly_fasta = ch_samplesheet - .map { row -> - def meta = [ - id: row[0].id, - single_end: row[3] ? false : true, - coverage: row[4] ?: null, - run_accession: row[5], - assembler: row[6], - assembler_version: row[7] - ] - [meta, file(row[1])] + .map { meta, fasta, reads_1, reads_2 -> + def new_meta = meta + [single_end: !reads_2] + [new_meta, fasta] } // --------- Create reads channel with proper metadata structure reads_fastq = ch_samplesheet .filter { row -> row[2] && row[2] != "" } // Check if fastq_1 exists and is not empty - .map { row -> - def meta = [ - id: row[0].id, - single_end: row[3] ? false : true, - coverage: row[4] ?: null, - run_accession: row[5], - assembler: row[6], - assembler_version: row[7] - ] - - if (row[3] && row[3] != "") { - // If paired end reads - [meta, [file(row[2]), file(row[3])]] - } else { - // If single end - [meta, file(row[2])] - } + .map { meta, fasta, reads_1, reads_2 -> + def new_meta = meta + [single_end: !reads_2] + def reads = new_meta.single_end + ? [reads_1] + : [reads_1, reads_2] + [new_meta, reads] } // --------- Check fasta files are properly formatted and filter out files with less than 2 contigs @@ -92,7 +74,7 @@ workflow ASSEMBLYSUBMIT { // --------- Assembly coverage calculation // For assemblies without coverage, calculate coverage with CoverM coverm_input = FASTA_VALIDATION.out.valid_fastas - .filter { meta, _fasta -> meta.coverage == null } + .filter { meta, _fasta -> !(meta.coverage) } .join(reads_fastq) .multiMap { meta, fasta, fastq -> assembly: [ meta, fasta ] diff --git a/workflows/genomesubmit.nf b/workflows/genomesubmit.nf index d16de68..2cc74b3 100644 --- a/workflows/genomesubmit.nf +++ b/workflows/genomesubmit.nf @@ -61,36 +61,12 @@ workflow GENOMESUBMIT { // --------- Create genomes channel with proper metadata structure genome_fasta_and_reads = ch_samplesheet - .map { row -> - def meta = [ - id: row[0].id, - accession: row[2], - single_end: row[4] ? false : true, - assembly_software: row[5] ?: null, - binning_software: row[6] ?: null, - binning_parameters: row[7] ?: null, - stats_generation_software: row[8] ?: null, - completeness: row[9] ?: null, - contamination: row[10] ?: null, - genome_coverage: row[11] ?: null, - metagenome: row[12] ?: null, - co_assembly: row[13] ?: null, - broad_environment: row[14] ?: null, - local_environment: row[15] ?: null, - environmental_medium: row[16] ?: null, - RNA_presence: row[17] ?: null, - NCBI_lineage: row[18] ?: null - ] - def read1 = row[3] ? file(row[3]) : null - def read2 = row[4] ? file(row[4]) : null - - if (row[4] && row[4] != "") { - // If paired end reads - return [meta, file(row[1]), [read1, read2]] - } else { - // If single end - return [meta, file(row[1]), [read1]] - } + .map { meta, fasta, reads_1, reads_2 -> + def new_meta = meta + [single_end: !reads_2] + def reads = new_meta.single_end + ? [reads_1] + : [reads_1, reads_2] + [new_meta, fasta, reads] } genome_fasta = genome_fasta_and_reads.map{meta, fasta, _fq1 -> [meta, fasta]} @@ -104,7 +80,7 @@ workflow GENOMESUBMIT { // --------- Genome coverage calculation branched_coverage_results = FASTA_VALIDATION.out.valid_fastas .branch { meta, _fasta -> - genome_coverage_ref_input: meta.genome_coverage == null + genome_coverage_ref_input: !(meta.genome_coverage) genome_coverage_present: true // Everything else goes here } @@ -138,7 +114,7 @@ workflow GENOMESUBMIT { // --------- For genomes without RNA_presence info, calculate rRNA and tRNA branched_rna_results = fasta_updated_with_coverage .branch { meta, _fasta -> - rna_prediction_input: meta.RNA_presence == null + rna_prediction_input: meta.RNA_presence == null // it might be True/False rna_present: true // Everything else goes here } @@ -153,7 +129,7 @@ workflow GENOMESUBMIT { .map{ meta, rna_decision, fasta -> def lines = rna_decision.readLines() // support for empty decision files required for -stub mode - def decision = lines ? lines[0].split('\t')[1] : null + def decision = lines ? lines[0].split('\t')[1].toLowerCase() == 'true' : null def updated_meta = meta.clone() updated_meta.RNA_presence = decision return [updated_meta, fasta] @@ -163,7 +139,7 @@ workflow GENOMESUBMIT { // --------- Completeness and contamination calculation branched_stats_results = fasta_updated_with_rna .branch { meta, _fasta -> - genome_evaluation_input: meta.completeness == null || meta.contamination == null || meta.stats_generation_software == null + genome_evaluation_input: !(meta.completeness) || !(meta.contamination) || !(meta.stats_generation_software) evaluation_present: true // Everything else goes here } @@ -195,7 +171,7 @@ workflow GENOMESUBMIT { // --------- Taxonomy branched_taxonomy_results = fasta_updated_with_stats .branch { meta, _fasta -> - genome_taxonomy_input: meta.NCBI_lineage == null + genome_taxonomy_input: !(meta.NCBI_lineage) taxonomy_present: true // Everything else goes here } diff --git a/workflows/readsubmit.nf b/workflows/readsubmit.nf index 8b90399..8bdff88 100644 --- a/workflows/readsubmit.nf +++ b/workflows/readsubmit.nf @@ -45,30 +45,14 @@ workflow READSUBMIT { // --------- Create reads channel with proper metadata structure reads_ch = ch_samplesheet - .map { row -> - def (meta_in, sample_accession, fastq_1, fastq_2, - platform, instrument, library_source, library_selection, library_strategy, - insert_size, library_name, description) = row - def meta = [ - id: meta_in.id, - sample_accession: sample_accession, - single_end: fastq_2 ? false : true, - platform: platform, - instrument: instrument, - library_source: library_source, - library_selection: library_selection, - library_strategy: library_strategy, - insert_size: insert_size ?: null, - library_name: library_name ?: null, - description: description ?: null - ] - - if (fastq_2 && fastq_2 != "") { + .map { meta, reads_1, reads_2 -> + def new_meta = meta + [single_end: !reads_2] + if ( !new_meta.single_end ) { // If paired end reads - [meta, [file(fastq_1), file(fastq_2)]] + [new_meta, [reads_1, reads_2]] } else { // If single end - [meta, file(fastq_1)] + [new_meta, reads_1] } }