|
| 1 | +version 1.0 |
| 2 | + |
| 3 | +import "../../../tasks/Viral/Genomad.wdl" as GnomadTasks |
| 4 | +import "../../../tasks/Viral/VirSorter2.wdl" as VS2Tasks |
| 5 | +import "../../../tasks/Viral/CheckV.wdl" as CheckVTasks |
| 6 | +import "../../../tasks/Viral/ViralSummary.wdl" as SumTasks |
| 7 | + |
| 8 | +workflow HvpViralPipeline { |
| 9 | + |
| 10 | + meta { |
| 11 | + description: "Single-sample HVP viral identification and quality assessment pipeline. Accepts the merged assembly+rescue FASTA from HvpReadRescue and runs geNomad and VirSorter2 in parallel to identify viral sequences, then assesses quality of each tool's output with CheckV. Produces a per-contig summary joining all four tool outputs and aggregate scalar metrics for the Terra data table." |
| 12 | + |
| 13 | + allowNestedInputs: true |
| 14 | + |
| 15 | + outputs: { |
| 16 | + genomad_virus_summary_tsv: "geNomad virus_summary.tsv (per-sequence scores, topology, taxonomy)", |
| 17 | + genomad_virus_fna: "Viral sequences FASTA from geNomad; input to CheckV", |
| 18 | + vs2_score_tsv: "VirSorter2 final-viral-score.tsv (per-sequence viral scores and group assignments)", |
| 19 | + vs2_viral_combined_fa: "Viral sequences FASTA from VirSorter2; input to CheckV", |
| 20 | + genomad_checkv_quality_tsv: "CheckV quality_summary.tsv for geNomad viral sequences", |
| 21 | + genomad_checkv_viruses_fna: "CheckV viruses.fna for geNomad viral sequences (complete/HQ genomes)", |
| 22 | + genomad_checkv_proviruses_fna: "CheckV proviruses.fna for geNomad viral sequences (proviral extracts)", |
| 23 | + vs2_checkv_quality_tsv: "CheckV quality_summary.tsv for VirSorter2 viral sequences", |
| 24 | + vs2_checkv_viruses_fna: "CheckV viruses.fna for VirSorter2 viral sequences (complete/HQ genomes)", |
| 25 | + vs2_checkv_proviruses_fna: "CheckV proviruses.fna for VirSorter2 viral sequences (proviral extracts)", |
| 26 | + viral_contig_summary_tsv: "Per-contig summary TSV joining geNomad and VirSorter2 scores with CheckV quality results", |
| 27 | + viral_stats_tsv: "Single-row aggregate viral metrics TSV for the sample", |
| 28 | + n_viral_contigs: "Total viral contigs called by at least one tool", |
| 29 | + n_hq_viral: "Number of high-quality viral contigs (CheckV High-quality or Complete)", |
| 30 | + n_complete_viral: "Number of complete viral genomes (CheckV Complete)", |
| 31 | + n_both_tools: "Number of contigs called viral by both geNomad and VirSorter2", |
| 32 | + n50_viral: "N50 length of viral contigs", |
| 33 | + total_viral_bases: "Total bases across all viral contigs" |
| 34 | + } |
| 35 | + } |
| 36 | + |
| 37 | + parameter_meta { |
| 38 | + merged_fa_gz: "Merged assembly+rescue FASTA (gzipped) from HvpReadRescue" |
| 39 | + sample_name: "Sample identifier used as output file prefix (e.g. bc2097)" |
| 40 | + genomad_db_tgz: "geNomad database as a single compressed archive (.tar.gz or .tar.zst)" |
| 41 | + vs2_db_tgz: "VirSorter2 database as a single compressed archive (.tar.gz or .tar.zst)" |
| 42 | + checkv_db_tgz: "CheckV database as a single compressed archive (.tar.gz or .tar.zst)" |
| 43 | + genomad_extra_args: "Additional command-line args appended verbatim to the genomad invocation" |
| 44 | + vs2_min_length: "Minimum sequence length for VirSorter2 (default 1000)" |
| 45 | + vs2_extra_args: "Additional command-line args appended verbatim to the virsorter run invocation" |
| 46 | + } |
| 47 | + |
| 48 | + input { |
| 49 | + File merged_fa_gz |
| 50 | + String sample_name |
| 51 | + |
| 52 | + File genomad_db_tgz |
| 53 | + File vs2_db_tgz |
| 54 | + File checkv_db_tgz |
| 55 | + |
| 56 | + String genomad_extra_args = "" |
| 57 | + Int vs2_min_length = 1000 |
| 58 | + String vs2_extra_args = "" |
| 59 | + } |
| 60 | + |
| 61 | + # geNomad and VirSorter2 run in parallel — both take the merged assembly+rescue FASTA |
| 62 | + call GnomadTasks.Genomad as t_01_Genomad { |
| 63 | + input: |
| 64 | + merged_fa_gz = merged_fa_gz, |
| 65 | + genomad_db_tgz = genomad_db_tgz, |
| 66 | + sample_name = sample_name, |
| 67 | + extra_args = genomad_extra_args |
| 68 | + } |
| 69 | +
|
| 70 | + call VS2Tasks.VirSorter2 as t_02_VirSorter2 { |
| 71 | + input: |
| 72 | + merged_fa_gz = merged_fa_gz, |
| 73 | + vs2_db_tgz = vs2_db_tgz, |
| 74 | + sample_name = sample_name, |
| 75 | + min_length = vs2_min_length, |
| 76 | + extra_args = vs2_extra_args |
| 77 | + } |
| 78 | +
|
| 79 | + # CheckV runs once per upstream tool output |
| 80 | + call CheckVTasks.CheckV as t_03_CheckVGenomd { |
| 81 | + input: |
| 82 | + virus_fna = t_01_Genomad.virus_fna, |
| 83 | + checkv_db_tgz = checkv_db_tgz, |
| 84 | + sample_name = sample_name, |
| 85 | + tool_prefix = "genomad" |
| 86 | + } |
| 87 | +
|
| 88 | + call CheckVTasks.CheckV as t_04_CheckVVS2 { |
| 89 | + input: |
| 90 | + virus_fna = t_02_VirSorter2.viral_combined_fa, |
| 91 | + checkv_db_tgz = checkv_db_tgz, |
| 92 | + sample_name = sample_name, |
| 93 | + tool_prefix = "vs2" |
| 94 | + } |
| 95 | +
|
| 96 | + # Join all four tool outputs into a per-contig summary |
| 97 | + call SumTasks.ViralContigSummary as t_05_ViralContigSummary { |
| 98 | + input: |
| 99 | + genomad_summary_tsv = t_01_Genomad.virus_summary_tsv, |
| 100 | + genomad_checkv_tsv = t_03_CheckVGenomd.quality_summary_tsv, |
| 101 | + vs2_score_tsv = t_02_VirSorter2.score_tsv, |
| 102 | + vs2_checkv_tsv = t_04_CheckVVS2.quality_summary_tsv, |
| 103 | + sample_name = sample_name |
| 104 | + } |
| 105 | +
|
| 106 | + # Aggregate per-contig summary to scalar metrics for the data table |
| 107 | + call SumTasks.ViralOverallSummary as t_06_ViralOverallSummary { |
| 108 | + input: |
| 109 | + viral_contig_summary_tsv = t_05_ViralContigSummary.viral_contig_summary_tsv, |
| 110 | + sample_name = sample_name |
| 111 | + } |
| 112 | +
|
| 113 | + output { |
| 114 | + File genomad_virus_summary_tsv = t_01_Genomad.virus_summary_tsv |
| 115 | + File genomad_virus_fna = t_01_Genomad.virus_fna |
| 116 | + |
| 117 | + File vs2_score_tsv = t_02_VirSorter2.score_tsv |
| 118 | + File vs2_viral_combined_fa = t_02_VirSorter2.viral_combined_fa |
| 119 | + |
| 120 | + File genomad_checkv_quality_tsv = t_03_CheckVGenomd.quality_summary_tsv |
| 121 | + File genomad_checkv_viruses_fna = t_03_CheckVGenomd.viruses_fna |
| 122 | + File genomad_checkv_proviruses_fna = t_03_CheckVGenomd.proviruses_fna |
| 123 | + |
| 124 | + File vs2_checkv_quality_tsv = t_04_CheckVVS2.quality_summary_tsv |
| 125 | + File vs2_checkv_viruses_fna = t_04_CheckVVS2.viruses_fna |
| 126 | + File vs2_checkv_proviruses_fna = t_04_CheckVVS2.proviruses_fna |
| 127 | + |
| 128 | + File viral_contig_summary_tsv = t_05_ViralContigSummary.viral_contig_summary_tsv |
| 129 | + |
| 130 | + File viral_stats_tsv = t_06_ViralOverallSummary.viral_stats_tsv |
| 131 | + Int n_viral_contigs = t_06_ViralOverallSummary.n_viral_contigs |
| 132 | + Int n_hq_viral = t_06_ViralOverallSummary.n_hq_viral |
| 133 | + Int n_complete_viral = t_06_ViralOverallSummary.n_complete_viral |
| 134 | + Int n_both_tools = t_06_ViralOverallSummary.n_both_tools |
| 135 | + Int n50_viral = t_06_ViralOverallSummary.n50_viral |
| 136 | + Int total_viral_bases = t_06_ViralOverallSummary.total_viral_bases |
| 137 | + } |
| 138 | +} |
0 commit comments