TCT utility functions

TCT.TCT.Gene_id_converter(id_list, API_url)
TCT.TCT.ID_convert_to_preferred_name_nodeNormalizer(id_list)
TCT.TCT.TCT_help(func)
TCT.TCT.TRAPI_json_validation(query_json_cur_clean, ALL_predicates, ALL_categories)
TCT.TCT.add_new_API_for_query(APInames, metaKG, newAPIname, newAPIurl, newAPIcategory, newAPIsubject, newAPIobject)

This function is used to add a new API beyond the current list of APIs for query Example: APInames, metaKG = add_new_API_for_query(APInames, metaKG, “BigGIM_BMG”, “http://127.0.0.1:8000/find_path_by_predicate”, “Gene-physically_interacts_with-gene”, “Gene”, “Gene”)

TCT.TCT.ask_chatGPT(prompt_text)
TCT.TCT.ask_chatGPT4(prompt_text)
TCT.TCT.connecting_two_dots_two_hops(sorted_dic1, sorted_dic)
TCT.TCT.extract_json(txt)
TCT.TCT.filter_APIs(sele_predicates, metaKG)
TCT.TCT.find_path_by_two_ends(subject1_ids, subject1_categories, predicates1, object_categories, subject2_ids, subject2_categories, predicates2, API_list1, API_list2, API1_keys_forAnalysis, API1_keys_NotforAnalysis, API2_keys_forAnalysis, API2_keys_NotforAnalysis, metaKG, APInames)
TCT.TCT.find_similar_category(query_json_cur_clean, ALL_categories)
TCT.TCT.find_similar_predicates(query_json_cur_clean, ALL_predicates)
TCT.TCT.format_id(query_json_cur_clean)
TCT.TCT.format_query_json(subject_ids, object_ids, subject_categories, object_categories, predicates)

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.format_query_json_old(subject_ids, object_ids, subject_categories, object_categories, predicates)

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_KP_metadata()
TCT.TCT.get_SmartAPI_Translator_KP_info()

Get the SmartAPI Translator KP info from the smart-api.info API. Returns a DataFrame with the SmartAPI Translator KP info. Examples ——– >>> get_SmartAPI_Translator_KP_info(‘AML’)

TCT.TCT.get_Translator_API_URL(API_sele, APInames)
TCT.TCT.get_Translator_APIs()

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.get_curie(name)
TCT.TCT.get_pair_annotation(result, input_node_list)
TCT.TCT.get_ranking_by_infores(sorted_dic, Temp_result_df, Top)
TCT.TCT.get_ranking_by_kp(sorted_dic, Temp_result_df, Top)
TCT.TCT.get_ranking_by_predicates(sorted_dic, Temp_result_df, Top)
TCT.TCT.get_similar_category(query_json_cur_clean, KG_category)
TCT.TCT.get_similar_predicate(query_json_cur_clean, All_predicates)
TCT.TCT.list_Translator_APIs()
TCT.TCT.list_functions()
TCT.TCT.load_json_template()
TCT.TCT.merge_by_ranking_index(result_ranked_by_primary_infores, result_ranked_by_primary_infores2, top_n=20, title_fontsize=12, fontsize=12)
TCT.TCT.merge_ranking_by_number_of_infores(result_ranked_by_primary_infores, result_ranked_by_primary_infores1, top_n=30, fontsize=12, title_fontsize=12, output_png='NE_heatmap.png')
TCT.TCT.parallel_api_query(URLS, query_json, max_workers=1)
TCT.TCT.parse_KG(result)

subject_object subject object predicate primary_knowledge_sources aggregator_knowledge_sources subject_predicate_object_primary_knowledge_sources_aggregator_knowledge_sources

TCT.TCT.parse_network_result(result, input_node1_list)
TCT.TCT.parse_pair_annotation(pairs_found, input_node_list)
TCT.TCT.parse_result_old(API_keys_sele, API_keys_Not_include, predicates_forAnalysis, result_dic)
TCT.TCT.plot_graph_by_API(for_plot)
TCT.TCT.plot_graph_by_infores(for_plot)
TCT.TCT.plot_graph_by_predicates(for_plot)
TCT.TCT.plot_heatmap(predicates_by_nodes_df, num_of_nodes=20, fontsize=6, title_fontsize=10, output_png='NE_heatmap.png')
TCT.TCT.plot_heatmap_ui(predicates_by_nodes_df, num_of_nodes=20, fontsize=6, title_fontsize=10, output_png='NE_heatmap.png')
TCT.TCT.plot_path_bar(x, y, fontsize=8, title_fontsize=10, output_png='NE_heatmap.png')
TCT.TCT.query_KP(remoteURL, query_json)
TCT.TCT.query_KP_all(subject_ids, object_ids, subject_categories, object_categories, predicates, API_list, metaKG, APInames)
TCT.TCT.query_chatGPT(customized_input, model='gpt-3.5-turbo')
TCT.TCT.query_chatGPT4(customized_input)
TCT.TCT.rank_by_primary_infores(result_parsed, input_node)

Editd Dec 5, 2023

TCT.TCT.rank_by_primary_infores_input_as_list(result_parsed, input_nodes)

Editd Dec 5, 2023

TCT.TCT.ranking_result_by_predicates_object(Temp_result_df)
TCT.TCT.ranking_result_by_predicates_subject(Temp_result_df)
TCT.TCT.select_API(sub_list, obj_list, metaKG)

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

TCT.TCT.select_concept(sub_list, obj_list, metaKG)
TCT.TCT.select_predicates_inKP(sub_list, obj_list, KPname, metaKG)

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

TCT.TCT.select_result_to_analysis(sele_genes, Temp_result_df1, Temp_result_df2)
TCT.TCT.visulization_one_hop_ranking(result_ranked_by_primary_infores, result_parsed, num_of_nodes=20, input_query='NCBIGene:3845', fontsize=6, title_fontsize=12, output_png1='NE_heatmap1.png', output_png2='NE_heatmap2.png')
TCT.TCT.visulization_one_hop_ranking_input_as_list(result_ranked_by_primary_infores, result_parsed, num_of_nodes=20, input_query='NCBIGene:3845', fontsize=6, title_fontsize=12, output_png1='NE_heatmap1.png', output_png2='NE_heatmap2.png')
TCT.TCT.visulize_path(input_node1_id, intermediate_node, input_node3_id, result, result2)