Metadata-Version: 2.4
Name: proteoflux
Version: 1.10.4
Summary: Transparent and reproducible proteomics analysis pipeline
Author-email: Biozentrum Proteomics Core Facility <dariush.mollet@unibas.ch>
License: MIT License
        
        Copyright (c) 2026 Biozentrum, University of Basel
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
        
Project-URL: Repository, https://github.com/afanc/proteoflux
Project-URL: Issues, https://github.com/afanc/proteoflux/issues
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas<3.0,>=2.1
Requires-Dist: numpy<2.2,>=1.24
Requires-Dist: scanpy==1.11.0
Requires-Dist: numba==0.61.0
Requires-Dist: matplotlib
Requires-Dist: seaborn<0.14.0,>=0.12.2
Requires-Dist: phosx==0.23.1
Requires-Dist: typer[all]
Requires-Dist: pyyaml
Requires-Dist: scikit-learn
Requires-Dist: scikit-misc
Requires-Dist: missingno
Requires-Dist: torch
Requires-Dist: fastcluster
Requires-Dist: anndata==0.11.4
Requires-Dist: pyarrow
Requires-Dist: polars==1.36.1
Requires-Dist: openpyxl
Requires-Dist: xlsxwriter
Requires-Dist: InquirerPy
Requires-Dist: inmoose
Requires-Dist: directlfq[dask]
Requires-Dist: tqdm
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Dynamic: license-file

# ProteoFlux

[![PyPI](https://img.shields.io/pypi/v/proteoflux)](https://pypi.org/project/proteoflux/)
[![Python >=3.10](https://img.shields.io/badge/Python-%3E%3D3.10-blue)](#installation)
[![Scientific tests](https://github.com/Afanc/proteoflux/actions/workflows/smoke-test.yml/badge.svg)](https://github.com/Afanc/proteoflux/actions/workflows/smoke-test.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue)](https://github.com/Afanc/proteoflux/blob/HEAD/LICENSE)
[![DOI: 10.5281/zenodo.18640998](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.18640998-blue)](https://doi.org/10.5281/zenodo.18640998)

ProteoFlux is an open-source Python framework for transparent, reproducible downstream analysis of quantitative proteomics data.

It operates on quantitative outputs generated by upstream search and quantification tools and provides a unified workflow for:

- Protein-centric proteomics  
- Peptide-centric analyses  
- Phosphoproteomics (with optional protein-level covariate adjustment)  
- PELSA analyses  

ProteoFlux emphasizes:

- Explicit data semantics  
- Transparent preprocessing  
- Explicit statistical models and testing scopes
- Seeded stochastic methods and inspectable outputs

---

## Overview

![ProteoFlux overview](assets/proteoflux_overview.png)

ProteoFlux takes a single YAML configuration file and produces:

- Harmonized and preprocessed quantification data
- Differential expression using the InMoose implementation of limma; separate 4PL dose-response fitting for PELSA
- Optional KSEA or PhosX kinase activity analysis for phosphoproteomics
- Principal component analysis (PCA), multidimensional scaling (MDS), and hierarchical clustering
- An optional structured multi-page PDF report
- Portable `.h5ad` files compatible with [ProteoViewer](https://github.com/Afanc/proteoviewer)
- Optional summary tables in Excel

---

## Installation

Python **≥3.10** is required. We recommend **Python 3.13** in a dedicated
environment; CI tests Python 3.11 and 3.13. The scientific reference environment
is listed in `tests/constraints.txt`.

PhosX is pinned to 0.23.1 because ProteoFlux uses its version-specific interfaces.
Keep the dependency versions, configuration, input ordering and random seeds
when reproducing results; a seed alone does not make results independent of
input order or dependency changes.

### Install from PyPI (recommended)

```bash
python -m pip install proteoflux
```

### Install from source (development)

```bash
git clone https://github.com/afanc/proteoflux.git
cd proteoflux
python -m pip install -e .
```

This installs ProteoFlux in editable mode.

---

## Quickstart (CLI)

List available configuration templates:

```bash
proteoflux templates
```

Create a template:

```bash
proteoflux init spectronaut-proteomics --path config.yaml
```

Edit paths, column mappings and analysis settings before running. Relative paths
resolve from your current working directory, not from the YAML file’s directory.
Template choices can differ from runtime defaults; see the configuration guide.
PELSA is available as `proteoflux init spectronaut-pelsa --path config.yaml`.

Run the pipeline:

```bash
proteoflux run --config config.yaml
```

---

## Output Files

| File | Description |
|------|------------|
| `*.h5ad` | Required output: processed values in `X`, raw/log/normalized layers, statistics, evidence and metadata |
| `*.xlsx` | Optional summary and evidence tables; curve results for PELSA |
| `*.pdf` | Optional multi-page QC and analysis report |

See [output semantics](docs/RESULTS.md) for matrix axes, missingness and the meaning
of “raw.” Preserve the original input files and YAML separately.

The `.h5ad` files are compatible with [ProteoViewer](https://github.com/Afanc/proteoviewer), an interactive visualization tool for ProteoFlux outputs.

---

## Using ProteoFlux as a Python Library

ProteoFlux can also be used programmatically:

```python
import yaml
from proteoflux.main import run_pipeline

with open("config.yaml") as stream:
    config = yaml.safe_load(stream)  # or supply a dictionary
run_pipeline(config)
```

This allows:

- Integration into larger workflows
- Batch processing
- Use inside Jupyter notebooks
- Custom downstream analysis of AnnData objects

The library accepts the same configuration dictionary as the CLI.
`run_pipeline` writes the configured outputs and returns `None`. Read the saved
object with `anndata.read_h5ad(...)` for downstream work. To obtain preprocessing
results only, use `proteoflux.workflow.dataset.Dataset(**config).get_anndata()`;
this does not run differential/kinase/PELSA analysis or export results.

---

## Configuration

All parameters are defined in a single YAML configuration file. We recommend starting with a template:

```bash
proteoflux templates
proteoflux init TEMPLATE_NAME
```

Full parameter reference:

See the configuration guide [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
Quantitative inference uses log2 values: start normalization with `log2` for
linear inputs. Phospho background adjustment uses a fixed unit slope. If any
condition in the selected contrasts has one sample, the whole analysis is pilot.
See [1.10.4 behavior changes](docs/RELEASE_NOTES_1.10.4.md) before reusing older configs.

---

## Examples

Runnable, reduced example datasets and matching configs are provided under `examples/`:

- `examples/searle_small/`: small DIA proteomics example (Spectronaut export subset)
- `examples/phospho_small/`: phosphoproteomics example with an injected flow-through covariate run (Spectronaut export subsets)
- `examples/pelsa_small/`: small pelsa analysis example (Spectronaut export subsets)

Each example folder contains a `README.md` with a minimal command to run the pipeline (typically `proteoflux run --config <config>.yaml`) and the required input files (data + annotation, if applicable).

---

## Paper

The manuscript source is provided as [paper.md](paper.md).

---

## License

ProteoFlux is released under the MIT License. See the LICENSE file for details.

---

## Citation

If you use ProteoFlux in your work, please cite:

ProteoFlux (latest version).  
Zenodo. https://doi.org/10.5281/zenodo.18640998
