Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.

meierlab.networks.graph.gen_base_graph_from_atlas#

meierlab.networks.graph.gen_base_graph_from_atlas(atlas, atlas_delim=',')[source]#

Generate a networkx graph containing atlas/parcellation information.

Parameters:
atlasstr or file path

Atlas file containing at minimum: [index, label] for parcellation data. Optionally, include additional node attributes (e.g., hemisphere, resolution, color, etc.).

atlas_delimstr, optional

Delimiter used to read the atlas, by default “,”.

Returns:
networkx.Graph

A networkx graph containing nodes with labels from the atlas given. Edges are the ((n*n-1)/2) + n combination of node pairs, which includes self-loop identity pairs.

Examples

>>> from meierlab.networks import graph
>>> atlas = 'schaefer2018/atlas.csv'
>>> G = graph.gen_base_graph_from_atlas(atlas)
>>> G.nodes()
NodeView(('LH_Vis_1', 'LH_Vis_2', 'LH_Vis_3',
'LH_Vis_4', 'LH_Vis_5', 'RH_Vis_1', 'RH_Vis_2',
'RH_Vis_3', 'RH_Vis_4', 'RH_Vis_5', 'LH_Default_Temp_1',
'LH_Default_Temp_2', 'LH_Default_Temp_3',
'LH_Default_Temp_4','LH_Default_Temp_5',
'LH_Default_Temp_6', 'LH_Default_Temp_7',
'LH_Default_Temp_8', 'LH_Default_Temp_9',
'LH_Default_Temp_10','RH_Default_Temp_1',
'RH_Default_Temp_2', 'RH_Default_Temp_3',
'RH_Default_Temp_4', 'RH_Default_Temp_5',
'RH_Default_Temp_6','RH_Default_Temp_7',
'RH_Default_Temp_8'))