Methylation clock

From ClawBio/ClawBio · View interactive version

Methylation clock is an AI agent skill from the GitHub repository ClawBio/ClawBio. Compute epigenetic age from DNA methylation arrays using PyAging clocks from GEO accessions or local files.

How to use this skill

Skill file

Methylation Clock

Domain Decisions

Epigenetic age workflows are difficult to reproduce because preprocessing and clock inputs differ across tools and publications.

This skill standardizes a PyAging-first pipeline from ingestion to report generation, with explicit reproducibility outputs.

Core Capabilities

  1. Accepts exactly one input source: GEO accession (--geo-id) or local methylation file (--input).
  2. Applies notebook-aligned preprocessing (female derivation and EPICv2 aggregation by default).
  3. Converts tabular data to AnnData and runs one or more methylation clocks.
  4. Exports predictions, missing-feature diagnostics, metadata, figures, and reproducibility artifacts.

Input Contract

Demo And Usage

The bundled two-sample demo is synthetic. Its fixed-seed generator, public probe-identifier source, and checksums are documented in skills/methylation-clock/data/PROVENANCE.md. Its placeholder ages and sex labels have no relationship to the simulated beta values; use its clock predictions only to check that the workflow runs. Reports label this fixture as synthetic whether it is selected with --demo or supplied through --input.

Install the optional PyAging dependency in the Python environment used to run ClawBio. The demo below was verified with PyAging 0.5.7; first use of a clock downloads its public model weights. Local input data is not uploaded.

python -m pip install "pyaging>=0.5.7,<0.6"
# Demo
python skills/methylation-clock/methylation_clock.py \
  --demo --clocks Horvath2013 \
  --output /tmp/methylation_clock_demo

# GEO input
python skills/methylation-clock/methylation_clock.py \
  --geo-id GSE139307 \
  --clocks Horvath2013 \
  --output /tmp/methylation_clock_geo

# Local methylation file
python skills/methylation-clock/methylation_clock.py \
  --input my_methylation.csv.gz \
  --clocks Horvath2013,DunedinPACE \
  --output /tmp/methylation_clock_local

Use pickle input only when you trust its source; deserializing an untrusted pickle can execute code. --geo-id downloads a public GEO example into the chosen output directory. The skill refuses a nonempty output directory.

What The Five Default Clocks Measure

| Clock | PyAging target | Intended tissue | Additional model inputs | Output unit |

|---|---|---|---|---|

| Horvath2013 | Chronological age | Multiple tissues | None | Years |

| AltumAge | Chronological age | Multiple tissues | None | Years |

| PCGrimAge | Mortality-risk proxy reproducing GrimAge | Whole blood | Age and sex | Years |

| GrimAge2 | Mortality risk | Whole blood | Age and sex | Years |

| DunedinPACE | Pace of aging | Whole blood | None | Biological years per chronological year |

The targets, tissues, and units come from the PyAging clock catalogue; its DNA methylation tutorial identifies age and sex as features for PCGrimAge and GrimAge2. The report uses a unit from PyAging metadata when available, with documented units for the five default clocks as fallbacks. tissue_type is descriptive metadata, not an automatic compatibility check. Compare predictions only within an appropriate tissue and target; a DunedinPACE value is not an age in years. A difference between an estimate and chronological age is not, by itself, a validated health assessment or an age-acceleration analysis.

Gotchas

Output Structure

methylation_clock_report/
├── report.md
├── result.json
├── figures/
│   ├── clock_distributions.png
│   └── clock_correlation.png  # at least two clocks and ten complete samples
├── tables/
│   ├── predictions.csv
│   ├── prediction_summary.csv
│   ├── missing_features.csv
│   ├── clock_metadata.json
│   └── input_qc.json
└── reproducibility/
    ├── commands.sh
    ├── environment.yml
    └── checksums.sha256

Safety Rules

  1. ClawBio is local-first: user methylation data must remain on-device.
  2. The skill refuses non-empty output directories to avoid silent overwrite.
  3. Reports must include this disclaimer: "ClawBio is a research and educational tool. It is not a medical device and does not provide clinical diagnoses. Consult a healthcare professional before making any medical decisions."
  4. Check tables/input_qc.json and tables/missing_features.csv before interpreting a prediction. Missing-feature counts and successful execution do not establish validity for a tissue or cohort.

Agent Boundary

  1. Route methylation clock requests to skills/methylation-clock/methylation_clock.py.
  2. Do not infer clinical diagnosis or treatment from clock estimates.
  3. Trigger terms include: epigenetic age, methylation clock, Horvath, GrimAge, DunedinPACE, GEO, GSE.
  4. Valid downstream chaining: rnaseq-de for transcriptomic-aging contrasts and equity-scorer for cohort context.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.