agingclockbench 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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aaditya Srivant Geddam
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.
@@ -0,0 +1,183 @@
1
+ Metadata-Version: 2.4
2
+ Name: agingclockbench
3
+ Version: 0.1.0
4
+ Summary: Benchmark biological aging clocks on your data — PhenoAge, KDM, DunedinPACE proxy
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Keywords: aging,biomarkers,aging-clocks,longevity,biological-age,phenoage,kdm,nhanes,mortality
8
+ Author: Aaditya Geddam
9
+ Author-email: aaditya.geddam@gmail.com
10
+ Requires-Python: >=3.11,<4.0
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
20
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
21
+ Requires-Dist: click (>=8.1.0)
22
+ Requires-Dist: lifelines (>=0.28.0)
23
+ Requires-Dist: matplotlib (>=3.8.0)
24
+ Requires-Dist: numpy (>=1.26.0)
25
+ Requires-Dist: pandas (>=2.2.0)
26
+ Requires-Dist: plotly (>=5.17.0)
27
+ Requires-Dist: pyarrow (>=13.0.0)
28
+ Requires-Dist: pydantic (>=2.3.0)
29
+ Requires-Dist: scipy (>=1.13.0)
30
+ Requires-Dist: seaborn (>=0.13.0)
31
+ Project-URL: Documentation, https://aadityageddam-ux.github.io/aging_clock_bench/
32
+ Project-URL: Homepage, https://aadityageddam-ux.github.io/aging_clock_bench/
33
+ Project-URL: Repository, https://github.com/aadityageddam-ux/aging_clock_bench
34
+ Description-Content-Type: text/markdown
35
+
36
+ # AgingClockBench
37
+
38
+ [![PyPI version](https://badge.fury.io/py/agingclockbench.svg)](https://badge.fury.io/py/agingclockbench)
39
+ [![Tests](https://github.com/aadityageddam-ux/aging_clock_bench/actions/workflows/test.yml/badge.svg)](https://github.com/aadityageddam-ux/aging_clock_bench/actions/workflows/test.yml)
40
+ [![Coverage](https://img.shields.io/badge/coverage-89%25-brightgreen)](https://github.com/aadityageddam-ux/aging_clock_bench)
41
+ [![Docs](https://img.shields.io/badge/docs-GitHub%20Pages-blue)](https://aadityageddam-ux.github.io/aging_clock_bench/)
42
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
43
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue)](https://www.python.org/downloads/)
44
+
45
+ **Benchmark biological aging clocks on your data in minutes.**
46
+
47
+ Multiple biological aging clocks exist — PhenoAge, KDM, DunedinPACE — but no standard tool lets researchers compare them side-by-side. AgingClockBench is the **first open-source Python package** implementing multiple clocks with a unified interface and reproducible mortality-validated benchmarking.
48
+
49
+ 📖 **[Full Documentation](https://aadityageddam-ux.github.io/aging_clock_bench/)**
50
+
51
+ ---
52
+
53
+ ## Install
54
+
55
+ ```bash
56
+ pip install agingclockbench
57
+ ```
58
+
59
+ Requires Python 3.11+.
60
+
61
+ ---
62
+
63
+ ## Quick Start
64
+
65
+ ```python
66
+ from agingclockbench import PhenoAge, KDM, BenchmarkSuite
67
+ from agingclockbench.datasets import load_nhanes_sample
68
+
69
+ # Load bundled NHANES 1999-2000 (N=4,086, 20-year mortality follow-up)
70
+ df = load_nhanes_sample()
71
+
72
+ # Compute biological ages
73
+ results = {
74
+ "PhenoAge": PhenoAge().transform(df),
75
+ "KDM": KDM().transform(df),
76
+ }
77
+
78
+ # Benchmark against mortality
79
+ suite = BenchmarkSuite(mortality_col="mortstat", followup_col="permth_exm")
80
+ report = suite.run(df, results)
81
+
82
+ print(report.to_dataframe())
83
+ ```
84
+
85
+ ```
86
+ Clock Pearson r Mort HR (per SD accel) Mort p-value
87
+ PhenoAge 0.930 1.83 0.000001
88
+ KDM 0.677 1.41 0.000001
89
+ ```
90
+
91
+ ```python
92
+ report.plot_km_survival() # Kaplan-Meier by acceleration quartile
93
+ report.plot_comparison() # biological age vs chronological age
94
+ report.to_html("report.html") # interactive Plotly report
95
+ ```
96
+
97
+ ---
98
+
99
+ ## CLI
100
+
101
+ ```bash
102
+ # Benchmark on bundled NHANES with HTML report
103
+ agingclockbench benchmark --data bundled --clocks all --report
104
+
105
+ # Your own data
106
+ agingclockbench benchmark \
107
+ --data my_cohort.csv \
108
+ --clocks PhenoAge KDM \
109
+ --mortality-col vital_status \
110
+ --followup-col followup_months \
111
+ --output ./results/
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Implemented Clocks
117
+
118
+ | Clock | Reference | Biomarkers | Key metric (NHANES) |
119
+ |-------|-----------|-----------|---------------------|
120
+ | **PhenoAge** | Levine et al. 2018 *Aging Cell* | 9 blood | Pearson r=0.93, HR=1.83 |
121
+ | **KDM** | Klemera & Doubal 2006 *Mech Ageing Dev* | 8 blood | Pearson r=0.68, HR=1.41 |
122
+ | **DunedinPACEProxy** | Proxy (NOT Belsky 2022) | 7 blood | pace corr w/ PhenoAge accel r=0.84 |
123
+
124
+ > **Note:** DunedinPACEProxy is a blood-biomarker approximation. The real DunedinPACE requires DNA methylation data (Illumina EPIC array).
125
+
126
+ ---
127
+
128
+ ## Features
129
+
130
+ - ✅ **Unified interface** — all clocks share the same `transform()` API
131
+ - ✅ **Validated** — PhenoAge implementation cross-validated against reference; zero numerical difference on N=4,086 NHANES participants
132
+ - ✅ **Mortality benchmarking** — Cox PH hazard ratios, Kaplan-Meier curves
133
+ - ✅ **Bundled data** — NHANES 1999-2000 with 20-year mortality follow-up, ready to use
134
+ - ✅ **Interactive reports** — Plotly HTML with comparison plots and benchmark table
135
+ - ✅ **CLI tool** — `agingclockbench benchmark` works out of the box
136
+ - ✅ **89% test coverage** — 76+ tests, CI/CD on every push
137
+
138
+ ---
139
+
140
+ ## Documentation
141
+
142
+ | Resource | Link |
143
+ |----------|------|
144
+ | Full docs | [aadityageddam-ux.github.io/aging_clock_bench](https://aadityageddam-ux.github.io/aging_clock_bench/) |
145
+ | Quickstart | [docs/quickstart](https://aadityageddam-ux.github.io/aging_clock_bench/quickstart/) |
146
+ | PhenoAge algorithm | [docs/algorithms/phenoage](https://aadityageddam-ux.github.io/aging_clock_bench/algorithms/phenoage/) |
147
+ | FAQ | [docs/faq](https://aadityageddam-ux.github.io/aging_clock_bench/faq/) |
148
+ | Example notebooks | [examples/](examples/) |
149
+
150
+ ---
151
+
152
+ ## Citation
153
+
154
+ If you use AgingClockBench in your research, please cite:
155
+
156
+ ```bibtex
157
+ @software{geddam2026agingclockbench,
158
+ author = {Geddam, Aaditya},
159
+ title = {AgingClockBench: Benchmarking biological aging clocks},
160
+ url = {https://github.com/aadityageddam-ux/aging_clock_bench},
161
+ year = {2026}
162
+ }
163
+ ```
164
+
165
+ **Also cite the underlying clock papers:**
166
+
167
+ - Levine ME, et al. *Aging Cell.* 2018. (PhenoAge)
168
+ - Klemera P, Doubal S. *Mech Ageing Dev.* 2006. (KDM)
169
+
170
+ ---
171
+
172
+ ## Contributing
173
+
174
+ Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md).
175
+
176
+ To add a new clock, implement the `BaseClock` interface — see the [FAQ](https://aadityageddam-ux.github.io/aging_clock_bench/faq/#how-do-i-add-a-new-clock).
177
+
178
+ ---
179
+
180
+ ## License
181
+
182
+ MIT © Aaditya Geddam
183
+
@@ -0,0 +1,147 @@
1
+ # AgingClockBench
2
+
3
+ [![PyPI version](https://badge.fury.io/py/agingclockbench.svg)](https://badge.fury.io/py/agingclockbench)
4
+ [![Tests](https://github.com/aadityageddam-ux/aging_clock_bench/actions/workflows/test.yml/badge.svg)](https://github.com/aadityageddam-ux/aging_clock_bench/actions/workflows/test.yml)
5
+ [![Coverage](https://img.shields.io/badge/coverage-89%25-brightgreen)](https://github.com/aadityageddam-ux/aging_clock_bench)
6
+ [![Docs](https://img.shields.io/badge/docs-GitHub%20Pages-blue)](https://aadityageddam-ux.github.io/aging_clock_bench/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue)](https://www.python.org/downloads/)
9
+
10
+ **Benchmark biological aging clocks on your data in minutes.**
11
+
12
+ Multiple biological aging clocks exist — PhenoAge, KDM, DunedinPACE — but no standard tool lets researchers compare them side-by-side. AgingClockBench is the **first open-source Python package** implementing multiple clocks with a unified interface and reproducible mortality-validated benchmarking.
13
+
14
+ 📖 **[Full Documentation](https://aadityageddam-ux.github.io/aging_clock_bench/)**
15
+
16
+ ---
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ pip install agingclockbench
22
+ ```
23
+
24
+ Requires Python 3.11+.
25
+
26
+ ---
27
+
28
+ ## Quick Start
29
+
30
+ ```python
31
+ from agingclockbench import PhenoAge, KDM, BenchmarkSuite
32
+ from agingclockbench.datasets import load_nhanes_sample
33
+
34
+ # Load bundled NHANES 1999-2000 (N=4,086, 20-year mortality follow-up)
35
+ df = load_nhanes_sample()
36
+
37
+ # Compute biological ages
38
+ results = {
39
+ "PhenoAge": PhenoAge().transform(df),
40
+ "KDM": KDM().transform(df),
41
+ }
42
+
43
+ # Benchmark against mortality
44
+ suite = BenchmarkSuite(mortality_col="mortstat", followup_col="permth_exm")
45
+ report = suite.run(df, results)
46
+
47
+ print(report.to_dataframe())
48
+ ```
49
+
50
+ ```
51
+ Clock Pearson r Mort HR (per SD accel) Mort p-value
52
+ PhenoAge 0.930 1.83 0.000001
53
+ KDM 0.677 1.41 0.000001
54
+ ```
55
+
56
+ ```python
57
+ report.plot_km_survival() # Kaplan-Meier by acceleration quartile
58
+ report.plot_comparison() # biological age vs chronological age
59
+ report.to_html("report.html") # interactive Plotly report
60
+ ```
61
+
62
+ ---
63
+
64
+ ## CLI
65
+
66
+ ```bash
67
+ # Benchmark on bundled NHANES with HTML report
68
+ agingclockbench benchmark --data bundled --clocks all --report
69
+
70
+ # Your own data
71
+ agingclockbench benchmark \
72
+ --data my_cohort.csv \
73
+ --clocks PhenoAge KDM \
74
+ --mortality-col vital_status \
75
+ --followup-col followup_months \
76
+ --output ./results/
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Implemented Clocks
82
+
83
+ | Clock | Reference | Biomarkers | Key metric (NHANES) |
84
+ |-------|-----------|-----------|---------------------|
85
+ | **PhenoAge** | Levine et al. 2018 *Aging Cell* | 9 blood | Pearson r=0.93, HR=1.83 |
86
+ | **KDM** | Klemera & Doubal 2006 *Mech Ageing Dev* | 8 blood | Pearson r=0.68, HR=1.41 |
87
+ | **DunedinPACEProxy** | Proxy (NOT Belsky 2022) | 7 blood | pace corr w/ PhenoAge accel r=0.84 |
88
+
89
+ > **Note:** DunedinPACEProxy is a blood-biomarker approximation. The real DunedinPACE requires DNA methylation data (Illumina EPIC array).
90
+
91
+ ---
92
+
93
+ ## Features
94
+
95
+ - ✅ **Unified interface** — all clocks share the same `transform()` API
96
+ - ✅ **Validated** — PhenoAge implementation cross-validated against reference; zero numerical difference on N=4,086 NHANES participants
97
+ - ✅ **Mortality benchmarking** — Cox PH hazard ratios, Kaplan-Meier curves
98
+ - ✅ **Bundled data** — NHANES 1999-2000 with 20-year mortality follow-up, ready to use
99
+ - ✅ **Interactive reports** — Plotly HTML with comparison plots and benchmark table
100
+ - ✅ **CLI tool** — `agingclockbench benchmark` works out of the box
101
+ - ✅ **89% test coverage** — 76+ tests, CI/CD on every push
102
+
103
+ ---
104
+
105
+ ## Documentation
106
+
107
+ | Resource | Link |
108
+ |----------|------|
109
+ | Full docs | [aadityageddam-ux.github.io/aging_clock_bench](https://aadityageddam-ux.github.io/aging_clock_bench/) |
110
+ | Quickstart | [docs/quickstart](https://aadityageddam-ux.github.io/aging_clock_bench/quickstart/) |
111
+ | PhenoAge algorithm | [docs/algorithms/phenoage](https://aadityageddam-ux.github.io/aging_clock_bench/algorithms/phenoage/) |
112
+ | FAQ | [docs/faq](https://aadityageddam-ux.github.io/aging_clock_bench/faq/) |
113
+ | Example notebooks | [examples/](examples/) |
114
+
115
+ ---
116
+
117
+ ## Citation
118
+
119
+ If you use AgingClockBench in your research, please cite:
120
+
121
+ ```bibtex
122
+ @software{geddam2026agingclockbench,
123
+ author = {Geddam, Aaditya},
124
+ title = {AgingClockBench: Benchmarking biological aging clocks},
125
+ url = {https://github.com/aadityageddam-ux/aging_clock_bench},
126
+ year = {2026}
127
+ }
128
+ ```
129
+
130
+ **Also cite the underlying clock papers:**
131
+
132
+ - Levine ME, et al. *Aging Cell.* 2018. (PhenoAge)
133
+ - Klemera P, Doubal S. *Mech Ageing Dev.* 2006. (KDM)
134
+
135
+ ---
136
+
137
+ ## Contributing
138
+
139
+ Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md).
140
+
141
+ To add a new clock, implement the `BaseClock` interface — see the [FAQ](https://aadityageddam-ux.github.io/aging_clock_bench/faq/#how-do-i-add-a-new-clock).
142
+
143
+ ---
144
+
145
+ ## License
146
+
147
+ MIT © Aaditya Geddam
@@ -0,0 +1,76 @@
1
+ [tool.poetry]
2
+ name = "agingclockbench"
3
+ version = "0.1.0"
4
+ description = "Benchmark biological aging clocks on your data — PhenoAge, KDM, DunedinPACE proxy"
5
+ authors = ["Aaditya Geddam <aaditya.geddam@gmail.com>"]
6
+ license = "MIT"
7
+ readme = "README.md"
8
+ homepage = "https://aadityageddam-ux.github.io/aging_clock_bench/"
9
+ repository = "https://github.com/aadityageddam-ux/aging_clock_bench"
10
+ documentation = "https://aadityageddam-ux.github.io/aging_clock_bench/"
11
+ keywords = ["aging", "biomarkers", "aging-clocks", "longevity", "biological-age",
12
+ "phenoage", "kdm", "nhanes", "mortality"]
13
+ classifiers = [
14
+ "Development Status :: 4 - Beta",
15
+ "Intended Audience :: Science/Research",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Programming Language :: Python :: 3.13",
20
+ "Topic :: Scientific/Engineering :: Bio-Informatics",
21
+ "Topic :: Scientific/Engineering :: Medical Science Apps.",
22
+ ]
23
+ packages = [{include = "agingclockbench", from = "src"}]
24
+ include = ["src/agingclockbench/datasets/nhanes_sample.parquet"]
25
+
26
+ [tool.poetry.dependencies]
27
+ python = "^3.11"
28
+ pandas = ">=2.2.0"
29
+ numpy = ">=1.26.0"
30
+ scipy = ">=1.13.0"
31
+ lifelines = ">=0.28.0"
32
+ pydantic = ">=2.3.0"
33
+ plotly = ">=5.17.0"
34
+ seaborn = ">=0.13.0"
35
+ matplotlib = ">=3.8.0"
36
+ click = ">=8.1.0"
37
+ pyarrow = ">=13.0.0"
38
+
39
+ [tool.poetry.group.dev.dependencies]
40
+ pytest = "~7.4.0"
41
+ pytest-cov = "~4.1.0"
42
+ hypothesis = "~6.82.0"
43
+ black = "~23.9.0"
44
+ ruff = "~0.1.0"
45
+ mypy = "~1.5.0"
46
+ mkdocs = "~1.5.0"
47
+ mkdocs-material = "~9.1.0"
48
+ mkdocstrings = {version = ">=0.24.0", extras = ["python"]}
49
+
50
+ [tool.poetry.scripts]
51
+ agingclockbench = "agingclockbench.cli:cli"
52
+
53
+ [build-system]
54
+ requires = ["poetry-core"]
55
+ build-backend = "poetry.core.masonry.api"
56
+
57
+ [tool.black]
58
+ line-length = 88
59
+ target-version = ["py311"]
60
+
61
+ [tool.ruff]
62
+ line-length = 88
63
+ select = ["E", "F", "W", "I"]
64
+
65
+ [tool.mypy]
66
+ python_version = "3.11"
67
+ strict = false
68
+ ignore_missing_imports = true
69
+
70
+ [tool.pytest.ini_options]
71
+ testpaths = ["tests"]
72
+ addopts = "-v"
73
+
74
+ [tool.coverage.run]
75
+ source = ["src/agingclockbench"]
76
+ omit = ["*/tests/*", "*/__init__.py"]
@@ -0,0 +1,9 @@
1
+ """AgingClockBench: Benchmark biological aging clocks on your data."""
2
+
3
+ from agingclockbench.clocks.phenoage import PhenoAge
4
+ from agingclockbench.clocks.kdm import KDM
5
+ from agingclockbench.clocks.dunedinpace import DunedinPACEProxy
6
+ from agingclockbench.benchmarks.suite import BenchmarkSuite
7
+
8
+ __version__ = "0.1.0"
9
+ __all__ = ["PhenoAge", "KDM", "DunedinPACEProxy", "BenchmarkSuite"]
@@ -0,0 +1,3 @@
1
+ from agingclockbench.benchmarks.suite import BenchmarkSuite, BenchmarkResult, BenchmarkReport
2
+
3
+ __all__ = ["BenchmarkSuite", "BenchmarkResult", "BenchmarkReport"]
@@ -0,0 +1,22 @@
1
+ """Individual metric functions used by BenchmarkSuite."""
2
+
3
+ import numpy as np
4
+ import pandas as pd
5
+ from scipy import stats
6
+
7
+
8
+ def pearson_correlation(x: pd.Series, y: pd.Series) -> tuple[float, float]:
9
+ """Return (r, p-value) Pearson correlation between x and y."""
10
+ r, p = stats.pearsonr(x, y)
11
+ return float(r), float(p)
12
+
13
+
14
+ def spearman_correlation(x: pd.Series, y: pd.Series) -> float:
15
+ """Return Spearman rho between x and y."""
16
+ return float(stats.spearmanr(x, y).statistic)
17
+
18
+
19
+ def coefficient_of_variation(series: pd.Series) -> float:
20
+ """Return coefficient of variation (SD / mean)."""
21
+ mean = series.mean()
22
+ return float(series.std() / mean) if mean != 0 else float("nan")