Skip to content

Commit

Permalink
Merge pull request #48 from monarch-initiative/47-add-handling-of-mul…
Browse files Browse the repository at this point in the history
…tiple-modifiers-in-phenotype-annotation

47 add handling of multiple modifiers in phenotype annotation
  • Loading branch information
yaseminbridges authored Dec 17, 2024
2 parents 273db47 + 7aef594 commit f6e4f7e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "phenotype2phenopacket"
version = "0.6.7"
version = "0.6.8"
description = ""
authors = ["Yasemin Bridges <[email protected]>"]
readme = "README.md"
Expand Down
17 changes: 9 additions & 8 deletions src/phenotype2phenopacket/utils/phenopacket_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,14 +653,15 @@ def create_modifier(self, phenotype_annotation_entry: dict) -> List[OntologyClas
otherwise returns None.
"""
if phenotype_annotation_entry["modifier"] is not None:
try:
rels = self.human_phenotype_ontology.entity_alias_map(
phenotype_annotation_entry["modifier"]
)
term = "".join(rels[(list(rels.keys())[0])])
return [OntologyClass(id=phenotype_annotation_entry["modifier"], label=term)]
except IndexError:
return [OntologyClass(id=phenotype_annotation_entry["modifier"])]
ontology_class = []
for modifier in list(set(phenotype_annotation_entry["modifier"].split(";"))):
try:
rels = self.human_phenotype_ontology.entity_alias_map(modifier)
term = "".join(rels[(list(rels.keys())[0])])
ontology_class.append(OntologyClass(id=modifier, label=term))
except IndexError:
ontology_class.append(OntologyClass(id=modifier))
return ontology_class
else:
return None

Expand Down

0 comments on commit f6e4f7e

Please sign in to comment.