Metadata-Version: 2.4
Name: python-limma
Version: 0.1.0
Summary: Pure-Python port of Bioconductor limma — linear models & empirical-Bayes moderated statistics for differential expression (voom, lmFit, eBayes, topTable).
Author-email: Zehua Zeng <starlitnightly@163.com>
License: LGPL-3.0-or-later
Project-URL: Homepage, https://github.com/omicverse/py-limma
Project-URL: Repository, https://github.com/omicverse/py-limma
Project-URL: Issues, https://github.com/omicverse/py-limma/issues
Project-URL: Upstream Bioc package, https://bioconductor.org/packages/release/bioc/html/limma.html
Project-URL: Upstream (omicverse), https://github.com/Starlitnightly/omicverse
Keywords: limma,differential-expression,voom,eBayes,linear-models,empirical-bayes,RNA-seq,microarray,proteomics,bioinformatics
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.23
Requires-Dist: scipy>=1.10
Requires-Dist: pandas>=1.5
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Dynamic: license-file

# limmapy

A **pure-Python port of [Bioconductor limma](https://bioconductor.org/packages/release/bioc/html/limma.html)** (Ritchie et al., *Nucleic Acids Research* 2015) — linear models and empirical-Bayes moderated statistics for differential expression.

- **No `rpy2`**, no R install — the core limma linear-model workflow reimplemented in NumPy / SciPy
- The canonical pipeline: `voom → lmFit → contrasts.fit → eBayes → topTable`
- Smyth 2004 empirical-Bayes variance moderation; `treat`, `decideTests`, `duplicateCorrelation`, `removeBatchEffect`
- Both Python-style (`lm_fit`, `ebayes`, `top_table`) and R-style (`lmFit`, `eBayes`, `topTable`) names exported
- `pandas` / `numpy`-friendly

> The import name is **`pylimma`**; the PyPI distribution name is **`python-limma`** (`pip install python-limma`). The names `pylimma` / `limmapy` were unavailable on PyPI, so the distribution carries the omicverse-ecosystem name.

> This is a **standalone mirror** of the implementation developed in [`omicverse`](https://github.com/Starlitnightly/omicverse). It powers `omicverse`'s edgeR / limma-voom differential-expression backends and the `pydeqms` proteomics workflow.

## Install

```bash
pip install python-limma
```

## Quick start

```python
import numpy as np
import pylimma

# expr: genes x samples log-expression matrix; design: samples x coefficients
fit = pylimma.lmFit(expr, design)
fit = pylimma.eBayes(fit)
res = pylimma.topTable(fit, coef=1, number=np.inf)
res.head()
```

### RNA-seq with voom

```python
import pylimma
v = pylimma.voom(counts, design)            # EList: mean-variance weights
fit = pylimma.eBayes(pylimma.lmFit(v.E, design, weights=v.weights))
pylimma.topTable(fit, coef=1)
```

## API

| Python | R counterpart |
|---|---|
| `lm_fit` / `lmFit` | `lmFit` |
| `ebayes` / `eBayes` | `eBayes` |
| `contrasts_fit` | `contrasts.fit` |
| `top_table` / `topTable` | `topTable` |
| `voom` | `voom` |
| `treat` | `treat` |
| `decide_tests` / `decideTests` | `decideTests` |
| `duplicate_correlation` / `duplicateCorrelation` | `duplicateCorrelation` |
| `remove_batch_effect` / `removeBatchEffect` | `removeBatchEffect` |
| `MArrayLM`, `EList`, `TestResults` | the corresponding S4 classes |

## Citation

> Ritchie, M.E., Phipson, B., Wu, D., Hu, Y., Law, C.W., Shi, W., Smyth, G.K. **limma powers differential expression analyses for RNA-sequencing and microarray studies.** *Nucleic Acids Research* 43(7), e47 (2015).

…and acknowledge omicverse / this repo for the Python port.

## License

LGPL-3.0-or-later — matches the upstream Bioconductor package.
