risk-network 0.0.9b33__tar.gz → 0.0.9b34__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 (48) hide show
  1. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/PKG-INFO +1 -1
  2. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/__init__.py +1 -1
  3. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/neighborhoods/api.py +3 -3
  4. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/network/io.py +18 -2
  5. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/stats/stat_tests.py +3 -3
  6. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk_network.egg-info/PKG-INFO +1 -1
  7. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/LICENSE +0 -0
  8. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/MANIFEST.in +0 -0
  9. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/README.md +0 -0
  10. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/pyproject.toml +0 -0
  11. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/annotations/__init__.py +0 -0
  12. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/annotations/annotations.py +0 -0
  13. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/annotations/io.py +0 -0
  14. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/constants.py +0 -0
  15. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/log/__init__.py +0 -0
  16. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/log/console.py +0 -0
  17. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/log/parameters.py +0 -0
  18. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/neighborhoods/__init__.py +0 -0
  19. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/neighborhoods/community.py +0 -0
  20. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/neighborhoods/domains.py +0 -0
  21. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/neighborhoods/neighborhoods.py +0 -0
  22. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/network/__init__.py +0 -0
  23. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/network/geometry.py +0 -0
  24. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/network/graph/__init__.py +0 -0
  25. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/network/graph/api.py +0 -0
  26. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/network/graph/graph.py +0 -0
  27. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/network/graph/summary.py +0 -0
  28. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/network/plotter/__init__.py +0 -0
  29. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/network/plotter/api.py +0 -0
  30. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/network/plotter/canvas.py +0 -0
  31. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/network/plotter/contour.py +0 -0
  32. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/network/plotter/labels.py +0 -0
  33. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/network/plotter/network.py +0 -0
  34. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/network/plotter/plotter.py +0 -0
  35. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/network/plotter/utils/colors.py +0 -0
  36. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/network/plotter/utils/layout.py +0 -0
  37. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/risk.py +0 -0
  38. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/stats/__init__.py +0 -0
  39. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/stats/permutation/__init__.py +0 -0
  40. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/stats/permutation/permutation.py +0 -0
  41. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/stats/permutation/test_functions.py +0 -0
  42. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk/stats/significance.py +0 -0
  43. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk_network.egg-info/SOURCES.txt +0 -0
  44. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk_network.egg-info/dependency_links.txt +0 -0
  45. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk_network.egg-info/requires.txt +0 -0
  46. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/risk_network.egg-info/top_level.txt +0 -0
  47. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/setup.cfg +0 -0
  48. {risk_network-0.0.9b33 → risk_network-0.0.9b34}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: risk-network
3
- Version: 0.0.9b33
3
+ Version: 0.0.9b34
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: Regional Inference of Significant Kinships
7
7
 
8
8
  from risk.risk import RISK
9
9
 
10
- __version__ = "0.0.9-beta.33"
10
+ __version__ = "0.0.9-beta.34"
@@ -280,7 +280,7 @@ class NeighborhoodsAPI:
280
280
  null_distribution: str = "network",
281
281
  random_seed: int = 888,
282
282
  ) -> Dict[str, Any]:
283
- """Load significant neighborhoods for the network using the Z-score test.
283
+ """Load significant neighborhoods for the network using the z-score test.
284
284
 
285
285
  Args:
286
286
  network (nx.Graph): The network graph.
@@ -299,8 +299,8 @@ class NeighborhoodsAPI:
299
299
  Returns:
300
300
  Dict[str, Any]: Computed significance of neighborhoods.
301
301
  """
302
- log_header("Running Z-score test")
303
- # Compute neighborhood significance using the Z-score test
302
+ log_header("Running z-score test")
303
+ # Compute neighborhood significance using the z-score test
304
304
  return self._load_neighborhoods_by_statistical_test(
305
305
  network=network,
306
306
  annotations=annotations,
@@ -262,8 +262,25 @@ class NetworkIO:
262
262
  attribute_table.columns = attribute_table.iloc[0]
263
263
  # Skip first four rows, select source and target columns, and reset index
264
264
  attribute_table = attribute_table.iloc[4:, :]
265
- attribute_table = attribute_table[[source_label, target_label]]
265
+ try:
266
+ # Attempt to filter the attribute_table with the given labels
267
+ attribute_table = attribute_table[[source_label, target_label]]
268
+ except KeyError as e:
269
+ # Find which key(s) caused the issue
270
+ missing_keys = [
271
+ key
272
+ for key in [source_label, target_label]
273
+ if key not in attribute_table.columns
274
+ ]
275
+ # Raise the KeyError with details about the issue and available options
276
+ available_columns = ", ".join(attribute_table.columns)
277
+ raise KeyError(
278
+ f"The column(s) '{', '.join(missing_keys)}' do not exist in the table. "
279
+ f"Available columns are: {available_columns}."
280
+ ) from e
281
+
266
282
  attribute_table = attribute_table.dropna().reset_index(drop=True)
283
+
267
284
  # Create a graph
268
285
  G = nx.Graph()
269
286
  # Add edges and nodes
@@ -271,7 +288,6 @@ class NetworkIO:
271
288
  source = row[source_label]
272
289
  target = row[target_label]
273
290
  G.add_edge(source, target)
274
-
275
291
  if source not in G:
276
292
  G.add_node(source) # Optionally add x, y coordinates here if available
277
293
  if target not in G:
@@ -215,7 +215,7 @@ def compute_zscore_test(
215
215
  null_distribution: str = "network",
216
216
  ) -> Dict[str, Any]:
217
217
  """
218
- Compute Z-score test for enrichment and depletion in neighborhoods with selectable null distribution.
218
+ Compute z-score test for enrichment and depletion in neighborhoods with selectable null distribution.
219
219
 
220
220
  Args:
221
221
  neighborhoods (csr_matrix): Sparse binary matrix representing neighborhoods.
@@ -257,10 +257,10 @@ def compute_zscore_test(
257
257
  * (1 - neighborhood_sums / background_population)
258
258
  )
259
259
  std_dev[std_dev == 0] = np.nan # Avoid division by zero
260
- # Compute Z-scores
260
+ # Compute z-scores
261
261
  z_scores = (observed - expected) / std_dev
262
262
 
263
- # Convert Z-scores to depletion and enrichment p-values
263
+ # Convert z-scores to depletion and enrichment p-values
264
264
  enrichment_pvals = norm.sf(z_scores) # Upper tail
265
265
  depletion_pvals = norm.cdf(z_scores) # Lower tail
266
266
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: risk-network
3
- Version: 0.0.9b33
3
+ Version: 0.0.9b34
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