TCT.TCT_pathfinder¶
- TCT.TCT_pathfinder.build_query_graph(start_node_id, end_node_id, start_node_categories=None, end_node_categories=None, constraints_path=None)[source]¶
start_node_categories and end_node_categories are lists of categories.
- TCT.TCT_pathfinder.format_pathfinder_query(node1_id, node1_category, node2_id, node2_category)[source]¶
- TCT.TCT_pathfinder.format_query_json_for_pathfinder_with_constraints(subject_ids, object_ids=None, subject_categories=None, object_categories=None, predicates=None, constraints=None)[source]¶
format user’s input into a query json for pathfinder pipeline with constraints on the intermediate node categories.
- Parameters:
- subject_idsstr
a curie id for the subject node
- object_idsstr
a curie id for the object node
- subject_categorieslist
a list of categories for the subject node
- object_categorieslist
a list of categories for the object node
- predicateslist
a list of predicates for the edge between subject and object nodes
- constraintslist
a list of intermediate categories for the pathfinder pipeline, currently only one intermediate category is allowed in the constraints list.
- Returns:
- query_json_tempdict
a query json for pathfinder pipeline
Examples
>>> query_json_temp = format_query_json_for_pathfinder_with_constraints( subject_ids='NCBIGene:6774', object_ids='NCBIGene:4170', subject_categories=['biolink:Gene'], object_categories=['biolink:Gene'], predicates=['biolink:related_to'], constraints=['biolink:Protein'])
- TCT.TCT_pathfinder.generate_score_results(results, method='infores')[source]¶
Generates a score dict, and a list of “analyses”. method can be ‘infores’ or ‘edges’
- TCT.TCT_pathfinder.parse_results_for_pathfinder(start_node_id: str, end_node_id: str, result1: dict, result2: dict, start_node_categories=None, end_node_categories=None, get_node_info=True, scoring_method='infores')[source]¶
Converts the results of two TRAPI queries into the same general json format as the other pathfinder APIs. scoring_method is how the node scores are generated, and could be ‘infores’ or ‘edges’.