-
Notifications
You must be signed in to change notification settings - Fork 16
Graph methods
Jambler edited this page Jun 3, 2019
·
6 revisions
All methods available to NetworkX MultiDiGraph are also available.
graph_obj = import_gg_graph(<path_to_GG_xml_file>)
gg_object.ids()
>>> graph_obj = import_gg_graph('./3Genomes.xml')
>>> print(graph_obj.ids())
['H37Rv', 'H37Ra', 'W-148']
gg_object.get_sequence(region_start, region_stop, seq_name)
Where mtb_gg_object is a GenGraph object containing multiple genomes including H37Rv, and the carB gene sequence is found in MTB isolate H37Rv at position 1557101 - 1560448.
>>> carB_sequence = mtb_gg_object.get_sequence(1557101, 1560448, 'H37Rv')
>>> print(carB_sequence)
GTGCCCCGTCGCACCG...GGGGCGTCGAGCGGTGA
gg_object.get_region_subgraph(region_start, region_stop, seq_name)
Extract the subgraph representing the MTB carB gene.
>>> carB_subgraph = mtb_gg_object.get_region_subgraph(1557101, 1560448, 'H37Rv')