Skip to content

Commit

Permalink
"bug fix: some gnomAD documents may not contain 'AF' field and will f…
Browse files Browse the repository at this point in the history
…ail the assertion; checked the key existence before assertion"
  • Loading branch information
erikyao committed Jun 24, 2021
1 parent 9d4a25b commit 44f77d0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/hub/dataload/sources/gnomad/gnomad_common_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,10 @@ def parse(self, record: vcf.model._Record, doc_key: str):

info = record.INFO

assert len(record.ALT) == len(info['AC']), \
"length of record.ALT != length of info.AC, at CHROM=%s, POS=%s" % (record.CHROM, record.POS)
assert len(record.ALT) == len(info['AF']), \
"length of record.ALT != length of info.AF, at CHROM=%s, POS=%s" % (record.CHROM, record.POS)
assert len(record.ALT) == len(info['nhomalt']), \
"length of record.ALT != length of info.nhomalt, at CHROM=%s, POS=%s" % (record.CHROM, record.POS)
for key in ["AC", "AF", "nhomalt"]:
if key in info:
assert len(record.ALT) == len(info[key]), \
"length of record.ALT != length of info.%s, at CHROM=%s, POS=%s" % (key, record.CHROM, record.POS)

profile_list = self.profile_parser.parse(record)
site_quality_metrics_dict = self.site_quality_metrics_parser.parse(info)
Expand Down

0 comments on commit 44f77d0

Please sign in to comment.