TCT.TCT_network_annotator

TCT.TCT_network_annotator.get_connected_graph(result_parsed, input_identifiers)[source]

This function is used to extract the connected graph from the returned graph based on neighborhood finder from multiple inputs. It will only include the input nodes and the nodes that are connected to the input nodes with degree greater than 1.

Parameters:
result_parseddict

The parsed results for results from TCT_neighborhood_finder.neighborhood_finder_multiple_inputs().

input_identifierslist

A list of input node identifiers, which are also input for TCT_neighborhood_finder.neighborhood_finder_multiple_inputs().

Returns:
result_parseddict

The connected graph extracted from the parsed results.

Examples

>>> input_identifiers = ['NCBIGene:6774', 'NCBIGene:4170','NCBIGene:4792','NCBIGene:4288','NCBIGene:596','NCBIGene:581','NCBIGene:836','NCBIGene:6777','NCBIGene:4790','NCBIGene:545']
>>> result, result_parsed = TCT_neighborhood_finder.neighborhood_finder_multiple_inputs(input_identifiers,
                                                                                        node2_categories = ['biolink:Gene','biolink:Protein'],
                                                                                        APInames = APInames,
                                                                                        metaKG = metaKG,
                                                                                        API_predicates = API_predicates)   
>>> result = TCT_network_annotator.get_connected_graph(result_parsed, input_identifiers)
>>> import datetime
>>> import json
>>> timestamp = datetime.datetime.now().strftime('%Y%m%d_%H%M%S')
>>> with open('./PathFinder_testing_results/'+'TCT_neighborhood_finder_result_'+'_'+timestamp+'.json', 'w') as f:
>>>     json.dump(result, f)
>>> # visualize the result using the TCT visualization tool (https://github.com/NCATSTranslator/Translator_component_toolkit/blob/main/notebooks/visulize_path_finder_results.html). 
TCT.TCT_network_annotator.network_annotator(gene_list, select_APIs, node2_categories, select_metaKG, API_predicates, output_file=None)[source]

Filter multiple TRAPI neighborhood JSON files by gene list and merge them into a single TRAPI JSON.

Parameters:
gene_listlist

Gene symbols to keep.

output_filestr, optional

Output merged JSON file.

Returns:
dict

Merged TRAPI JSON object.