# Claw Ancestry Pca

Ancestry decomposition PCA against the Simons Genome Diversity Project

- Repository: https://github.com/ClawBio/ClawBio (1172 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add ClawBio/ClawBio --skill claw-ancestry-pca -g -a claude-code -y`
Codex: `npx skills add ClawBio/ClawBio --skill claw-ancestry-pca -g -a codex -y`
Cursor: `npx skills add ClawBio/ClawBio --skill claw-ancestry-pca -g -a cursor -y`
Gemini CLI: `npx skills add ClawBio/ClawBio --skill claw-ancestry-pca -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add ClawBio/ClawBio`

## Description

Ancestry decomposition PCA against the Simons Genome Diversity Project

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 🦖 Ancestry Decomposition PCA

Place your study cohort in global genetic context by computing a joint PCA against the Simons Genome Diversity Project (SGDP), 345 samples from 164 populations spanning every inhabited continent.

## What it does

1. Takes your VCF + population map as input
2. Finds common variants between your cohort and the SGDP reference panel (bundled)
3. Runs PLINK PCA on the merged dataset
4. Separates your cohort from SGDP reference samples
5. Matches SGDP samples to their population labels (164 populations)
6. Generates a publication-quality multi-panel figure:
   - **Panel A**: PC1 vs PC2, main population structure of your cohort
   - **Panel B**: PC3 vs PC2 with regional groupings and confidence ellipses
   - **Panel C**: PC3 vs PC1 with language/cultural groupings
   - **Panel D**: Global context, your samples (circles) vs SGDP (triangles)
7. Produces a markdown report with variance explained, population assignments, and reproducibility bundle

## Why this exists

If you ask ChatGPT to "run a PCA against a global reference panel," it will:
- Not know which reference panel to use
- Hallucinate PLINK flags for merging datasets with different variant sets
- Skip IBD removal (related individuals distort PCA)
- Not normalise contig names between your VCF and the reference
- Produce a single scatter plot with no population labels

This skill encodes the correct methodological decisions:
- Uses SGDP (the gold-standard reference for global diversity)
- Handles contig normalisation (chr1 vs 1)
- Filters to common biallelic SNPs shared between datasets
- Removes related individuals via IBD checks
- Produces publication-quality multi-panel figures with confidence ellipses
- Differentiates your samples (circles) from reference (triangles)

## Reference Panel

The rest: https://github.com/ClawBio/ClawBio/blob/HEAD/skills/claw-ancestry-pca/SKILL.md
