ETIA.CRV.visualization package

Submodules

ETIA.CRV.visualization.cytoscape_utils module

cytoscape_ping()[source]
cytoscape_version_info()[source]
create_network_from_data_frames(edges, title, collection)[source]
matrix_to_cyto(matrix_pd)[source]
Parameters:

matrix – a pandas array of size N*N where N is the number of nodes in tetrad_graph matrix(i, j) = 2 and matrix(j, i) = 3: i–>j matrix(i, j) = 1 and matrix(j, i) = 1: io-oj should appear only in PAGs matrix(i, j) = 2 and matrix(j, i) = 2: i<->j should appear only in MAGs and PAGs matrix(i, j) = 3 and matrix(j, i) = 3: i—j should appear only in PDAGs matrix(i, j) = 2 and matrix(j, i) = 1: io->j

Returns:

a pandas dataframe of size (number of edges)*(3) which contains information about all edges

1st column : source 2nd column : target 3rd column : interaction_type

Return type:

cyto_edges

ETIA.CRV.visualization.visualization module

class Visualization(matrix_pd, net_name, collection_name)[source]

Bases: object

A class to create and manage network visualizations in Cytoscape based on causal discovery results.

Parameters:
  • matrix_pd (pd.DataFrame) – A pandas DataFrame containing the adjacency matrix of the graph to visualize.

  • net_name (str) – The name of the network to create in Cytoscape.

  • collection_name (str) – The name of the collection to store the network in Cytoscape.

style_name

The name of the visual style applied to the network in Cytoscape.

Type:

str

network_suid

The unique identifier for the network in Cytoscape.

Type:

int

plot_cytoscape()[source]

Plots the graph in Cytoscape based on the adjacency matrix.

create_visual_style(node_size=35, node_shape='ellipse', node_color='#FDD49E')[source]

Creates a visual style for the Cytoscape network.

set_node_color(node_names, color)[source]

Sets the color of specified nodes.

hide_nodes(nodes)[source]

Hides specific nodes from the Cytoscape network.

plot_edge_confidence(edge_confidence)[source]

Plots edge confidence by adjusting edge widths and opacities.

hide_edges(threshold)[source]

Hides edges based on a specified confidence threshold.

set_layout(layout_name='force-directed')[source]

Applies a layout to the network in Cytoscape.

export_to_png(file_path='network.png')[source]

Exports the network visualization as a PNG file.

plot_cytoscape()[source]

Plots the graph in Cytoscape based on the adjacency matrix.

This method converts the adjacency matrix into a Cytoscape-readable format and visualizes the graph in the Cytoscape application.

Return type:

None

create_visual_style(node_size=35, node_shape='ellipse', node_color='#FDD49E')[source]

Creates a visual style for the Cytoscape network.

Parameters:
  • node_size (int, optional) – The size of the nodes in the network. Default is 35.

  • node_shape (str, optional) – The shape of the nodes in the network. Default is ‘ellipse’.

  • node_color (str, optional) – The fill color of the nodes in the network. Default is ‘#FDD49E’.

Return type:

None

set_node_color(node_names, color)[source]

Sets the color for a specified list of nodes by their names.

Parameters:
  • node_names (list of str) – List of node names to set the color for.

  • color (str) – The color to apply to the nodes (e.g., ‘#ADD8E6’).

Return type:

None

hide_nodes(nodes)[source]

Hides a group of nodes identified by their names.

Parameters:

nodes (list of str) – List of node names to hide.

Return type:

None

plot_edge_confidence(edge_confidence)[source]

Plots edge confidence by adjusting edge widths and opacities.

Parameters:

edge_confidence (pd.DataFrame) – A DataFrame containing edge confidence data.

Return type:

None

hide_edges(threshold)[source]

Hides a group of edges based on a threshold value.

Parameters:

threshold (float) – Threshold for edge confidence. Edges below this value will be hidden.

Return type:

None

set_layout(layout_name='force-directed')[source]

Sets the layout for the network visualization.

Parameters:

layout_name (str, optional) – Name of the layout to apply (e.g., ‘force-directed’). Default is ‘force-directed’.

Return type:

None

export_to_png(file_path='network.png')[source]

Exports the current network view to a PNG file.

Parameters:

file_path (str, optional) – Path to save the PNG file. Default is ‘network.png’.

Return type:

None

matrix_to_cyto(matrix_pd)[source]

Converts an adjacency matrix to a Cytoscape-readable format.

Parameters:

matrix_pd (pd.DataFrame) – A pandas DataFrame representing an adjacency matrix.

Returns:

cyto_edges – A DataFrame of edges with source, target, and interaction type for Cytoscape visualization.

Return type:

pd.DataFrame