Visualization¶
All methods used to perform the visualizations.
Network visualization¶
Utils to generate the Cytoscape.js network.
-
compath.visualization.cytoscape.filter_network_by_similarity(graph, min_similarity)[source]¶ Remove edges with similarity less than the minimum given.
- Parameters
graph (networkx.Graph) – graph
min_similarity (float) – minimum similarity required to keep an edge
-
compath.visualization.cytoscape.pathways_to_similarity_network(manager_dict, pathways)[source]¶ Create a graph with the given pathways related by their similarity
-
compath.visualization.cytoscape.enrich_graph_with_mappings(graph, mappings)[source]¶ Enrich a graph with the mapping information.
- Parameters
networkx.Graph (graph) –
mappings (iter) –
-
compath.visualization.cytoscape.networkx_to_cytoscape_js(graph)[source]¶ Convert a networkx graph to the cytoscape json format.
- Parameters
graph (iter[PathwayMapping]) –
- Return type
Dendrogram visualization¶
Utils to generate the D3.js dendrogram. This module is adapted from https://gist.github.com/mdml/7537455.
-
compath.visualization.d3_dendrogram.create_similarity_matrix(gene_sets)[source]¶ Create a similarity matrix for a given pathway-geneset dataset.
- Parameters
gene_sets (dict) – pathway gene set dictionary
- Return type
pandas.DataFrame
- Returns
similarity matrix
-
compath.visualization.d3_dendrogram.add_node(node, parent)[source]¶ Create a nested dictionary from the ClusterNode’s returned by SciPy.
- Parameters
node –
parent (dict) –
-
compath.visualization.d3_dendrogram.label_tree(id_name_dict, name_manager_dict, cluster_to_x, tree)[source]¶ Label the tree in a recursive way with names, resource and cluster information.
-
compath.visualization.d3_dendrogram.get_dendrogram_tree(gene_sets, pathway_manager_dict)[source]¶ Return ready to plot json data.
-
compath.visualization.d3_dendrogram.get_descendants(manager, resource, pathway_id, pathway_name)[source]¶ Generate d3 dendrogram structure by using BFS starting from the starting from a parent (root) node to the last descendants.
-
compath.visualization.d3_dendrogram.get_mapping_dendrogram(manager, resource, pathway_id, pathway_name)[source]¶ Generate d3 dendrogram structure by using BFS starting from the queried node in both directions of the hierarchy.
Venn Diagram visualization¶
Utils to generate the Venn Diagram.
-
compath.visualization.venn_diagram.process_overlap_for_venn_diagram(gene_sets, skip_gene_set_info=False)[source]¶ Calculate gene sets overlaps and process the structure to render venn diagram -> https://github.com/benfred/venn.js/.