risk-network 0.0.5b6__tar.gz → 0.0.6b0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/PKG-INFO +3 -4
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/README.md +2 -3
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/__init__.py +1 -1
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/network/io.py +19 -10
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/network/plot.py +20 -5
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk_network.egg-info/PKG-INFO +3 -4
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/LICENSE +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/MANIFEST.in +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/pyproject.toml +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/annotations/__init__.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/annotations/annotations.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/annotations/io.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/constants.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/log/__init__.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/log/console.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/log/params.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/neighborhoods/__init__.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/neighborhoods/community.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/neighborhoods/domains.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/neighborhoods/neighborhoods.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/network/__init__.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/network/geometry.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/network/graph.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/risk.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/stats/__init__.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/stats/fisher_exact.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/stats/hypergeom.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/stats/permutation/__init__.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/stats/permutation/permutation.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/stats/permutation/test_functions.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk/stats/stats.py +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk_network.egg-info/SOURCES.txt +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk_network.egg-info/dependency_links.txt +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk_network.egg-info/requires.txt +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/risk_network.egg-info/top_level.txt +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/setup.cfg +0 -0
- {risk_network-0.0.5b6 → risk_network-0.0.6b0}/setup.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: risk-network
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.6b0
|
4
4
|
Summary: A Python package for biological network analysis
|
5
5
|
Author: Ira Horecka
|
6
6
|
Author-email: Ira Horecka <ira89@icloud.com>
|
@@ -710,8 +710,7 @@ Requires-Dist: threadpoolctl
|
|
710
710
|
Requires-Dist: tqdm
|
711
711
|
|
712
712
|
<p align="center">
|
713
|
-
<img src="
|
714
|
-
<img src="./docs/github/risk-logo-light.png#gh-light-mode-only" width="400" />
|
713
|
+
<img src="https://i.imgur.com/Fo9EmnK.png" width="400" />
|
715
714
|
</p>
|
716
715
|
|
717
716
|
<p align="center">
|
@@ -736,7 +735,7 @@ RISK is a software tool for visualizing spatial relationships in networks. It ai
|
|
736
735
|
|
737
736
|
*Saccharomyces cerevisiae* proteins oriented by physical interactions discovered through affinity enrichment and mass spectrometry (Michaelis et al., 2023).
|
738
737
|
|
739
|
-

|
740
739
|
|
741
740
|
## Installation
|
742
741
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
<p align="center">
|
2
|
-
<img src="
|
3
|
-
<img src="./docs/github/risk-logo-light.png#gh-light-mode-only" width="400" />
|
2
|
+
<img src="https://i.imgur.com/Fo9EmnK.png" width="400" />
|
4
3
|
</p>
|
5
4
|
|
6
5
|
<p align="center">
|
@@ -25,7 +24,7 @@ RISK is a software tool for visualizing spatial relationships in networks. It ai
|
|
25
24
|
|
26
25
|
*Saccharomyces cerevisiae* proteins oriented by physical interactions discovered through affinity enrichment and mass spectrometry (Michaelis et al., 2023).
|
27
26
|
|
28
|
-

