From 0587b5ebe2a8a397f6e61ab3d5a7522ae40e0e85 Mon Sep 17 00:00:00 2001 From: Andrew Bonney Date: Thu, 12 Mar 2026 20:34:16 -0500 Subject: [PATCH] Fix per-interval indel accumulation bug and negative coordinate in add_normal_counts - Move indel record list inside the per-interval loop so it resets each iteration; previously vcf_dicts accumulated across all intervals, causing duplicate/incorrect VCF output - Clamp fetch() start to max(0, ...) in add_normal_counts to prevent ValueError for variants near chromosome start - Rename vcf_results/vcf_dicts to all_indel_records/indel_vcf_records for clarity --- bin/find_edited_reads.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/find_edited_reads.py b/bin/find_edited_reads.py index 8288737..604f52c 100755 --- a/bin/find_edited_reads.py +++ b/bin/find_edited_reads.py @@ -837,7 +837,7 @@ def add_normal_counts(df, reads, fasta, flank=300, debug=False): alt = row['alt'] start_idx = pos - 1 - ref_seq = fasta.fetch(chrom, start_idx - flank, start_idx + len(ref) + flank) + ref_seq = fasta.fetch(chrom, max(0, start_idx - flank), start_idx + len(ref) + flank) alt_seq = ref_seq if alt != '.':