risk-network 0.0.14b2__py3-none-any.whl → 0.0.15__py3-none-any.whl
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/__init__.py +1 -1
- risk/_neighborhoods/_api.py +1 -95
- risk/_neighborhoods/_domains.py +77 -26
- risk/_neighborhoods/_neighborhoods.py +45 -23
- risk/_neighborhoods/_stats/__init__.py +0 -2
- risk/_neighborhoods/_stats/_tests.py +1 -105
- risk/_network/_graph/_summary.py +20 -22
- risk_network-0.0.15.dist-info/METADATA +109 -0
- {risk_network-0.0.14b2.dist-info → risk_network-0.0.15.dist-info}/RECORD +12 -12
- risk_network-0.0.14b2.dist-info/METADATA +0 -125
- {risk_network-0.0.14b2.dist-info → risk_network-0.0.15.dist-info}/WHEEL +0 -0
- {risk_network-0.0.14b2.dist-info → risk_network-0.0.15.dist-info}/licenses/LICENSE +0 -0
- {risk_network-0.0.14b2.dist-info → risk_network-0.0.15.dist-info}/top_level.txt +0 -0
risk/__init__.py
CHANGED
risk/_neighborhoods/_api.py
CHANGED
@@ -17,8 +17,6 @@ from ._stats import (
|
|
17
17
|
compute_chi2_test,
|
18
18
|
compute_hypergeom_test,
|
19
19
|
compute_permutation_test,
|
20
|
-
compute_poisson_test,
|
21
|
-
compute_zscore_test,
|
22
20
|
)
|
23
21
|
|
24
22
|
|
@@ -226,98 +224,6 @@ class NeighborhoodsAPI:
|
|
226
224
|
max_workers=max_workers,
|
227
225
|
)
|
228
226
|
|
229
|
-
def load_neighborhoods_poisson(
|
230
|
-
self,
|
231
|
-
network: nx.Graph,
|
232
|
-
annotation: Dict[str, Any],
|
233
|
-
distance_metric: Union[str, List, Tuple, np.ndarray] = "louvain",
|
234
|
-
louvain_resolution: float = 0.1,
|
235
|
-
leiden_resolution: float = 1.0,
|
236
|
-
fraction_shortest_edges: Union[float, List, Tuple, np.ndarray] = 0.5,
|
237
|
-
null_distribution: str = "network",
|
238
|
-
random_seed: int = 888,
|
239
|
-
) -> Dict[str, Any]:
|
240
|
-
"""
|
241
|
-
Load significant neighborhoods for the network using the Poisson test.
|
242
|
-
|
243
|
-
Args:
|
244
|
-
network (nx.Graph): The network graph.
|
245
|
-
annotation (Dict[str, Any]): The annotation associated with the network.
|
246
|
-
distance_metric (str, List, Tuple, or np.ndarray, optional): The distance metric(s) to use. Can be a string for one
|
247
|
-
metric or a list/tuple/ndarray of metrics ('greedy_modularity', 'louvain', 'leiden', 'label_propagation',
|
248
|
-
'markov_clustering', 'walktrap', 'spinglass'). Defaults to 'louvain'.
|
249
|
-
louvain_resolution (float, optional): Resolution parameter for Louvain clustering. Defaults to 0.1.
|
250
|
-
leiden_resolution (float, optional): Resolution parameter for Leiden clustering. Defaults to 1.0.
|
251
|
-
fraction_shortest_edges (float, List, Tuple, or np.ndarray, optional): Shortest edge rank fraction threshold(s) for creating subgraphs.
|
252
|
-
Can be a single float for one threshold or a list/tuple of floats corresponding to multiple thresholds.
|
253
|
-
Defaults to 0.5.
|
254
|
-
null_distribution (str, optional): Type of null distribution ('network' or 'annotation'). Defaults to "network".
|
255
|
-
random_seed (int, optional): Seed for random number generation. Defaults to 888.
|
256
|
-
|
257
|
-
Returns:
|
258
|
-
Dict[str, Any]: Computed significance of neighborhoods.
|
259
|
-
"""
|
260
|
-
log_header("Running Poisson test")
|
261
|
-
# Compute neighborhood significance using the Poisson test
|
262
|
-
return self._load_neighborhoods_by_statistical_test(
|
263
|
-
network=network,
|
264
|
-
annotation=annotation,
|
265
|
-
distance_metric=distance_metric,
|
266
|
-
louvain_resolution=louvain_resolution,
|
267
|
-
leiden_resolution=leiden_resolution,
|
268
|
-
fraction_shortest_edges=fraction_shortest_edges,
|
269
|
-
null_distribution=null_distribution,
|
270
|
-
random_seed=random_seed,
|
271
|
-
statistical_test_key="poisson",
|
272
|
-
statistical_test_function=compute_poisson_test,
|
273
|
-
)
|
274
|
-
|
275
|
-
def load_neighborhoods_zscore(
|
276
|
-
self,
|
277
|
-
network: nx.Graph,
|
278
|
-
annotation: Dict[str, Any],
|
279
|
-
distance_metric: Union[str, List, Tuple, np.ndarray] = "louvain",
|
280
|
-
louvain_resolution: float = 0.1,
|
281
|
-
leiden_resolution: float = 1.0,
|
282
|
-
fraction_shortest_edges: Union[float, List, Tuple, np.ndarray] = 0.5,
|
283
|
-
null_distribution: str = "network",
|
284
|
-
random_seed: int = 888,
|
285
|
-
) -> Dict[str, Any]:
|
286
|
-
"""
|
287
|
-
Load significant neighborhoods for the network using the z-score test.
|
288
|
-
|
289
|
-
Args:
|
290
|
-
network (nx.Graph): The network graph.
|
291
|
-
annotation (Dict[str, Any]): The annotation associated with the network.
|
292
|
-
distance_metric (str, List, Tuple, or np.ndarray, optional): The distance metric(s) to use. Can be a string for one
|
293
|
-
metric or a list/tuple/ndarray of metrics ('greedy_modularity', 'louvain', 'leiden', 'label_propagation',
|
294
|
-
'markov_clustering', 'walktrap', 'spinglass'). Defaults to 'louvain'.
|
295
|
-
louvain_resolution (float, optional): Resolution parameter for Louvain clustering. Defaults to 0.1.
|
296
|
-
leiden_resolution (float, optional): Resolution parameter for Leiden clustering. Defaults to 1.0.
|
297
|
-
fraction_shortest_edges (float, List, Tuple, or np.ndarray, optional): Shortest edge rank fraction threshold(s) for creating subgraphs.
|
298
|
-
Can be a single float for one threshold or a list/tuple of floats corresponding to multiple thresholds.
|
299
|
-
Defaults to 0.5.
|
300
|
-
null_distribution (str, optional): Type of null distribution ('network' or 'annotation'). Defaults to "network".
|
301
|
-
random_seed (int, optional): Seed for random number generation. Defaults to 888.
|
302
|
-
|
303
|
-
Returns:
|
304
|
-
Dict[str, Any]: Computed significance of neighborhoods.
|
305
|
-
"""
|
306
|
-
log_header("Running z-score test")
|
307
|
-
# Compute neighborhood significance using the z-score test
|
308
|
-
return self._load_neighborhoods_by_statistical_test(
|
309
|
-
network=network,
|
310
|
-
annotation=annotation,
|
311
|
-
distance_metric=distance_metric,
|
312
|
-
louvain_resolution=louvain_resolution,
|
313
|
-
leiden_resolution=leiden_resolution,
|
314
|
-
fraction_shortest_edges=fraction_shortest_edges,
|
315
|
-
null_distribution=null_distribution,
|
316
|
-
random_seed=random_seed,
|
317
|
-
statistical_test_key="zscore",
|
318
|
-
statistical_test_function=compute_zscore_test,
|
319
|
-
)
|
320
|
-
|
321
227
|
def _load_neighborhoods_by_statistical_test(
|
322
228
|
self,
|
323
229
|
network: nx.Graph,
|
@@ -348,7 +254,7 @@ class NeighborhoodsAPI:
|
|
348
254
|
null_distribution (str, optional): The type of null distribution to use ('network' or 'annotation').
|
349
255
|
Defaults to "network".
|
350
256
|
random_seed (int, optional): Seed for random number generation to ensure reproducibility. Defaults to 888.
|
351
|
-
statistical_test_key (str, optional): Key or name of the statistical test to be applied (e.g., "hypergeom", "
|
257
|
+
statistical_test_key (str, optional): Key or name of the statistical test to be applied (e.g., "hypergeom", "binom").
|
352
258
|
Used for logging and debugging. Defaults to "hypergeom".
|
353
259
|
statistical_test_function (Any, optional): The function implementing the statistical test.
|
354
260
|
It should accept neighborhoods, annotation, null distribution, and additional kwargs.
|
risk/_neighborhoods/_domains.py
CHANGED
@@ -54,37 +54,48 @@ def define_domains(
|
|
54
54
|
Raises:
|
55
55
|
ValueError: If the clustering criterion is set to "off" or if an error occurs during clustering.
|
56
56
|
"""
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
# Validate args first; let user mistakes raise immediately
|
58
|
+
clustering_off = _validate_clustering_args(
|
59
|
+
linkage_criterion, linkage_method, linkage_metric, linkage_threshold
|
60
|
+
)
|
60
61
|
|
62
|
+
# If clustering is turned off, assign unique domains and skip
|
63
|
+
if clustering_off:
|
64
|
+
n_rows = len(top_annotation)
|
65
|
+
logger.warning("Clustering is turned off. Skipping clustering.")
|
66
|
+
top_annotation["domain"] = range(1, n_rows + 1)
|
67
|
+
else:
|
61
68
|
# Transpose the matrix to cluster annotations
|
62
69
|
m = significant_neighborhoods_significance[:, top_annotation["significant_annotation"]].T
|
63
70
|
# Safeguard the matrix by replacing NaN, Inf, and -Inf values
|
64
71
|
m = _safeguard_matrix(m)
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
72
|
+
try:
|
73
|
+
# Optimize silhouette score across different linkage methods and distance metrics
|
74
|
+
(
|
75
|
+
best_linkage,
|
76
|
+
best_metric,
|
77
|
+
best_threshold,
|
78
|
+
) = _optimize_silhouette_across_linkage_and_metrics(
|
79
|
+
m, linkage_criterion, linkage_method, linkage_metric, linkage_threshold
|
80
|
+
)
|
81
|
+
# Perform hierarchical clustering
|
82
|
+
Z = linkage(m, method=best_linkage, metric=best_metric)
|
83
|
+
logger.warning(
|
84
|
+
f"Linkage criterion: '{linkage_criterion}'\nLinkage method: '{best_linkage}'\nLinkage metric: '{best_metric}'\nLinkage threshold: {round(best_threshold, 3)}"
|
85
|
+
)
|
86
|
+
# Calculate the optimal threshold for clustering
|
87
|
+
max_d_optimal = np.max(Z[:, 2]) * best_threshold
|
88
|
+
# Assign domains to the annotation matrix
|
89
|
+
domains = fcluster(Z, max_d_optimal, criterion=linkage_criterion)
|
90
|
+
top_annotation["domain"] = 0
|
91
|
+
top_annotation.loc[top_annotation["significant_annotation"], "domain"] = domains
|
92
|
+
except (LinAlgError, ValueError):
|
93
|
+
# Numerical errors or degenerate input are handled gracefully (not user error)
|
94
|
+
n_rows = len(top_annotation)
|
95
|
+
logger.error(
|
96
|
+
"Clustering failed due to numerical or data degeneracy. Assigning unique domains."
|
97
|
+
)
|
98
|
+
top_annotation["domain"] = range(1, n_rows + 1)
|
88
99
|
|
89
100
|
# Create DataFrames to store domain information
|
90
101
|
node_to_significance = pd.DataFrame(
|
@@ -184,6 +195,46 @@ def trim_domains(
|
|
184
195
|
return valid_domains, valid_trimmed_domains_matrix
|
185
196
|
|
186
197
|
|
198
|
+
def _validate_clustering_args(
|
199
|
+
linkage_criterion: str,
|
200
|
+
linkage_method: str,
|
201
|
+
linkage_metric: str,
|
202
|
+
linkage_threshold: Union[float, str],
|
203
|
+
) -> bool:
|
204
|
+
"""
|
205
|
+
Validate user-provided clustering arguments.
|
206
|
+
|
207
|
+
Returns:
|
208
|
+
bool: True if clustering is turned off (criterion == 'off'); False otherwise.
|
209
|
+
|
210
|
+
Raises:
|
211
|
+
ValueError: If any argument is invalid (user error).
|
212
|
+
"""
|
213
|
+
# Allow opting out of clustering without raising
|
214
|
+
if linkage_criterion == "off":
|
215
|
+
return True
|
216
|
+
# Validate linkage method (allow "auto")
|
217
|
+
if linkage_method != "auto" and linkage_method not in LINKAGE_METHODS:
|
218
|
+
raise ValueError(
|
219
|
+
f"Invalid linkage_method '{linkage_method}'. Allowed values are 'auto' or one of: {sorted(LINKAGE_METHODS)}"
|
220
|
+
)
|
221
|
+
# Validate linkage metric (allow "auto")
|
222
|
+
if linkage_metric != "auto" and linkage_metric not in LINKAGE_METRICS:
|
223
|
+
raise ValueError(
|
224
|
+
f"Invalid linkage_metric '{linkage_metric}'. Allowed values are 'auto' or one of: {sorted(LINKAGE_METRICS)}"
|
225
|
+
)
|
226
|
+
# Validate linkage threshold (allow "auto"; otherwise must be float in (0, 1])
|
227
|
+
if linkage_threshold != "auto":
|
228
|
+
try:
|
229
|
+
lt = float(linkage_threshold)
|
230
|
+
except (TypeError, ValueError):
|
231
|
+
raise ValueError("linkage_threshold must be 'auto' or a float in the interval (0, 1].")
|
232
|
+
if not (0.0 < lt <= 1.0):
|
233
|
+
raise ValueError(f"linkage_threshold must be within (0, 1]. Received: {lt}")
|
234
|
+
|
235
|
+
return False
|
236
|
+
|
237
|
+
|
187
238
|
def _safeguard_matrix(matrix: np.ndarray) -> np.ndarray:
|
188
239
|
"""
|
189
240
|
Safeguard the matrix by replacing NaN, Inf, and -Inf values.
|
@@ -394,34 +394,33 @@ def _prune_neighbors(
|
|
394
394
|
# Identify indices with non-zero rows in the binary significance matrix
|
395
395
|
non_zero_indices = np.where(significant_binary_significance_matrix.sum(axis=1) != 0)[0]
|
396
396
|
median_distances = []
|
397
|
+
distance_lookup = {}
|
397
398
|
for node in non_zero_indices:
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
399
|
+
dist = _median_distance_to_significant_neighbors(
|
400
|
+
node, network, significant_binary_significance_matrix
|
401
|
+
)
|
402
|
+
if dist is not None:
|
403
|
+
median_distances.append(dist)
|
404
|
+
distance_lookup[node] = dist
|
405
|
+
|
406
|
+
if not median_distances:
|
407
|
+
logger.warning("No significant neighbors found for pruning.")
|
408
|
+
significant_significance_matrix = np.where(
|
409
|
+
significant_binary_significance_matrix == 1, significance_matrix, 0
|
410
|
+
)
|
411
|
+
return (
|
412
|
+
significance_matrix,
|
413
|
+
significant_binary_significance_matrix,
|
414
|
+
significant_significance_matrix,
|
415
|
+
)
|
408
416
|
|
409
417
|
# Calculate the distance threshold value based on rank
|
410
418
|
distance_threshold_value = _calculate_threshold(median_distances, 1 - distance_threshold)
|
411
419
|
# Prune nodes that are outliers based on the distance threshold
|
412
|
-
for
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
if significant_binary_significance_matrix[n].sum() != 0
|
417
|
-
]
|
418
|
-
if neighbors:
|
419
|
-
median_distance = np.median(
|
420
|
-
[_get_euclidean_distance(row_index, n, network) for n in neighbors]
|
421
|
-
)
|
422
|
-
if median_distance >= distance_threshold_value:
|
423
|
-
significance_matrix[row_index] = 0
|
424
|
-
significant_binary_significance_matrix[row_index] = 0
|
420
|
+
for node, dist in distance_lookup.items():
|
421
|
+
if dist >= distance_threshold_value:
|
422
|
+
significance_matrix[node] = 0
|
423
|
+
significant_binary_significance_matrix[node] = 0
|
425
424
|
|
426
425
|
# Create a matrix where non-significant entries are set to zero
|
427
426
|
significant_significance_matrix = np.where(
|
@@ -435,6 +434,29 @@ def _prune_neighbors(
|
|
435
434
|
)
|
436
435
|
|
437
436
|
|
437
|
+
def _median_distance_to_significant_neighbors(
|
438
|
+
node, network, significance_mask
|
439
|
+
) -> Union[float, None]:
|
440
|
+
"""
|
441
|
+
Calculate the median distance from a node to its significant neighbors.
|
442
|
+
|
443
|
+
Args:
|
444
|
+
node (Any): The node for which the median distance is being calculated.
|
445
|
+
network (nx.Graph): The network graph containing the nodes.
|
446
|
+
significance_mask (np.ndarray): Binary matrix indicating significant nodes.
|
447
|
+
|
448
|
+
Returns:
|
449
|
+
Union[float, None]: The median distance to significant neighbors, or None if no significant neighbors exist.
|
450
|
+
"""
|
451
|
+
neighbors = [n for n in network.neighbors(node) if significance_mask[n].sum() != 0]
|
452
|
+
if not neighbors:
|
453
|
+
return None
|
454
|
+
# Calculate distances to significant neighbors
|
455
|
+
distances = [_get_euclidean_distance(node, n, network) for n in neighbors]
|
456
|
+
|
457
|
+
return np.median(distances)
|
458
|
+
|
459
|
+
|
438
460
|
def _get_euclidean_distance(node1: Any, node2: Any, network: nx.Graph) -> float:
|
439
461
|
"""
|
440
462
|
Calculate the Euclidean distance between two nodes in the network.
|
@@ -7,7 +7,7 @@ from typing import Any, Dict
|
|
7
7
|
|
8
8
|
import numpy as np
|
9
9
|
from scipy.sparse import csr_matrix
|
10
|
-
from scipy.stats import binom, chi2, hypergeom, norm
|
10
|
+
from scipy.stats import binom, chi2, hypergeom, norm
|
11
11
|
|
12
12
|
|
13
13
|
def compute_binom_test(
|
@@ -174,107 +174,3 @@ def compute_hypergeom_test(
|
|
174
174
|
)
|
175
175
|
|
176
176
|
return {"depletion_pvals": depletion_pvals, "enrichment_pvals": enrichment_pvals}
|
177
|
-
|
178
|
-
|
179
|
-
def compute_poisson_test(
|
180
|
-
neighborhoods: csr_matrix,
|
181
|
-
annotation: csr_matrix,
|
182
|
-
null_distribution: str = "network",
|
183
|
-
) -> Dict[str, Any]:
|
184
|
-
"""
|
185
|
-
Compute Poisson test for enrichment and depletion in neighborhoods with selectable null distribution.
|
186
|
-
|
187
|
-
Args:
|
188
|
-
neighborhoods (csr_matrix): Sparse binary matrix representing neighborhoods.
|
189
|
-
annotation (csr_matrix): Sparse binary matrix representing annotation.
|
190
|
-
null_distribution (str, optional): Type of null distribution ('network' or 'annotation'). Defaults to "network".
|
191
|
-
|
192
|
-
Returns:
|
193
|
-
Dict[str, Any]: Dictionary containing depletion and enrichment p-values.
|
194
|
-
|
195
|
-
Raises:
|
196
|
-
ValueError: If an invalid null_distribution value is provided.
|
197
|
-
"""
|
198
|
-
# Matrix multiplication to get the number of annotated nodes in each neighborhood
|
199
|
-
annotated_in_neighborhood = neighborhoods @ annotation # Sparse result
|
200
|
-
# Convert annotated counts to dense for downstream calculations
|
201
|
-
annotated_in_neighborhood_dense = annotated_in_neighborhood.toarray()
|
202
|
-
|
203
|
-
# Compute lambda_expected based on the chosen null distribution
|
204
|
-
if null_distribution == "network":
|
205
|
-
# Use the mean across neighborhoods (axis=1)
|
206
|
-
lambda_expected = np.mean(annotated_in_neighborhood_dense, axis=1, keepdims=True)
|
207
|
-
elif null_distribution == "annotation":
|
208
|
-
# Use the mean across annotations (axis=0)
|
209
|
-
lambda_expected = np.mean(annotated_in_neighborhood_dense, axis=0, keepdims=True)
|
210
|
-
else:
|
211
|
-
raise ValueError(
|
212
|
-
"Invalid null_distribution value. Choose either 'network' or 'annotation'."
|
213
|
-
)
|
214
|
-
|
215
|
-
# Compute p-values for enrichment and depletion using Poisson distribution
|
216
|
-
enrichment_pvals = 1 - poisson.cdf(annotated_in_neighborhood_dense - 1, lambda_expected)
|
217
|
-
depletion_pvals = poisson.cdf(annotated_in_neighborhood_dense, lambda_expected)
|
218
|
-
|
219
|
-
return {"enrichment_pvals": enrichment_pvals, "depletion_pvals": depletion_pvals}
|
220
|
-
|
221
|
-
|
222
|
-
def compute_zscore_test(
|
223
|
-
neighborhoods: csr_matrix,
|
224
|
-
annotation: csr_matrix,
|
225
|
-
null_distribution: str = "network",
|
226
|
-
) -> Dict[str, Any]:
|
227
|
-
"""
|
228
|
-
Compute z-score test for enrichment and depletion in neighborhoods with selectable null distribution.
|
229
|
-
|
230
|
-
Args:
|
231
|
-
neighborhoods (csr_matrix): Sparse binary matrix representing neighborhoods.
|
232
|
-
annotation (csr_matrix): Sparse binary matrix representing annotation.
|
233
|
-
null_distribution (str, optional): Type of null distribution ('network' or 'annotation'). Defaults to "network".
|
234
|
-
|
235
|
-
Returns:
|
236
|
-
Dict[str, Any]: Dictionary containing depletion and enrichment p-values.
|
237
|
-
|
238
|
-
Raises:
|
239
|
-
ValueError: If an invalid null_distribution value is provided.
|
240
|
-
"""
|
241
|
-
# Total number of nodes in the network
|
242
|
-
total_node_count = neighborhoods.shape[1]
|
243
|
-
|
244
|
-
# Compute sums
|
245
|
-
if null_distribution == "network":
|
246
|
-
background_population = total_node_count
|
247
|
-
neighborhood_sums = neighborhoods.sum(axis=0).A.flatten() # Dense column sums
|
248
|
-
annotation_sums = annotation.sum(axis=0).A.flatten() # Dense row sums
|
249
|
-
elif null_distribution == "annotation":
|
250
|
-
annotated_nodes = annotation.sum(axis=1).A.flatten() > 0 # Dense boolean mask
|
251
|
-
background_population = annotated_nodes.sum()
|
252
|
-
neighborhood_sums = neighborhoods[annotated_nodes].sum(axis=0).A.flatten()
|
253
|
-
annotation_sums = annotation[annotated_nodes].sum(axis=0).A.flatten()
|
254
|
-
else:
|
255
|
-
raise ValueError(
|
256
|
-
"Invalid null_distribution value. Choose either 'network' or 'annotation'."
|
257
|
-
)
|
258
|
-
|
259
|
-
# Observed values
|
260
|
-
observed = (neighborhoods.T @ annotation).toarray() # Convert sparse result to dense
|
261
|
-
# Expected values under the null
|
262
|
-
neighborhood_sums = neighborhood_sums.reshape(-1, 1) # Ensure correct shape
|
263
|
-
annotation_sums = annotation_sums.reshape(1, -1) # Ensure correct shape
|
264
|
-
expected = (neighborhood_sums @ annotation_sums) / background_population
|
265
|
-
|
266
|
-
# Standard deviation under the null
|
267
|
-
std_dev = np.sqrt(
|
268
|
-
expected
|
269
|
-
* (1 - annotation_sums / background_population)
|
270
|
-
* (1 - neighborhood_sums / background_population)
|
271
|
-
)
|
272
|
-
std_dev[std_dev == 0] = np.nan # Avoid division by zero
|
273
|
-
# Compute z-scores
|
274
|
-
z_scores = (observed - expected) / std_dev
|
275
|
-
|
276
|
-
# Convert z-scores to depletion and enrichment p-values
|
277
|
-
enrichment_pvals = norm.sf(z_scores) # Upper tail
|
278
|
-
depletion_pvals = norm.cdf(z_scores) # Lower tail
|
279
|
-
|
280
|
-
return {"depletion_pvals": depletion_pvals, "enrichment_pvals": enrichment_pvals}
|
risk/_network/_graph/_summary.py
CHANGED
@@ -84,7 +84,7 @@ class Summary:
|
|
84
84
|
|
85
85
|
Returns:
|
86
86
|
pd.DataFrame: Processed DataFrame containing significance scores, p-values, q-values,
|
87
|
-
and annotation
|
87
|
+
and matched annotation members information.
|
88
88
|
"""
|
89
89
|
log_header("Loading analysis summary")
|
90
90
|
# Calculate significance and depletion q-values from p-value matrices in annotation
|
@@ -109,9 +109,9 @@ class Summary:
|
|
109
109
|
# Add minimum p-values and q-values to DataFrame
|
110
110
|
results[
|
111
111
|
[
|
112
|
-
"Enrichment P-
|
112
|
+
"Enrichment P-value",
|
113
113
|
"Enrichment Q-value",
|
114
|
-
"Depletion P-
|
114
|
+
"Depletion P-value",
|
115
115
|
"Depletion Q-value",
|
116
116
|
]
|
117
117
|
] = results.apply(
|
@@ -126,26 +126,27 @@ class Summary:
|
|
126
126
|
axis=1,
|
127
127
|
result_type="expand",
|
128
128
|
)
|
129
|
-
# Add annotation members and their counts
|
130
|
-
results["
|
129
|
+
# Add matched annotation members and their counts
|
130
|
+
results["Matched Members"] = results["Annotation"].apply(
|
131
131
|
lambda desc: self._get_annotation_members(desc)
|
132
132
|
)
|
133
|
-
results["
|
134
|
-
"
|
135
|
-
|
133
|
+
results["Matched Count"] = results["Matched Members"].apply(
|
134
|
+
lambda x: len(x.split(";")) if x else 0
|
135
|
+
)
|
136
136
|
|
137
|
+
# Drop the "Summed Significance Score" column before reordering and returning
|
138
|
+
results = results.drop(columns=["Summed Significance Score"])
|
137
139
|
# Reorder columns and drop rows with NaN values
|
138
140
|
results = (
|
139
141
|
results[
|
140
142
|
[
|
141
143
|
"Domain ID",
|
142
144
|
"Annotation",
|
143
|
-
"
|
144
|
-
"
|
145
|
-
"
|
146
|
-
"Enrichment P-Value",
|
145
|
+
"Matched Members",
|
146
|
+
"Matched Count",
|
147
|
+
"Enrichment P-value",
|
147
148
|
"Enrichment Q-value",
|
148
|
-
"Depletion P-
|
149
|
+
"Depletion P-value",
|
149
150
|
"Depletion Q-value",
|
150
151
|
]
|
151
152
|
]
|
@@ -159,20 +160,17 @@ class Summary:
|
|
159
160
|
results = pd.merge(ordered_annotation, results, on="Annotation", how="left").fillna(
|
160
161
|
{
|
161
162
|
"Domain ID": -1,
|
162
|
-
"
|
163
|
-
"
|
164
|
-
"
|
165
|
-
"Enrichment P-Value": 1.0,
|
163
|
+
"Matched Members": "",
|
164
|
+
"Matched Count": 0,
|
165
|
+
"Enrichment P-value": 1.0,
|
166
166
|
"Enrichment Q-value": 1.0,
|
167
|
-
"Depletion P-
|
167
|
+
"Depletion P-value": 1.0,
|
168
168
|
"Depletion Q-value": 1.0,
|
169
169
|
}
|
170
170
|
)
|
171
|
-
# Convert "Domain ID" and "
|
171
|
+
# Convert "Domain ID" and "Matched Count" to integers
|
172
172
|
results["Domain ID"] = results["Domain ID"].astype(int)
|
173
|
-
results["
|
174
|
-
"Annotation Members in Network Count"
|
175
|
-
].astype(int)
|
173
|
+
results["Matched Count"] = results["Matched Count"].astype(int)
|
176
174
|
|
177
175
|
return results
|
178
176
|
|
@@ -0,0 +1,109 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: risk-network
|
3
|
+
Version: 0.0.15
|
4
|
+
Summary: A Python package for scalable network analysis and high-quality visualization.
|
5
|
+
Author-email: Ira Horecka <ira89@icloud.com>
|
6
|
+
License: GPL-3.0-or-later
|
7
|
+
Project-URL: Homepage, https://github.com/riskportal/risk
|
8
|
+
Project-URL: Issues, https://github.com/riskportal/risk/issues
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
10
|
+
Classifier: Intended Audience :: Developers
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
12
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
13
|
+
Classifier: Operating System :: OS Independent
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
21
|
+
Requires-Python: >=3.8
|
22
|
+
Description-Content-Type: text/markdown
|
23
|
+
License-File: LICENSE
|
24
|
+
Requires-Dist: ipywidgets
|
25
|
+
Requires-Dist: leidenalg
|
26
|
+
Requires-Dist: markov_clustering
|
27
|
+
Requires-Dist: matplotlib
|
28
|
+
Requires-Dist: networkx
|
29
|
+
Requires-Dist: nltk
|
30
|
+
Requires-Dist: numpy
|
31
|
+
Requires-Dist: openpyxl
|
32
|
+
Requires-Dist: pandas
|
33
|
+
Requires-Dist: python-igraph
|
34
|
+
Requires-Dist: python-louvain
|
35
|
+
Requires-Dist: scikit-learn
|
36
|
+
Requires-Dist: scipy
|
37
|
+
Requires-Dist: statsmodels
|
38
|
+
Requires-Dist: threadpoolctl
|
39
|
+
Requires-Dist: tqdm
|
40
|
+
Dynamic: license-file
|
41
|
+
|
42
|
+
# RISK
|
43
|
+
|
44
|
+

|
45
|
+
[](https://pypi.python.org/pypi/risk-network)
|
46
|
+

|
47
|
+
[](https://doi.org/10.5281/zenodo.xxxxxxx)
|
48
|
+

|
49
|
+

|
50
|
+
|
51
|
+
**RISK** (Regional Inference of Significant Kinships) is a next-generation tool for biological network annotation and visualization. It integrates community detection algorithms, rigorous overrepresentation analysis, and a modular framework for diverse network types. RISK identifies biologically coherent relationships within networks and generates publication-ready visualizations, making it a useful tool for biological and interdisciplinary network analysis.
|
52
|
+
|
53
|
+
For a full description of RISK and its applications, see:
|
54
|
+
<br>
|
55
|
+
**Horecka and Röst (2025)**, _"RISK: a next-generation tool for biological network annotation and visualization"_.
|
56
|
+
<br>
|
57
|
+
DOI: [10.5281/zenodo.xxxxxxx](https://doi.org/10.5281/zenodo.xxxxxxx)
|
58
|
+
|
59
|
+
## Documentation and Tutorial
|
60
|
+
|
61
|
+
Full documentation is available at:
|
62
|
+
|
63
|
+
- **Docs:** [https://riskportal.github.io/risk-docs](https://riskportal.github.io/risk-docs)
|
64
|
+
- **Tutorial Jupyter Notebook Repository:** [https://github.com/riskportal/risk-docs](https://github.com/riskportal/risk-docs)
|
65
|
+
|
66
|
+
## Installation
|
67
|
+
|
68
|
+
RISK is compatible with Python 3.8 or later and runs on all major operating systems. To install the latest version of RISK, run:
|
69
|
+
|
70
|
+
```bash
|
71
|
+
pip install risk-network --upgrade
|
72
|
+
```
|
73
|
+
|
74
|
+
## Key Features of RISK
|
75
|
+
|
76
|
+
- **Broad Data Compatibility**: Accepts multiple network formats (Cytoscape, Cytoscape JSON, GPickle, NetworkX) and user-provided annotations formatted as term–to–gene membership tables (JSON, CSV, TSV, Excel, Python dictionaries).
|
77
|
+
- **Flexible Clustering**: Offers Louvain, Leiden, Markov Clustering, Greedy Modularity, Label Propagation, Spinglass, and Walktrap, with user-defined resolution parameters to detect both coarse and fine-grained modules.
|
78
|
+
- **Statistical Testing**: Provides permutation, hypergeometric, chi-squared, and binomial tests, balancing statistical rigor with speed.
|
79
|
+
- **High-Resolution Visualization**: Generates publication-ready figures with customizable node/edge properties, contour overlays, and export to SVG, PNG, or PDF.
|
80
|
+
|
81
|
+
## Example Usage
|
82
|
+
|
83
|
+
We applied RISK to a _Saccharomyces cerevisiae_ protein–protein interaction (PPI) network (Michaelis _et al_., 2023; 3,839 proteins, 30,955 interactions). RISK identified compact, functional modules overrepresented in Gene Ontology Biological Process (GO BP) terms (Ashburner _et al_., 2000), revealing biological organization including ribosomal assembly, mitochondrial organization, and RNA polymerase activity (P < 0.0001).
|
84
|
+
|
85
|
+
[](https://i.imgur.com/fSNf5Ad.jpeg)
|
86
|
+
**RISK workflow overview and analysis of the yeast PPI network**. GO BP terms are color-coded to represent key cellular processes—including ribosomal assembly, mitochondrial organization, and RNA polymerase activity (P < 0.0001).
|
87
|
+
|
88
|
+
## Citation
|
89
|
+
|
90
|
+
If you use RISK in your research, please cite the following:
|
91
|
+
|
92
|
+
**Horecka and Röst (2025)**, _"RISK: a next-generation tool for biological network annotation and visualization"_.
|
93
|
+
<br>
|
94
|
+
DOI: [10.5281/zenodo.xxxxxxx](https://doi.org/10.5281/zenodo.xxxxxxx)
|
95
|
+
|
96
|
+
## Contributing
|
97
|
+
|
98
|
+
We welcome contributions from the community:
|
99
|
+
|
100
|
+
- [Issues Tracker](https://github.com/riskportal/risk/issues)
|
101
|
+
- [Source Code](https://github.com/riskportal/risk/tree/main/risk)
|
102
|
+
|
103
|
+
## Support
|
104
|
+
|
105
|
+
If you encounter issues or have suggestions for new features, please use the [Issues Tracker](https://github.com/riskportal/risk/issues) on GitHub.
|
106
|
+
|
107
|
+
## License
|
108
|
+
|
109
|
+
RISK is open source under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html).
|
@@ -1,4 +1,4 @@
|
|
1
|
-
risk/__init__.py,sha256=
|
1
|
+
risk/__init__.py,sha256=XXYfTIS7rMH0d7BtRqnU9BgUTlsbGb-ZDHV8bs7wekc,136
|
2
2
|
risk/_risk.py,sha256=VULCdM41BlWKM1ou4Qc579ffZ9dMZkfhAwKYgbaEeKM,1054
|
3
3
|
risk/_annotation/__init__.py,sha256=zr7w1DHkmvrkKFGKdPhrcvZHV-xsfd5TZOaWtFiP4Dc,164
|
4
4
|
risk/_annotation/_annotation.py,sha256=03vcnkdi4HGH5UUyokUyOdyyjXOLoKSmLFuK7VAl41c,15174
|
@@ -8,12 +8,12 @@ risk/_log/__init__.py,sha256=LX6BsfcGOH0RbAdQaUmIU-LVMmArDdKwn0jFtj45FYo,205
|
|
8
8
|
risk/_log/_console.py,sha256=1jSFzY3w0-vVqIBCgc-IhyJPNT6vRg8GSGxhyw_D9MI,4653
|
9
9
|
risk/_log/_parameters.py,sha256=8FkeeBtULDFVw3UijLArK-G3OIjy6YXyRXmPPckK7fU,5893
|
10
10
|
risk/_neighborhoods/__init__.py,sha256=eKwjpEUKSUmAirRZ_qPTVF7MLkvhCn_fulPVq158wM8,185
|
11
|
-
risk/_neighborhoods/_api.py,sha256=
|
11
|
+
risk/_neighborhoods/_api.py,sha256=kwCJo8fW1v11fNlCZmC_2XH4TG2ZrIL2j2PvBJrlyj8,18236
|
12
12
|
risk/_neighborhoods/_community.py,sha256=Tr-EHO91EWbMmNr_z21UCngiqWOlWIqcjwBig_VXI8c,17850
|
13
|
-
risk/_neighborhoods/_domains.py,sha256=
|
14
|
-
risk/_neighborhoods/_neighborhoods.py,sha256=
|
15
|
-
risk/_neighborhoods/_stats/__init__.py,sha256=
|
16
|
-
risk/_neighborhoods/_stats/_tests.py,sha256
|
13
|
+
risk/_neighborhoods/_domains.py,sha256=Q3MUWW9KjuERpxs4H1dNFhalDjdatMkWSnB12BerUDU,16580
|
14
|
+
risk/_neighborhoods/_neighborhoods.py,sha256=9hpQCYG0d9fZLYj-fVACgLJBtw3dW8C-0YbE2OWuX-M,21436
|
15
|
+
risk/_neighborhoods/_stats/__init__.py,sha256=iu22scpdgTHm6N_hAN81iXIoZCRPFuFAxf71jYWwsUU,213
|
16
|
+
risk/_neighborhoods/_stats/_tests.py,sha256=KWwNWyKJ3Rrb1cI5qJcKv9YhU1-7sJoI-yMR1RqvHOQ,7557
|
17
17
|
risk/_neighborhoods/_stats/_permutation/__init__.py,sha256=nfTaW29CK8OZCdFnpMVlHnFaqr1E4AZp6mvhlUazHXM,140
|
18
18
|
risk/_neighborhoods/_stats/_permutation/_permutation.py,sha256=e5qVuYWGhiAn5Jv8VILk-WYMOO4km48cGdRYTOl355M,10661
|
19
19
|
risk/_neighborhoods/_stats/_permutation/_test_functions.py,sha256=lGI_MkdbW4UHI0jWN_T1OattRjXrq_qmzAmOfels670,3165
|
@@ -23,7 +23,7 @@ risk/_network/_graph/__init__.py,sha256=SFgxgxUiZK4vvw6bdQ04DSMXEr8xjMaQV-Wne6wA
|
|
23
23
|
risk/_network/_graph/_api.py,sha256=sp3_mLJDP_xQexYBjyM17iyzLb2oGmiC050kcw-jVho,8474
|
24
24
|
risk/_network/_graph/_graph.py,sha256=x2EWT_ZVwxh7m9a01yG4WMdmAxBxiaxX3CvkqP9QAXE,12486
|
25
25
|
risk/_network/_graph/_stats.py,sha256=6mxZkuL6LJlwKDsBbP22DAVkNUEhq-JZwYMKhFKD08k,7359
|
26
|
-
risk/_network/_graph/_summary.py,sha256=
|
26
|
+
risk/_network/_graph/_summary.py,sha256=RISQHy6Ur37e6F8ZM9X-IwNOit-hUiUxSCUZU_8-1Tw,10198
|
27
27
|
risk/_network/_plotter/__init__.py,sha256=qFRtQKSBGIqmUGwmA7VPL7hTHBb9yvRIt0nLISXnwkY,84
|
28
28
|
risk/_network/_plotter/_api.py,sha256=OaV1CCRGsz98wEEzyEhaq2CqEuZh6t2qS7g_rY6HJJs,1727
|
29
29
|
risk/_network/_plotter/_canvas.py,sha256=H7rPz4Gv7ED3bDHMif4cf2usdU4ifmxzXeug5A_no68,13599
|
@@ -34,8 +34,8 @@ risk/_network/_plotter/_plotter.py,sha256=F2hw-spUdsXjvuG36o0YFR3Pnd-CZOHYUq4vW0
|
|
34
34
|
risk/_network/_plotter/_utils/__init__.py,sha256=JXgjKiBWvXx0X2IeFnrOh5YZQGQoELbhJZ0Zh2mFEOo,211
|
35
35
|
risk/_network/_plotter/_utils/_colors.py,sha256=JCliSvz8_-TsjilaRHSEsqdXFBUYlzhXKOSRGdCm9Kw,19177
|
36
36
|
risk/_network/_plotter/_utils/_layout.py,sha256=GyGLc2U1WWUVL1Te9uPi_CLqlW_E4TImXRAL5TeA5D8,3633
|
37
|
-
risk_network-0.0.
|
38
|
-
risk_network-0.0.
|
39
|
-
risk_network-0.0.
|
40
|
-
risk_network-0.0.
|
41
|
-
risk_network-0.0.
|
37
|
+
risk_network-0.0.15.dist-info/licenses/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
|
38
|
+
risk_network-0.0.15.dist-info/METADATA,sha256=20u6GupvvgFm16zUW2mPlYWz3V-FuxC-303GOvFxiKM,5542
|
39
|
+
risk_network-0.0.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
40
|
+
risk_network-0.0.15.dist-info/top_level.txt,sha256=NX7C2PFKTvC1JhVKv14DFlFAIFnKc6Lpsu1ZfxvQwVw,5
|
41
|
+
risk_network-0.0.15.dist-info/RECORD,,
|
@@ -1,125 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: risk-network
|
3
|
-
Version: 0.0.14b2
|
4
|
-
Summary: A Python package for scalable network analysis and high-quality visualization.
|
5
|
-
Author-email: Ira Horecka <ira89@icloud.com>
|
6
|
-
License: GPL-3.0-or-later
|
7
|
-
Project-URL: Homepage, https://github.com/riskportal/network
|
8
|
-
Project-URL: Issues, https://github.com/riskportal/network/issues
|
9
|
-
Classifier: Development Status :: 4 - Beta
|
10
|
-
Classifier: Intended Audience :: Developers
|
11
|
-
Classifier: Intended Audience :: Science/Research
|
12
|
-
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
|
13
|
-
Classifier: Operating System :: OS Independent
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
15
|
-
Classifier: Programming Language :: Python :: 3.8
|
16
|
-
Classifier: Programming Language :: Python :: 3 :: Only
|
17
|
-
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
18
|
-
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
19
|
-
Classifier: Topic :: Scientific/Engineering :: Visualization
|
20
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
21
|
-
Requires-Python: >=3.8
|
22
|
-
Description-Content-Type: text/markdown
|
23
|
-
License-File: LICENSE
|
24
|
-
Requires-Dist: ipywidgets
|
25
|
-
Requires-Dist: leidenalg
|
26
|
-
Requires-Dist: markov_clustering
|
27
|
-
Requires-Dist: matplotlib
|
28
|
-
Requires-Dist: networkx
|
29
|
-
Requires-Dist: nltk
|
30
|
-
Requires-Dist: numpy
|
31
|
-
Requires-Dist: openpyxl
|
32
|
-
Requires-Dist: pandas
|
33
|
-
Requires-Dist: python-igraph
|
34
|
-
Requires-Dist: python-louvain
|
35
|
-
Requires-Dist: scikit-learn
|
36
|
-
Requires-Dist: scipy
|
37
|
-
Requires-Dist: statsmodels
|
38
|
-
Requires-Dist: threadpoolctl
|
39
|
-
Requires-Dist: tqdm
|
40
|
-
Dynamic: license-file
|
41
|
-
|
42
|
-
# RISK Network
|
43
|
-
|
44
|
-
<p align="center">
|
45
|
-
<img src="https://i.imgur.com/8TleEJs.png" width="50%" />
|
46
|
-
</p>
|
47
|
-
|
48
|
-
<br>
|
49
|
-
|
50
|
-

|
51
|
-
[](https://pypi.python.org/pypi/risk-network)
|
52
|
-

|
53
|
-
[](https://doi.org/10.5281/zenodo.xxxxxxx)
|
54
|
-

|
55
|
-

|
56
|
-
|
57
|
-
**RISK** (Regional Inference of Significant Kinships) is a next-generation tool for biological network annotation and visualization. RISK integrates community detection-based clustering, rigorous statistical enrichment analysis, and a modular framework to uncover biologically meaningful relationships and generate high-resolution visualizations. RISK supports diverse data formats and is optimized for large-scale network analysis, making it a valuable resource for researchers in systems biology and beyond.
|
58
|
-
|
59
|
-
## Documentation and Tutorial
|
60
|
-
|
61
|
-
Full documentation is available at:
|
62
|
-
|
63
|
-
- **Docs:** [https://riskportal.github.io/network-tutorial](https://riskportal.github.io/network-tutorial)
|
64
|
-
- **Tutorial Jupyter Notebook Repository:** [https://github.com/riskportal/network-tutorial](https://github.com/riskportal/network-tutorial)
|
65
|
-
|
66
|
-
## Installation
|
67
|
-
|
68
|
-
RISK is compatible with Python 3.8 or later and runs on all major operating systems. To install the latest version of RISK, run:
|
69
|
-
|
70
|
-
```bash
|
71
|
-
pip install risk-network --upgrade
|
72
|
-
```
|
73
|
-
|
74
|
-
## Features
|
75
|
-
|
76
|
-
- **Comprehensive Network Analysis**: Analyze biological networks (e.g., protein–protein interaction and genetic interaction networks) as well as non-biological networks.
|
77
|
-
- **Advanced Clustering Algorithms**: Supports Louvain, Leiden, Markov Clustering, Greedy Modularity, Label Propagation, Spinglass, and Walktrap for identifying structured network regions.
|
78
|
-
- **Flexible Visualization**: Produce customizable, high-resolution network visualizations with kernel density estimate overlays, adjustable node and edge attributes, and export options in SVG, PNG, and PDF formats.
|
79
|
-
- **Efficient Data Handling**: Supports multiple input/output formats, including JSON, CSV, TSV, Excel, Cytoscape, and GPickle.
|
80
|
-
- **Statistical Analysis**: Assess functional enrichment using hypergeometric, permutation (network-aware), binomial, chi-squared, Poisson, and z-score tests, ensuring statistical adaptability across datasets.
|
81
|
-
- **Cross-Domain Applicability**: Suitable for network analysis across biological and non-biological domains, including social and communication networks.
|
82
|
-
|
83
|
-
## Example Usage
|
84
|
-
|
85
|
-
We applied RISK to a *Saccharomyces cerevisiae* protein–protein interaction network from Michaelis et al. (2023), filtering for proteins with six or more interactions to emphasize core functional relationships. RISK identified compact, statistically enriched clusters corresponding to biological processes such as ribosomal assembly and mitochondrial organization.
|
86
|
-
|
87
|
-
[](https://i.imgur.com/lJHJrJr.jpeg)
|
88
|
-
|
89
|
-
This figure highlights RISK’s capability to detect both established and novel functional modules within the yeast interactome.
|
90
|
-
|
91
|
-
## Citation
|
92
|
-
|
93
|
-
If you use RISK in your research, please reference the following:
|
94
|
-
|
95
|
-
**Horecka et al.**, *"RISK: a next-generation tool for biological network annotation and visualization"*, 2025.
|
96
|
-
DOI: [10.1234/zenodo.xxxxxxx](https://doi.org/10.1234/zenodo.xxxxxxx)
|
97
|
-
|
98
|
-
## Software Architecture and Implementation
|
99
|
-
|
100
|
-
RISK features a streamlined, modular architecture designed to meet diverse research needs. RISK’s modular design enables users to run individual components—such as clustering, statistical testing, or visualization—independently or in combination, depending on the analysis workflow. It includes dedicated modules for:
|
101
|
-
|
102
|
-
- **Data I/O**: Supports JSON, CSV, TSV, Excel, Cytoscape, and GPickle formats.
|
103
|
-
- **Clustering**: Supports multiple clustering methods, including Louvain, Leiden, Markov Clustering, Greedy Modularity, Label Propagation, Spinglass, and Walktrap. Provides flexible distance metrics tailored to network structure.
|
104
|
-
- **Statistical Analysis**: Provides a suite of tests for overrepresentation analysis of annotations.
|
105
|
-
- **Visualization**: Offers customizable, high-resolution output in multiple formats, including SVG, PNG, and PDF.
|
106
|
-
- **Configuration Management**: Centralized parameters in risk.params ensure reproducibility and easy tuning for large-scale analyses.
|
107
|
-
|
108
|
-
## Performance and Efficiency
|
109
|
-
|
110
|
-
Benchmarking results demonstrate that RISK efficiently scales to networks exceeding hundreds of thousands of edges, maintaining low execution times and optimal memory usage across statistical tests.
|
111
|
-
|
112
|
-
## Contributing
|
113
|
-
|
114
|
-
We welcome contributions from the community:
|
115
|
-
|
116
|
-
- [Issues Tracker](https://github.com/riskportal/network/issues)
|
117
|
-
- [Source Code](https://github.com/riskportal/network/tree/main/risk)
|
118
|
-
|
119
|
-
## Support
|
120
|
-
|
121
|
-
If you encounter issues or have suggestions for new features, please use the [Issues Tracker](https://github.com/riskportal/network/issues) on GitHub.
|
122
|
-
|
123
|
-
## License
|
124
|
-
|
125
|
-
RISK is open source under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html).
|
File without changes
|
File without changes
|
File without changes
|