AlistairNWard/vcfCTools — Issue #3: Incorrect variants filtered for records with multiple variants of the same type at the same position.
Author: kmsquire
Created: 2011-12-06 22:58:00+00:00
State: open

For variants where there are multiple records for the same location and variant type, the decision of whether to print out a variant from one file should not depend on whether the variant at the same iter in the other file should be output or not, as it has already been determined whether or not each file is duplicate. Patch below, also available in commit a0fb800918f4ad4ad5558b0734b7ab5bb2f68e46 of kmsquire/vcfCTools.

Kevin

```diff

diff --git a/variant.cpp b/variant.cpp
index d5d4732..d5b677e 100644
--- a/variant.cpp
+++ b/variant.cpp
@@ -661,9 +661,8 @@ void variant::compareAlleles(vector& alleles1, vectororiginalPosition, iter->recordNumber - 1, rsid, infoAdd);
} else {
@@ -683,16 +682,14 @@ void variant::compareAlleles(vector& alleles1, vectororiginalPosition][iter->recordNumber - 1].filtered[iter->altID] = write;
}
aIter++;
- bIter++;
}

// Then the second file.
if (!flags.writeFromFirst || flags.findUnion) {
iter = alleles2.begin();
- aIter = commonA.begin();
bIter = commonB.begin();
for (; iter != alleles2.end(); iter++) {
- if (*aIter && *bIter) {
+ if (*bIter) {
write = (flags.findUnique) ? true : flags.writeFromFirst;
var.originalVariantsMap[iter->originalPosition][iter->recordNumber - 1].filtered[iter->altID] = write;
} else {
@@ -707,7 +704,6 @@ void variant::compareAlleles(vector& alleles1, vectororiginalPosition][iter->recordNumber - 1].filtered[iter->altID] = write;
}
- aIter++;
bIter++;
}
}
```