Skip to content

Commit

Permalink
Merge 49cd95f into a3d5da9
Browse files Browse the repository at this point in the history
  • Loading branch information
susannasiebert committed Jun 19, 2020
2 parents a3d5da9 + 49cd95f commit 5420824
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
44 changes: 44 additions & 0 deletions civicpy/civic.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,19 @@ def csq(self, include_status=None):
"{} ({})".format(evidence.source.citation_id, evidence.source.source_type),
str(evidence.variant_origin),
evidence.status,
str(evidence.clinical_significance or ''),
str(evidence.evidence_direction or ''),
str(evidence.disease),
'&'.join([str(drug) for drug in evidence.drugs]),
str(evidence.drug_interaction_type or ""),
'&'.join(["{} (HPO ID {})".format(phenotype.hpo_class, phenotype.hpo_id) for phenotype in evidence.phenotypes]),
evidence.evidence_level,
str(evidence.rating),
"",
"",
"",
"",
"",
]))
for assertion in self.assertions:
if include_status is not None and assertion.status not in include_status:
Expand All @@ -664,6 +677,19 @@ def csq(self, include_status=None):
"",
str(assertion.variant_origin),
assertion.status,
assertion.clinical_significance,
assertion.evidence_direction,
str(assertion.disease),
'&'.join([str(drug) for drug in assertion.drugs]),
str(assertion.drug_interaction_type or ''),
"",
"",
"",
"&".join([acmg_code.code for acmg_code in assertion.acmg_codes]),
str(assertion.amp_level or ''),
assertion.format_nccn_guideline(),
str(assertion.fda_regulatory_approval or ''),
str(assertion.fda_companion_test or ''),
]))
return csq

Expand Down Expand Up @@ -798,6 +824,12 @@ def evidence(self):
def hpo_ids(self):
return [x.hpo_id for x in self.phenotypes if x.hpo_id]

def format_nccn_guideline(self):
if self.nccn_guideline is None:
return ""
else:
return "{} (v{})".format(self.nccn_guideline, self.nccn_guideline_version)


class User(CivicRecord):

Expand Down Expand Up @@ -896,10 +928,22 @@ def update(self):
class Drug(CivicAttribute):
_SIMPLE_FIELDS = CivicRecord._SIMPLE_FIELDS.union({'ncit_id'})

def __str__(self):
if self.ncit_id is None:
return self.name
else:
return "{} (NCIt ID {})".format(self.name, self.ncit_id)


class Disease(CivicAttribute):
_SIMPLE_FIELDS = CivicRecord._SIMPLE_FIELDS.union({'display_name', 'doid', 'url'})

def __str__(self):
if self.doid is None:
return self.name
else:
return "{} (DOID {})".format(self.name, self.doid)


class Country(CivicAttribute):
_SIMPLE_FIELDS = CivicRecord._SIMPLE_FIELDS.union({'iso', 'name'})
Expand Down
13 changes: 13 additions & 0 deletions civicpy/exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,19 @@ class VCFWriter(DictWriter):
'CIViC Entity Source',
'CIViC Entity Variant Origin',
'CIViC Entity Status',
'CIViC Entity Clinical Signifiance',
'CIViC Entity Direction',
'CIViC Entity Disease',
'CIViC Entity Drugs',
'CIViC Entity Drug Interaction Type',
'CIViC Evidence Phenotypes',
'CIViC Evidence Level',
'CIViC Evidence Rating',
'CIViC Assertion ACMG Codes',
'CIViC Assertion AMP Category',
'CIViC Assertion NCCN Guideline',
'CIVIC Assertion Regulatory Approval',
'CIVIC Assertion FDA Companion Test ',
]))


Expand Down

0 comments on commit 5420824

Please sign in to comment.