Skip to content

Commit

Permalink
ClinVarXMLRecord: Show SCV, more fixes to HGVS parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMadBug committed Sep 1, 2023
1 parent 3c66ae5 commit 1bc0e1b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion annotation/clinvar_xml_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ClinVarXmlParserOutput:
class ClinVarXmlParser(XmlParser, ABC):

RE_DATE_EXTRACTOR = re.compile("([0-9]+-[0-9]+-[0-9]+).*")
RE_GOOD_CHGVS = re.compile("^(N._(.+)?:c[.][0-9_a-zA-Z>]+)( .*)?$")
RE_GOOD_CHGVS = re.compile("^(N._(.+)?:c[.][^ ]+)( .*)?$")
RE_ORPHA = re.compile("ORPHA([0-9]+)")

@staticmethod
Expand Down
5 changes: 3 additions & 2 deletions annotation/clinvar_xml_parser_via_vcv.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class ClinVarXmlParserViaVCV(ClinVarXmlParser):

PARSER_VERSION = 202 # change this whenever the parsing changes, so we know to ignore the old cache
PARSER_VERSION = 203 # change this whenever the parsing changes, so we know to ignore the old cache

@classmethod
def load_from_clinvar_id(cls, clinvar_variation_id: int) -> ClinVarXmlParserOutput:
Expand Down Expand Up @@ -115,7 +115,8 @@ def parse_variant_coordinate(self, elem):
start = elem.get("start")
ref = elem.get("referenceAllele")
alt = elem.get("alternateAllele")
self.latest.variant_coordinate = f"{chr}:{start} {ref}>{alt} ({assembly})"
if chr and start and ref and alt:
self.latest.variant_coordinate = f"{chr}:{start} {ref}>{alt} ({assembly})"


@parser_path(
Expand Down
4 changes: 3 additions & 1 deletion annotation/templates/annotation/clinvar_records_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
<tbody>
{% for record in records %}
<tr>
<td>{% clinvar_stars record.stars record.review_status %} <a class="subtle-link" href="https://www.ncbi.nlm.nih.gov/clinvar/submitters/{{ record.org_id }}">{{ record.submitter }}</a></td>
<td>{% clinvar_stars record.stars record.review_status %} <a class="subtle-link" href="https://www.ncbi.nlm.nih.gov/clinvar/submitters/{{ record.org_id }}">{{ record.submitter }}</a>
<br/><span class="text-secondary">{{ record.record_id }}</span>
</td>
<td>{% if record.c_hgvs %}{% c_hgvs record.c_hgvs %}{% elif record.variant_coordinate %}{{ record.variant_coordinate }}{% else %}<span class="no-value">-</span>{% endif %}</td>
<td class="cs-{{ record.clinical_significance|lower }} text-center">{{ record.clinical_significance | ekey:"clinical_significance" }}</td>
<td>{% if record.condition %}{% ontology_term record.condition %}{% else %}<span class="no-value">-</span>{% endif %}</td>
Expand Down

0 comments on commit 1bc0e1b

Please sign in to comment.