ETIA.CRV.visualization package
Submodules
ETIA.CRV.visualization.cytoscape_utils module
- 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:
objectA 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
- create_visual_style(node_size=35, node_shape='ellipse', node_color='#FDD49E')[source]
Creates a visual style for the Cytoscape network.
- plot_edge_confidence(edge_confidence)[source]
Plots edge confidence by adjusting edge widths and opacities.
- 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
- 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