risk-network 0.0.8b22__tar.gz → 0.0.8b23__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.
Files changed (44) hide show
  1. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/PKG-INFO +1 -1
  2. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/__init__.py +1 -1
  3. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/network/plot/utils/layout.py +38 -0
  4. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk_network.egg-info/PKG-INFO +1 -1
  5. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/LICENSE +0 -0
  6. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/MANIFEST.in +0 -0
  7. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/README.md +0 -0
  8. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/pyproject.toml +0 -0
  9. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/annotations/__init__.py +0 -0
  10. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/annotations/annotations.py +0 -0
  11. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/annotations/io.py +0 -0
  12. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/constants.py +0 -0
  13. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/log/__init__.py +0 -0
  14. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/log/config.py +0 -0
  15. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/log/params.py +0 -0
  16. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/neighborhoods/__init__.py +0 -0
  17. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/neighborhoods/community.py +0 -0
  18. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/neighborhoods/domains.py +0 -0
  19. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/neighborhoods/neighborhoods.py +0 -0
  20. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/network/__init__.py +0 -0
  21. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/network/geometry.py +0 -0
  22. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/network/graph.py +0 -0
  23. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/network/io.py +0 -0
  24. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/network/plot/__init__.py +0 -0
  25. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/network/plot/canvas.py +0 -0
  26. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/network/plot/contour.py +0 -0
  27. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/network/plot/labels.py +0 -0
  28. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/network/plot/network.py +0 -0
  29. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/network/plot/plotter.py +0 -0
  30. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/network/plot/utils/color.py +0 -0
  31. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/risk.py +0 -0
  32. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/stats/__init__.py +0 -0
  33. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/stats/hypergeom.py +0 -0
  34. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/stats/permutation/__init__.py +0 -0
  35. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/stats/permutation/permutation.py +0 -0
  36. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/stats/permutation/test_functions.py +0 -0
  37. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/stats/poisson.py +0 -0
  38. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk/stats/stats.py +0 -0
  39. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk_network.egg-info/SOURCES.txt +0 -0
  40. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk_network.egg-info/dependency_links.txt +0 -0
  41. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk_network.egg-info/requires.txt +0 -0
  42. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/risk_network.egg-info/top_level.txt +0 -0
  43. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/setup.cfg +0 -0
  44. {risk_network-0.0.8b22 → risk_network-0.0.8b23}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: risk-network
3
- Version: 0.0.8b22
3
+ Version: 0.0.8b23
4
4
  Summary: A Python package for biological network analysis
5
5
  Author: Ira Horecka
6
6
  Author-email: Ira Horecka <ira89@icloud.com>
@@ -7,4 +7,4 @@ RISK: RISK Infers Spatial Kinships
7
7
 
8
8
  from risk.risk import RISK
9
9
 
10
- __version__ = "0.0.8-beta.22"
10
+ __version__ = "0.0.8-beta.23"
@@ -30,6 +30,44 @@ def calculate_bounding_box(
30
30
  return center, radius
31
31
 
32
32
 
33
+ def refine_center_iteratively(
34
+ node_coordinates: np.ndarray,
35
+ radius_margin: float = 1.05,
36
+ max_iterations: int = 10,
37
+ tolerance: float = 1e-2,
38
+ ) -> Tuple[np.ndarray, float]:
39
+ """Refine the center of the graph iteratively to minimize skew in node distribution.
40
+
41
+ Args:
42
+ node_coordinates (np.ndarray): Array of node coordinates (x, y).
43
+ radius_margin (float, optional): Margin factor to apply to the bounding box radius. Defaults to 1.05.
44
+ max_iterations (int, optional): Maximum number of iterations for refining the center. Defaults to 10.
45
+ tolerance (float, optional): Stopping tolerance for center adjustment. Defaults to 1e-2.
46
+
47
+ Returns:
48
+ tuple: Refined center and the final radius.
49
+ """
50
+ # Initial center and radius based on the bounding box
51
+ center, radius = calculate_bounding_box(node_coordinates, radius_margin)
52
+ for _ in range(max_iterations):
53
+ # Shift the coordinates based on the current center
54
+ shifted_coordinates = node_coordinates - center
55
+ # Calculate skew (difference in distance from the center)
56
+ skew = np.mean(shifted_coordinates, axis=0)
57
+ # If skew is below tolerance, stop
58
+ if np.linalg.norm(skew) < tolerance:
59
+ break
60
+
61
+ # Adjust the center by moving it in the direction opposite to the skew
62
+ center += skew
63
+
64
+ # After refinement, recalculate the bounding radius
65
+ shifted_coordinates = node_coordinates - center
66
+ new_radius = np.max(np.linalg.norm(shifted_coordinates, axis=1)) * radius_margin
67
+
68
+ return center, new_radius
69
+
70
+
33
71
  def calculate_centroids(network, domain_id_to_node_ids_map):
34
72
  """Calculate the centroid for each domain based on node x and y coordinates in the network.
35
73
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: risk-network
3
- Version: 0.0.8b22
3
+ Version: 0.0.8b23
4
4
  Summary: A Python package for biological network analysis
5
5
  Author: Ira Horecka
6
6
  Author-email: Ira Horecka <ira89@icloud.com>
File without changes