hwanglab/divine

KeyError: '*' when a given position is not covered in a VCF

Opened this issue · 0 comments

When an allele is missing due to an upstream deletion, it is marked as "*" in the ALT field from the VCF as per https://samtools.github.io/hts-specs/VCFv4.2.pdf

Currently, that is not dealt properly by Divine, leading to that error:

Traceback (most recent call last):
  File "/opt/divine/gcn/bin/annotpipe.py", line 118, in <module>
    main()
  File "/opt/divine/gcn/bin/annotpipe.py", line 115, in main
    ap.annotate_varant()
  File "/opt/divine/gcn/bin/annotpipe.py", line 83, in annotate_varant
    annotator.main(self.invcf, self.outvcf, self.logger, options)
  File "/opt/divine/gcn/lib/varann/vartype/varant/annotator.py", line 1421, in main
    for annt in snpa.annotate(chrom, pos, ref, alt):
  File "/opt/divine/gcn/lib/varann/vartype/varant/annotator.py", line 880, in annotate
    cdna_pos = self.hgvs.to_cDNA(self.chrom, pos0, ref0, alt0, refseq_acc)
  File "/opt/divine/gcn/bin/hgConvert/hgvs_resource.py", line 91, in to_cDNA
    cdna = pyhgvs.format_hgvs_name(chrom, offset, ref, alt, self.genome, transcript)
  File "/usr/lib/python2.7/dist-packages/pyhgvs/__init__.py", line 1471, in format_hgvs_name
    use_counsyl=use_counsyl)
  File "/usr/lib/python2.7/dist-packages/pyhgvs/__init__.py", line 1434, in variant_to_hgvs_name
    alt = revcomp(alt)
  File "/usr/lib/python2.7/dist-packages/pyhgvs/variants.py", line 15, in revcomp
    return ''.join(_COMP[base] for base in reversed(seq))
  File "/usr/lib/python2.7/dist-packages/pyhgvs/variants.py", line 15, in <genexpr>
    return ''.join(_COMP[base] for base in reversed(seq))
KeyError: '*'