Task-Oriented Recipes
Validate and Update Seeds
Construct the term list:
from pandasaurus.curie_validator import CurieValidator terms = CurieValidator.construct_term_list(seeds)
Catch validation errors:
from pandasaurus.utils.pandasaurus_exceptions import InvalidTerm, ObsoletedTerm try: CurieValidator.get_validation_report(terms) except InvalidTerm as err: print(err) except ObsoletedTerm as err: print(err)
Replace obsoleted terms programmatically:
query = Query(seeds) query.update_obsoleted_terms()
Contextual Enrichment
Gather all terms that are part_of a context and enrich them:
q = Query(kidney_terms, force_fail=True)
enriched = q.contextual_slim_enrichment(["UBERON:0000362"]) # renal medulla
Parent-only Enrichment
Use pandasaurus.query.Query.parent_enrichment() for a one-hop graph:
q = Query(seeds)
parent_df = q.parent_enrichment()
Export to Graph
After any enrichment call:
graph_df = q.graph_df # pandas DataFrame
rdflib_graph = q.graph
Use pandasaurus.graph.graph_generator to further manipulate the graph or export as needed.