diff --git a/pyproject.toml b/pyproject.toml index bdf6cdc..fbe5c18 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "phenotype2phenopacket" -version = "0.6.9" +version = "0.6.10" description = "" authors = ["Yasemin Bridges "] readme = "README.md" diff --git a/src/phenotype2phenopacket/utils/phenopacket_utils.py b/src/phenotype2phenopacket/utils/phenopacket_utils.py index 5e9a5a7..43b2b46 100644 --- a/src/phenotype2phenopacket/utils/phenopacket_utils.py +++ b/src/phenotype2phenopacket/utils/phenopacket_utils.py @@ -473,17 +473,17 @@ def get_parents_of_terms(self, phenotype_entry: dict, steps: int) -> dict: """ term_id = phenotype_entry["hpo_id"] rels = self.ontology.entity_alias_map(term_id) - term = "".join(rels[(list(rels.keys())[0])]) + term = "".join(rels[(list(rels.keys())[0])]) if rels else "" if term.startswith("Abnormality of"): return phenotype_entry for _i in range(steps): parents = self.ontology.hierarchical_parents(term_id) if not parents: - warnings.warn(f"No parents found for term {term}", stacklevel=2) + warnings.warn(f"No parents found for term {term_id}", stacklevel=2) return phenotype_entry parent = self.secret_rand.choice(parents) rels = self.ontology.entity_alias_map(parent) - term = "".join(rels[(list(rels.keys())[0])]) + term = "".join(rels[(list(rels.keys())[0])]) if rels else "" if ( term.startswith("Abnormality of") or term_id == "HP:0000118" @@ -632,7 +632,7 @@ def create_onset(self, phenotype_annotation_entry: dict) -> TimeElement: rels = self.human_phenotype_ontology.entity_alias_map( phenotype_annotation_entry["onset"] ) - term = "".join(rels[(list(rels.keys())[0])]) + term = "".join(rels[(list(rels.keys())[0])]) if rels else None return TimeElement( ontology_class=OntologyClass(id=phenotype_annotation_entry["onset"], label=term) )