bio-phasing-imputation-haplotype-phasing
Phases genotype data into haplotypes to prepare for genetic analysis and population studies.
Install
mkdir -p .claude/skills/bio-phasing-imputation-haplotype-phasing && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/16081" && unzip -o skill.zip -d .claude/skills/bio-phasing-imputation-haplotype-phasing && rm skill.zipInstalls to .claude/skills/bio-phasing-imputation-haplotype-phasing
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
<!-- # COPYRIGHT NOTICE # This file is part of the "Universal Biomedical Skills" project. # Copyright (c) 2026 MD BABU MIA, PhD <[email protected]> # All Rights Reserved. # # This code is proprietary and confidential. # Unauthorized copying of this file, via any medium is striKey capabilities
- →Phase genotypes into haplotypes
- →Prepare VCF files for imputation
- →Use Beagle for phasing
- →Use SHAPEIT5 for phasing large datasets
- →Check phasing results for phased vs unphased genotypes
How it works
It uses CLI tools like Beagle or SHAPEIT5 to resolve allele inheritance, processing VCF files to create phased haplotype data, optionally using genetic maps or reference panels for accuracy.
Inputs & outputs
When to use bio-phasing-imputation-haplotype-phasing
- →Preparing VCF files
- →Haplotype phasing
- →Population genetic analysis
About this skill
name: bio-phasing-imputation-haplotype-phasing description: Phase genotypes into haplotypes using Beagle or SHAPEIT. Resolves which alleles are inherited together on each chromosome. Use when preparing VCF files for imputation, HLA typing, or population genetic analyses requiring phased haplotypes. tool_type: cli primary_tool: beagle measurable_outcome: Execute skill workflow successfully with valid output within 15 minutes. allowed-tools:
- read_file
- run_shell_command
Haplotype Phasing
Beagle 5.4 Phasing (Recommended)
# Download Beagle 5.4
wget https://faculty.washington.edu/browning/beagle/beagle.22Jul22.46e.jar
# Basic phasing
java -jar beagle.22Jul22.46e.jar \
gt=input.vcf.gz \
out=phased
# Output: phased.vcf.gz (phased genotypes)
# With genetic map (improves accuracy)
java -jar beagle.22Jul22.46e.jar \
gt=input.vcf.gz \
map=plink.chr22.GRCh38.map \
out=phased
Beagle Options
java -jar beagle.22Jul22.46e.jar \
gt=input.vcf.gz \
out=phased \
map=genetic_map.txt \
nthreads=8 \
window=40 \
overlap=4 \
ne=20000 \ # Effective population size
seed=12345 # For reproducibility
Phase Per Chromosome
# Process each chromosome separately
for chr in {1..22}; do
java -Xmx16g -jar beagle.jar \
gt=input.chr${chr}.vcf.gz \
map=genetic_maps/plink.chr${chr}.GRCh38.map \
out=phased.chr${chr} \
nthreads=8
done
# Concatenate chromosomes
bcftools concat phased.chr*.vcf.gz -Oz -o phased.all.vcf.gz
bcftools index phased.all.vcf.gz
SHAPEIT5 Phasing (for Large Datasets)
# Phase common variants first
shapeit5_phase_common \
--input input.vcf.gz \
--map genetic_map.txt \
--output phased_common.bcf \
--thread 8 \
--log phased.log
# Then phase rare variants
shapeit5_phase_rare \
--input input.vcf.gz \
--scaffold phased_common.bcf \
--map genetic_map.txt \
--output phased.bcf \
--thread 8
SHAPEIT5 with Reference Panel
# Improves phasing using reference haplotypes
shapeit5_phase_common \
--input input.vcf.gz \
--reference reference_panel.bcf \
--map genetic_map.txt \
--output phased.bcf \
--thread 8
Beagle with Reference Panel
# Use reference panel for better phasing
java -jar beagle.22Jul22.46e.jar \
gt=input.vcf.gz \
ref=reference.vcf.gz \
map=genetic_map.txt \
out=phased \
nthreads=8
Input Preparation
# Filter variants before phasing
bcftools view -m2 -M2 -v snps input.vcf.gz -Oz -o biallelic_snps.vcf.gz
# Remove missing genotypes (optional)
bcftools view -g ^miss biallelic_snps.vcf.gz -Oz -o no_missing.vcf.gz
# Normalize (important!)
bcftools norm -f reference.fa -Oz -o normalized.vcf.gz input.vcf.gz
Check Phasing Results
# View phased genotypes (| instead of /)
bcftools query -f '%CHROM\t%POS\t[%GT\t]\n' phased.vcf.gz | head
# Unphased: 0/1
# Phased: 0|1 or 1|0
# Count phased vs unphased
bcftools query -f '[%GT\n]' phased.vcf.gz | grep -c '|'
Genetic Maps
# Download genetic maps (GRCh38)
wget https://faculty.washington.edu/browning/beagle/genetic_maps/plink.GRCh38.map.zip
unzip plink.GRCh38.map.zip
# Format: chromosome position rate(cM/Mb) genetic_position(cM)
# chr1 55550 2.981822 0.000000
Key Parameters
| Parameter | Beagle | SHAPEIT5 | Description |
|---|---|---|---|
| Threads | nthreads | --thread | CPU threads |
| Window | window | --window | Analysis window size |
| Eff. pop size | ne | --effective-size | For LD modeling |
| Seed | seed | --seed | Random seed |
Memory Requirements
| Dataset Size | Beagle Memory | SHAPEIT5 Memory |
|---|---|---|
| 1,000 samples | 8 GB | 4 GB |
| 10,000 samples | 32 GB | 16 GB |
| 100,000 samples | 64+ GB | 32 GB |
Phasing Accuracy Metrics
- Switch error rate: Rate of phase switches vs truth
- Mismatch error rate: Overall haplotype differences
- Measure using trio data or known haplotypes
Related Skills
- phasing-imputation/genotype-imputation - Impute after phasing
- phasing-imputation/reference-panels - Get reference data
- variant-calling/filtering-best-practices - Prepare input VCF
- population-genetics/linkage-disequilibrium - LD analysis
When not to use it
- →When the task requires genotype imputation before phasing
- →When the task requires reference data not available in reference panels
Limitations
- →Beagle memory requirements can be 64+ GB for 100,000 samples
- →SHAPEIT5 memory requirements can be 32 GB for 100,000 samples
- →Genetic maps are required for improved accuracy
How it compares
This skill provides a specialized workflow for haplotype phasing using established bioinformatics tools, ensuring accurate resolution of allele inheritance for downstream genetic analyses.
Compared to similar skills
bio-phasing-imputation-haplotype-phasing side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| bio-phasing-imputation-haplotype-phasing (this skill) | 0 | 5mo | Review | Advanced |
| jupyter-notebook | 30 | 6mo | Review | Intermediate |
| juicebox-core-workflow-b | 1 | 1mo | Review | Advanced |
| obspy-data-api | 1 | 6mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
jupyter-notebook
davila7
Use when the user asks to create, scaffold, or edit Jupyter notebooks (`.ipynb`) for experiments, explorations, or tutorials; prefer the bundled templates and run the helper script `new_notebook.py` to generate a clean starting notebook.
juicebox-core-workflow-b
jeremylongshore
Implement Juicebox candidate enrichment workflow. Use when enriching profile data, gathering additional candidate details, or building comprehensive candidate profiles. Trigger with phrases like "juicebox enrich profile", "juicebox candidate details", "enrich candidate data", "juicebox profile enrichment".
obspy-data-api
benchflow-ai
An overview of the core data API of ObsPy, a Python framework for processing seismological data. It is useful for parsing common seismological file formats, or manipulating custom data into standard objects for downstream use cases such as ObsPy's signal processing routines or SeisBench's modeling API.
perplexity-core-workflow-b
jeremylongshore
Execute Perplexity secondary workflow: Core Workflow B. Use when implementing secondary use case, or complementing primary workflow. Trigger with phrases like "perplexity secondary workflow", "secondary task with perplexity".
source-coding
parcadei
Problem-solving strategies for source coding in information theory
biopython
davila7
Primary Python toolkit for molecular biology. Preferred for Python-based PubMed/NCBI queries (Bio.Entrez), sequence manipulation, file parsing (FASTA, GenBank, FASTQ, PDB), advanced BLAST workflows, structures, phylogenetics. For quick BLAST, use gget. For direct REST API, use pubmed-database.