|
29
28
|
|
30
29
|
## Installation
|
31
30
|
|
@@ -418,29 +418,37 @@ class NetworkIO:
|
|
418
418
|
return G
|
419
419
|
|
420
420
|
def _remove_invalid_graph_properties(self, G: nx.Graph) -> None:
|
421
|
-
"""Remove invalid properties from the graph
|
421
|
+
"""Remove invalid properties from the graph, including self-loops, nodes with fewer edges than
|
422
|
+
the threshold, and isolated nodes.
|
422
423
|
|
423
424
|
Args:
|
424
425
|
G (nx.Graph): A NetworkX graph object.
|
425
426
|
"""
|
426
|
-
#
|
427
|
+
# Count number of nodes and edges before cleaning
|
428
|
+
num_initial_nodes = G.number_of_nodes()
|
429
|
+
num_initial_edges = G.number_of_edges()
|
430
|
+
# Remove self-loops to ensure correct edge count
|
427
431
|
G.remove_edges_from(list(nx.selfloop_edges(G)))
|
428
|
-
#
|
432
|
+
# Iteratively remove nodes with fewer edges than the threshold
|
429
433
|
while True:
|
430
|
-
nodes_to_remove = [
|
431
|
-
node for node in G.nodes() if G.degree(node) < self.min_edges_per_node
|
432
|
-
]
|
434
|
+
nodes_to_remove = [node for node in G.nodes if G.degree(node) < self.min_edges_per_node]
|
433
435
|
if not nodes_to_remove:
|
434
|
-
break # Exit loop if no more nodes
|
435
|
-
|
436
|
-
# Remove the nodes and their associated edges
|
436
|
+
break # Exit loop if no more nodes need removal
|
437
437
|
G.remove_nodes_from(nodes_to_remove)
|
438
438
|
|
439
|
-
#
|
439
|
+
# Remove isolated nodes
|
440
440
|
isolated_nodes = list(nx.isolates(G))
|
441
441
|
if isolated_nodes:
|
442
442
|
G.remove_nodes_from(isolated_nodes)
|
443
443
|
|
444
|
+
# Log the number of nodes and edges before and after cleaning
|
445
|
+
num_final_nodes = G.number_of_nodes()
|
446
|
+
num_final_edges = G.number_of_edges()
|
447
|
+
print(f"Initial node count: {num_initial_nodes}")
|
448
|
+
print(f"Final node count: {num_final_nodes}")
|
449
|
+
print(f"Initial edge count: {num_initial_edges}")
|
450
|
+
print(f"Final edge count: {num_final_edges}")
|
451
|
+
|
444
452
|
def _assign_edge_weights(self, G: nx.Graph) -> None:
|
445
453
|
"""Assign weights to the edges in the graph.
|
446
454
|
|
@@ -502,6 +510,7 @@ class NetworkIO:
|
|
502
510
|
print(f"Edge weight: {'Included' if self.include_edge_weight else 'Excluded'}")
|
503
511
|
if self.include_edge_weight:
|
504
512
|
print(f"Weight label: {self.weight_label}")
|
513
|
+
print(f"Minimum edges per node: {self.min_edges_per_node}")
|
505
514
|
print(f"Projection: {'Sphere' if self.compute_sphere else 'Plane'}")
|
506
515
|
if self.compute_sphere:
|
507
516
|
print(f"Surface depth: {self.surface_depth}")
|
@@ -630,12 +630,16 @@ class NetworkPlotter:
|
|
630
630
|
return domain_central_node
|
631
631
|
|
632
632
|
def get_annotated_node_colors(
|
633
|
-
self,
|
633
|
+
self,
|
634
|
+
nonenriched_color: Union[str, List, Tuple, np.ndarray] = "white",
|
635
|
+
random_seed: int = 888,
|
636
|
+
**kwargs,
|
634
637
|
) -> np.ndarray:
|
635
638
|
"""Adjust the colors of nodes in the network graph based on enrichment.
|
636
639
|
|
637
640
|
Args:
|
638
|
-
nonenriched_color (str, optional): Color for non-enriched nodes.
|
641
|
+
nonenriched_color (str, list, tuple, or np.ndarray, optional): Color for non-enriched nodes.
|
642
|
+
Defaults to "white". If an alpha channel is provided, it will be used to darken the RGB values.
|
639
643
|
random_seed (int, optional): Seed for random number generation. Defaults to 888.
|
640
644
|
**kwargs: Additional keyword arguments for `get_domain_colors`.
|
641
645
|
|
@@ -648,12 +652,23 @@ class NetworkPlotter:
|
|
648
652
|
# Convert the non-enriched color from string to RGBA
|
649
653
|
nonenriched_color = mcolors.to_rgba(nonenriched_color)
|
650
654
|
|
655
|
+
# Ensure nonenriched_color is a NumPy array
|
656
|
+
nonenriched_color = np.array(nonenriched_color)
|
657
|
+
# If alpha is provided (4th value), darken the RGB values based on alpha
|
658
|
+
if len(nonenriched_color) == 4 and nonenriched_color[3] < 1.0:
|
659
|
+
alpha = nonenriched_color[3]
|
660
|
+
# Adjust RGB based on alpha (darken)
|
661
|
+
nonenriched_color[:3] = nonenriched_color[:3] * alpha
|
662
|
+
# Set alpha to 1.0 after darkening the color
|
663
|
+
nonenriched_color[3] = 1.0
|
664
|
+
|
651
665
|
# Adjust node colors: replace any fully transparent nodes (enriched) with the non-enriched color
|
652
666
|
adjusted_network_colors = np.where(
|
653
|
-
np.all(network_colors == 0, axis=1, keepdims=True),
|
654
|
-
np.array([nonenriched_color]),
|
655
|
-
network_colors,
|
667
|
+
np.all(network_colors[:, :3] == 0, axis=1, keepdims=True), # Check RGB values only
|
668
|
+
np.array([nonenriched_color]), # Apply the non-enriched color (with adjusted alpha)
|
669
|
+
network_colors, # Keep the original colors
|
656
670
|
)
|
671
|
+
|
657
672
|
return adjusted_network_colors
|
658
673
|
|
659
674
|
def get_annotated_node_sizes(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: risk-network
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.6b0
|
4
4
|
Summary: A Python package for biological network analysis
|
5
5
|
Author: Ira Horecka
|
6
6
|
Author-email: Ira Horecka <ira89@icloud.com>
|
@@ -710,8 +710,7 @@ Requires-Dist: threadpoolctl
|
|
710
710
|
Requires-Dist: tqdm
|
711
711
|
|
712
712
|
<p align="center">
|
713
|
-
<img src="
|
714
|
-
<img src="./docs/github/risk-logo-light.png#gh-light-mode-only" width="400" />
|
713
|
+
<img src="https://i.imgur.com/Fo9EmnK.png" width="400" />
|
715
714
|
</p>
|
716
715
|
|
717
716
|
<p align="center">
|
@@ -736,7 +735,7 @@ RISK is a software tool for visualizing spatial relationships in networks. It ai
|
|
736
735
|
|
737
736
|
*Saccharomyces cerevisiae* proteins oriented by physical interactions discovered through affinity enrichment and mass spectrometry (Michaelis et al., 2023).
|
738
737
|
|
739
|
-

|
740
739
|
|
741
740
|
## Installation
|
742
741
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|