risk-network 0.0.7b10__py3-none-any.whl → 0.0.7b11__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/annotations/io.py +2 -2
- risk/log/config.py +8 -9
- risk/neighborhoods/domains.py +2 -2
- risk/neighborhoods/neighborhoods.py +2 -2
- risk/network/io.py +12 -12
- risk/risk.py +12 -12
- risk/stats/permutation/test_functions.py +2 -2
- {risk_network-0.0.7b10.dist-info → risk_network-0.0.7b11.dist-info}/METADATA +1 -1
- {risk_network-0.0.7b10.dist-info → risk_network-0.0.7b11.dist-info}/RECORD +13 -13
- {risk_network-0.0.7b10.dist-info → risk_network-0.0.7b11.dist-info}/LICENSE +0 -0
- {risk_network-0.0.7b10.dist-info → risk_network-0.0.7b11.dist-info}/WHEEL +0 -0
- {risk_network-0.0.7b10.dist-info → risk_network-0.0.7b11.dist-info}/top_level.txt +0 -0
risk/__init__.py
CHANGED
risk/annotations/io.py
CHANGED
@@ -219,6 +219,6 @@ def _log_loading(filetype: str, filepath: str = "") -> None:
|
|
219
219
|
filepath (str, optional): The path to the file being loaded.
|
220
220
|
"""
|
221
221
|
log_header("Loading annotations")
|
222
|
-
logger.
|
222
|
+
logger.info(f"Filetype: {filetype}")
|
223
223
|
if filepath:
|
224
|
-
logger.
|
224
|
+
logger.info(f"Filepath: {filepath}")
|
risk/log/config.py
CHANGED
@@ -5,17 +5,16 @@ risk/log/config
|
|
5
5
|
|
6
6
|
import logging
|
7
7
|
|
8
|
-
# Create
|
8
|
+
# Create and configure the global logger
|
9
9
|
logger = logging.getLogger("risk_logger")
|
10
|
-
logger.setLevel(logging.
|
11
|
-
# Create
|
10
|
+
logger.setLevel(logging.INFO)
|
11
|
+
# Create and configure the console handler
|
12
12
|
console_handler = logging.StreamHandler()
|
13
|
-
console_handler.setLevel(logging.
|
14
|
-
#
|
13
|
+
console_handler.setLevel(logging.INFO)
|
14
|
+
# Set the output format for the logger
|
15
15
|
formatter = logging.Formatter("%(message)s")
|
16
16
|
console_handler.setFormatter(formatter)
|
17
|
-
|
18
|
-
# Add the handler to the logger if it doesn't already exist
|
17
|
+
# Add the console handler to the logger if not already attached
|
19
18
|
if not logger.hasHandlers():
|
20
19
|
logger.addHandler(console_handler)
|
21
20
|
|
@@ -30,8 +29,8 @@ def set_global_verbosity(verbose):
|
|
30
29
|
None
|
31
30
|
"""
|
32
31
|
if verbose:
|
33
|
-
logger.setLevel(logging.
|
34
|
-
console_handler.setLevel(logging.
|
32
|
+
logger.setLevel(logging.INFO) # Show all messages
|
33
|
+
console_handler.setLevel(logging.INFO)
|
35
34
|
else:
|
36
35
|
logger.setLevel(logging.ERROR) # Show only error messages
|
37
36
|
console_handler.setLevel(logging.ERROR)
|
risk/neighborhoods/domains.py
CHANGED
@@ -46,10 +46,10 @@ def define_domains(
|
|
46
46
|
)
|
47
47
|
# Perform hierarchical clustering
|
48
48
|
Z = linkage(m, method=best_linkage, metric=best_metric)
|
49
|
-
logger.
|
49
|
+
logger.info(
|
50
50
|
f"Linkage criterion: '{linkage_criterion}'\nLinkage method: '{best_linkage}'\nLinkage metric: '{best_metric}'"
|
51
51
|
)
|
52
|
-
logger.
|
52
|
+
logger.info(f"Optimal linkage threshold: {round(best_threshold, 3)}")
|
53
53
|
# Calculate the optimal threshold for clustering
|
54
54
|
max_d_optimal = np.max(Z[:, 2]) * best_threshold
|
55
55
|
# Assign domains to the annotations matrix
|
@@ -130,7 +130,7 @@ def process_neighborhoods(
|
|
130
130
|
enrichment_matrix = neighborhoods["enrichment_matrix"]
|
131
131
|
binary_enrichment_matrix = neighborhoods["binary_enrichment_matrix"]
|
132
132
|
significant_enrichment_matrix = neighborhoods["significant_enrichment_matrix"]
|
133
|
-
logger.
|
133
|
+
logger.info(f"Imputation depth: {impute_depth}")
|
134
134
|
if impute_depth:
|
135
135
|
(
|
136
136
|
enrichment_matrix,
|
@@ -143,7 +143,7 @@ def process_neighborhoods(
|
|
143
143
|
max_depth=impute_depth,
|
144
144
|
)
|
145
145
|
|
146
|
-
logger.
|
146
|
+
logger.info(f"Pruning threshold: {prune_threshold}")
|
147
147
|
if prune_threshold:
|
148
148
|
(
|
149
149
|
enrichment_matrix,
|
risk/network/io.py
CHANGED
@@ -451,10 +451,10 @@ class NetworkIO:
|
|
451
451
|
# Log the number of nodes and edges before and after cleaning
|
452
452
|
num_final_nodes = G.number_of_nodes()
|
453
453
|
num_final_edges = G.number_of_edges()
|
454
|
-
logger.
|
455
|
-
logger.
|
456
|
-
logger.
|
457
|
-
logger.
|
454
|
+
logger.info(f"Initial node count: {num_initial_nodes}")
|
455
|
+
logger.info(f"Final node count: {num_final_nodes}")
|
456
|
+
logger.info(f"Initial edge count: {num_initial_edges}")
|
457
|
+
logger.info(f"Final edge count: {num_final_edges}")
|
458
458
|
|
459
459
|
def _assign_edge_weights(self, G: nx.Graph) -> None:
|
460
460
|
"""Assign weights to the edges in the graph.
|
@@ -472,7 +472,7 @@ class NetworkIO:
|
|
472
472
|
) # Default to 1.0 if 'weight' not present
|
473
473
|
|
474
474
|
if self.include_edge_weight and missing_weights:
|
475
|
-
logger.
|
475
|
+
logger.info(f"Total edges missing weights: {missing_weights}")
|
476
476
|
|
477
477
|
def _validate_nodes(self, G: nx.Graph) -> None:
|
478
478
|
"""Validate the graph structure and attributes.
|
@@ -511,13 +511,13 @@ class NetworkIO:
|
|
511
511
|
filepath (str, optional): The path to the file being loaded. Defaults to "".
|
512
512
|
"""
|
513
513
|
log_header("Loading network")
|
514
|
-
logger.
|
514
|
+
logger.info(f"Filetype: {filetype}")
|
515
515
|
if filepath:
|
516
|
-
logger.
|
517
|
-
logger.
|
516
|
+
logger.info(f"Filepath: {filepath}")
|
517
|
+
logger.info(f"Edge weight: {'Included' if self.include_edge_weight else 'Excluded'}")
|
518
518
|
if self.include_edge_weight:
|
519
|
-
logger.
|
520
|
-
logger.
|
521
|
-
logger.
|
519
|
+
logger.info(f"Weight label: {self.weight_label}")
|
520
|
+
logger.info(f"Minimum edges per node: {self.min_edges_per_node}")
|
521
|
+
logger.info(f"Projection: {'Sphere' if self.compute_sphere else 'Plane'}")
|
522
522
|
if self.compute_sphere:
|
523
|
-
logger.
|
523
|
+
logger.info(f"Surface depth: {self.surface_depth}")
|
risk/risk.py
CHANGED
@@ -221,10 +221,10 @@ class RISK(NetworkIO, AnnotationsIO):
|
|
221
221
|
)
|
222
222
|
|
223
223
|
# Log and display permutation test settings
|
224
|
-
logger.
|
225
|
-
logger.
|
226
|
-
logger.
|
227
|
-
logger.
|
224
|
+
logger.info(f"Neighborhood scoring metric: '{score_metric}'")
|
225
|
+
logger.info(f"Null distribution: '{null_distribution}'")
|
226
|
+
logger.info(f"Number of permutations: {num_permutations}")
|
227
|
+
logger.info(f"Maximum workers: {max_workers}")
|
228
228
|
# Run permutation test to compute neighborhood significance
|
229
229
|
neighborhood_significance = compute_permutation_test(
|
230
230
|
neighborhoods=neighborhoods,
|
@@ -290,9 +290,9 @@ class RISK(NetworkIO, AnnotationsIO):
|
|
290
290
|
max_cluster_size=max_cluster_size,
|
291
291
|
)
|
292
292
|
|
293
|
-
logger.
|
294
|
-
logger.
|
295
|
-
logger.
|
293
|
+
logger.info(f"p-value cutoff: {pval_cutoff}")
|
294
|
+
logger.info(f"FDR BH cutoff: {fdr_cutoff}")
|
295
|
+
logger.info(
|
296
296
|
f"Significance tail: '{tail}' ({'enrichment' if tail == 'right' else 'depletion' if tail == 'left' else 'both'})"
|
297
297
|
)
|
298
298
|
# Calculate significant neighborhoods based on the provided parameters
|
@@ -314,8 +314,8 @@ class RISK(NetworkIO, AnnotationsIO):
|
|
314
314
|
)
|
315
315
|
|
316
316
|
log_header("Finding top annotations")
|
317
|
-
logger.
|
318
|
-
logger.
|
317
|
+
logger.info(f"Min cluster size: {min_cluster_size}")
|
318
|
+
logger.info(f"Max cluster size: {max_cluster_size}")
|
319
319
|
# Define top annotations based on processed neighborhoods
|
320
320
|
top_annotations = self._define_top_annotations(
|
321
321
|
network=network,
|
@@ -414,9 +414,9 @@ class RISK(NetworkIO, AnnotationsIO):
|
|
414
414
|
else:
|
415
415
|
for_print_distance_metric = distance_metric
|
416
416
|
# Log and display neighborhood settings
|
417
|
-
logger.
|
418
|
-
logger.
|
419
|
-
logger.
|
417
|
+
logger.info(f"Distance metric: '{for_print_distance_metric}'")
|
418
|
+
logger.info(f"Edge length threshold: {edge_length_threshold}")
|
419
|
+
logger.info(f"Random seed: {random_seed}")
|
420
420
|
|
421
421
|
# Compute neighborhoods based on the network and distance metric
|
422
422
|
neighborhoods = get_network_neighborhoods(
|
@@ -1,20 +1,20 @@
|
|
1
|
-
risk/__init__.py,sha256=
|
1
|
+
risk/__init__.py,sha256=LDYtIaVSfLSXLCFAOtMfMWteX-C8tpOnI8OPnqr90bY,113
|
2
2
|
risk/constants.py,sha256=XInRaH78Slnw_sWgAsBFbUHkyA0h0jL0DKGuQNbOvjM,550
|
3
|
-
risk/risk.py,sha256=
|
3
|
+
risk/risk.py,sha256=TYuZbEiEZugwZgR0Kr8kSXiH2GWE-6BxanSEZeSVpFU,21327
|
4
4
|
risk/annotations/__init__.py,sha256=vUpVvMRE5if01Ic8QY6M2Ae3EFGJHdugEe9PdEkAW4Y,138
|
5
5
|
risk/annotations/annotations.py,sha256=3FFyJE9Gp5oRN72_8iVAUnecsmTtx2G2fp5AlCY1oUk,11405
|
6
|
-
risk/annotations/io.py,sha256=
|
6
|
+
risk/annotations/io.py,sha256=ZcONDioLZjLQAbXhhoNHQRsY9nq-aTpyPtHGUSW7ka0,9473
|
7
7
|
risk/log/__init__.py,sha256=aDUz5LMFQsz0UlsQI2EdXtiBKRLfml1UMeZKC7QQIGU,134
|
8
|
-
risk/log/config.py,sha256=
|
8
|
+
risk/log/config.py,sha256=hXUewhm35wgc7UYQWmwy9YHDdmDwHP-bAUvi8edlFGM,1360
|
9
9
|
risk/log/params.py,sha256=DUmsqPo9hi3rQHFgLTunP14I-vVoyQSFZbx5aSYmVts,6363
|
10
10
|
risk/neighborhoods/__init__.py,sha256=tKKEg4lsbqFukpgYlUGxU_v_9FOqK7V0uvM9T2QzoL0,206
|
11
11
|
risk/neighborhoods/community.py,sha256=stYYBXeZlGLMV-k8ckQeIqThT6v9y-S3hETobAo9590,6817
|
12
|
-
risk/neighborhoods/domains.py,sha256=
|
13
|
-
risk/neighborhoods/neighborhoods.py,sha256=
|
12
|
+
risk/neighborhoods/domains.py,sha256=_N4E4EJoMNa7M7-6eHRJKzPYREd24kPPKdYQ3jTByxo,10734
|
13
|
+
risk/neighborhoods/neighborhoods.py,sha256=0hxi1jFoXQQX7eg94LfX6qrK_S7E4NGe5fIlOsAOg0Y,18258
|
14
14
|
risk/network/__init__.py,sha256=iEPeJdZfqp0toxtbElryB8jbz9_t_k4QQ3iDvKE8C_0,126
|
15
15
|
risk/network/geometry.py,sha256=H1yGVVqgbfpzBzJwEheDLfvGLSA284jGQQTn612L4Vc,6759
|
16
16
|
risk/network/graph.py,sha256=_LEoom4EEowGALuJKSXcev9RAAHu2FqIeq3u7mkifW0,16479
|
17
|
-
risk/network/io.py,sha256=
|
17
|
+
risk/network/io.py,sha256=LmjivifAZURzSaPs-dx3KkNDGmVnfUFJdj5WY0BZJI8,21254
|
18
18
|
risk/network/plot.py,sha256=3OucCoKJwx9M9H4lqAvcQdM9YiCSyIxz21jyqDbpffc,62286
|
19
19
|
risk/stats/__init__.py,sha256=WcgoETQ-hS0LQqKRsAMIPtP15xZ-4eul6VUBuUx4Wzc,220
|
20
20
|
risk/stats/hypergeom.py,sha256=o6Qnj31gCAKxr2uQirXrbv7XvdDJGEq69MFW-ubx_hA,2272
|
@@ -22,9 +22,9 @@ risk/stats/poisson.py,sha256=8x9hB4DCukq4gNIlIKO-c_jYG1-BTwTX53oLauFyfj8,1793
|
|
22
22
|
risk/stats/stats.py,sha256=kvShov-94W6ffgDUTb522vB9hDJQSyTsYif_UIaFfSM,7059
|
23
23
|
risk/stats/permutation/__init__.py,sha256=neJp7FENC-zg_CGOXqv-iIvz1r5XUKI9Ruxhmq7kDOI,105
|
24
24
|
risk/stats/permutation/permutation.py,sha256=kmSZ7bQ-AD0TFiQDgIwfxTeqHa4pjp7fIcOzAqyhUNY,9714
|
25
|
-
risk/stats/permutation/test_functions.py,sha256=
|
26
|
-
risk_network-0.0.
|
27
|
-
risk_network-0.0.
|
28
|
-
risk_network-0.0.
|
29
|
-
risk_network-0.0.
|
30
|
-
risk_network-0.0.
|
25
|
+
risk/stats/permutation/test_functions.py,sha256=lftOude6hee0pyR80HlBD32522JkDoN5hrKQ9VEbuoY,2345
|
26
|
+
risk_network-0.0.7b11.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
|
27
|
+
risk_network-0.0.7b11.dist-info/METADATA,sha256=x4uCZ5QCWk-nyaVLFGSsZX1eJs21dbLSo1FpDbyQ83Y,43143
|
28
|
+
risk_network-0.0.7b11.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
29
|
+
risk_network-0.0.7b11.dist-info/top_level.txt,sha256=NX7C2PFKTvC1JhVKv14DFlFAIFnKc6Lpsu1ZfxvQwVw,5
|
30
|
+
risk_network-0.0.7b11.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|