Skip to content

Commit 8edc275

Browse files
tpshea2claude
andcommitted
fix: use proviral_length for proviruses in viral N50/total_bases
ViralOverallSummary was using the full host contig length for provirus rows, inflating n50_viral and total_viral_bases. Now substitutes proviral_length (geNomad CheckV, falling back to VirSorter2 CheckV) when either tool flags a contig as a provirus. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7681d28 commit 8edc275

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

wdl/tasks/Viral/ViralSummary.wdl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,18 @@ for row in rows:
329329
)
330330
qual_counts[bq] += 1
331331
332-
cl = row.get('contig_length', '')
332+
# Use proviral_length for proviruses so we don't inflate N50/total_bases
333+
# with the full host contig. Fall back to vs2 provirus flag if genomad
334+
# didn't call it, then fall back to full contig_length if neither flagged it.
335+
is_provirus = (
336+
row.get('genomad_checkv_provirus', '') == 'Yes' or
337+
row.get('vs2_checkv_provirus', '') == 'Yes'
338+
)
339+
if is_provirus:
340+
cl = (row.get('genomad_checkv_proviral_length', '') or
341+
row.get('vs2_checkv_proviral_length', ''))
342+
else:
343+
cl = row.get('contig_length', '')
333344
if cl and cl != 'NA':
334345
try:
335346
lengths.append(int(cl))

0 commit comments

Comments
 (0)