From a2c56a8b1f67cd98c0d3dc8602f4da5daa38652d Mon Sep 17 00:00:00 2001 From: Matthew Wells Date: Tue, 12 Nov 2024 11:59:35 -0600 Subject: [PATCH] fixed failig test case --- modules/local/report.nf | 4 -- tests/main.nf.test | 84 ++++++++++++++++++++--------------------- 2 files changed, 42 insertions(+), 46 deletions(-) diff --git a/modules/local/report.nf b/modules/local/report.nf index bd14fce..5b13127 100644 --- a/modules/local/report.nf +++ b/modules/local/report.nf @@ -41,9 +41,7 @@ process REPORT{ def report_tag = test_in[i+1] def report_value = test_in[i+2] - println meta_data if(!sample_data.containsKey(meta_data.sample)){ - // Todo issue grabbing correct tag is here sample_data[meta_data.sample] = [:] sample_data[meta_data.sample]["meta"] = [:] } @@ -680,8 +678,6 @@ def generate_qc_data(data, search_phrases, qc_species_tag){ def species_tag_location = 0 for(k in data){ if(!k.value.meta.metagenomic){ - println k.value - println k.key def species = get_species(k.value[k.key][top_hit_tag], search_phrases, shortest_token) // update coverage first so its values can be used in generating qc messages generate_coverage_data(data[k.key], params.coverage_calc_fields.bp_field, species) diff --git a/tests/main.nf.test b/tests/main.nf.test index ef559da..b3fde7c 100644 --- a/tests/main.nf.test +++ b/tests/main.nf.test @@ -155,45 +155,45 @@ nextflow_pipeline { // parse output json file def json = path("$launchDir/results/FinalReports/Aggregated/Json/final_report.json").json - assert json.short.short.RawReadSummary.R1."total_bp".equals(118750) - assert json.short.short.RawReadSummary.R1."total_reads".equals(475) - assert json.short.short.RawReadSummary.R1."read_qual_mean".equals(40.0) - assert json.short.short.RawReadSummary.R1."mean_sequence_length".equals(250.0) - - assert json.short.short.FastP.summary.sequencing.equals("paired end (250 cycles + 250 cycles)") - assert json.short.short.FastP.summary.before_filtering.total_reads.equals(950) - assert json.short.short.FastP.filtering_result.passed_filter_reads.equals(950) - assert json.short.short.FastP.filtering_result.low_quality_reads.equals(0) - assert json.short.short.FastP.insert_size.peak.equals(347) - - //assert json.short.meta.metagenomic.equals(false) // Currently, this is "null". - assert json.short.meta.assembly.equals(false) - assert json.short.meta.hybrid.equals(false) - assert json.short.meta.single_end.equals(false) - assert json.short.meta.merge.equals(false) - assert json.short.meta.downsampled.equals(false) - - assert json.short.short.AssemblyCompleted.equals(true) - assert json.short.short.QUAST."0"."Total length (>= 0 bp)".equals("4949") - assert json.short.short.QUAST."0"."Largest contig".equals("4949") - assert json.short.short.QUAST."0"."GC (%)".equals("52.96") - assert json.short.short.QUAST."0"."Avg. coverage depth".equals("47") + assert json.INX.INX.RawReadSummary.R1."total_bp".equals(118750) + assert json.INX.INX.RawReadSummary.R1."total_reads".equals(475) + assert json.INX.INX.RawReadSummary.R1."read_qual_mean".equals(40.0) + assert json.INX.INX.RawReadSummary.R1."mean_sequence_length".equals(250.0) + + assert json.INX.INX.FastP.summary.sequencing.equals("paired end (250 cycles + 250 cycles)") + assert json.INX.INX.FastP.summary.before_filtering.total_reads.equals(950) + assert json.INX.INX.FastP.filtering_result.passed_filter_reads.equals(950) + assert json.INX.INX.FastP.filtering_result.low_quality_reads.equals(0) + assert json.INX.INX.FastP.insert_size.peak.equals(347) + + //assert json.INX.meta.metagenomic.equals(false) // Currently, this is "null". + assert json.INX.meta.assembly.equals(false) + assert json.INX.meta.hybrid.equals(false) + assert json.INX.meta.single_end.equals(false) + assert json.INX.meta.merge.equals(false) + assert json.INX.meta.downsampled.equals(false) + + assert json.INX.INX.AssemblyCompleted.equals(true) + assert json.INX.INX.QUAST."0"."Total length (>= 0 bp)".equals("4949") + assert json.INX.INX.QUAST."0"."Largest contig".equals("4949") + assert json.INX.INX.QUAST."0"."GC (%)".equals("52.96") + assert json.INX.INX.QUAST."0"."Avg. coverage depth".equals("47") // Below two values should be empty - assert json.short.short.StarAMR."0"."Genotype".equals("None") - assert json.short.short.StarAMR."0"."Predicted Phenotype".equals("Susceptible") - assert json.short.short.StarAMR."0"."Genome Length".equals("4949") + assert json.INX.INX.StarAMR."0"."Genotype".equals("None") + assert json.INX.INX.StarAMR."0"."Predicted Phenotype".equals("Susceptible") + assert json.INX.INX.StarAMR."0"."Genome Length".equals("4949") - assert json.short.short.CheckM."0"."# genomes".equals("5656") - assert json.short.short.CheckM."0"."# markers".equals("56") - assert json.short.short.CheckM."0"."# marker sets".equals("24") - assert json.short.short.CheckM."0".Contamination.equals("0.00") + assert json.INX.INX.CheckM."0"."# genomes".equals("5656") + assert json.INX.INX.CheckM."0"."# markers".equals("56") + assert json.INX.INX.CheckM."0"."# marker sets".equals("24") + assert json.INX.INX.CheckM."0".Contamination.equals("0.00") - assert json.short.short.SevenGeneMLSTReport[0].filename.equals("short.filtered.fasta.gz") + assert json.INX.INX.SevenGeneMLSTReport[0].filename.equals("short.filtered.fasta.gz") - assert json.short.short.Abricate."0".RESISTANCE.equals("NoData") // All Abricate results for this are "NoData". + assert json.INX.INX.Abricate."0".RESISTANCE.equals("NoData") // All Abricate results for this are "NoData". - def assembly_path = "$launchDir/results/Assembly/FinalAssembly/short/short.final.filtered.assembly.fasta.gz" + def assembly_path = "$launchDir/results/Assembly/FinalAssembly/INX/short.final.filtered.assembly.fasta.gz" assert path(assembly_path).exists() // parse assembly file @@ -209,17 +209,17 @@ nextflow_pipeline { // output files assert iridanext_global.findAll { it.path == "FinalReports/Aggregated/Json/final_report.json" }.size() == 1 assert iridanext_global.findAll { it.path == "FinalReports/Aggregated/Tables/final_report.tsv" }.size() == 1 - assert iridanext_samples.short.findAll { it.path == "Assembly/FinalAssembly/short/short.final.filtered.assembly.fasta.gz" }.size() == 1 - assert iridanext_samples.short.findAll { it.path == "Assembly/Quality/QUAST/short/short.transposed_short.quast.quality.tsv" }.size() == 1 - assert iridanext_samples.short.findAll { it.path == "Assembly/Quality/SeqKitStats/short.seqkit.stats.summary.tsv" }.size() == 1 - assert iridanext_samples.short.findAll { it.path == "Assembly/PostProcessing/Speciation/MashScreen/short.mash.screen.taxa.screen.screen" }.size() == 1 - assert iridanext_samples.short.findAll { it.path == "Reads/Quality/Trimmed/MashScreen/short.mash.screen.reads.screen.screen" }.size() == 1 - assert iridanext_samples.short.findAll { it.path == "Reads/Quality/Trimmed/FastP/short.fastp.summary.json" }.size() == 1 - assert iridanext_samples.short.findAll { it.path == "Reads/Quality/RawReadQuality/short.read.scan.summary.json" }.size() == 1 - assert iridanext_samples.short.findAll { it.path == "FinalReports/FlattenedReports/short.flat_sample.json.gz" }.size() == 1 + assert iridanext_samples.INX.findAll { it.path == "Assembly/FinalAssembly/INX/short.final.filtered.assembly.fasta.gz" }.size() == 1 + assert iridanext_samples.INX.findAll { it.path == "Assembly/Quality/QUAST/short/short.transposed_short.quast.quality.tsv" }.size() == 1 + assert iridanext_samples.INX.findAll { it.path == "Assembly/Quality/SeqKitStats/short.seqkit.stats.summary.tsv" }.size() == 1 + assert iridanext_samples.INX.findAll { it.path == "Assembly/PostProcessing/Speciation/MashScreen/short.mash.screen.taxa.screen.screen" }.size() == 1 + assert iridanext_samples.INX.findAll { it.path == "Reads/Quality/Trimmed/MashScreen/short.mash.screen.reads.screen.screen" }.size() == 1 + assert iridanext_samples.INX.findAll { it.path == "Reads/Quality/Trimmed/FastP/short.fastp.summary.json" }.size() == 1 + assert iridanext_samples.INX.findAll { it.path == "Reads/Quality/RawReadQuality/short.read.scan.summary.json" }.size() == 1 + assert iridanext_samples.INX.findAll { it.path == "FinalReports/FlattenedReports/INX.flat_sample.json.gz" }.size() == 1 // output metadata - assert iridanext_metadata.short."QC Status" == "PASSED" + assert iridanext_metadata.INX."QC Status" == "PASSED" }