bio-long-read-sequencing-haplotype-phasing
Phases small variants, SVs, and methylation from Oxford Nanopore and PacBio long reads (read-backed/physical phasing) with WhatsHap, LongPhase, or HiPhase…
от lilinji★ 18 звёзд на GitHub
Установить bio-long-read-sequencing-haplotype-phasing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Version Compatibility
Reference examples tested with: whatshap 2.3+, longphase 1.7+, samtools 1.19+, tabix/htslib 1.19+.
Before using code patterns, verify installed versions match. If versions differ:
- CLI:
<tool> --versionthen<tool> --helpto confirm flags
Behavior to record:
whatshap phase --referenceenables realignment mode (rescues indel phasing on error-prone long reads); omitting it falls back to lower-quality genotype-only phasing.- Phasing the VCF and haplotagging the BAM are SEPARATE steps; downstream read-level tools need the BAM HP tag.
--max-coverage 15(WhatsHap) is a runtime downsampling cap, not a minimum-depth requirement.
If code throws an error, introspect the installed tool (whatshap phase --help, longphase --help) and adapt the example to the actual API rather than retrying.
Read-Backed Haplotype Phasing
"Phase my long-read variants" -> Reconstruct haplotypes directly from reads that span heterozygous sites, then haplotag the BAM so downstream tools can see the phase.
- CLI:
whatshap phase -o phased.vcf.gz --reference ref.fa --indels variants.vcf.gz aln.bamthenwhatshap haplotag -o haplotagged.bam --reference ref.fa phased.vcf.gz aln.bam
This is read-backed (physical, panel-free) phasing of a single sample. Statistical/reference-panel phasing for imputation lives in phasing-imputation/haplotype-phasing; building phased haplotype contigs lives in genome-assembly/hifi-assembly.
The Single Most Important Modern Insight -- Phasing the VCF Is Useless Until the BAM Is Haplotagged, and Blocks Break Where No Read Spans Two Hets
Read-backed phasing is sample-intrinsic and panel-free (the haplotypes are exactly what this individual's reads physically witness), with two load-bearing consequences:
phasewrites the VCF;haplotagwrites the BAM - they are different products.whatshap phase/longphase phaseset GT pipe (0|1) and a PS phase-set in the VCF; they do NOT touch the BAM. Every read-level downstream tool (modkit--partition-tag HPfor allele-specific methylation, pb-CpG-tools--hap-tag HP, Severus for phased SVs, IGV color-by-HP,whatshap split) keys on the per-readHPtag that ONLYhaplotagwrites. A user who runsphaseand stops has a phased VCF and an un-haplotagged BAM, and the downstream step silently produces only an ungrouped partition. Triage:samtools view haplotagged.bam | grep -m1 'HP:i:'.- Phase blocks break wherever no single read spans two adjacent hets. Block length is capped by read length x heterozygosity: a long homozygous run (or a coverage/mapping dropout) ends a block no matter how long the reads are. A genome is phased into MANY blocks, not one haplotype per chromosome, and between-block phase is arbitrary until a long-range method (trio, Hi-C) stitches them. So "the genome is phased" is meaningless without block N50 AND switch error together.
Tool Decision Tree
Switch-error accuracy is comparable across read-based tools (~0.1-0.4% on long reads); choose on speed, SV/mod co-phasing, platform, and pedigree.
| Scenario | Tool | Why |
|---|---|---|
| Careful default; indel phasing | WhatsHap (--reference --indels) |
realignment mode rescues indels; widest downstream familiarity |
| Parents/pedigree sequenced | WhatsHap --ped (PedMEC) |
the gold standard - chromosome-scale, lowest switch error |
| Whole-genome ONT speed | LongPhase (--ont) |
~10x faster; 30x human in ~1 min |
| Co-phase SVs / methylation into long blocks | LongPhase (--sv-file/--mod-file) |
a phased SV bridges het-sparse gaps; block N50 ~25 Mbp |
| PacBio HiFi, joint small+SV+STR | HiPhase | PacBio-native one-pass phasing |
| Multi-tech (Hi-C / 10x) | HapCUT2 | models Hi-C/linked-read error |
| Inside PEPPER-Margin-DeepVariant | margin | legacy embedded haplotagger |
Clair3 uses WhatsHap (or LongPhase) internally to phase its het SNPs and haplotag the BAM feeding its full-alignment model - this skill owns that phase->haplotag mechanism (see clair3-variants).
The Tags (the central distinction)
| Layer | Tag | Meaning |
|---|---|---|
| VCF (per variant) | GT with ` |
vs/` |
| VCF (per variant) | FORMAT/PS (Integer) |
phase-set / block id; variants sharing a PS are phased relative to each other (conventionally the first variant's position) |
| BAM (per read) | HP:i:1 / HP:i:2 |
the haplotype this read was assigned to (written by haplotag) |
| BAM (per read) | PS:i:<int> |
the phase set the read's assignment belongs to (matches the VCF PS) |
Unassigned reads carry NO HP tag (not HP:i:0). Do not confuse the VCF HP FORMAT tag (GATK style) with the BAM HP read tag.
Phasing Quality - Report Block N50 AND Switch Error
| Metric | Tool | Trap |
|---|---|---|
| phase-block N50/NG50 | whatshap stats |
contiguity, not correctness; gameable by over-joining blocks (which raises switch er |
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- examples/longphase_sv_cophasing.sh
- examples/phase_and_haplotag.sh
- usage-guide.md
FAQ
Что делает скилл bio-long-read-sequencing-haplotype-phasing?
Phases small variants, SVs, and methylation from Oxford Nanopore and PacBio long reads (read-backed/physical phasing) with WhatsHap, LongPhase, or HiPhase, and haplotags the BAM (HP/PS tags) for allele-resolved downstream analysis. Covers why phase blocks break at het-sparse gaps (read length x heterozygosity), why phasing the VCF is useless until the BAM is haplotagged, the GT-pipe/PS and read HP/PS tag spec, reporting block N50 with switch error, the diploid-assumption/CNV/haploid-region traps, trio phasing as the gold standard, and the boundary to statistical panel phasing. Use when phasing long-read variants, haplotagging reads for allele-specific methylation/expression or phased SVs, choosing WhatsHap vs LongPhase vs HiPhase, trio phasing, or assessing phasing quality.
Как установить скилл bio-long-read-sequencing-haplotype-phasing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл bio-long-read-sequencing-haplotype-phasing запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…