Install any skill in seconds. Free to start, no credit card required.
Get Started Free →PLINK file formats, format conversion, and quality control filtering for population genetics. Convert between VCF, BED/BIM/FAM, and PED/MAP formats, apply MAF, genotyping rate, and HWE filters using PLINK 1.9 and 2.0. Use when working with PLINK format files or running QC.
.claude/skills/bio-population-genetics-plink-basics/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 153% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 65% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 123% | 0% |
| case-18 | ✗→✓ | ▲ Improved | 115% | 0% |
| case-22 | ✗→✓ | ▲ Improved | 100% | 0% |
<!--
#
#
-->
File formats, conversion, and quality control filtering with PLINK 1.9 and 2.0.
| File | Contents | |------|----------| | .bed | Binary genotype data | | .bim | Variant information (chr, ID, cM, pos, A1, A2) | | .fam | Sample information (FID, IID, father, mother, sex, pheno) |
| File | Contents | |------|----------| | .pgen | Binary genotype data (compressed) | | .pvar | Variant information | | .psam | Sample information |
| File | Contents | |------|----------| | .ped | Genotypes (FID, IID, father, mother, sex, pheno, genotypes) | | .map | Variant positions (chr, ID, cM, pos) |
bash# PLINK 1.9 plink --vcf input.vcf.gz --make-bed --out output # PLINK 2.0 plink2 --vcf input.vcf.gz --make-bed --out output # With sample ID handling plink2 --vcf input.vcf.gz --double-id --make-bed --out output
bash# PLINK 1.9 plink --bfile input --recode vcf --out output # PLINK 2.0 plink2 --bfile input --export vcf --out output # Compressed VCF plink2 --bfile input --export vcf bgz --out output
bash# PLINK 1.9 (PLINK 2.0 doesn't support .ped/.map directly) plink --file input --make-bed --out output
bash# PLINK 1.9 plink --bfile input --recode --out output # PLINK 2.0 plink2 --bfile input --export ped --out output
bash# Convert to PGEN format plink2 --bfile input --make-pgen --out output # Convert back to BED plink2 --pfile input --make-bed --out output
bash# Remove variants with MAF < 0.01 plink --bfile input --maf 0.01 --make-bed --out output # PLINK 2.0 plink2 --bfile input --maf 0.01 --make-bed --out output # Remove rare variants (MAF < 0.05) plink2 --bfile input --maf 0.05 --make-bed --out output
bash# Per-variant missing rate (remove if >5% missing) plink2 --bfile input --geno 0.05 --make-bed --out output # Per-sample missing rate (remove if >5% missing) plink2 --bfile input --mind 0.05 --make-bed --out output
bash# Remove variants with HWE p-value < 1e-6 plink2 --bfile input --hwe 1e-6 --make-bed --out output # Different threshold for cases vs controls plink2 --bfile input --hwe 1e-6 --hwe-all --make-bed --out output
bash# Standard QC filtering plink2 --bfile input \ --maf 0.01 \ --geno 0.05 \ --mind 0.05 \ --hwe 1e-6 \ --make-bed --out qc_filtered
bash# Keep specific samples (samples.txt: FID IID per line) plink2 --bfile input --keep samples.txt --make-bed --out output # Remove specific samples plink2 --bfile input --remove samples.txt --make-bed --out output # Keep single sample plink2 --bfile input --keep-fam sample_id --make-bed --out output
bash# Extract specific variants (variants.txt: variant IDs) plink2 --bfile input --extract variants.txt --make-bed --out output # Exclude specific variants plink2 --bfile input --exclude variants.txt --make-bed --out output # Extract by range plink2 --bfile input --extract range chr1:1000000-2000000 --make-bed --out output
bash# Single chromosome plink2 --bfile input --chr 22 --make-bed --out chr22 # Multiple chromosomes plink2 --bfile input --chr 1-22 --make-bed --out autosomes # Exclude chromosome plink2 --bfile input --not-chr 23,24,25,26 --make-bed --out autosomes
bash# PLINK 1.9 (MAF-based) plink --bfile input --freq --out output # PLINK 2.0 (ALT allele frequency - not MAF!) plink2 --bfile input --freq --out output # PLINK 2.0 with MAF plink2 --bfile input --freq cols=+mac,+mafreq --out output
bash# Per-sample and per-variant missing rates plink2 --bfile input --missing --out output # Output files: # output.smiss - sample missing rates # output.vmiss - variant missing rates
Verify reported sex matches X chromosome heterozygosity.
bash# PLINK 1.9 plink --bfile input --check-sex --out sex_check # PLINK 2.0 plink2 --bfile input --split-par hg38 --check-sex --out sex_check
pythonimport pandas as pd sex = pd.read_csv('sex_check.sexcheck', sep='\s+') problems = sex[sex['STATUS'] == 'PROBLEM'] print(f'Sex mismatches: {len(problems)}') # F statistic: <0.2 = female, >0.8 = male, between = ambiguous # PEDSEX: reported sex (1=male, 2=female, 0=unknown) # SNPSEX: inferred sex (1=male, 2=female, 0=undetermined)
bash# Update sex from check results plink2 --bfile input --update-sex sex_check.sexcheck col-num=4 --make-bed --out updated # Remove sex mismatches awk '$5 == "PROBLEM" {print $1, $2}' sex_check.sexcheck > sex_problems.txt plink2 --bfile input --remove sex_problems.txt --make-bed --out output
bash# phenotypes.txt: FID IID pheno (1=control, 2=case, -9=missing) plink2 --bfile input --pheno phenotypes.txt --make-bed --out output # Quantitative phenotype plink2 --bfile input --pheno phenotypes.txt --make-bed --out output
bash# sex.txt: FID IID sex (1=male, 2=female, 0=unknown) plink2 --bfile input --update-sex sex.txt --make-bed --out output
bash# ids.txt: old_FID old_IID new_FID new_IID plink2 --bfile input --update-ids ids.txt --make-bed --out output
bash# Merge two datasets (PLINK 1.9) plink --bfile data1 --bmerge data2.bed data2.bim data2.fam --make-bed --out merged # Merge list of datasets plink --bfile data1 --merge-list merge_list.txt --make-bed --out merged # merge_list.txt contains: data2.bed data2.bim data2.fam (one set per line) # Handle strand flips plink --bfile data1 --bmerge data2 --make-bed --out merged # If error: plink --bfile data2 --flip missnps.txt --make-bed --out data2_flipped
bash# Set ID based on position plink2 --bfile input --set-all-var-ids @:#:\$r:\$a --make-bed --out output # Format: chr:pos:ref:alt
bash# update.txt: old_id new_id plink2 --bfile input --update-name update.txt --make-bed --out output
| Feature | PLINK 2.0 | PLINK 1.9 | |---------|-----------|-----------| | Status | Current | Legacy | | Command | plink2 | plink | | Format | .pgen/.pvar/.psam | .bed/.bim/.fam | | Speed | Faster | Baseline | | Memory | More efficient | Higher for large data | | Export VCF | --export vcf | --recode vcf | | Frequency output | ALT frequency | MAF | | Missing output | .smiss/.vmiss | .imiss/.lmiss | | PED/MAP support | No (convert via 1.9) | Yes (--file) |
<!-- 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-02 | pass→pass | 6,185 | 3,937 | -36% | 1 | 1 | 0% | 1,309 | 3,124 | +139% | 0 | 0 | — |
case-03 | pass→pass | 7,677 | 3,144 | -59% | 1 | 1 | 0% | 1,450 | 3,110 | +114% | 0 | 0 | — |
case-01 | fail→pass | 6,821 | 5,086 | -25% | 1 | 1 | 0% | 1,439 | 3,640 | +153% | 0 | 0 | — |
case-04 | pass→pass | 7,219 | 3,614 | -50% | 1 | 1 | 0% | 1,309 | 3,246 | +148% | 0 | 0 | — |
case-05 | pass→pass | 6,611 | 2,845 | -57% | 1 | 1 | 0% | 1,348 | 3,082 | +129% | 0 | 0 | — |
case-06 | pass→pass | 3,046 | 2,720 | -11% | 1 | 1 | 0% | 612 | 3,040 | +397% | 0 | 0 | — |
case-07 | pass→pass | 4,781 | 3,086 | -35% | 1 | 1 | 0% | 889 | 3,146 | +254% | 0 | 0 | — |
case-08 | fail→pass | 9,567 | 2,987 | -69% | 1 | 1 | 0% | 1,903 | 3,149 | +65% | 0 | 0 | — |
case-09 | pass→pass | 10,601 | 5,694 | -46% | 1 | 1 | 0% | 2,214 | 3,712 | +68% | 0 | 0 | — |
case-10 | pass→pass | 9,858 | 3,637 | -63% | 1 | 1 | 0% | 1,939 | 3,264 | +68% | 0 | 0 | — |
case-11 | pass→pass | 8,922 | 5,874 | -34% | 1 | 1 | 0% | 1,664 | 3,762 | +126% | 0 | 0 | — |
case-12 | fail→fail | 6,664 | 10,543 | +58% | 1 | 1 | 0% | 1,320 | 3,687 | +179% | 0 | 0 | — |
case-13 | fail→pass | 7,160 | 3,487 | -51% | 1 | 1 | 0% | 1,398 | 3,115 | +123% | 0 | 0 | — |
case-14 | fail→fail | 8,232 | 3,393 | -59% | 1 | 1 | 0% | 1,658 | 3,243 | +96% | 0 | 0 | — |
case-15 | pass→pass | 6,954 | 3,635 | -48% | 1 | 1 | 0% | 1,432 | 3,263 | +128% | 0 | 0 | — |
case-16 | pass→pass | 8,498 | 5,292 | -38% | 1 | 1 | 0% | 1,775 | 3,679 | +107% | 0 | 0 | — |
case-17 | pass→pass | 4,789 | 2,475 | -48% | 1 | 1 | 0% | 937 | 3,035 | +224% | 0 | 0 | — |
case-18 | fail→pass | 8,301 | 5,281 | -36% | 1 | 1 | 0% | 1,617 | 3,475 | +115% | 0 | 0 | — |
case-19 | fail→fail | 10,616 | 6,156 | -42% | 1 | 1 | 0% | 2,005 | 3,733 | +86% | 0 | 0 | — |
case-20 | pass→pass | 11,470 | 9,587 | -16% | 1 | 1 | 0% | 2,309 | 4,383 | +90% | 0 | 0 | — |
case-21 | pass→pass | 12,249 | 7,448 | -39% | 1 | 1 | 0% | 1,883 | 4,049 | +115% | 0 | 0 | — |
case-22 | fail→pass | 11,521 | 9,517 | -17% | 1 | 1 | 0% | 2,138 | 4,272 | +100% | 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 | +9% |
Other measured skills in the registry, with their headline benchmark lift.