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_node (str)

The input node - should be a CURIE id.

node2_categories (list)

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

APInames (dict)

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

metaKG (DataFrame)

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

API_predicates (dict)

A dictionary containing the predicates for each API.

input_node_category (list)

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

attribute_constraints (list)

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.

Example:
>>> 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.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’.