Skip to content

Commit

Permalink
Warn for bad variant order
Browse files Browse the repository at this point in the history
  • Loading branch information
MalinAhlberg committed Apr 24, 2019
1 parent 2e7abcb commit 38c1604
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/importer/data_importer/raw_data_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,12 @@ def _insert_variants(self):
def get_callcount(self, data):
"""Increment the call count by the calls found at this position."""
if data['chrom'] == self.chrom and data['pos'] < self.lastpos:
# TODO check this earlier, to avoid partial data to be inserted in the DB
raise Exception(f"Variant file corrupt, variants not given in incremental order.")
# If this position is smaller than the last, the file order might be invalid.
# Give a warning, but keep on counting.
msg = "VCF file not ok, variants not given in incremental order. Callcount may not be valid!!!\n\n"
logging.warning(msg)

if data['chrom'] != self.chrom or data['pos'] > self.lastpos:
if data['chrom'] != self.chrom or data['pos'] != self.lastpos:
# We are at a new position, count and save the calls for the last position
self.counter['calls'] += len(self.counter['tmp_calls'])

Expand Down

0 comments on commit 38c1604

Please sign in to comment.