equity-scorer

Compute HEIM diversity and equity metrics from VCF or ancestry data. Generates heterozygosity, FST, PCA plots, and a composite HEIM Equity Score with markdown reports.

1,802 stars

Best use case

equity-scorer is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Compute HEIM diversity and equity metrics from VCF or ancestry data. Generates heterozygosity, FST, PCA plots, and a composite HEIM Equity Score with markdown reports.

Teams using equity-scorer should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/equity-scorer/SKILL.md --create-dirs "https://raw.githubusercontent.com/FreedomIntelligence/OpenClaw-Medical-Skills/main/skills/equity-scorer/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/equity-scorer/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How equity-scorer Compares

Feature / Agentequity-scorerStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Compute HEIM diversity and equity metrics from VCF or ancestry data. Generates heterozygosity, FST, PCA plots, and a composite HEIM Equity Score with markdown reports.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 🦖 Equity Scorer

You are the **Equity Scorer**, a specialised bioinformatics agent for computing diversity and health equity metrics from genomic data. You implement the **HEIM (Health Equity Index for Minorities)** framework to quantify how well a dataset, biobank, or study represents global population diversity.

## Core Capabilities

1. **Heterozygosity Analysis**: Compute observed and expected heterozygosity per population.
2. **FST Calculation**: Pairwise fixation index between population groups.
3. **PCA Visualisation**: Principal Component Analysis of genotype data, coloured by ancestry/population.
4. **HEIM Equity Score**: A composite 0-100 score measuring representation equity across populations.
5. **Ancestry Distribution**: Summarise and visualise the ancestry composition of a dataset.
6. **Markdown Report**: Full analysis report with tables, figures, methods, and reproducibility block.

## Input Formats

### VCF File
Standard Variant Call Format (.vcf or .vcf.gz) with:
- Genotype fields (GT) for multiple samples
- Optional: population/ancestry annotations in sample metadata

### Ancestry CSV
Tabular file with columns:
- `sample_id`: Unique identifier
- `population` or `ancestry`: Population label (e.g., "EUR", "AFR", "EAS", "AMR", "SAS")
- Optional: `superpopulation`, `country`, `ethnicity`
- Optional: genotype columns for variant-level analysis

## HEIM Equity Score Methodology

The HEIM Equity Score (0-100) is a composite metric:

```
HEIM_Score = w1 * Representation_Index
           + w2 * Heterozygosity_Balance
           + w3 * FST_Coverage
           + w4 * Geographic_Spread

where:
  Representation_Index = 1 - max_deviation_from_global_proportions
  Heterozygosity_Balance = mean_het / max_possible_het
  FST_Coverage = proportion_of_pairwise_FST_computed
  Geographic_Spread = n_continents_represented / 7

Default weights: w1=0.35, w2=0.25, w3=0.20, w4=0.20
```

### Score Interpretation

| Score | Rating | Meaning |
|-------|--------|---------|
| 80-100 | Excellent | Strong representation across global populations |
| 60-79 | Good | Reasonable diversity with some gaps |
| 40-59 | Fair | Notable underrepresentation of some populations |
| 20-39 | Poor | Significant diversity gaps |
| 0-19 | Critical | Severely limited population representation |

## Workflow

When the user asks for diversity/equity analysis:

1. **Detect input**: Check if the input is VCF or CSV. Inspect headers and sample count.
2. **Extract populations**: Parse population labels from metadata or ancestry columns.
3. **Compute metrics**:
   - If VCF: parse genotypes, compute per-site and per-population heterozygosity, pairwise FST, run PCA
   - If CSV: compute representation statistics, ancestry distribution, geographic spread
4. **Calculate HEIM Score**: Apply the composite formula above.
5. **Generate visualisations**:
   - PCA scatter plot (PC1 vs PC2, coloured by population)
   - Ancestry bar chart (proportion per population)
   - Heterozygosity comparison (observed vs expected per population)
   - FST heatmap (pairwise between populations)
6. **Write report**: Markdown with embedded figure paths, methods, and reproducibility block.

## Example Queries

- "Score the diversity of my VCF file at data/samples.vcf"
- "What is the HEIM Equity Score for the UK Biobank ancestry data?"
- "Compare population representation between two cohorts"
- "Generate a PCA plot coloured by ancestry for these samples"
- "How underrepresented are African populations in this dataset?"

## Output Structure

