TCT.TCT_neighborhood_finder

TCT.TCT_neighborhood_finder.neighborhood_finder(input_node, node2_categories, APInames, metaKG, API_predicates, input_node_category=[], predicates_subset=None, attribute_constraints=None)[source]

This function is used to find the neighborhood of a given input node with intermediate categories.

Parameters:
input_nodestr

The input node - should be a CURIE id.

node2_categorieslist

A list of intermediate categories to be used in the neighborhood finding process.

APInamesdict

A dictionary containing the names of the APIs to be used.

metaKGDataFrame

The metadata knowledge graph containing information about the APIs and their predicates.

API_predicatesdict

A dictionary containing the predicates for each API.

input_node_categorylist

Optional. A list of categories for the input node. If empty, it will be derived from the input node’s types.

attribute_constraintslist

Optional. List of outputs of translator_query.build_attribute_constraint

Returns:
input_node_idstr

The curie id of the input node.

resultdict

The result of the query for the input node.

result_parsedDataFrame

The parsed results for the input node.

result_ranked_by_primary_inforesDataFrame

The ranked results based on primary infores.

Examples

>>> input_node_id, result, result_parsed, result_ranked_by_primary_infores1 = neighborhood_finder('MONDO:0008170', #Ovarian Cancer
                                                                                        node2_categories = ['biolink:SmallMolecule', 'biolink:Drug', 'biolink:ChemicalEntity'],
                                                                                        APInames = APInames,
                                                                                        metaKG = metaKG,
                                                                                        API_predicates = API_predicates)
TCT.TCT_neighborhood_finder.neighborhood_finder_multiple_inputs(input_nodes: list[str], node2_categories: list[str], APInames, metaKG, API_predicates, input_node_category=[], predicates_subset=None, attribute_constraints=None)[source]

This function is used to find the neighborhood of a given input node with intermediate categories.

Parameters:
input_nodeslist[str]

The input nodes - should be a list of CURIE ids.

node2_categorieslist

A list of intermediate categories to be used in the neighborhood finding process.

APInamesdict

A dictionary containing the names of the APIs to be used.

metaKGDataFrame

The metadata knowledge graph containing information about the APIs and their predicates.

API_predicatesdict

A dictionary containing the predicates for each API.

input_node_categorylist

Optional. A list of categories for the input node. If empty, it will be derived from the input node’s types.

attribute_constraintslist

Optional. List of outputs of translator_query.build_attribute_constraint

Returns:
input_node_id (str)

The curie id of the input node.

result (dict)

The result of the query for the input node.

result_parsed (DataFrame)

The parsed results for the input node.

result_ranked_by_primary_infores (DataFrame)

The ranked results based on primary infores.

Examples

>>> result, result_parsed = neighborhood_finder_multiple_inputs(['NCBIGene:6774', 'NCBIGene:4170', 'NCBIGene:4792'],
                                                                node2_categories = ['biolink:SmallMolecule', 'biolink:Drug', 'biolink:ChemicalEntity'],
                                                                APInames = APInames,
                                                                metaKG = metaKG,
                                                                API_predicates = API_predicates)
TCT.TCT_neighborhood_finder.parse_results_for_neighborhood_finder(start_node_id: str, results: 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’.

TCT.TCT_neighborhood_finder.parse_results_for_neighborhood_finder_multiple_inputs(start_node_ids: list[str], results: 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’.