Skip to content

Commit

Permalink
Cover both relation and predicate when determining cat
Browse files Browse the repository at this point in the history
  • Loading branch information
caufieldjh committed Jun 7, 2024
1 parent 439a936 commit 6ef0f53
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions kg_phenio/transform_utils/phenio/phenio_edge_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,24 @@

# Association

# The relation tells us which class to use.
# The relation or predicate tells us which class to use.
# We default to generic Association.
# TODO: add more to this map
remap_rels = {
"biolink:has_phenotype": "DiseaseToPhenotypicFeatureAssociation",
"UPHENO:0000003": "DiseaseOrPhenotypicFeatureToLocationAssociation",
}

if subj_curie_prefix == "MONDO" and obj_curie_prefix == "HP":
relation = "biolink:has_phenotype"
relation = str(row["relation"])
predicate = "biolink:has_phenotype"
else:
relation = str(row["relation"])
predicate = str(row["predicate"])

if relation in remap_rels:
category_name = remap_rels[relation]
elif predicate in remap_rels:
category_name = remap_rels[predicate]
else:
category_name = "Association"
AssocClass = getattr(
Expand All @@ -105,7 +108,8 @@
association = AssocClass(
id=row["id"],
subject=row["subject"],
predicate=row["predicate"],
predicate=predicate,
relation=relation,
object=row["object"],
original_predicate=row["relation"],
primary_knowledge_source=primary_knowledge_source,
Expand Down

0 comments on commit 6ef0f53

Please sign in to comment.