From 38c160400aadf35190cc1529ecc34d04ac64907c Mon Sep 17 00:00:00 2001 From: MalinAhlberg Date: Wed, 24 Apr 2019 14:29:13 +0200 Subject: [PATCH] Warn for bad variant order --- scripts/importer/data_importer/raw_data_importer.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/importer/data_importer/raw_data_importer.py b/scripts/importer/data_importer/raw_data_importer.py index 35c848e32..0da67b78d 100644 --- a/scripts/importer/data_importer/raw_data_importer.py +++ b/scripts/importer/data_importer/raw_data_importer.py @@ -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'])