Skip to main content

MetaClock workflow

MetaClock workflow diagram

This repository contains workflows for chronological-age prediction, cross-domain generalization, biological-age and disease analysis, functional enrichment, and intervention analysis. GEO workflows download inputs into repository-local data directories. The workflow READMEs describe the required files and preparation steps.

Project overview

MetaClock is an integrated framework that combines predictions from multiple established epigenetic clocks into meta models. This repository organizes the reproducible downstream workflows used to evaluate chronological-age prediction, quantify generalization across array platforms, tissues, and species, and study biological-age associations with disease and interventions.

Environment

Install uv and create the locked Python 3.11 environment from the repository root:

uv sync --frozen

MetaClock Python package

The aging_metaclock distribution provides the importable metaclock package. Install it from PyPI using Python 3.11:

python -m pip install aging_metaclock

For local development, install from the repository root:

python -m pip install -e .

Input contract

metaclock.fit() accepts an in-memory anndata.AnnData object or an .h5ad file in pyaging's standard orientation:

  • rows are samples;
  • columns are DNAm or phenotype features;
  • feature names are stored in adata.var_names;
  • the numeric training response is stored in adata.obs["age"] by default.

Clocks that use phenotype covariates, such as GrimAge, require those covariates in the input matrix and adata.var_names according to pyaging's input rules.

Fit and predict

Pass any ordered list of pyaging component-model names. The fitted result is an sklearn-compatible pipeline whose predict() method first runs the same components in the same order and then applies the trained meta-regressor:

import metaclock

component_model_list = [
    "horvath2013",
    "hannum",
    "dnamphenoage",
]

model = metaclock.fit(
    train_adata,
    component_model_list,
    "elastic_net",
    target="age",
)

predicted_age = model.predict(test_adata)

The three positional arguments are the input data, component-model list, and model architecture. Set pyaging_dir when using a specific local pyaging weight cache. The component ordering used for fitting is retained for every later prediction.

To run the component clocks without fitting a meta-model:

component_outputs = metaclock.predict_components(
    test_adata,
    component_model_list,
)

Supported architectures are elastic_net, lasso, ridge, linear_regression, random_forest, svr, mlp, and lightgbm. The mlp architecture uses StandardScaler followed by sklearn's MLPRegressor; its network parameters can be overridden through model_params. LightGBM is part of the standard locked environment and uses its sklearn-compatible LGBMRegressor interface.

Fitted models can be saved with joblib and loaded for later prediction:

import joblib

joblib.dump(model, model_output_path)
loaded_model = joblib.load(model_output_path)
predicted_age = loaded_model.predict(test_adata)

Metadata

Release files for aging-metaclock 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aging-metaclock 0.1.0
File Size Uploaded
aging_metaclock-0.1.0.tar.gz 8.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aging-metaclock 0.1.0
File Interpreter ABI Platform
aging_metaclock-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.8 kB

Release files / aging_metaclock-0.1.0.tar.gz

Download URL aging_metaclock-0.1.0.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8203bba43adbd568021e2940e38defe05625af1fb5c45a03b54e584df5a0254e
BLAKE2b-256 checksum
How to use checksums
80a5a9d76f6c92d416a75472667f9a0c503879e0e2ade6f8ef23a1d909117b9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.14

Release files / aging_metaclock-0.1.0-py3-none-any.whl

Download URL aging_metaclock-0.1.0-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
574e4b432373cf67ff6bb7fff22e8791f71293d5f27c10ef3f12e072f51d3401
BLAKE2b-256 checksum
How to use checksums
070e290d216f8ce76ca7147c86a9f3c4a5b20e632f2e1432bce27c42d839f44d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page