TCT utility functions

TCT.TCT.Neiborhood_finder(input_node, node2_categories, APInames, metaKG, API_predicates, input_node_category=[])[source]

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

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.

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.

node2_categories = [‘biolink:SmallMolecule’, ‘biolink:Drug’, ‘biolink:ChemicalEntity’], APInames = APInames, metaKG = metaKG, API_predicates = API_predicates)


TCT.TCT.Path_finder(input_node1, input_node2, intermediate_categories, APInames, metaKG, API_predicates, input_node1_category=[], input_node2_category=[])[source]

This function is used to find paths between two input nodes with intermediate categories.

input_node2 (str): The second input node, can be a gene name, protein name, or any other identifier. intermediate_categories (list): A list of intermediate categories to be used in the path finding process.

input_node1_id (str): The curie id of the first input node. input_node2_id (str): The curie id of the second input node. result1 (dict): The result of the query for the first input node. result2 (dict): The result of the query for the second input node. result_parsed1 (DataFrame): The parsed results for the first input node. result_parsed2 (DataFrame): The parsed results for the second input node. result_ranked_by_primary_infores1 (DataFrame): The ranked results for the first input node based on primary infores. result_ranked_by_primary_infores2 (DataFrame): The ranked results for the second ————– Example: >>> paths, input_node1_id, input_node2_id, result1, result2, result_parsed1, result_parsed2, result_ranked_by_primary_infores1, result_ranked_by_primary_infores2 = Path_finder(‘WNT7B’, ‘NPM1’, [‘biolink:Gene’, ‘biolink:Protein’]) ————–

TCT.TCT.format_query_json(subject_ids, object_ids, subject_categories, object_categories, predicates)[source]

Example input: subject_ids = [“NCBIGene:3845”] object_ids = [] subject_categories = [“biolink:Gene”] object_categories = [“biolink:Gene”] predicates = [“biolink:positively_correlated_with”, “biolink:physically_interacts_with”]

TCT.TCT.get_SmartAPI_Translator_KP_info()[source]

Get the SmartAPI Translator KP info from the smart-api.info API. Returns a DataFrame with the SmartAPI Translator KP info.

Examples

>>> Translator_KP_info,APInames = get_SmartAPI_Translator_KP_info('AML')
TCT.TCT.get_Translator_APIs()[source]

Get a list of Translator APIs from the smart-api.info and return the detailed information for each API in a data frame and the list of API names.

Examples

>>> Translator_KP_info,APInames= TCT.get_SmartAPI_Translator_KP_info() 
TCT.TCT.parse_KG(result)[source]

subject_object subject object predicate primary_knowledge_sources aggregator_knowledge_sources subject_predicate_object_primary_knowledge_sources_aggregator_knowledge_sources

TCT.TCT.rank_by_primary_infores(result_parsed, input_node)[source]

Editd Dec 5, 2023

TCT.TCT.rank_by_primary_infores_input_as_list(result_parsed, input_nodes)[source]

Editd Dec 5, 2023

TCT.TCT.sele_predicates_API(input_node1_category, input_node2_category, metaKG, APInames)[source]

Selects predicates, APIs, and API URLs for the given input node categories.

TCT.TCT.select_API(sub_list, obj_list, metaKG)[source]

selects the APIs that can connect the given subject and object categories in the meta knowledge graph.

sub_list = [“biolink:Gene”, “biolink:Protein”] obj_list = [“biolink:Gene”, “biolink:Disease”]

>>> obj_list = ["biolink:Gene", "biolink:Disease"]
>>> 
>>> Translator_KP_info,APInames= translator_kpinfo.get_translator_kp_info()
>>> print(len(Translator_KP_info))
>>> metaKG = translator_metakg.get_KP_metadata(APInames) 
>>> print(metaKG.shape)
>>> APInames,metaKG = translator_metakg.add_plover_API(APInames, metaKG)
>>> selected_apis = select_API(sub_list, obj_list, metaKG)
>>> print(selected_apis)
TCT.TCT.select_concept(sub_list, obj_list, metaKG)[source]

Selects the predicates connecting the given subject and object categories in the meta knowledge graph.

TCT.TCT.select_predicates_inKP(sub_list, obj_list, KPname, metaKG)[source]

sub_list = [“biolink:Gene”, “biolink:Protein”] obj_list = [“biolink:Gene”, “biolink:Disease”] KPname = “” # it should be one of the names in APInames