Skip to content

Commit

Permalink
Update VarSeq/Generic VCF to export condition terms
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMadBug committed Jul 9, 2024
1 parent 6b82e71 commit 3be9a44
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
VCFHeaderNumberSpecial, VCFHeader, VCFExportTweak
from library.django_utils import get_url_from_view_path
from library.utils import local_date_str_no_dash
from ontology.models import OntologyTerm
from snpdb.models import Variant, Allele


Expand Down Expand Up @@ -118,7 +119,7 @@ def lab_names(self):
header_id="significance",
number=1,
header_type=VCFHeaderType.Integer,
description="Classification, 1 = Benign, 2 = Likely Benign, 3 = VUS/Other, 4 = Likely Pathogenic/Oncogenic, 5 = Pathogenic/Oncogenic",
description="Most Pathogenic Classification, 1 = Benign, 2 = Likely Benign, 3 = VUS/Other, 4 = Likely Pathogenic/Oncogenic, 5 = Pathogenic/Oncogenic",
categories={"system": VCFTargetSystem.EMEDGENE})
def significance(self):
all_values = []
Expand Down Expand Up @@ -170,6 +171,22 @@ def unique_values(self, evidence_key: str, raw: bool = False):
else:
return [e_key.pretty_value(val) for val in sorted_values]

@export_vcf_info_cell(
header_id="condition_terms",
number=VCFHeaderNumberSpecial.UNBOUND,
header_type=VCFHeaderType.String,
description="All unique conditions this variant is being curated against, only provides values that could be matched to exact ontology terms",
categories={"system": {VCFTargetSystem.GENERIC, VCFTargetSystem.VARSEQ}}
)
def condition_terms(self):
all_terms: set[OntologyTerm] = set()
for cm in self.allele_data.cms:
if cr := cm.classification.condition_resolution_obj:
all_terms.update(cr.terms)
if all_terms:
sorted_terms = sorted(all_terms)
return [f"{t.id} {t.name}" for t in sorted_terms]

@export_vcf_info_cell(
header_id="classification",
number=VCFHeaderNumberSpecial.UNBOUND,
Expand Down

0 comments on commit 3be9a44

Please sign in to comment.