Describe the bug
We have observed that ivar variants can generate false positive variant calls for genomes that contain insertions or deletions. Here is an example from a public genome that contains the 9bp orf1ab SGF deletion:
REGION POS REF ALT REF_DP REF_RV REF_QUAL ALT_DP ALT_RV ALT_QUAL ALT_FREQ
MN908947.3 11287 G -TCTGGTTTT 3914 2751 46 4907 0 20 0.960274
MN908947.3 11288 T A 2 2 34 20 2 35 0.909091
MN908947.3 11291 G A 9 6 48 3 0 32 0.25
MN908947.3 11296 T G 8 6 42 29 17 50 0.74359
Position 11287 has an exceptionally well supported deletion (nearly 5000x coverage) and three very weak substitutions within the deleted region.
The root cause of this is alignment errors around the ends of reads where bwa (or any other aligner) prefers to introduce mismatches rather than a long gap:

I believe this issue is much more likely to occur with nextera-based sequencing data as reads can start/end anywhere, and if you sequence deeply enough inevitably some reads will be difficult to align.
In this particular case the consensus sequence is correct and the spurious calls only appear in .variants.tsv. In other cases however I think alignment problems can introduce Ns in the consensus adjacent to, or within, the deletion which can cause issues with variant consequence prediction.
This issue may be related to #79 and #83, although I think it is separate since it is driven by alignment artifacts.
To Reproduce
Run ivar using the standard pipeline on this data:
https://www.ebi.ac.uk/ena/browser/view/ERX4873573
Describe the bug
We have observed that
ivar variantscan generate false positive variant calls for genomes that contain insertions or deletions. Here is an example from a public genome that contains the 9bp orf1ab SGF deletion:Position 11287 has an exceptionally well supported deletion (nearly 5000x coverage) and three very weak substitutions within the deleted region.
The root cause of this is alignment errors around the ends of reads where bwa (or any other aligner) prefers to introduce mismatches rather than a long gap:
I believe this issue is much more likely to occur with nextera-based sequencing data as reads can start/end anywhere, and if you sequence deeply enough inevitably some reads will be difficult to align.
In this particular case the consensus sequence is correct and the spurious calls only appear in
.variants.tsv. In other cases however I think alignment problems can introduceNs in the consensus adjacent to, or within, the deletion which can cause issues with variant consequence prediction.This issue may be related to #79 and #83, although I think it is separate since it is driven by alignment artifacts.
To Reproduce
Run ivar using the standard pipeline on this data:
https://www.ebi.ac.uk/ena/browser/view/ERX4873573