Skip to content

neurostatx.cli.CompareGraphs

Attributes

NameDescription
appCyclopts application for the CompareGraphs command-line tool.

Functions

NameDescription
CompareGraphsExtract high-percentile nodes from one graph and color them on another.

appattributemodule attribute#

app = App(default_parameter=Parameter(negative=()))

Cyclopts application for the CompareGraphs command-line tool.

CompareGraphsfunction#

def CompareGraphs(in_graph1: Annotated[str, Parameter(show_default=False, group='Essential Files Options')], weight: Annotated[str, Parameter(show_default=False, group='Essential Files Options')], percentile: Annotated[float, Parameter(show_default=False, group='Essential Files Options')], in_graph2: Annotated[str, Parameter(show_default=False, group='Essential Files Options')], out_folder: Annotated[str, Parameter(group='Essential Files Options')] = './comparison_results/', verbose: Annotated[bool, Parameter(-v, --verbose, group='Optional parameters')] = False, overwrite: Annotated[bool, Parameter(-f, --overwrite, group='Optional parameters')] = False, label_centroids: Annotated[bool, Parameter(show_default=True, group='Network Visualization Options')] = True, label_subjects: Annotated[bool, Parameter(show_default=True, group='Network Visualization Options')] = False, centroids_size: Annotated[int, Parameter(show_default=True, group='Network Visualization Options')] = 500, centroid_alpha: Annotated[float, Parameter(show_default=True, group='Network Visualization Options')] = 1, centroid_node_color: Annotated[str, Parameter(show_default=True, group='Network Visualization Options')] = 'white', centroid_edge_color: Annotated[str, Parameter(show_default=True, group='Network Visualization Options')] = 'black', subject_node_size: Annotated[int, Parameter(show_default=True, group='Network Visualization Options')] = 5, background_alpha: Annotated[bool, Parameter(show_default=True, group='Network Visualization Options')] = True, subject_edge_color: Annotated[str, Parameter(show_default=True, group='Network Visualization Options')] = None, colormap: Annotated[str, Parameter(show_default=True, group='Network Visualization Options')] = 'gray', legend_title: Annotated[str, Parameter(show_default=False, group='Network Visualization Options')] = 'Membership values')

Extract high-percentile nodes from one graph and color them on another.

CompareGraphs compares two undirected weighted graph networks by extracting the Xth-percentile nodes from –in-graph1 and labelling those nodes on –in-graph2. The percentile is set by –percentile.

Parameters

NameTypeDefaultDescription
in_graph1strrequiredFirst graph from which subjects above –percentile will be extracted and colored.
weightstrrequiredEdge weight to use for the graph.
percentilefloatrequiredPercentile value used to extract subjects.
in_graph2strrequiredSecond graph to color extracted subjects on.
out_folderstr'./comparison_results/'Path of the folder in which the results will be written. If not specified, current folder and default name will be used. Defaults to ./comparison_results/.
verboseboolFalseIf true, produce verbose output. Defaults to False.
overwriteboolFalseIf true, force overwriting of existing output files. Defaults to False.
label_centroidsboolTrueIf true, centroids will be labelled. Defaults to True.
label_subjectsboolFalseIf true, will label subjects nodes. Defaults to False.
centroids_sizeint500Size of the centroids nodes. Defaults to 500.
centroid_alphafloat1Alpha value representing the transparency of the centroids nodes. Defaults to 1.
centroid_node_colorstr'white'Centroids nodes color to use. Defaults to white.
centroid_edge_colorstr'black'Assign a color to the edge of the centroids nodes. Defaults to black.
subject_node_sizeint5Assign the size of the subjects nodes. Defaults to 5.
background_alphaboolTrueIf true, will plot the background nodes with alpha = 0.2. Defaults to True.
subject_edge_colorstrNoneAssign a color to the edge of the subjects nodes. Defaults to None.
colormapstr'gray'Colormap to use when coloring the edges of the network based on the membership values of each cluster. Available colormaps are those from Matplotlib (https://matplotlib.org/stable/tutorials/colors/colormaps.html). Defaults to gray.
legend_titlestr'Membership values'Legend title (colormap). Defaults to Membership values.

Examples

Terminal window
CompareGraphs --in-graph1 graph1.gml --in-matrix membership_mat.npy
--percentile 80 --in-graph2 graph2.gml