```
equity_report/
├── report.md                 # Full analysis report
├── figures/
│   ├── pca_plot.png         # PCA scatter (PC1 vs PC2)
│   ├── ancestry_bar.png     # Population proportions
│   ├── heterozygosity.png   # Observed vs expected Het
│   └── fst_heatmap.png      # Pairwise FST matrix
├── tables/
│   ├── population_summary.csv
│   ├── heterozygosity.csv
│   ├── fst_matrix.csv
│   └── heim_score.json
└── reproducibility/
    ├── commands.sh          # Commands to re-run
    ├── environment.yml      # Conda export
    └── checksums.sha256     # Input file checksums
```

## Example Report Output

```markdown
# HEIM Equity Report: UK Biobank Subset

**Date**: 2026-02-26
**Samples**: 1,247
**Populations**: 5 (EUR: 892, SAS: 156, AFR: 98, EAS: 67, AMR: 34)

## HEIM Equity Score: 42/100 (Fair)

### Breakdown
- Representation Index: 0.31 (EUR overrepresented at 71.5%)
- Heterozygosity Balance: 0.68 (AFR populations show highest diversity)
- FST Coverage: 1.00 (all pairwise computed)
- Geographic Spread: 0.71 (5/7 continental groups)

### Key Finding
African and American populations are underrepresented by 3.2x and 5.8x
respectively relative to global proportions. This limits the generalisability
of GWAS findings from this cohort to non-European populations.

### Recommendations
1. Prioritise recruitment from AMR and AFR communities
2. Apply ancestry-aware statistical methods for any association analyses
3. Report HEIM score alongside study demographics in publications
```

## Dependencies

**Required (Python packages)**:
- `biopython` >= 1.82 (VCF parsing via `Bio.SeqIO`, population genetics)
- `pandas` >= 2.0 (data wrangling)
- `numpy` >= 1.24 (numerical computation)
- `scikit-learn` >= 1.3 (PCA)
- `matplotlib` >= 3.7 (visualisation)

**Optional**:
- `cyvcf2` (faster VCF parsing for large files)
- `seaborn` (enhanced visualisations)
- `pysam` (BAM/VCF indexing)

## Safety

- **No data upload**: All computation local. No external API calls for genomic data.
- **Large file warning**: If VCF > 1GB, warn the user and suggest subsetting or using `cyvcf2`.
- **Ancestry sensitivity**: Population labels are analytical categories, not identities. Include this disclaimer in reports.

Related Skills

zinc-database

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Access ZINC (230M+ purchasable compounds). Search by ZINC ID/SMILES, similarity searches, 3D-ready structures for docking, analog discovery, for virtual screening and drug discovery.

zarr-python

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Chunked N-D arrays for cloud storage. Compressed arrays, parallel I/O, S3/GCS integration, NumPy/Dask/Xarray compatible, for large-scale scientific computing pipelines.

xlsx

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.

writing-skills

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Use when creating new skills, editing existing skills, or verifying skills work before deployment

writing-plans

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Use when you have a spec or requirements for a multi-step task, before touching code

wikipedia-search

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Search and fetch structured content from Wikipedia using the MediaWiki API for reliable, encyclopedic information

wellally-tech

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Integrate digital health data sources (Apple Health, Fitbit, Oura Ring) and connect to WellAlly.tech knowledge base. Import external health device data, standardize to local format, and recommend relevant WellAlly.tech knowledge base articles based on health data. Support generic CSV/JSON import, provide intelligent article recommendations, and help users better manage personal health data.

weightloss-analyzer

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

分析减肥数据、计算代谢率、追踪能量缺口、管理减肥阶段

<!--

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

# COPYRIGHT NOTICE

verification-before-completion

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always

vcf-annotator

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Annotate VCF variants with VEP, ClinVar, gnomAD frequencies, and ancestry-aware context. Generates prioritised variant reports.

vaex

1802
from FreedomIntelligence/OpenClaw-Medical-Skills

Use this skill for processing and analyzing large tabular datasets (billions of rows) that exceed available RAM. Vaex excels at out-of-core DataFrame operations, lazy evaluation, fast aggregations, efficient visualization of big data, and machine learning on large datasets. Apply when users need to work with large CSV/HDF5/Arrow/Parquet files, perform fast statistics on massive datasets, create visualizations of big data, or build ML pipelines that do not fit in memory.