risk-network 0.0.5b5__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.5b5 → risk_network-0.0.6b0}/PKG-INFO +3 -4
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/README.md +2 -3
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/__init__.py +1 -1
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/network/io.py +19 -10
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/network/plot.py +23 -7
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk_network.egg-info/PKG-INFO +3 -4
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/LICENSE +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/MANIFEST.in +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/pyproject.toml +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/annotations/__init__.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/annotations/annotations.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/annotations/io.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/constants.py +2 -2
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/log/__init__.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/log/console.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/log/params.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/neighborhoods/__init__.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/neighborhoods/community.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/neighborhoods/domains.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/neighborhoods/neighborhoods.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/network/__init__.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/network/geometry.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/network/graph.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/risk.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/stats/__init__.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/stats/fisher_exact.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/stats/hypergeom.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/stats/permutation/__init__.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/stats/permutation/permutation.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/stats/permutation/test_functions.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk/stats/stats.py +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk_network.egg-info/SOURCES.txt +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk_network.egg-info/dependency_links.txt +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk_network.egg-info/requires.txt +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/risk_network.egg-info/top_level.txt +0 -0
- {risk_network-0.0.5b5 → risk_network-0.0.6b0}/setup.cfg +0 -0
- {risk_network-0.0.5b5 → 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}")
|
@@ -494,6 +494,7 @@ class NetworkPlotter:
|
|
494
494
|
if max_labels is not None and max_labels < len(filtered_domain_centroids):
|
495
495
|
step = len(filtered_domain_centroids) / max_labels
|
496
496
|
selected_indices = [int(i * step) for i in range(max_labels)]
|
497
|
+
# Filter the centroids, terms, and valid_indices to only use the selected indices
|
497
498
|
filtered_domain_centroids = {
|
498
499
|
k: v
|
499
500
|
for i, (k, v) in enumerate(filtered_domain_centroids.items())
|
@@ -504,8 +505,8 @@ class NetworkPlotter:
|
|
504
505
|
for i, (k, v) in enumerate(filtered_domain_terms.items())
|
505
506
|
if i in selected_indices
|
506
507
|
}
|
507
|
-
|
508
|
-
|
508
|
+
# Update valid_indices to match selected indices
|
509
|
+
valid_indices = [valid_indices[i] for i in selected_indices]
|
509
510
|
|
510
511
|
# Calculate the bounding box around the network
|
511
512
|
center, radius = _calculate_bounding_box(
|
@@ -629,12 +630,16 @@ class NetworkPlotter:
|
|
629
630
|
return domain_central_node
|
630
631
|
|
631
632
|
def get_annotated_node_colors(
|
632
|
-
self,
|
633
|
+
self,
|
634
|
+
nonenriched_color: Union[str, List, Tuple, np.ndarray] = "white",
|
635
|
+
random_seed: int = 888,
|
636
|
+
**kwargs,
|
633
637
|
) -> np.ndarray:
|
634
638
|
"""Adjust the colors of nodes in the network graph based on enrichment.
|
635
639
|
|
636
640
|
Args:
|
637
|
-
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.
|
638
643
|
random_seed (int, optional): Seed for random number generation. Defaults to 888.
|
639
644
|
**kwargs: Additional keyword arguments for `get_domain_colors`.
|
640
645
|
|
@@ -647,12 +652,23 @@ class NetworkPlotter:
|
|
647
652
|
# Convert the non-enriched color from string to RGBA
|
648
653
|
nonenriched_color = mcolors.to_rgba(nonenriched_color)
|
649
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
|
+
|
650
665
|
# Adjust node colors: replace any fully transparent nodes (enriched) with the non-enriched color
|
651
666
|
adjusted_network_colors = np.where(
|
652
|
-
np.all(network_colors == 0, axis=1, keepdims=True),
|
653
|
-
np.array([nonenriched_color]),
|
654
|
-
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
|
655
670
|
)
|
671
|
+
|
656
672
|
return adjusted_network_colors
|
657
673
|
|
658
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
|
@@ -3,6 +3,8 @@ risk/constants
|
|
3
3
|
~~~~~~~~~~~~~~
|
4
4
|
"""
|
5
5
|
|
6
|
+
GROUP_LINKAGE_METHODS = ["single", "complete", "average", "weighted", "centroid", "median", "ward"]
|
7
|
+
|
6
8
|
GROUP_DISTANCE_METRICS = [
|
7
9
|
"braycurtis",
|
8
10
|
"canberra",
|
@@ -27,5 +29,3 @@ GROUP_DISTANCE_METRICS = [
|
|
27
29
|
"sqeuclidean",
|
28
30
|
"yule",
|
29
31
|
]
|
30
|
-
|
31
|
-
GROUP_LINKAGE_METHODS = ["single", "complete", "average", "weighted", "centroid", "median", "ward"]
|
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
|