Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Calculate linkage disequilibrium statistics (r², D'), perform LD pruning for population structure analysis, identify haplotype blocks, and visualize LD patterns using PLINK, scikit-allel, and LDBlockShow. Use when calculating LD or pruning variants.
.claude/skills/bio-population-genetics-linkage-disequilibrium/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | 46% | 0% |
| case-16 | ✗→✓ | ▲ Improved | 23% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 57% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 104% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 36% | 0% |
<!--
#
#
-->
Calculate LD statistics, prune correlated variants, and identify haplotype blocks.
bash# All pairs within window plink2 --bfile data --r2 --ld-window-kb 1000 --ld-window-r2 0.2 --out ld_results # With SNP names in output plink2 --bfile data --r2 inter-chr --ld-window-r2 0 --out all_pairs # Squared correlation matrix plink2 --bfile data --r2-phased square --out ld_matrix
# ld_results.ld contains:
CHR_A BP_A SNP_A CHR_B BP_B SNP_B R2bash# r² with D' statistics plink --bfile data --r2 dprime --ld-window-kb 500 --out ld_with_dprime # Inter-chromosome LD plink --bfile data --r2 inter-chr --ld-snp-list target_snps.txt --out target_ld
bash# Calculate pruning list plink2 --bfile data --indep-pairwise 50 10 0.1 --out prune # Output files: # prune.prune.in - Variants to keep # prune.prune.out - Variants to remove # Extract pruned set plink2 --bfile data --extract prune.prune.in --make-bed --out data_pruned
| Parameter | Description | Common Values | |-----------|-------------|---------------| | Window (50) | Variants per window | 50-200 | | Step (10) | Variants to shift | 5-50 | | r² threshold (0.1) | Max LD allowed | 0.1-0.5 |
bash# Strict pruning for PCA/Admixture plink2 --bfile data --indep-pairwise 50 10 0.1 --out strict_prune # Moderate pruning for polygenic scores plink2 --bfile data --indep-pairwise 200 50 0.5 --out moderate_prune # Region-based pruning plink2 --bfile data --indep-pairwise 50 10 0.2 --chr 6 --from-mb 25 --to-mb 35 --out mhc_prune
pythonimport allel import numpy as np callset = allel.read_vcf('data.vcf.gz') gt = allel.GenotypeArray(callset['calldata/GT']) pos = callset['variants/POS'] gn = gt.to_n_alt() r2 = allel.rogers_huff_r(gn[:100]) ** 2
pythonimport allel import numpy as np import matplotlib.pyplot as plt gn = gt.to_n_alt() r2, dist = [], [] n_variants = min(1000, gn.shape[0]) for i in range(n_variants): for j in range(i + 1, min(i + 100, n_variants)): r = allel.rogers_huff_r(gn[[i, j]])[0, 1] ** 2 d = pos[j] - pos[i] r2.append(r) dist.append(d) r2 = np.array(r2) dist = np.array(dist) bins = np.arange(0, 100001, 1000) bin_means = [] for i in range(len(bins) - 1): mask = (dist >= bins[i]) & (dist < bins[i + 1]) if mask.sum() > 0: bin_means.append(np.mean(r2[mask])) else: bin_means.append(np.nan) plt.figure(figsize=(10, 6)) plt.plot(bins[:-1] / 1000, bin_means) plt.xlabel('Distance (kb)') plt.ylabel('Mean r²') plt.title('LD Decay') plt.savefig('ld_decay.png')
bash# Identify haplotype blocks (Gabriel et al.) plink --bfile data --blocks no-pheno-req --out blocks # Output: blocks.blocks (block boundaries) # Output: blocks.blocks.det (block details)
pythonimport pandas as pd blocks = pd.read_csv('blocks.blocks.det', sep='\s+') print(f'Number of blocks: {len(blocks)}') print(f'Mean block size: {blocks["KB"].mean():.1f} kb') print(f'Mean SNPs per block: {blocks["NSNPS"].mean():.1f}')
pythonimport allel import numpy as np import matplotlib.pyplot as plt gn = gt.to_n_alt()[:200] r = allel.rogers_huff_r(gn) r2_matrix = r ** 2 plt.figure(figsize=(10, 10)) plt.imshow(r2_matrix, cmap='hot', vmin=0, vmax=1) plt.colorbar(label='r²') plt.xlabel('Variant index') plt.ylabel('Variant index') plt.title('LD Matrix') plt.savefig('ld_matrix.png', dpi=150)
bash# Clump GWAS results by LD plink --bfile data \ --clump gwas_results.txt \ --clump-p1 5e-8 \ --clump-p2 1e-5 \ --clump-r2 0.1 \ --clump-kb 250 \ --out clumped # Output: clumped.clumped (independent signals)
| Parameter | Description | |-----------|-------------| | --clump-p1 | Index SNP p-value threshold | | --clump-p2 | Clumped SNP p-value threshold | | --clump-r2 | LD threshold for clumping | | --clump-kb | Physical distance threshold |
bash# Pairwise LD for region vcftools --vcf data.vcf --geno-r2 --ld-window-bp 100000 --out ld_results # Output: ld_results.geno.ld # Haplotype-based r² vcftools --vcf data.vcf --hap-r2 --ld-window-bp 100000 --out hap_ld
bash# 1. Calculate genome-wide LD plink2 --bfile data --r2 --ld-window-kb 500 --ld-window-r2 0.2 --out ld_genome # 2. Generate pruned set for PCA plink2 --bfile data --indep-pairwise 50 10 0.1 --out prune plink2 --bfile data --extract prune.prune.in --make-bed --out pruned # 3. Identify haplotype blocks plink --bfile data --blocks no-pheno-req --out blocks # 4. Visualize LD for specific region plink --bfile data --r2 dprime --chr 6 --from-mb 28 --to-mb 34 --out mhc_ld
<!-- AUTHOR_SIGNATURE: 9a7f3c2e-MD-BABU-MIA-2026-MSSM-SECURE -->
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | pass→pass | 10,511 | 6,246 | -41% | 1 | 1 | 0% | 2,123 | 3,241 | +53% | 0 | 0 | — |
case-02 | pass→pass | 14,488 | 14,549 | +0% | 1 | 1 | 0% | 3,148 | 5,109 | +62% | 0 | 0 | — |
case-03 | fail→pass | 19,100 | 6,087 | -68% | 1 | 1 | 0% | 2,077 | 3,037 | +46% | 0 | 0 | — |
case-16 | fail→pass | 11,787 | 4,341 | -63% | 1 | 1 | 0% | 2,326 | 2,869 | +23% | 0 | 0 | — |
case-04 | pass→pass | 14,827 | 3,561 | -76% | 1 | 1 | 0% | 2,821 | 2,766 | -2% | 0 | 0 | — |
case-05 | fail→pass | 13,173 | 8,404 | -36% | 1 | 1 | 0% | 2,396 | 3,758 | +57% | 0 | 0 | — |
case-06 | pass→pass | 11,289 | 4,099 | -64% | 1 | 1 | 0% | 2,028 | 2,728 | +35% | 0 | 0 | — |
case-07 | pass→pass | 10,184 | 3,549 | -65% | 1 | 1 | 0% | 1,963 | 2,747 | +40% | 0 | 0 | — |
case-08 | fail→pass | 8,724 | 8,790 | +1% | 1 | 1 | 0% | 1,765 | 3,606 | +104% | 0 | 0 | — |
case-09 | pass→pass | 13,161 | 3,904 | -70% | 1 | 1 | 0% | 2,325 | 2,828 | +22% | 0 | 0 | — |
case-10 | pass→pass | 7,988 | 3,869 | -52% | 1 | 1 | 0% | 1,561 | 2,821 | +81% | 0 | 0 | — |
case-11 | fail→pass | 11,136 | 3,992 | -64% | 1 | 1 | 0% | 2,054 | 2,784 | +36% | 0 | 0 | — |
case-12 | pass→pass | 9,714 | 4,412 | -55% | 1 | 1 | 0% | 1,839 | 2,914 | +58% | 0 | 0 | — |
case-13 | pass→pass | 10,368 | 7,733 | -25% | 1 | 1 | 0% | 1,929 | 3,483 | +81% | 0 | 0 | — |
case-14 | pass→pass | 7,612 | 4,823 | -37% | 1 | 1 | 0% | 1,552 | 3,079 | +98% | 0 | 0 | — |
case-15 | pass→pass | 9,181 | 5,753 | -37% | 1 | 1 | 0% | 1,884 | 2,996 | +59% | 0 | 0 | — |
case-17 | pass→pass | 15,612 | 9,824 | -37% | 1 | 1 | 0% | 3,304 | 4,120 | +25% | 0 | 0 | — |
case-18 | pass→pass | 6,647 | 3,244 | -51% | 1 | 1 | 0% | 1,283 | 2,647 | +106% | 0 | 0 | — |
case-19 | pass→pass | 12,144 | 3,729 | -69% | 1 | 1 | 0% | 2,338 | 2,755 | +18% | 0 | 0 | — |
case-20 | pass→pass | 5,889 | 3,905 | -34% | 1 | 1 | 0% | 1,198 | 2,748 | +129% | 0 | 0 | — |
case-21 | pass→pass | 9,354 | 6,622 | -29% | 1 | 1 | 0% | 1,790 | 3,401 | +90% | 0 | 0 | — |
case-22 | pass→pass | 12,602 | 9,304 | -26% | 1 | 1 | 0% | 2,294 | 3,811 | +66% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +23 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
| Model | Method | Date | Lift |
|---|---|---|---|
| gemini-3.6-flash | verified | 7/24/2026 | +27% |
Other measured skills in the registry, with their headline benchmark lift.