risk-network 0.0.8b27__py3-none-any.whl → 0.0.9__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 +2 -2
- risk/annotations/__init__.py +2 -2
- risk/annotations/annotations.py +195 -118
- risk/annotations/io.py +47 -31
- risk/log/__init__.py +4 -2
- risk/log/console.py +3 -1
- risk/log/{params.py → parameters.py} +17 -42
- risk/neighborhoods/__init__.py +3 -5
- risk/neighborhoods/api.py +442 -0
- risk/neighborhoods/community.py +324 -101
- risk/neighborhoods/domains.py +125 -52
- risk/neighborhoods/neighborhoods.py +177 -165
- risk/network/__init__.py +1 -3
- risk/network/geometry.py +71 -89
- risk/network/graph/__init__.py +6 -0
- risk/network/graph/api.py +200 -0
- risk/network/{graph.py → graph/graph.py} +90 -40
- risk/network/graph/summary.py +254 -0
- risk/network/io.py +103 -114
- risk/network/plotter/__init__.py +6 -0
- risk/network/plotter/api.py +54 -0
- risk/network/{plot → plotter}/canvas.py +9 -8
- risk/network/{plot → plotter}/contour.py +27 -24
- risk/network/{plot → plotter}/labels.py +73 -78
- risk/network/{plot → plotter}/network.py +45 -39
- risk/network/{plot → plotter}/plotter.py +23 -17
- risk/network/{plot/utils/color.py → plotter/utils/colors.py} +114 -122
- risk/network/{plot → plotter}/utils/layout.py +10 -7
- risk/risk.py +11 -500
- risk/stats/__init__.py +10 -4
- risk/stats/permutation/__init__.py +1 -1
- risk/stats/permutation/permutation.py +44 -38
- risk/stats/permutation/test_functions.py +26 -18
- risk/stats/{stats.py → significance.py} +17 -15
- risk/stats/stat_tests.py +267 -0
- {risk_network-0.0.8b27.dist-info → risk_network-0.0.9.dist-info}/METADATA +31 -46
- risk_network-0.0.9.dist-info/RECORD +40 -0
- {risk_network-0.0.8b27.dist-info → risk_network-0.0.9.dist-info}/WHEEL +1 -1
- risk/constants.py +0 -31
- risk/network/plot/__init__.py +0 -6
- risk/stats/hypergeom.py +0 -54
- risk/stats/poisson.py +0 -44
- risk_network-0.0.8b27.dist-info/RECORD +0 -37
- {risk_network-0.0.8b27.dist-info → risk_network-0.0.9.dist-info}/LICENSE +0 -0
- {risk_network-0.0.8b27.dist-info → risk_network-0.0.9.dist-info}/top_level.txt +0 -0
@@ -1,10 +1,10 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.2
|
2
2
|
Name: risk-network
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.9
|
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
|
-
License:
|
7
|
+
License: GNU GENERAL PUBLIC LICENSE
|
8
8
|
Version 3, 29 June 2007
|
9
9
|
|
10
10
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
@@ -695,19 +695,23 @@ Requires-Python: >=3.8
|
|
695
695
|
Description-Content-Type: text/markdown
|
696
696
|
License-File: LICENSE
|
697
697
|
Requires-Dist: ipywidgets
|
698
|
-
Requires-Dist:
|
698
|
+
Requires-Dist: leidenalg
|
699
|
+
Requires-Dist: markov_clustering
|
699
700
|
Requires-Dist: matplotlib
|
700
701
|
Requires-Dist: networkx
|
701
702
|
Requires-Dist: nltk==3.8.1
|
702
703
|
Requires-Dist: numpy
|
703
704
|
Requires-Dist: openpyxl
|
704
705
|
Requires-Dist: pandas
|
706
|
+
Requires-Dist: python-igraph
|
705
707
|
Requires-Dist: python-louvain
|
706
708
|
Requires-Dist: scikit-learn
|
707
709
|
Requires-Dist: scipy
|
708
710
|
Requires-Dist: statsmodels
|
709
711
|
Requires-Dist: threadpoolctl
|
710
712
|
Requires-Dist: tqdm
|
713
|
+
Dynamic: author
|
714
|
+
Dynamic: requires-python
|
711
715
|
|
712
716
|
# RISK Network
|
713
717
|
|
@@ -724,78 +728,59 @@ Requires-Dist: tqdm
|
|
724
728
|

|
725
729
|

