Added single-line duplicate values check for ID
According to VCF 4.3 specifications, ID cannot have duplicate values, so added a new check for duplicate values. If any duplicated IDs are found in a single line (semicolon separated list), then an error is thrown and file is declared as invalid.
@@ -119,6 +119,14 @@ namespace ebi
throw new IdBodyError{line, "ID must not contain semicolons or whitespaces"};
}
}
+
+ std::map<std::string, int> counter;
+ for (auto id = ids.begin(); id != ids.end(); ++id) {
+ counter[*id]++;
+ if (counter[*id] >= 2) {
+ throw new IdBodyError{line, "ID must not have duplicate values"};
+ }
+ }
}
void Record::check_alternate_alleles() const
