protrider 0.9.1__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.
- protrider-0.9.1/.github/workflows/publish.yml +30 -0
- protrider-0.9.1/.github/workflows/tests.yml +29 -0
- protrider-0.9.1/.gitignore +12 -0
- protrider-0.9.1/LICENSE +21 -0
- protrider-0.9.1/PKG-INFO +272 -0
- protrider-0.9.1/README.md +214 -0
- protrider-0.9.1/config.yaml +75 -0
- protrider-0.9.1/pyproject.toml +65 -0
- protrider-0.9.1/sample_data/protrider_sample_dataset.tsv +201 -0
- protrider-0.9.1/sample_data/sample_annotations.tsv +65 -0
- protrider-0.9.1/setup.cfg +4 -0
- protrider-0.9.1/src/protrider/__init__.py +5 -0
- protrider-0.9.1/src/protrider/cli.py +265 -0
- protrider-0.9.1/src/protrider/config.py +216 -0
- protrider-0.9.1/src/protrider/datasets/__init__.py +1 -0
- protrider-0.9.1/src/protrider/datasets/covariates.py +139 -0
- protrider-0.9.1/src/protrider/datasets/datasets.py +170 -0
- protrider-0.9.1/src/protrider/datasets/protein_intensities.py +98 -0
- protrider-0.9.1/src/protrider/model/__init__.py +2 -0
- protrider-0.9.1/src/protrider/model/model.py +299 -0
- protrider-0.9.1/src/protrider/model/model_helper.py +262 -0
- protrider-0.9.1/src/protrider/pipeline.py +634 -0
- protrider-0.9.1/src/protrider/plots.py +362 -0
- protrider-0.9.1/src/protrider/stats.py +318 -0
- protrider-0.9.1/src/protrider.egg-info/PKG-INFO +272 -0
- protrider-0.9.1/src/protrider.egg-info/SOURCES.txt +40 -0
- protrider-0.9.1/src/protrider.egg-info/dependency_links.txt +1 -0
- protrider-0.9.1/src/protrider.egg-info/entry_points.txt +2 -0
- protrider-0.9.1/src/protrider.egg-info/requires.txt +17 -0
- protrider-0.9.1/src/protrider.egg-info/top_level.txt +1 -0
- protrider-0.9.1/tests/README.md +85 -0
- protrider-0.9.1/tests/__init__.py +1 -0
- protrider-0.9.1/tests/conftest.py +36 -0
- protrider-0.9.1/tests/test_config.py +421 -0
- protrider-0.9.1/tests/test_covariates.py +328 -0
- protrider-0.9.1/tests/test_dataset.py +20 -0
- protrider-0.9.1/tests/test_model_save_load.py +189 -0
- protrider-0.9.1/tests/test_pipeline_config.py +63 -0
- protrider-0.9.1/tests/test_pipeline_features.py +352 -0
- protrider-0.9.1/tests/test_pipeline_misc.py +243 -0
- protrider-0.9.1/tests/test_pipeline_standard.py +206 -0
- protrider-0.9.1/uv.lock +3026 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
environment: pypi
|
|
12
|
+
permissions:
|
|
13
|
+
id-token: write
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
with:
|
|
18
|
+
fetch-depth: 0
|
|
19
|
+
|
|
20
|
+
- name: Install uv
|
|
21
|
+
uses: astral-sh/setup-uv@v5
|
|
22
|
+
|
|
23
|
+
- name: Set up Python
|
|
24
|
+
run: uv python install 3.14
|
|
25
|
+
|
|
26
|
+
- name: Build
|
|
27
|
+
run: uv build
|
|
28
|
+
|
|
29
|
+
- name: Publish
|
|
30
|
+
run: uv publish
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
test:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- name: Install uv
|
|
15
|
+
uses: astral-sh/setup-uv@v5
|
|
16
|
+
|
|
17
|
+
- name: Set up Python
|
|
18
|
+
run: uv python install 3.14
|
|
19
|
+
|
|
20
|
+
- name: Install dependencies
|
|
21
|
+
run: uv sync --all-groups
|
|
22
|
+
|
|
23
|
+
- name: Run tests
|
|
24
|
+
run: uv run pytest tests/ -q
|
|
25
|
+
|
|
26
|
+
- name: Run CLI smoke test
|
|
27
|
+
run: |
|
|
28
|
+
uv run protrider run --config config.yaml
|
|
29
|
+
uv run protrider plot --config config.yaml all
|
protrider-0.9.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Gagneur Lab, Technical University of Munich
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
protrider-0.9.1/PKG-INFO
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: protrider
|
|
3
|
+
Version: 0.9.1
|
|
4
|
+
Summary: PROTRIDER - Protein outlier detection method
|
|
5
|
+
Author: Ines Scheller, George Tsitsiridis, Christian Mertes, Vicente A Yépez, Ata Jadid Ahari
|
|
6
|
+
Author-email: Daniela Klaproth-Andrade <daniela.andrade@tum.de>, Julien Gagneur <gagneur@in.tum.de>
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2025 Gagneur Lab, Technical University of Munich
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
|
|
29
|
+
Project-URL: Homepage, https://github.com/gagneurlab/PROTRIDER
|
|
30
|
+
Project-URL: Bug Tracker, https://github.com/gagneurlab/PROTRIDER/issues
|
|
31
|
+
Project-URL: Publication, https://doi.org/10.1093/bioinformatics/btaf628
|
|
32
|
+
Keywords: proteomics,mass spectrometry,outlier detection,autoencoder,bioinformatics
|
|
33
|
+
Classifier: Programming Language :: Python :: 3
|
|
34
|
+
Classifier: Intended Audience :: Science/Research
|
|
35
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Operating System :: OS Independent
|
|
38
|
+
Requires-Python: >=3.10
|
|
39
|
+
Description-Content-Type: text/markdown
|
|
40
|
+
License-File: LICENSE
|
|
41
|
+
Requires-Dist: click
|
|
42
|
+
Requires-Dist: numpy
|
|
43
|
+
Requires-Dist: pandas
|
|
44
|
+
Requires-Dist: pyaml
|
|
45
|
+
Requires-Dist: torch
|
|
46
|
+
Requires-Dist: tqdm
|
|
47
|
+
Requires-Dist: optht
|
|
48
|
+
Requires-Dist: pydeseq2
|
|
49
|
+
Requires-Dist: scipy
|
|
50
|
+
Requires-Dist: scikit-learn
|
|
51
|
+
Requires-Dist: seaborn
|
|
52
|
+
Requires-Dist: plotnine
|
|
53
|
+
Requires-Dist: pyarrow
|
|
54
|
+
Requires-Dist: fastparquet
|
|
55
|
+
Provides-Extra: wandb
|
|
56
|
+
Requires-Dist: wandb; extra == "wandb"
|
|
57
|
+
Dynamic: license-file
|
|
58
|
+
|
|
59
|
+
# PROTRIDER
|
|
60
|
+
|
|
61
|
+
[](https://github.com/gagneurlab/PROTRIDER/actions/workflows/tests.yml)
|
|
62
|
+
[](LICENSE)
|
|
63
|
+
[](https://www.python.org/downloads/)
|
|
64
|
+
|
|
65
|
+
PROTRIDER is an autoencoder-based method to call protein outliers from mass spectrometry-based proteomics datasets.
|
|
66
|
+
|
|
67
|
+
Have a look at our [paper](https://doi.org/10.1093/bioinformatics/btaf628) for information about our work.
|
|
68
|
+
|
|
69
|
+
<details open>
|
|
70
|
+
<summary><b>Table of Contents</b></summary>
|
|
71
|
+
|
|
72
|
+
- [🚀 Quickstart](#-quickstart)
|
|
73
|
+
- [⚙️ Installation](#️-installation)
|
|
74
|
+
- [📖 Usage](#-usage)
|
|
75
|
+
- [🗂️ Configuration](#️-configuration)
|
|
76
|
+
- [📤 Output](#-output)
|
|
77
|
+
- [▶️ Run](#️-run)
|
|
78
|
+
- [📄 License](#-license)
|
|
79
|
+
- [📚 Citation](#-citation)
|
|
80
|
+
|
|
81
|
+
</details>
|
|
82
|
+
|
|
83
|
+
## 🚀 Quickstart
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# 1. Install
|
|
87
|
+
pip install .
|
|
88
|
+
|
|
89
|
+
# 2. Run on the included sample data
|
|
90
|
+
protrider run --config config.yaml
|
|
91
|
+
|
|
92
|
+
# 3. Plot results
|
|
93
|
+
protrider plot --config config.yaml all
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Results are written to the directory specified by `out_dir` in `config.yaml` (default: `output/`). The key output file is `protrider_summary.csv`, which contains outlier calls with p-values, z-scores, and fold changes for every sample–protein pair.
|
|
97
|
+
|
|
98
|
+
## ⚙️ Installation
|
|
99
|
+
|
|
100
|
+
PROTRIDER was tested using Python 3.14 on Linux. We recommend a dedicated conda environment:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
conda create --name protrider_env python=3.14
|
|
104
|
+
conda activate protrider_env
|
|
105
|
+
pip install .
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Verify the installation:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
protrider --help
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
More information on conda environments can be found in [Conda's user guide](https://docs.conda.io/projects/conda/en/latest/user-guide/).
|
|
115
|
+
|
|
116
|
+
## 📖 Usage
|
|
117
|
+
|
|
118
|
+
### 🗂️ Configuration
|
|
119
|
+
|
|
120
|
+
All parameters are set in a YAML configuration file. A template is provided as `config.yaml`.
|
|
121
|
+
|
|
122
|
+
Input files are specified in the config:
|
|
123
|
+
|
|
124
|
+
- **`input_intensities`**: CSV, TSV, or Parquet file with protein intensities (columns = samples, rows = proteins)
|
|
125
|
+
- **`sample_annotation`** (optional): CSV or TSV file with sample covariates (one row per sample)
|
|
126
|
+
|
|
127
|
+
An example dataset is included under `sample_data/`.
|
|
128
|
+
|
|
129
|
+
<details open>
|
|
130
|
+
<summary><b>Configuration parameters</b></summary>
|
|
131
|
+
|
|
132
|
+
| Parameter | Description |
|
|
133
|
+
|-----------|-------------|
|
|
134
|
+
| `out_dir` | Output directory |
|
|
135
|
+
| `input_intensities` | Path to protein intensities file |
|
|
136
|
+
| `sample_annotation` | Path to sample annotations file (optional) |
|
|
137
|
+
| `index_col` | Column name containing protein IDs |
|
|
138
|
+
| `cov_used` | List of covariate column names from the annotation file (optional) |
|
|
139
|
+
| `find_q_method` | Method to determine latent dimension: `OHT` (default), `gs`, `bs` (binary search), or an integer |
|
|
140
|
+
| `pval_dist` | Distribution for p-value calculation: `t` (default) or `gaussian` |
|
|
141
|
+
| `n_epochs` | Number of training epochs (default: `100`) |
|
|
142
|
+
| `checkpoint_path` | Path to save/load model checkpoint (optional) |
|
|
143
|
+
|
|
144
|
+
</details>
|
|
145
|
+
|
|
146
|
+
### 📤 Output
|
|
147
|
+
|
|
148
|
+
The key output file is `protrider_summary.csv`, which contains outlier calls with p-values, z-scores, and fold changes for every sample–protein pair.
|
|
149
|
+
|
|
150
|
+
<details>
|
|
151
|
+
<summary><b>Output files</b></summary>
|
|
152
|
+
|
|
153
|
+
| File | Description |
|
|
154
|
+
|------|-------------|
|
|
155
|
+
| `protrider_summary.csv` | Long-format summary with outlier calls for all sample–protein pairs |
|
|
156
|
+
| `pvals.csv` | Two-sided p-values (samples × proteins) |
|
|
157
|
+
| `pvals_adj.csv` | BH/BY-adjusted p-values |
|
|
158
|
+
| `pvals_one_sided.csv` | Left-sided p-values |
|
|
159
|
+
| `zscores.csv` | Z-scores |
|
|
160
|
+
| `residuals.csv` | Model residuals (observed − predicted) |
|
|
161
|
+
| `log2fc.csv` | Log2 fold changes |
|
|
162
|
+
| `fc.csv` | Fold changes |
|
|
163
|
+
| `output.csv` | Autoencoder reconstructed values |
|
|
164
|
+
| `processed_input.csv` | Preprocessed input passed to the autoencoder |
|
|
165
|
+
| `additional_info.csv` | Model metadata (latent dimension, learning rate, loss) |
|
|
166
|
+
| `train_losses.csv` | Per-epoch training loss |
|
|
167
|
+
| `fit_parameters.csv` | Per-protein distribution fit parameters |
|
|
168
|
+
| `config.yaml` | Saved configuration for reproducibility |
|
|
169
|
+
|
|
170
|
+
</details>
|
|
171
|
+
|
|
172
|
+
### ▶️ Run
|
|
173
|
+
|
|
174
|
+
Run the pipeline:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
protrider run --config config.yaml
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Generate plots:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# All plots
|
|
184
|
+
protrider plot --config config.yaml all
|
|
185
|
+
|
|
186
|
+
# Individual plot types
|
|
187
|
+
protrider plot --config config.yaml pvals
|
|
188
|
+
protrider plot --config config.yaml aberrant_per_sample
|
|
189
|
+
protrider plot --config config.yaml training_loss
|
|
190
|
+
protrider plot --config config.yaml encoding_dim
|
|
191
|
+
|
|
192
|
+
# Expected vs observed for a specific protein
|
|
193
|
+
protrider plot --config config.yaml expected_vs_observed --protein_id <protein_id>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
<details>
|
|
197
|
+
<summary><b>Model checkpointing</b></summary>
|
|
198
|
+
|
|
199
|
+
PROTRIDER automatically saves trained models and reuses them in subsequent runs, skipping retraining if a checkpoint exists. By default the model is saved to `<out_dir>/model.pt`.
|
|
200
|
+
|
|
201
|
+
To use a custom checkpoint location, set `checkpoint_path` in your config:
|
|
202
|
+
|
|
203
|
+
```yaml
|
|
204
|
+
checkpoint_path: models/my_model.pt
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
To force retraining, delete the checkpoint file or point to a new path.
|
|
208
|
+
|
|
209
|
+
</details>
|
|
210
|
+
|
|
211
|
+
<details>
|
|
212
|
+
<summary><b>Python API</b></summary>
|
|
213
|
+
|
|
214
|
+
```python
|
|
215
|
+
import protrider
|
|
216
|
+
|
|
217
|
+
config = protrider.ProtriderConfig(
|
|
218
|
+
out_dir='output/',
|
|
219
|
+
input_intensities='data/protein_intensities.csv',
|
|
220
|
+
sample_annotation='data/sample_annotations.csv',
|
|
221
|
+
index_col='protein_ID',
|
|
222
|
+
cov_used=['AGE', 'SEX'],
|
|
223
|
+
n_epochs=100,
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
# Run
|
|
227
|
+
result, model_info, fit_params, gs_result = protrider.run(config)
|
|
228
|
+
|
|
229
|
+
# Save results
|
|
230
|
+
result.save(config.out_dir, format='wide') # individual CSV files
|
|
231
|
+
result.save(config.out_dir, format='long') # protrider_summary.csv
|
|
232
|
+
model_info.save(config.out_dir)
|
|
233
|
+
config.save(config.out_dir)
|
|
234
|
+
|
|
235
|
+
# Generate plots (omit out_dir to get plot objects without saving)
|
|
236
|
+
model_info.plot_training_loss(config.out_dir)
|
|
237
|
+
result.plot_aberrant_per_sample(config.out_dir)
|
|
238
|
+
hist_plot, qq_plot = result.plot_pvals(config.out_dir)
|
|
239
|
+
result.plot_expected_vs_observed('protein_123', config.out_dir)
|
|
240
|
+
|
|
241
|
+
# Access results as DataFrames
|
|
242
|
+
result.df_pvals # p-values
|
|
243
|
+
result.df_pvals_adj # adjusted p-values
|
|
244
|
+
result.df_Z # z-scores
|
|
245
|
+
result.df_res # residuals
|
|
246
|
+
result.log2fc # log2 fold changes
|
|
247
|
+
result.fc # fold changes
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
</details>
|
|
251
|
+
|
|
252
|
+
## 📄 License
|
|
253
|
+
|
|
254
|
+
This project is licensed under the [MIT License](LICENSE).
|
|
255
|
+
|
|
256
|
+
## 📚 Citation
|
|
257
|
+
|
|
258
|
+
If you use PROTRIDER, please cite:
|
|
259
|
+
|
|
260
|
+
```bibtex
|
|
261
|
+
@article{10.1093/bioinformatics/btaf628,
|
|
262
|
+
author = {Klaproth-Andrade, Daniela and Scheller, Ines F and Tsitsiridis, Georgios and Loipfinger, Stefan and Mertes, Christian and Smirnov, Dmitrii and Prokisch, Holger and Yépez, Vicente A and Gagneur, Julien},
|
|
263
|
+
title = {PROTRIDER: Protein abundance outlier detection from mass spectrometry-based proteomics data with a conditional autoencoder},
|
|
264
|
+
journal = {Bioinformatics},
|
|
265
|
+
pages = {btaf628},
|
|
266
|
+
year = {2025},
|
|
267
|
+
month = {11},
|
|
268
|
+
issn = {1367-4811},
|
|
269
|
+
doi = {10.1093/bioinformatics/btaf628},
|
|
270
|
+
url = {https://doi.org/10.1093/bioinformatics/btaf628},
|
|
271
|
+
}
|
|
272
|
+
```
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
# PROTRIDER
|
|
2
|
+
|
|
3
|
+
[](https://github.com/gagneurlab/PROTRIDER/actions/workflows/tests.yml)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://www.python.org/downloads/)
|
|
6
|
+
|
|
7
|
+
PROTRIDER is an autoencoder-based method to call protein outliers from mass spectrometry-based proteomics datasets.
|
|
8
|
+
|
|
9
|
+
Have a look at our [paper](https://doi.org/10.1093/bioinformatics/btaf628) for information about our work.
|
|
10
|
+
|
|
11
|
+
<details open>
|
|
12
|
+
<summary><b>Table of Contents</b></summary>
|
|
13
|
+
|
|
14
|
+
- [🚀 Quickstart](#-quickstart)
|
|
15
|
+
- [⚙️ Installation](#️-installation)
|
|
16
|
+
- [📖 Usage](#-usage)
|
|
17
|
+
- [🗂️ Configuration](#️-configuration)
|
|
18
|
+
- [📤 Output](#-output)
|
|
19
|
+
- [▶️ Run](#️-run)
|
|
20
|
+
- [📄 License](#-license)
|
|
21
|
+
- [📚 Citation](#-citation)
|
|
22
|
+
|
|
23
|
+
</details>
|
|
24
|
+
|
|
25
|
+
## 🚀 Quickstart
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# 1. Install
|
|
29
|
+
pip install .
|
|
30
|
+
|
|
31
|
+
# 2. Run on the included sample data
|
|
32
|
+
protrider run --config config.yaml
|
|
33
|
+
|
|
34
|
+
# 3. Plot results
|
|
35
|
+
protrider plot --config config.yaml all
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Results are written to the directory specified by `out_dir` in `config.yaml` (default: `output/`). The key output file is `protrider_summary.csv`, which contains outlier calls with p-values, z-scores, and fold changes for every sample–protein pair.
|
|
39
|
+
|
|
40
|
+
## ⚙️ Installation
|
|
41
|
+
|
|
42
|
+
PROTRIDER was tested using Python 3.14 on Linux. We recommend a dedicated conda environment:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
conda create --name protrider_env python=3.14
|
|
46
|
+
conda activate protrider_env
|
|
47
|
+
pip install .
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Verify the installation:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
protrider --help
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
More information on conda environments can be found in [Conda's user guide](https://docs.conda.io/projects/conda/en/latest/user-guide/).
|
|
57
|
+
|
|
58
|
+
## 📖 Usage
|
|
59
|
+
|
|
60
|
+
### 🗂️ Configuration
|
|
61
|
+
|
|
62
|
+
All parameters are set in a YAML configuration file. A template is provided as `config.yaml`.
|
|
63
|
+
|
|
64
|
+
Input files are specified in the config:
|
|
65
|
+
|
|
66
|
+
- **`input_intensities`**: CSV, TSV, or Parquet file with protein intensities (columns = samples, rows = proteins)
|
|
67
|
+
- **`sample_annotation`** (optional): CSV or TSV file with sample covariates (one row per sample)
|
|
68
|
+
|
|
69
|
+
An example dataset is included under `sample_data/`.
|
|
70
|
+
|
|
71
|
+
<details open>
|
|
72
|
+
<summary><b>Configuration parameters</b></summary>
|
|
73
|
+
|
|
74
|
+
| Parameter | Description |
|
|
75
|
+
|-----------|-------------|
|
|
76
|
+
| `out_dir` | Output directory |
|
|
77
|
+
| `input_intensities` | Path to protein intensities file |
|
|
78
|
+
| `sample_annotation` | Path to sample annotations file (optional) |
|
|
79
|
+
| `index_col` | Column name containing protein IDs |
|
|
80
|
+
| `cov_used` | List of covariate column names from the annotation file (optional) |
|
|
81
|
+
| `find_q_method` | Method to determine latent dimension: `OHT` (default), `gs`, `bs` (binary search), or an integer |
|
|
82
|
+
| `pval_dist` | Distribution for p-value calculation: `t` (default) or `gaussian` |
|
|
83
|
+
| `n_epochs` | Number of training epochs (default: `100`) |
|
|
84
|
+
| `checkpoint_path` | Path to save/load model checkpoint (optional) |
|
|
85
|
+
|
|
86
|
+
</details>
|
|
87
|
+
|
|
88
|
+
### 📤 Output
|
|
89
|
+
|
|
90
|
+
The key output file is `protrider_summary.csv`, which contains outlier calls with p-values, z-scores, and fold changes for every sample–protein pair.
|
|
91
|
+
|
|
92
|
+
<details>
|
|
93
|
+
<summary><b>Output files</b></summary>
|
|
94
|
+
|
|
95
|
+
| File | Description |
|
|
96
|
+
|------|-------------|
|
|
97
|
+
| `protrider_summary.csv` | Long-format summary with outlier calls for all sample–protein pairs |
|
|
98
|
+
| `pvals.csv` | Two-sided p-values (samples × proteins) |
|
|
99
|
+
| `pvals_adj.csv` | BH/BY-adjusted p-values |
|
|
100
|
+
| `pvals_one_sided.csv` | Left-sided p-values |
|
|
101
|
+
| `zscores.csv` | Z-scores |
|
|
102
|
+
| `residuals.csv` | Model residuals (observed − predicted) |
|
|
103
|
+
| `log2fc.csv` | Log2 fold changes |
|
|
104
|
+
| `fc.csv` | Fold changes |
|
|
105
|
+
| `output.csv` | Autoencoder reconstructed values |
|
|
106
|
+
| `processed_input.csv` | Preprocessed input passed to the autoencoder |
|
|
107
|
+
| `additional_info.csv` | Model metadata (latent dimension, learning rate, loss) |
|
|
108
|
+
| `train_losses.csv` | Per-epoch training loss |
|
|
109
|
+
| `fit_parameters.csv` | Per-protein distribution fit parameters |
|
|
110
|
+
| `config.yaml` | Saved configuration for reproducibility |
|
|
111
|
+
|
|
112
|
+
</details>
|
|
113
|
+
|
|
114
|
+
### ▶️ Run
|
|
115
|
+
|
|
116
|
+
Run the pipeline:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
protrider run --config config.yaml
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Generate plots:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# All plots
|
|
126
|
+
protrider plot --config config.yaml all
|
|
127
|
+
|
|
128
|
+
# Individual plot types
|
|
129
|
+
protrider plot --config config.yaml pvals
|
|
130
|
+
protrider plot --config config.yaml aberrant_per_sample
|
|
131
|
+
protrider plot --config config.yaml training_loss
|
|
132
|
+
protrider plot --config config.yaml encoding_dim
|
|
133
|
+
|
|
134
|
+
# Expected vs observed for a specific protein
|
|
135
|
+
protrider plot --config config.yaml expected_vs_observed --protein_id <protein_id>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
<details>
|
|
139
|
+
<summary><b>Model checkpointing</b></summary>
|
|
140
|
+
|
|
141
|
+
PROTRIDER automatically saves trained models and reuses them in subsequent runs, skipping retraining if a checkpoint exists. By default the model is saved to `<out_dir>/model.pt`.
|
|
142
|
+
|
|
143
|
+
To use a custom checkpoint location, set `checkpoint_path` in your config:
|
|
144
|
+
|
|
145
|
+
```yaml
|
|
146
|
+
checkpoint_path: models/my_model.pt
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
To force retraining, delete the checkpoint file or point to a new path.
|
|
150
|
+
|
|
151
|
+
</details>
|
|
152
|
+
|
|
153
|
+
<details>
|
|
154
|
+
<summary><b>Python API</b></summary>
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
import protrider
|
|
158
|
+
|
|
159
|
+
config = protrider.ProtriderConfig(
|
|
160
|
+
out_dir='output/',
|
|
161
|
+
input_intensities='data/protein_intensities.csv',
|
|
162
|
+
sample_annotation='data/sample_annotations.csv',
|
|
163
|
+
index_col='protein_ID',
|
|
164
|
+
cov_used=['AGE', 'SEX'],
|
|
165
|
+
n_epochs=100,
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
# Run
|
|
169
|
+
result, model_info, fit_params, gs_result = protrider.run(config)
|
|
170
|
+
|
|
171
|
+
# Save results
|
|
172
|
+
result.save(config.out_dir, format='wide') # individual CSV files
|
|
173
|
+
result.save(config.out_dir, format='long') # protrider_summary.csv
|
|
174
|
+
model_info.save(config.out_dir)
|
|
175
|
+
config.save(config.out_dir)
|
|
176
|
+
|
|
177
|
+
# Generate plots (omit out_dir to get plot objects without saving)
|
|
178
|
+
model_info.plot_training_loss(config.out_dir)
|
|
179
|
+
result.plot_aberrant_per_sample(config.out_dir)
|
|
180
|
+
hist_plot, qq_plot = result.plot_pvals(config.out_dir)
|
|
181
|
+
result.plot_expected_vs_observed('protein_123', config.out_dir)
|
|
182
|
+
|
|
183
|
+
# Access results as DataFrames
|
|
184
|
+
result.df_pvals # p-values
|
|
185
|
+
result.df_pvals_adj # adjusted p-values
|
|
186
|
+
result.df_Z # z-scores
|
|
187
|
+
result.df_res # residuals
|
|
188
|
+
result.log2fc # log2 fold changes
|
|
189
|
+
result.fc # fold changes
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
</details>
|
|
193
|
+
|
|
194
|
+
## 📄 License
|
|
195
|
+
|
|
196
|
+
This project is licensed under the [MIT License](LICENSE).
|
|
197
|
+
|
|
198
|
+
## 📚 Citation
|
|
199
|
+
|
|
200
|
+
If you use PROTRIDER, please cite:
|
|
201
|
+
|
|
202
|
+
```bibtex
|
|
203
|
+
@article{10.1093/bioinformatics/btaf628,
|
|
204
|
+
author = {Klaproth-Andrade, Daniela and Scheller, Ines F and Tsitsiridis, Georgios and Loipfinger, Stefan and Mertes, Christian and Smirnov, Dmitrii and Prokisch, Holger and Yépez, Vicente A and Gagneur, Julien},
|
|
205
|
+
title = {PROTRIDER: Protein abundance outlier detection from mass spectrometry-based proteomics data with a conditional autoencoder},
|
|
206
|
+
journal = {Bioinformatics},
|
|
207
|
+
pages = {btaf628},
|
|
208
|
+
year = {2025},
|
|
209
|
+
month = {11},
|
|
210
|
+
issn = {1367-4811},
|
|
211
|
+
doi = {10.1093/bioinformatics/btaf628},
|
|
212
|
+
url = {https://doi.org/10.1093/bioinformatics/btaf628},
|
|
213
|
+
}
|
|
214
|
+
```
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# path to output directory to store result files
|
|
2
|
+
out_dir: output
|
|
3
|
+
|
|
4
|
+
# csv input file containing intensities. Columns are samples and rows are proteins.
|
|
5
|
+
input_intensities: sample_data/protrider_sample_dataset.tsv
|
|
6
|
+
|
|
7
|
+
# column name in the input file indicating the column name containing the protein names/IDs
|
|
8
|
+
index_col: "protein_ID"
|
|
9
|
+
|
|
10
|
+
# csv file containing sample annotations
|
|
11
|
+
# sample_annotation: sample_data/sample_annotations.tsv
|
|
12
|
+
|
|
13
|
+
## Preprocessing params
|
|
14
|
+
# maximum percentage of missing values per protein
|
|
15
|
+
max_allowed_NAs_per_protein: 0.3
|
|
16
|
+
# transformation funtion to apply to the data before model fitting. options are log10, log2, and log
|
|
17
|
+
# set this to null if the data is already log-transformed
|
|
18
|
+
log_func_name: "log"
|
|
19
|
+
|
|
20
|
+
# names of columns in the sample annotation file to be passed as covariates to the autoencoder.
|
|
21
|
+
# leaving this empty results in no covariates passed to the model
|
|
22
|
+
cov_used:
|
|
23
|
+
# - SEX
|
|
24
|
+
# - AGE
|
|
25
|
+
# - "BATCH_RUN"
|
|
26
|
+
|
|
27
|
+
# seed parameter for reproducibility
|
|
28
|
+
seed: 42
|
|
29
|
+
|
|
30
|
+
## Grid search outlier injection params
|
|
31
|
+
inj_freq: 1e-3
|
|
32
|
+
inj_mean: 3
|
|
33
|
+
inj_sd: 1.6
|
|
34
|
+
gs_epochs: 100
|
|
35
|
+
|
|
36
|
+
## Model params
|
|
37
|
+
autoencoder_training: True ## when set to false, it returns values after (PCA) initialization without training
|
|
38
|
+
|
|
39
|
+
n_layers: 1 # number of layers for the autoencoder model
|
|
40
|
+
n_epochs: 100 # number of training epochs
|
|
41
|
+
lr: 1e-4 # learning rate
|
|
42
|
+
batch_size:
|
|
43
|
+
|
|
44
|
+
find_q_method: "OHT" # option to find latent space dimension. Options: OHT, gs or an integer value
|
|
45
|
+
init_pca: True # PCA initialization
|
|
46
|
+
h_dim: # hidden dimension, only for n_layers>1
|
|
47
|
+
|
|
48
|
+
## Presence absence modelling
|
|
49
|
+
presence_absence: False
|
|
50
|
+
lambda_presence_absence: 0.5
|
|
51
|
+
|
|
52
|
+
## Stat params
|
|
53
|
+
pval_dist: 't' # Distribution choice for P-value computation. Options: gaussian, t
|
|
54
|
+
pval_adj: 'by' # Multiple testing correction. Options: by, bh
|
|
55
|
+
pval_sided: 'two-sided'
|
|
56
|
+
common_degrees_freedom: False # whether to use common degrees of freedom; more stable for small datasets
|
|
57
|
+
pseudocount: 0.01 # for FC computation
|
|
58
|
+
|
|
59
|
+
## Reporting params
|
|
60
|
+
outlier_threshold: 0.1
|
|
61
|
+
report_all: True
|
|
62
|
+
|
|
63
|
+
verbose: False
|
|
64
|
+
device: 'gpu'
|
|
65
|
+
|
|
66
|
+
## Model checkpoint
|
|
67
|
+
# Path to save/load model checkpoint (optional)
|
|
68
|
+
# If None: saves to out_dir/model.pt (or model_fold_N.pt for CV)
|
|
69
|
+
# If specified and exists: loads model from this path and skips training
|
|
70
|
+
# If specified and doesn't exist: trains and saves to this path
|
|
71
|
+
# checkpoint_path: 'checkpoint.pt'
|
|
72
|
+
|
|
73
|
+
use_wandb: False
|
|
74
|
+
# wandb_project: 'protrider_test'
|
|
75
|
+
# wandb_name: 'test_run'
|