pyedger 0.1.0__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.
- pyedger-0.1.0/LICENSE +7 -0
- pyedger-0.1.0/PKG-INFO +101 -0
- pyedger-0.1.0/README.md +71 -0
- pyedger-0.1.0/pyedger/__init__.py +106 -0
- pyedger-0.1.0/pyedger/core.py +2202 -0
- pyedger-0.1.0/pyedger.egg-info/PKG-INFO +101 -0
- pyedger-0.1.0/pyedger.egg-info/SOURCES.txt +11 -0
- pyedger-0.1.0/pyedger.egg-info/dependency_links.txt +1 -0
- pyedger-0.1.0/pyedger.egg-info/requires.txt +8 -0
- pyedger-0.1.0/pyedger.egg-info/top_level.txt +1 -0
- pyedger-0.1.0/pyproject.toml +54 -0
- pyedger-0.1.0/setup.cfg +4 -0
- pyedger-0.1.0/tests/test_smoke.py +73 -0
pyedger-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
This Python port is released under LGPL-3.0-or-later, matching the
|
|
5
|
+
license of the upstream Bioconductor package it ports. The full
|
|
6
|
+
LGPL-3 text is at https://www.gnu.org/licenses/lgpl-3.0.txt and
|
|
7
|
+
applies to all files in this repository.
|
pyedger-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyedger
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Pure-Python port of Bioconductor edgeR — negative-binomial models for differential expression of count data (estimateDisp, glmFit, glmLRT, glmQLFTest, exactTest).
|
|
5
|
+
Author-email: Zehua Zeng <starlitnightly@163.com>
|
|
6
|
+
License: LGPL-3.0-or-later
|
|
7
|
+
Project-URL: Homepage, https://github.com/omicverse/py-edgeR
|
|
8
|
+
Project-URL: Repository, https://github.com/omicverse/py-edgeR
|
|
9
|
+
Project-URL: Issues, https://github.com/omicverse/py-edgeR/issues
|
|
10
|
+
Project-URL: Upstream Bioc package, https://bioconductor.org/packages/release/bioc/html/edgeR.html
|
|
11
|
+
Project-URL: Upstream (omicverse), https://github.com/Starlitnightly/omicverse
|
|
12
|
+
Keywords: edgeR,differential-expression,RNA-seq,count-data,negative-binomial,GLM,dispersion,bioinformatics
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
19
|
+
Requires-Python: >=3.9
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: numpy>=1.23
|
|
23
|
+
Requires-Dist: scipy>=1.10
|
|
24
|
+
Requires-Dist: pandas>=1.5
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
28
|
+
Requires-Dist: ruff; extra == "dev"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# pyedger
|
|
32
|
+
|
|
33
|
+
A **pure-Python port of [Bioconductor edgeR](https://bioconductor.org/packages/release/bioc/html/edgeR.html)** (Robinson, McCarthy & Smyth, *Bioinformatics* 2010) — negative-binomial models for differential expression of count data.
|
|
34
|
+
|
|
35
|
+
- **No `rpy2`**, no R install — the edgeR negative-binomial GLM workflow reimplemented in NumPy / SciPy
|
|
36
|
+
- The canonical pipelines: `DGEList → calcNormFactors → estimateDisp → glmQLFit → glmQLFTest` and the classic `exactTest`
|
|
37
|
+
- TMM normalization, common / trended / tagwise dispersion, GLM and quasi-likelihood F-tests, `filterByExpr`, `cpm` / `aveLogCPM`
|
|
38
|
+
- Both Python-style (`glm_fit`, `estimate_disp`, `top_tags`) and R-style (`glmFit`, `estimateDisp`, `topTags`) names exported
|
|
39
|
+
|
|
40
|
+
> This is a **standalone mirror** of the implementation developed in [`omicverse`](https://github.com/Starlitnightly/omicverse), where it powers the edgeR differential-expression backend of `ov.bulk` / `pyDEG`.
|
|
41
|
+
|
|
42
|
+
## Install
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install pyedger
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Quick start
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
import numpy as np
|
|
52
|
+
import pyedger
|
|
53
|
+
|
|
54
|
+
# counts: genes x samples raw count matrix; group: per-sample condition labels
|
|
55
|
+
dge = pyedger.DGEList(counts=counts, group=group)
|
|
56
|
+
dge = pyedger.calcNormFactors(dge) # TMM normalization
|
|
57
|
+
keep = pyedger.filterByExpr(dge, group=group)
|
|
58
|
+
dge = dge[keep]
|
|
59
|
+
|
|
60
|
+
# Quasi-likelihood F-test workflow (the recommended edgeR pipeline)
|
|
61
|
+
dge = pyedger.estimateDisp(dge, design)
|
|
62
|
+
fit = pyedger.glmQLFit(dge, design)
|
|
63
|
+
qlf = pyedger.glmQLFTest(fit, coef=1)
|
|
64
|
+
res = pyedger.topTags(qlf, n=np.inf)
|
|
65
|
+
res.head()
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Classic exact test
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
dge = pyedger.estimateDisp(dge, design)
|
|
72
|
+
et = pyedger.exactTest(dge, pair=("control", "treated"))
|
|
73
|
+
pyedger.topTags(et)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## API
|
|
77
|
+
|
|
78
|
+
| Python | R counterpart |
|
|
79
|
+
|---|---|
|
|
80
|
+
| `DGEList` | `DGEList` |
|
|
81
|
+
| `calc_norm_factors` / `calcNormFactors` | `calcNormFactors` (TMM) |
|
|
82
|
+
| `filter_by_expr` / `filterByExpr` | `filterByExpr` |
|
|
83
|
+
| `estimate_disp` / `estimateDisp` | `estimateDisp` |
|
|
84
|
+
| `glm_fit` / `glmFit`, `glm_lrt` / `glmLRT` | `glmFit`, `glmLRT` |
|
|
85
|
+
| `glm_ql_fit` / `glmQLFit`, `glm_qlf_test` / `glmQLFTest` | `glmQLFit`, `glmQLFTest` |
|
|
86
|
+
| `exact_test` / `exactTest` | `exactTest` |
|
|
87
|
+
| `glm_treat` / `glmTreat` | `glmTreat` |
|
|
88
|
+
| `cpm`, `ave_log_cpm` / `aveLogCPM` | `cpm`, `aveLogCPM` |
|
|
89
|
+
| `top_tags` / `topTags` | `topTags` |
|
|
90
|
+
| `decide_tests_dge` / `decideTests` | `decideTestsDGE` |
|
|
91
|
+
| `DGEGLM`, `DGELRT`, `DGEExact`, `TestResults` | the corresponding S4 classes |
|
|
92
|
+
|
|
93
|
+
## Citation
|
|
94
|
+
|
|
95
|
+
> Robinson, M.D., McCarthy, D.J., Smyth, G.K. **edgeR: a Bioconductor package for differential expression analysis of digital gene expression data.** *Bioinformatics* 26(1), 139–140 (2010).
|
|
96
|
+
|
|
97
|
+
…and acknowledge omicverse / this repo for the Python port.
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
LGPL-3.0-or-later — matches the upstream Bioconductor package.
|
pyedger-0.1.0/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# pyedger
|
|
2
|
+
|
|
3
|
+
A **pure-Python port of [Bioconductor edgeR](https://bioconductor.org/packages/release/bioc/html/edgeR.html)** (Robinson, McCarthy & Smyth, *Bioinformatics* 2010) — negative-binomial models for differential expression of count data.
|
|
4
|
+
|
|
5
|
+
- **No `rpy2`**, no R install — the edgeR negative-binomial GLM workflow reimplemented in NumPy / SciPy
|
|
6
|
+
- The canonical pipelines: `DGEList → calcNormFactors → estimateDisp → glmQLFit → glmQLFTest` and the classic `exactTest`
|
|
7
|
+
- TMM normalization, common / trended / tagwise dispersion, GLM and quasi-likelihood F-tests, `filterByExpr`, `cpm` / `aveLogCPM`
|
|
8
|
+
- Both Python-style (`glm_fit`, `estimate_disp`, `top_tags`) and R-style (`glmFit`, `estimateDisp`, `topTags`) names exported
|
|
9
|
+
|
|
10
|
+
> This is a **standalone mirror** of the implementation developed in [`omicverse`](https://github.com/Starlitnightly/omicverse), where it powers the edgeR differential-expression backend of `ov.bulk` / `pyDEG`.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install pyedger
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quick start
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
import numpy as np
|
|
22
|
+
import pyedger
|
|
23
|
+
|
|
24
|
+
# counts: genes x samples raw count matrix; group: per-sample condition labels
|
|
25
|
+
dge = pyedger.DGEList(counts=counts, group=group)
|
|
26
|
+
dge = pyedger.calcNormFactors(dge) # TMM normalization
|
|
27
|
+
keep = pyedger.filterByExpr(dge, group=group)
|
|
28
|
+
dge = dge[keep]
|
|
29
|
+
|
|
30
|
+
# Quasi-likelihood F-test workflow (the recommended edgeR pipeline)
|
|
31
|
+
dge = pyedger.estimateDisp(dge, design)
|
|
32
|
+
fit = pyedger.glmQLFit(dge, design)
|
|
33
|
+
qlf = pyedger.glmQLFTest(fit, coef=1)
|
|
34
|
+
res = pyedger.topTags(qlf, n=np.inf)
|
|
35
|
+
res.head()
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Classic exact test
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
dge = pyedger.estimateDisp(dge, design)
|
|
42
|
+
et = pyedger.exactTest(dge, pair=("control", "treated"))
|
|
43
|
+
pyedger.topTags(et)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## API
|
|
47
|
+
|
|
48
|
+
| Python | R counterpart |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `DGEList` | `DGEList` |
|
|
51
|
+
| `calc_norm_factors` / `calcNormFactors` | `calcNormFactors` (TMM) |
|
|
52
|
+
| `filter_by_expr` / `filterByExpr` | `filterByExpr` |
|
|
53
|
+
| `estimate_disp` / `estimateDisp` | `estimateDisp` |
|
|
54
|
+
| `glm_fit` / `glmFit`, `glm_lrt` / `glmLRT` | `glmFit`, `glmLRT` |
|
|
55
|
+
| `glm_ql_fit` / `glmQLFit`, `glm_qlf_test` / `glmQLFTest` | `glmQLFit`, `glmQLFTest` |
|
|
56
|
+
| `exact_test` / `exactTest` | `exactTest` |
|
|
57
|
+
| `glm_treat` / `glmTreat` | `glmTreat` |
|
|
58
|
+
| `cpm`, `ave_log_cpm` / `aveLogCPM` | `cpm`, `aveLogCPM` |
|
|
59
|
+
| `top_tags` / `topTags` | `topTags` |
|
|
60
|
+
| `decide_tests_dge` / `decideTests` | `decideTestsDGE` |
|
|
61
|
+
| `DGEGLM`, `DGELRT`, `DGEExact`, `TestResults` | the corresponding S4 classes |
|
|
62
|
+
|
|
63
|
+
## Citation
|
|
64
|
+
|
|
65
|
+
> Robinson, M.D., McCarthy, D.J., Smyth, G.K. **edgeR: a Bioconductor package for differential expression analysis of digital gene expression data.** *Bioinformatics* 26(1), 139–140 (2010).
|
|
66
|
+
|
|
67
|
+
…and acknowledge omicverse / this repo for the Python port.
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
LGPL-3.0-or-later — matches the upstream Bioconductor package.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"""Pure-Python subset of Bioconductor edgeR."""
|
|
2
|
+
|
|
3
|
+
from .core import (
|
|
4
|
+
DGEExact,
|
|
5
|
+
DGEGLM,
|
|
6
|
+
DGELRT,
|
|
7
|
+
DGEList,
|
|
8
|
+
TestResults,
|
|
9
|
+
add_prior_count,
|
|
10
|
+
ave_log_cpm,
|
|
11
|
+
calc_norm_factors,
|
|
12
|
+
cpm,
|
|
13
|
+
decide_tests_dge,
|
|
14
|
+
effective_lib_sizes,
|
|
15
|
+
equalize_lib_sizes,
|
|
16
|
+
estimate_common_disp,
|
|
17
|
+
estimate_disp,
|
|
18
|
+
estimate_glm_common_disp,
|
|
19
|
+
estimate_glm_tagwise_disp,
|
|
20
|
+
estimate_glm_trended_disp,
|
|
21
|
+
estimate_tagwise_disp,
|
|
22
|
+
exact_test,
|
|
23
|
+
filter_by_expr,
|
|
24
|
+
glm_fit,
|
|
25
|
+
glm_lrt,
|
|
26
|
+
glm_ql_fit,
|
|
27
|
+
glm_qlf_test,
|
|
28
|
+
glm_treat,
|
|
29
|
+
pred_fc,
|
|
30
|
+
top_tags,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
calcNormFactors = calc_norm_factors
|
|
34
|
+
effectiveLibSizes = effective_lib_sizes
|
|
35
|
+
equalizeLibSizes = equalize_lib_sizes
|
|
36
|
+
estimateCommonDisp = estimate_common_disp
|
|
37
|
+
estimateTagwiseDisp = estimate_tagwise_disp
|
|
38
|
+
estimateDisp = estimate_disp
|
|
39
|
+
estimateGLMCommonDisp = estimate_glm_common_disp
|
|
40
|
+
estimateGLMTagwiseDisp = estimate_glm_tagwise_disp
|
|
41
|
+
estimateGLMTrendedDisp = estimate_glm_trended_disp
|
|
42
|
+
exactTest = exact_test
|
|
43
|
+
filterByExpr = filter_by_expr
|
|
44
|
+
glmFit = glm_fit
|
|
45
|
+
glmLRT = glm_lrt
|
|
46
|
+
glmTreat = glm_treat
|
|
47
|
+
glmQLFit = glm_ql_fit
|
|
48
|
+
glmQLFTest = glm_qlf_test
|
|
49
|
+
predFC = pred_fc
|
|
50
|
+
addPriorCount = add_prior_count
|
|
51
|
+
decideTestsDGE = decide_tests_dge
|
|
52
|
+
decideTests = decide_tests_dge
|
|
53
|
+
topTags = top_tags
|
|
54
|
+
aveLogCPM = ave_log_cpm
|
|
55
|
+
|
|
56
|
+
__all__ = [
|
|
57
|
+
"DGEExact",
|
|
58
|
+
"DGEGLM",
|
|
59
|
+
"DGELRT",
|
|
60
|
+
"DGEList",
|
|
61
|
+
"TestResults",
|
|
62
|
+
"add_prior_count",
|
|
63
|
+
"addPriorCount",
|
|
64
|
+
"ave_log_cpm",
|
|
65
|
+
"aveLogCPM",
|
|
66
|
+
"calc_norm_factors",
|
|
67
|
+
"calcNormFactors",
|
|
68
|
+
"effective_lib_sizes",
|
|
69
|
+
"effectiveLibSizes",
|
|
70
|
+
"equalize_lib_sizes",
|
|
71
|
+
"equalizeLibSizes",
|
|
72
|
+
"estimate_common_disp",
|
|
73
|
+
"estimateCommonDisp",
|
|
74
|
+
"estimate_tagwise_disp",
|
|
75
|
+
"estimateTagwiseDisp",
|
|
76
|
+
"estimate_disp",
|
|
77
|
+
"estimateDisp",
|
|
78
|
+
"estimate_glm_common_disp",
|
|
79
|
+
"estimateGLMCommonDisp",
|
|
80
|
+
"estimate_glm_tagwise_disp",
|
|
81
|
+
"estimateGLMTagwiseDisp",
|
|
82
|
+
"estimate_glm_trended_disp",
|
|
83
|
+
"estimateGLMTrendedDisp",
|
|
84
|
+
"exact_test",
|
|
85
|
+
"exactTest",
|
|
86
|
+
"filter_by_expr",
|
|
87
|
+
"filterByExpr",
|
|
88
|
+
"glm_fit",
|
|
89
|
+
"glmFit",
|
|
90
|
+
"glm_lrt",
|
|
91
|
+
"glmLRT",
|
|
92
|
+
"glm_treat",
|
|
93
|
+
"glmTreat",
|
|
94
|
+
"glm_ql_fit",
|
|
95
|
+
"glmQLFit",
|
|
96
|
+
"glm_qlf_test",
|
|
97
|
+
"glmQLFTest",
|
|
98
|
+
"pred_fc",
|
|
99
|
+
"predFC",
|
|
100
|
+
"top_tags",
|
|
101
|
+
"topTags",
|
|
102
|
+
"cpm",
|
|
103
|
+
"decide_tests_dge",
|
|
104
|
+
"decideTests",
|
|
105
|
+
"decideTestsDGE",
|
|
106
|
+
]
|