|
726
730
|
|
727
|
-
**RISK (
|
731
|
+
**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.
|
728
732
|
|
729
733
|
## Documentation and Tutorial
|
730
734
|
|
731
|
-
|
732
|
-
- **Tutorial**: An interactive Jupyter notebook tutorial can be found [here](https://github.com/riskportal/network-tutorial).
|
733
|
-
We highly recommend new users to consult the documentation and tutorial early on to fully leverage RISK's capabilities.
|
735
|
+
An interactive Jupyter notebook tutorial can be found [here](https://github.com/riskportal/network-tutorial). We highly recommend new users to consult the documentation and tutorial early on to fully utilize RISK's capabilities.
|
734
736
|
|
735
737
|
## Installation
|
736
738
|
|
737
|
-
RISK is compatible with Python 3.8
|
739
|
+
RISK is compatible with Python 3.8 or later and runs on all major operating systems. To install the latest version of RISK, run:
|
738
740
|
|
739
741
|
```bash
|
740
|
-
pip install risk-network
|
742
|
+
pip install risk-network --upgrade
|
741
743
|
```
|
742
744
|
|
743
745
|
## Features
|
744
746
|
|
745
|
-
- **Comprehensive Network Analysis**: Analyze biological networks
|
746
|
-
- **Advanced Clustering Algorithms**:
|
747
|
-
- **Flexible Visualization**:
|
748
|
-
- **Efficient Data Handling**:
|
749
|
-
- **Statistical Analysis**:
|
747
|
+
- **Comprehensive Network Analysis**: Analyze biological networks (e.g., protein–protein interaction and genetic interaction networks) as well as non-biological networks.
|
748
|
+
- **Advanced Clustering Algorithms**: Supports Louvain, Leiden, Markov Clustering, Greedy Modularity, Label Propagation, Spinglass, and Walktrap for identifying structured network regions.
|
749
|
+
- **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.
|
750
|
+
- **Efficient Data Handling**: Supports multiple input/output formats, including JSON, CSV, TSV, Excel, Cytoscape, and GPickle.
|
751
|
+
- **Statistical Analysis**: Assess functional enrichment using hypergeometric, permutation, binomial, chi-squared, Poisson, and z-score tests, ensuring statistical adaptability across datasets.
|
750
752
|
- **Cross-Domain Applicability**: Suitable for network analysis across biological and non-biological domains, including social and communication networks.
|
751
753
|
|
752
754
|
## Example Usage
|
753
755
|
|
754
|
-
We applied RISK to a *Saccharomyces cerevisiae* protein–protein interaction network,
|
756
|
+
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.
|
755
757
|
|
756
|
-
](https://i.imgur.com/lJHJrJr.jpeg)
|
757
759
|
|
758
|
-
RISK
|
760
|
+
This figure highlights RISK’s capability to detect both established and novel functional modules within the yeast interactome.
|
759
761
|
|
760
762
|
## Citation
|
761
763
|
|
762
|
-
If you use RISK in your research, please cite
|
764
|
+
If you use RISK in your research, please cite:
|
763
765
|
|
764
|
-
**Horecka
|
766
|
+
**Horecka et al.**, "RISK: a next-generation tool for biological network annotation and visualization", **Bioinformatics**, 2025. DOI: [10.1234/zenodo.xxxxxxx](https://doi.org/10.1234/zenodo.xxxxxxx)
|
765
767
|
|
766
768
|
## Software Architecture and Implementation
|
767
769
|
|
768
|
-
RISK features a streamlined, modular architecture designed to meet diverse research needs.
|
770
|
+
RISK features a streamlined, modular architecture designed to meet diverse research needs. It includes dedicated modules for:
|
769
771
|
|
770
|
-
|
771
|
-
|
772
|
-
- **
|
773
|
-
- **Visualization
|
774
|
-
|
775
|
-
### Clustering Algorithms
|
776
|
-
|
777
|
-
- **Available Algorithms**:
|
778
|
-
- Greedy Modularity
|
779
|
-
- Label Propagation
|
780
|
-
- Louvain
|
781
|
-
- Markov Clustering
|
782
|
-
- Spinglass
|
783
|
-
- Walktrap
|
784
|
-
- **Distance Metrics**: Supports both spherical and Euclidean distance metrics.
|
785
|
-
|
786
|
-
### Statistical Tests
|
787
|
-
|
788
|
-
- **Hypergeometric Test**
|
789
|
-
- **Permutation Test** (single- or multi-process modes)
|
790
|
-
- **Poisson Test**
|
772
|
+
- **Data I/O**: Supports JSON, CSV, TSV, Excel, Cytoscape, and GPickle formats.
|
773
|
+
- **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.
|
774
|
+
- **Statistical Analysis**: Provides a suite of tests for overrepresentation analysis of annotations.
|
775
|
+
- **Visualization**: Offers customizable, high-resolution output in multiple formats, including SVG, PNG, and PDF.
|
791
776
|
|
792
777
|
## Performance and Efficiency
|
793
778
|
|
794
|
-
|
779
|
+
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.
|
795
780
|
|
796
781
|
## Contributing
|
797
782
|
|
798
|
-
We welcome contributions from the community
|
783
|
+
We welcome contributions from the community:
|
799
784
|
|
800
785
|
- [Issues Tracker](https://github.com/irahorecka/risk/issues)
|
801
786
|
- [Source Code](https://github.com/irahorecka/risk/tree/main/risk)
|
@@ -806,8 +791,8 @@ If you encounter issues or have suggestions for new features, please use the [Is
|
|
806
791
|
|
807
792
|
## License
|
808
793
|
|
809
|
-
RISK is
|
794
|
+
RISK is open source under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html).
|
810
795
|
|
811
796
|
---
|
812
797
|
|
813
|
-
**Note**: For detailed documentation and to access the interactive tutorial, please visit the links
|
798
|
+
**Note**: For detailed documentation and to access the interactive tutorial, please visit the links above.
|
@@ -0,0 +1,40 @@
|
|
1
|
+
risk/__init__.py,sha256=XK5JlkLoKOn6dp3xXQmg08sN2QpAhnv3ds_26j9CxaY,119
|
2
|
+
risk/risk.py,sha256=s827_lRknFseOP9O4zW8sP-IcCd2EzrpV_tnVY_tz5s,1104
|
3
|
+
risk/annotations/__init__.py,sha256=parsbcux1U4urpUqh9AdzbDWuLj9HlMidycMPkpSQFo,179
|
4
|
+
risk/annotations/annotations.py,sha256=5X2R8RFxgK6kgSoj05UdCPcpkRRPOaHjGwnIrjeD5Ww,16299
|
5
|
+
risk/annotations/io.py,sha256=z1AJySsU-KL_IYuHa7j3nvuczmOHgK3WfaQ4TRunvrA,10499
|
6
|
+
risk/log/__init__.py,sha256=7LxDysQu7doi0LAvlY2YbjN6iJH0fNknqy8lSLgeljo,217
|
7
|
+
risk/log/console.py,sha256=PgjyEvyhYLUSHXPUKEqOmxsDsfrjPICIgqo_cAHq0N8,4575
|
8
|
+
risk/log/parameters.py,sha256=VtwfMzLU1xI4yji3-Ch5vHjH-KdwTfwaEMmi7hFQTs0,5716
|
9
|
+
risk/neighborhoods/__init__.py,sha256=Q74HwTH7okI-vaskJPy2bYwb5sNjGASTzJ6m8V8arCU,234
|
10
|
+
risk/neighborhoods/api.py,sha256=ywngw2TQVV27gYlWDXcs8-qnmeepnvb-W9ov6J6VEPM,23341
|
11
|
+
risk/neighborhoods/community.py,sha256=5Q_-VAJC-5SY5EUsB8gIlemeDoAL85uLjyl16pItHiQ,16699
|
12
|
+
risk/neighborhoods/domains.py,sha256=e4F_JnlTm9EWYSg-_eWAM2ehnjEqPDasKnhp1E8XKrw,14842
|
13
|
+
risk/neighborhoods/neighborhoods.py,sha256=l9FhADB1C-OxM8E9QXOcA4osUDgA1vs4ud-OCGKKybc,21457
|
14
|
+
risk/network/__init__.py,sha256=oVi3FA1XXKD84014Cykq-9bpX4_s0F3aAUfNOU-07Qw,73
|
15
|
+
risk/network/geometry.py,sha256=c9XweJ0-DImZPU2YAJTJAwVYnW_0OGlWClyvJpeIZE4,5476
|
16
|
+
risk/network/io.py,sha256=RCH4nQdgYDXcNwMfpSz7qEmPO0pJ1p9fL0rNQptsQrc,21673
|
17
|
+
risk/network/graph/__init__.py,sha256=ziGJew3yhtqvrb9LUuneDu_LwW2Wa9vd4UuhoL5l1CA,91
|
18
|
+
risk/network/graph/api.py,sha256=xS_rNDvZPdwIar2E9x9BKMeR0DcYuwcHiUpc_EcJ4-o,8536
|
19
|
+
risk/network/graph/graph.py,sha256=qEWyZvuaGT_vvjhreBdmRPX3gst2wQFaXhFAvikPSqw,12158
|
20
|
+
risk/network/graph/summary.py,sha256=Y_0rL2C1UoQeZQIPVe5LbaCO356Mcc8HisnrXwQsRm8,10289
|
21
|
+
risk/network/plotter/__init__.py,sha256=4gWtQHGzQVNHmEBXi31Zf0tX0y2sTcE66J_yGnn7268,99
|
22
|
+
risk/network/plotter/api.py,sha256=oJIj7vYv-3VpfN41ndCNtxcWIuhT2ULwAaPPU2f4oeM,1785
|
23
|
+
risk/network/plotter/canvas.py,sha256=ifyTMyXYRzlcdSYy6C23k3dmwtbLDrOfdMvEjkW2gLg,13460
|
24
|
+
risk/network/plotter/contour.py,sha256=oQDKmAKaEasnK1zqY7_bNctZ_IevZW2vxrbsnSrOSCI,15459
|
25
|
+
risk/network/plotter/labels.py,sha256=k5GWvgHS8bLekJk7Gtxy6G7tDeJDZPQ-z3VxYWjAWRM,45489
|
26
|
+
risk/network/plotter/network.py,sha256=0VySlJ4n3tkHsOhVVSa3yiSppT8y1dmIwa-DhRn0tcM,14131
|
27
|
+
risk/network/plotter/plotter.py,sha256=4PeAeutJbgvwy4USh5RdHALLtkmeAtaxQcd48r7Zxa0,5999
|
28
|
+
risk/network/plotter/utils/colors.py,sha256=EaiKsNPy_lcjrPp-QTNy3LnQdAZMjz2LegbeffMz2HM,18910
|
29
|
+
risk/network/plotter/utils/layout.py,sha256=OPqV8jzV9dpnOhYU4SYMSfsIXalVzESrlBSI_Y43OGU,3640
|
30
|
+
risk/stats/__init__.py,sha256=2zdLv3tUHKyAjwAo7LprVXRaak1cHgrpYMVMSik6JM4,324
|
31
|
+
risk/stats/significance.py,sha256=6cKv2xBQXWTHZ6HpNWIqlNfKKS5pG_BcCUdMM3r_zw4,7336
|
32
|
+
risk/stats/stat_tests.py,sha256=tj0ri9w89_1fsjGLuafTWpfBEwZXpSLn7Ej2aAQ5lxk,11776
|
33
|
+
risk/stats/permutation/__init__.py,sha256=OLmYLm2uj96hPsSaUs0vUqFYw6Thwch_aHtpL7L0ZFw,127
|
34
|
+
risk/stats/permutation/permutation.py,sha256=BWjgdBpLVcHvmwHy0bmD4aJFccxifNBSrrCBPppyKf4,10569
|
35
|
+
risk/stats/permutation/test_functions.py,sha256=KlECWTz1EZ6EPF_OAgHb0uznaIhopiVYb_AKUKuC4no,3120
|
36
|
+
risk_network-0.0.9.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
|
37
|
+
risk_network-0.0.9.dist-info/METADATA,sha256=tg_hgIBU82xx59c4IAlsq6WyvkQOk7JWurwPZK96PwE,46971
|
38
|
+
risk_network-0.0.9.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
39
|
+
risk_network-0.0.9.dist-info/top_level.txt,sha256=NX7C2PFKTvC1JhVKv14DFlFAIFnKc6Lpsu1ZfxvQwVw,5
|
40
|
+
risk_network-0.0.9.dist-info/RECORD,,
|
risk/constants.py
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
risk/constants
|
3
|
-
~~~~~~~~~~~~~~
|
4
|
-
"""
|
5
|
-
|
6
|
-
GROUP_LINKAGE_METHODS = ["single", "complete", "average", "weighted", "centroid", "median", "ward"]
|
7
|
-
|
8
|
-
GROUP_DISTANCE_METRICS = [
|
9
|
-
"braycurtis",
|
10
|
-
"canberra",
|
11
|
-
"chebyshev",
|
12
|
-
"cityblock",
|
13
|
-
"correlation",
|
14
|
-
"cosine",
|
15
|
-
"dice",
|
16
|
-
"euclidean",
|
17
|
-
"hamming",
|
18
|
-
"jaccard",
|
19
|
-
"jensenshannon",
|
20
|
-
"kulczynski1",
|
21
|
-
"mahalanobis",
|
22
|
-
"matching",
|
23
|
-
"minkowski",
|
24
|
-
"rogerstanimoto",
|
25
|
-
"russellrao",
|
26
|
-
"seuclidean",
|
27
|
-
"sokalmichener",
|
28
|
-
"sokalsneath",
|
29
|
-
"sqeuclidean",
|
30
|
-
"yule",
|
31
|
-
]
|
risk/network/plot/__init__.py
DELETED
risk/stats/hypergeom.py
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
risk/stats/hypergeom
|
3
|
-
~~~~~~~~~~~~~~~~~~~~
|
4
|
-
"""
|
5
|
-
|
6
|
-
from typing import Any, Dict
|
7
|
-
|
8
|
-
import numpy as np
|
9
|
-
from scipy.stats import hypergeom
|
10
|
-
|
11
|
-
|
12
|
-
def compute_hypergeom_test(
|
13
|
-
neighborhoods: np.ndarray, annotations: np.ndarray, null_distribution: str = "network"
|
14
|
-
) -> Dict[str, Any]:
|
15
|
-
"""Compute hypergeometric test for enrichment and depletion in neighborhoods with selectable null distribution.
|
16
|
-
|
17
|
-
Args:
|
18
|
-
neighborhoods (np.ndarray): Binary matrix representing neighborhoods.
|
19
|
-
annotations (np.ndarray): Binary matrix representing annotations.
|
20
|
-
null_distribution (str, optional): Type of null distribution ('network' or 'annotations'). Defaults to "network".
|
21
|
-
|
22
|
-
Returns:
|
23
|
-
Dict[str, Any]: Dictionary containing depletion and enrichment p-values.
|
24
|
-
"""
|
25
|
-
# Get the total number of nodes in the network
|
26
|
-
total_node_count = neighborhoods.shape[0]
|
27
|
-
|
28
|
-
if null_distribution == "network":
|
29
|
-
# Case 1: Use all nodes as the background
|
30
|
-
background_population = total_node_count
|
31
|
-
neighborhood_sums = np.sum(neighborhoods, axis=0, keepdims=True).T
|
32
|
-
annotation_sums = np.sum(annotations, axis=0, keepdims=True)
|
33
|
-
elif null_distribution == "annotations":
|
34
|
-
# Case 2: Only consider nodes with at least one annotation
|
35
|
-
annotated_nodes = np.sum(annotations, axis=1) > 0
|
36
|
-
background_population = np.sum(annotated_nodes)
|
37
|
-
neighborhood_sums = np.sum(neighborhoods[annotated_nodes], axis=0, keepdims=True).T
|
38
|
-
annotation_sums = np.sum(annotations[annotated_nodes], axis=0, keepdims=True)
|
39
|
-
else:
|
40
|
-
raise ValueError(
|
41
|
-
"Invalid null_distribution value. Choose either 'network' or 'annotations'."
|
42
|
-
)
|
43
|
-
|
44
|
-
# Matrix multiplication for annotated nodes in each neighborhood
|
45
|
-
annotated_in_neighborhood = neighborhoods.T @ annotations
|
46
|
-
# Calculate depletion and enrichment p-values using the hypergeometric distribution
|
47
|
-
depletion_pvals = hypergeom.cdf(
|
48
|
-
annotated_in_neighborhood, background_population, annotation_sums, neighborhood_sums
|
49
|
-
)
|
50
|
-
enrichment_pvals = hypergeom.sf(
|
51
|
-
annotated_in_neighborhood - 1, background_population, annotation_sums, neighborhood_sums
|
52
|
-
)
|
53
|
-
|
54
|
-
return {"depletion_pvals": depletion_pvals, "enrichment_pvals": enrichment_pvals}
|
risk/stats/poisson.py
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
risk/stats/poisson
|
3
|
-
~~~~~~~~~~~~~~~~~~
|
4
|
-
"""
|
5
|
-
|
6
|
-
from typing import Any, Dict
|
7
|
-
|
8
|
-
import numpy as np
|
9
|
-
from scipy.stats import poisson
|
10
|
-
|
11
|
-
|
12
|
-
def compute_poisson_test(
|
13
|
-
neighborhoods: np.ndarray, annotations: np.ndarray, null_distribution: str = "network"
|
14
|
-
) -> Dict[str, Any]:
|
15
|
-
"""Compute Poisson test for enrichment and depletion in neighborhoods with selectable null distribution.
|
16
|
-
|
17
|
-
Args:
|
18
|
-
neighborhoods (np.ndarray): Binary matrix representing neighborhoods.
|
19
|
-
annotations (np.ndarray): Binary matrix representing annotations.
|
20
|
-
null_distribution (str, optional): Type of null distribution ('network' or 'annotations'). Defaults to "network".
|
21
|
-
|
22
|
-
Returns:
|
23
|
-
Dict[str, Any]: Dictionary containing depletion and enrichment p-values.
|
24
|
-
"""
|
25
|
-
# Matrix multiplication to get the number of annotated nodes in each neighborhood
|
26
|
-
annotated_in_neighborhood = neighborhoods @ annotations
|
27
|
-
|
28
|
-
# Compute lambda_expected based on the chosen null distribution
|
29
|
-
if null_distribution == "network":
|
30
|
-
# Use the mean across neighborhoods (axis=1)
|
31
|
-
lambda_expected = np.mean(annotated_in_neighborhood, axis=1, keepdims=True)
|
32
|
-
elif null_distribution == "annotations":
|
33
|
-
# Use the mean across annotations (axis=0)
|
34
|
-
lambda_expected = np.mean(annotated_in_neighborhood, axis=0, keepdims=True)
|
35
|
-
else:
|
36
|
-
raise ValueError(
|
37
|
-
"Invalid null_distribution value. Choose either 'network' or 'annotations'."
|
38
|
-
)
|
39
|
-
|
40
|
-
# Compute p-values for enrichment and depletion using Poisson distribution
|
41
|
-
enrichment_pvals = 1 - poisson.cdf(annotated_in_neighborhood - 1, lambda_expected)
|
42
|
-
depletion_pvals = poisson.cdf(annotated_in_neighborhood, lambda_expected)
|
43
|
-
|
44
|
-
return {"enrichment_pvals": enrichment_pvals, "depletion_pvals": depletion_pvals}
|
@@ -1,37 +0,0 @@
|
|
1
|
-
risk/__init__.py,sha256=ac92cxvpV3NMnUqcZb1WHPrNCiY2Du_Nl1UOytIwoyg,113
|
2
|
-
risk/constants.py,sha256=XInRaH78Slnw_sWgAsBFbUHkyA0h0jL0DKGuQNbOvjM,550
|
3
|
-
risk/risk.py,sha256=8GTUpj3TC7XLwEUD22-fDTKXtW7PndzW9TixWaZ23bI,23853
|
4
|
-
risk/annotations/__init__.py,sha256=kXgadEXaCh0z8OyhOhTj7c3qXGmWgOhaSZ4gSzSb59U,147
|
5
|
-
risk/annotations/annotations.py,sha256=dHO6kQOQjMA57nYA-yTAU1uB-ieiZ5sknAKvX6vF0Os,13024
|
6
|
-
risk/annotations/io.py,sha256=powWzeimVdE0WCwlBCXyu5otMyZZHQujC0DS3m5DC0c,9505
|
7
|
-
risk/log/__init__.py,sha256=xKeU9uK1AnVk7Yt9GTp-E-dn7Ealow2igEXZZnQRa2c,135
|
8
|
-
risk/log/console.py,sha256=C52s3FgQ2e9kQWcXL8m7rs_pnKXt5Yy8PBHmQkOTiNo,4537
|
9
|
-
risk/log/params.py,sha256=qSTktJ3OazldTzgtDGZkh0s30vu5kiXPkiNGLdSFDvg,6416
|
10
|
-
risk/neighborhoods/__init__.py,sha256=tKKEg4lsbqFukpgYlUGxU_v_9FOqK7V0uvM9T2QzoL0,206
|
11
|
-
risk/neighborhoods/community.py,sha256=MAgIblbuisEPwVU6mFZd4Yd9NUKlaHK99suw51r1Is0,7065
|
12
|
-
risk/neighborhoods/domains.py,sha256=3iV0-nRLF2sL9_7epHY5b9AtTU-QQ84hOWO76VwFcrs,11685
|
13
|
-
risk/neighborhoods/neighborhoods.py,sha256=cT9CCi1uQLn9Kv9Lxt8AN_4s63SKIlOZspvUZnx27nE,21832
|
14
|
-
risk/network/__init__.py,sha256=iEPeJdZfqp0toxtbElryB8jbz9_t_k4QQ3iDvKE8C_0,126
|
15
|
-
risk/network/geometry.py,sha256=gFtYUj9j9aul4paKq_qSGJn39Nazxu_MXv8m-tYYtrk,6840
|
16
|
-
risk/network/graph.py,sha256=-tslu8nSbuBaqNGf6TQ8ON7C27v-BLH_37J2aC6Ke14,9602
|
17
|
-
risk/network/io.py,sha256=-NJ9Tg1s-DxhlDbwQGO4o87rbMqO4-BzShgnIgFoRRE,22962
|
18
|
-
risk/network/plot/__init__.py,sha256=MfmaXJgAZJgXZ2wrhK8pXwzETlcMaLChhWXKAozniAo,98
|
19
|
-
risk/network/plot/canvas.py,sha256=TlCpNtvoceizAumNr9I02JcBrBO6FiAFAa2ZC0bx3SU,13356
|
20
|
-
risk/network/plot/contour.py,sha256=CwX4i3uE5HL0W4kfx34U7YyoTTqMxyb7xaXKRVoNLzY,15265
|
21
|
-
risk/network/plot/labels.py,sha256=fNccRds6seShMFPN6WX_7M1_qnscBkcWEH3QOJAKalk,45502
|
22
|
-
risk/network/plot/network.py,sha256=6RURL1OdBFyQ34qNcwM_uH3LSQGYZZ8tZT51dggH1a0,13685
|
23
|
-
risk/network/plot/plotter.py,sha256=iTPMiTnTTatM_-q1Ox_bjt5Pvv-Lo8gceiYB6TVzDcw,5770
|
24
|
-
risk/network/plot/utils/color.py,sha256=WSs1ge2oZ8yXwyVk2QqBF-avRd0aYT-sYZr9cxxAn7M,19626
|
25
|
-
risk/network/plot/utils/layout.py,sha256=RnJq0yODpoheZnDl7KKFPQeXrnrsS3FLIdxupoYVZq4,3553
|
26
|
-
risk/stats/__init__.py,sha256=WcgoETQ-hS0LQqKRsAMIPtP15xZ-4eul6VUBuUx4Wzc,220
|
27
|
-
risk/stats/hypergeom.py,sha256=oc39f02ViB1vQ-uaDrxG_tzAT6dxQBRjc88EK2EGn78,2282
|
28
|
-
risk/stats/poisson.py,sha256=polLgwS08MTCNzupYdmMUoEUYrJOjAbcYtYwjlfeE5Y,1803
|
29
|
-
risk/stats/stats.py,sha256=6iGi0-oN05mTmupg6X_VEBxEQvi2rujNhfPk4aLjwNI,7186
|
30
|
-
risk/stats/permutation/__init__.py,sha256=neJp7FENC-zg_CGOXqv-iIvz1r5XUKI9Ruxhmq7kDOI,105
|
31
|
-
risk/stats/permutation/permutation.py,sha256=meBNSrbRa9P8WJ54n485l0H7VQJlMSfHqdN4aCKYCtQ,10105
|
32
|
-
risk/stats/permutation/test_functions.py,sha256=lftOude6hee0pyR80HlBD32522JkDoN5hrKQ9VEbuoY,2345
|
33
|
-
risk_network-0.0.8b27.dist-info/LICENSE,sha256=jOtLnuWt7d5Hsx6XXB2QxzrSe2sWWh3NgMfFRetluQM,35147
|
34
|
-
risk_network-0.0.8b27.dist-info/METADATA,sha256=7PXFvXkTlaMC7TB5B7P1ePXPwDPZqpXMeeKb_pVZL8o,47498
|
35
|
-
risk_network-0.0.8b27.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
36
|
-
risk_network-0.0.8b27.dist-info/top_level.txt,sha256=NX7C2PFKTvC1JhVKv14DFlFAIFnKc6Lpsu1ZfxvQwVw,5
|
37
|
-
risk_network-0.0.8b27.dist-info/RECORD,,
|
File without changes
|
File without changes
|