Skip to content

Commit

Permalink
pulling in changes from JM - adding a few edge types
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanDietzMorris committed Oct 11, 2023
1 parent 0ddc8cc commit 2f79860
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion parsers/biolink/src/loadBL.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class BLLoader(SourceDataLoader):
source_data_url = "https://api.monarchinitiative.org/api/"
license = "https://monarchinitiative.org/about/licensing"
attribution = "https://monarchinitiative.org/about/monarch"
parsing_version: str = '1.2'
parsing_version: str = '1.3'

def __init__(self, test_mode: bool = False, source_data_dir: str = None):
"""
Expand Down Expand Up @@ -163,11 +163,43 @@ def passes_qc_filter(line: list):
'biolink:treats'
}

PREDICATES_WITH_DISEASE_SUBJECT = {
'biolink:disrupts',
'biolink:caused_by',
'biolink:causes',
'biolink:has_participant'
}

ALLOWABLE_DISEASE_PHENOTYPE_PREFIXES = {
'MONDO:',
'UMLS:',
'OMIA:',
'OMIM:',
'OMIMPS:',
'MESH:',
'KEGG-ds:',
'HP:',
'DOID:',
'HGNC:',
'GeneReviews:',
'ORPHA:',
'EFO:',
'MP:'
}


def get_bl_edge_predicate(line: list):
predicate = line[EDGESDATACOLS.PREDICATE.value]
if predicate == 'biolink:biomarker_for' and not passes_qc_filter(line):
return None
elif predicate in PREDICATES_WITH_DISEASE_SUBJECT:
subject = line[EDGESDATACOLS.SUBJECT.value]
for prefix in ALLOWABLE_DISEASE_PHENOTYPE_PREFIXES:
if prefix in subject:
return predicate
else:
continue
return None
else:
return predicate if predicate in DESIRED_BL_PREDICATES else None

Expand Down

0 comments on commit 2f79860

Please sign in to comment.