[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EE0A0JJ7FHEE75N4EY81SA":3,"skill-same:01M7EE0A0JJ7FHEE75N4EY81SA":66},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":14,"repositoryHtmlUrl":33,"repositoryHomepageUrl":33,"ownerHtmlUrl":34,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":35,"install":36,"resources":49},"01M7EE0A0JJ7FHEE75N4EY81SA","bio-long-read-sequencing-haplotype-phasing",null,"Phases small variants, SVs, and methylation from Oxford Nanopore and PacBio long reads (read-backed\u002Fphysical phasing) with WhatsHap, LongPhase, or HiPhase, and haplotags the BAM (HP\u002FPS 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\u002FPS and read HP\u002FPS tag spec, reporting block N50 with switch error, the diploid-assumption\u002FCNV\u002Fhaploid-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\u002Fexpression or phased SVs, choosing WhatsHap vs LongPhase vs HiPhase, trio phasing, or assessing phasing quality.","Mr-Nobody-Anonymous\u002FAll-skills","Mr-Nobody-Anonymous","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F184253119?v=4","01M7AEXFJHKTYQW5R0ZCQQTWFV","anonymous","01M7C00M3GQR4QKP9GZA42GFAK",0,"MIT","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-long-read-sequencing-haplotype-phasing\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bio-long-read-sequencing-haplotype-phasing\ndescription: Phases small variants, SVs, and methylation from Oxford Nanopore and PacBio long reads (read-backed\u002Fphysical phasing) with WhatsHap, LongPhase, or HiPhase, and haplotags the BAM (HP\u002FPS 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\u002FPS and read HP\u002FPS tag spec, reporting block N50 with switch error, the diploid-assumption\u002FCNV\u002Fhaploid-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\u002Fexpression or phased SVs, choosing WhatsHap vs LongPhase vs HiPhase, trio phasing, or assessing phasing quality.\ntool_type: cli\nprimary_tool: whatshap\nsource: \"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills\"\nsource_repository: \"GPTomics\u002FbioSkills\"\nsource_path: \"long-read-sequencing\u002Fhaplotype-phasing\u002FSKILL.md\"\nlicense: \"MIT\"\nimported_at: \"2026-09-20\"\n---\n\n## Version Compatibility\n\nReference examples tested with: whatshap 2.3+, longphase 1.7+, samtools 1.19+, tabix\u002Fhtslib 1.19+.\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- CLI: `\u003Ctool> --version` then `\u003Ctool> --help` to confirm flags\n\nBehavior to record:\n- `whatshap phase --reference` enables realignment mode (rescues indel phasing on error-prone long reads); omitting it falls back to lower-quality genotype-only phasing.\n- Phasing the VCF and haplotagging the BAM are SEPARATE steps; downstream read-level tools need the BAM HP tag.\n- `--max-coverage 15` (WhatsHap) is a runtime downsampling cap, not a minimum-depth requirement.\n\nIf code throws an error, introspect the installed tool (`whatshap phase --help`, `longphase --help`) and adapt the example to the actual API rather than retrying.\n\n# Read-Backed Haplotype Phasing\n\n**\"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.\n- CLI: `whatshap phase -o phased.vcf.gz --reference ref.fa --indels variants.vcf.gz aln.bam` then `whatshap haplotag -o haplotagged.bam --reference ref.fa phased.vcf.gz aln.bam`\n\nThis is read-backed (physical, panel-free) phasing of a single sample. Statistical\u002Freference-panel phasing for imputation lives in phasing-imputation\u002Fhaplotype-phasing; building phased haplotype contigs lives in genome-assembly\u002Fhifi-assembly.\n\n## 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\n\nRead-backed phasing is sample-intrinsic and panel-free (the haplotypes are exactly what this individual's reads physically witness), with two load-bearing consequences:\n\n1. **`phase` writes the VCF; `haplotag` writes the BAM - they are different products.** `whatshap phase` \u002F `longphase phase` set 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 HP` for allele-specific methylation, pb-CpG-tools `--hap-tag HP`, Severus for phased SVs, IGV color-by-HP, `whatshap split`) keys on the per-read `HP` tag that ONLY `haplotag` writes. A user who runs `phase` and 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:'`.\n2. **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\u002Fmapping 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.\n\n## Tool Decision Tree\n\nSwitch-error accuracy is comparable across read-based tools (~0.1-0.4% on long reads); choose on speed, SV\u002Fmod co-phasing, platform, and pedigree.\n\n| Scenario | Tool | Why |\n|----------|------|-----|\n| Careful default; indel phasing | WhatsHap (`--reference --indels`) | realignment mode rescues indels; widest downstream familiarity |\n| Parents\u002Fpedigree sequenced | WhatsHap `--ped` (PedMEC) | the gold standard - chromosome-scale, lowest switch error |\n| Whole-genome ONT speed | LongPhase (`--ont`) | ~10x faster; 30x human in ~1 min |\n| Co-phase SVs \u002F methylation into long blocks | LongPhase (`--sv-file`\u002F`--mod-file`) | a phased SV bridges het-sparse gaps; block N50 ~25 Mbp |\n| PacBio HiFi, joint small+SV+STR | HiPhase | PacBio-native one-pass phasing |\n| Multi-tech (Hi-C \u002F 10x) | HapCUT2 | models Hi-C\u002Flinked-read error |\n| Inside PEPPER-Margin-DeepVariant | margin | legacy embedded haplotagger |\n\nClair3 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).\n\n## The Tags (the central distinction)\n\n| Layer | Tag | Meaning |\n|-------|-----|---------|\n| VCF (per variant) | `GT` with `|` vs `\u002F` | `0|1` phased (order = which haplotype carries ALT); `0\u002F1` unphased |\n| VCF (per variant) | `FORMAT\u002FPS` (Integer) | phase-set \u002F block id; variants sharing a PS are phased relative to each other (conventionally the first variant's position) |\n| BAM (per read) | `HP:i:1` \u002F `HP:i:2` | the haplotype this read was assigned to (written by `haplotag`) |\n| BAM (per read) | `PS:i:\u003Cint>` | the phase set the read's assignment belongs to (matches the VCF PS) |\n\nUnassigned 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.\n\n## Phasing Quality - Report Block N50 AND Switch Error\n\n| Metric | Tool | Trap |\n|--------|------|------|\n| phase-block N50\u002FNG50 | `whatshap stats` | contiguity, not correctness; gameable by over-joining blocks (which raises switch errors) |\n| phased fraction | `whatshap stats` | a tool can phase fewer easy sites to look better |\n| switch error rate | `whatshap compare` | the primary accuracy number |\n| switch vs flip decomposition | `whatshap compare` | a long switch propagates (damaging); a flip\u002Fshort switch self-corrects (one wrong variant) - quote the decomposition |\n| Hamming distance | `whatshap compare` | hypersensitive to switch position (a switch near a block start flips half the block) |\n\nLong blocks with a high switch rate are worse, not better, than honest short blocks. Benchmark against a trio-\u002Fstrand-seq-phased GIAB truth.\n\n## Core Commands\n\n```bash\n# WhatsHap: phase (VCF), then haplotag (BAM). --reference enables realignment for indels.\nwhatshap phase -o phased.vcf.gz --reference ref.fa --indels variants.vcf.gz aln.bam\ntabix -p vcf phased.vcf.gz\nwhatshap haplotag -o haplotagged.bam --reference ref.fa \\\n    --output-haplotag-list htlist.tsv.gz phased.vcf.gz aln.bam\nsamtools index haplotagged.bam\n\n# Quality\nwhatshap stats --gtf blocks.gtf phased.vcf.gz                       # block N50, count, fraction\nwhatshap compare --names truth,mine truth.vcf.gz phased.vcf.gz      # switch error, flip decomposition\n\n# Trio (gold standard) - --ped takes a PED file, not mother\u002Ffather\u002Fchild args\nwhatshap phase -o trio.vcf.gz --reference ref.fa --ped family.ped joint.vcf.gz mother.bam father.bam child.bam\n\n# LongPhase: faster whole-genome, co-phase SNP+indel+SV(+5mC) into long blocks\nlongphase phase -s snps.vcf --indels --sv-file svs.vcf -b aln.bam -r ref.fa -o phased -t 16 --ont\nlongphase haplotag -s phased.vcf --sv-file phased_SV.vcf -b aln.bam -r ref.fa -o haplotagged -t 16\n\n# Downstream consumer example: allele-specific methylation\nmodkit pileup haplotagged.bam asm\u002F --ref ref.fa --cpg --combine-strands --partition-tag HP\n```\n\n## Per-Method Failure Modes\n\n### Phased VCF but no HP tags downstream\n**Trigger:** running `phase` and pointing a read-level tool at the original BAM. **Mechanism:** `phase` writes the VCF only; the BAM HP tag comes from `haplotag`. **Symptom:** modkit returns only an ungrouped partition; IGV shows one color; Severus reports no phased SVs - all with no error. **Fix:** run `haplotag`; verify `samtools view ... | grep HP:i:`.\n\n### Short blocks blamed on the tool\n**Trigger:** a homozygosity-rich or inbred sample phasing into many short blocks. **Mechanism:** no intervening hets to link across a long homozygous run - intrinsic, not tool failure. **Symptom:** low block N50 despite good reads. **Fix:** expect it; use ultra-long reads or co-phase SVs (LongPhase) to bridge sparse-het gaps; only trio\u002FHi-C makes it chromosome-scale.\n\n### Indels phased poorly\n**Trigger:** `whatshap phase` without `--reference`. **Mechanism:** without realignment, allele support for indels in error-prone reads is noisy. **Symptom:** low indel phasing \u002F errors. **Fix:** always pass `--reference ref.fa` (and `--indels`) on long reads.\n\n### Confident phasing of a haploid\u002FCNV region\n**Trigger:** phasing chrX\u002FY\u002FMT in an XY sample, or inside a CNV\u002Fsegdup. **Mechanism:** the two-haplotype model is false there (hemizygous, >2 or 1 haplotype, or collapsed paralogs). **Symptom:** spurious micro-blocks, HP counts far from 50\u002F50. **Fix:** treat phasing there as unreliable; do not interpret it as biology.\n\n### Quoting N50 alone\n**Trigger:** comparing phasers on block N50. **Mechanism:** N50 is inflated by over-joining, which raises switch errors. **Symptom:** \"longer blocks\" that are actually worse. **Fix:** report block N50 AND switch error together; use the flip decomposition.\n\n## Quantitative Thresholds\n\n| Threshold | Source | Rationale |\n|-----------|--------|-----------|\n| Total depth ~15-20x for confident phasing | phasing practice | per-haplotype depth is ~half; below ~10x blocks fragment |\n| `--max-coverage 15` is a runtime cap | WhatsHap | wMEC is exponential in per-site coverage; >15x is redundant, not required |\n| long-read switch error ~0.1-0.4% | benchmarks vs trio truth | the achievable accuracy band |\n| LongPhase SNP+SV block N50 ~25 Mbp | Lin 2022 | co-phasing SVs bridges het-sparse gaps (vs ~10-15 Mbp SNP-only) |\n| ASM wants ~20x total | methylation practice | each haplotype must clear the ~10x per-site floor |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| `modkit --partition-tag HP` has only an ungrouped partition | BAM never haplotagged | run `whatshap haplotag` \u002F `longphase haplotag` |\n| `--trio` flag not recognized | the flag is `--ped` | pass a PED file: `--ped family.ped` |\n| Poor indel phasing | `--reference` omitted | add `--reference ref.fa --indels` |\n| 0 reads usable in phase | BAM @RG sample != VCF sample | `--ignore-read-groups` (or fix sample names) |\n| `longphase --platform ont` errors | platform is a bare flag | use `--ont` or `--pb` |\n| Spurious phasing on chrX\u002FCNV | diploid assumption violated | treat as unreliable; exclude haploid\u002FCNV regions |\n\n## References\n\n- Patterson M, Marschall T, Pisanti N, et al. 2015. WhatsHap: weighted haplotype assembly for future-generation sequencing reads. *J Comput Biol* 22(6):498-509.\n- Martin M, Patterson M, Garg S, et al. 2016. WhatsHap: fast and accurate read-based phasing. *bioRxiv* 085050.\n- Garg S, Martin M, Marschall T. 2016. Read-based phasing of related individuals (PedMEC). *Bioinformatics* 32(12):i234-i242.\n- Lin JH, Chen LC, Yu SC, Huang YT. 2022. LongPhase: an ultra-fast chromosome-scale phasing algorithm for small and large variants. *Bioinformatics* 38(7):1816-1822.\n- Holt JM, Saunders CT, Rowell WJ, et al. 2024. HiPhase: jointly phasing small, structural, and tandem repeat variants from HiFi sequencing. *Bioinformatics* 40(2):btae042.\n- Edge P, Bafna V, Bansal V. 2017. HapCUT2: robust and accurate haplotype assembly for diverse sequencing technologies. *Genome Res* 27(5):801-812.\n\n## Related Skills\n\n- clair3-variants - Produces the het VCF; Clair3 phases+haplotags internally via this mechanism\n- long-read-alignment - Produces the BAM (keep `-Y` so supplementaries are taggable)\n- nanopore-methylation - Allele-specific methylation via `modkit --partition-tag HP`\n- structural-variants - Severus consumes a haplotagged BAM for phased\u002Fsomatic SVs\n- basecalling - LongPhase can co-phase 5mC from a modBAM\n- phasing-imputation\u002Fhaplotype-phasing - Statistical\u002Freference-panel phasing for imputation\n- genome-assembly\u002Fhifi-assembly - Phased de novo haplotype contigs (trio\u002FHi-C)\n- hi-c-analysis\u002Fcontact-pairs - Hi-C long-range phasing (orthogonal)\n","## Version Compatibility\n\nReference examples tested with: whatshap 2.3+, longphase 1.7+, samtools 1.19+, tabix\u002Fhtslib 1.19+.\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- CLI: `\u003Ctool> --version` then `\u003Ctool> --help` to confirm flags\n\nBehavior to record:\n- `whatshap phase --reference` enables realignment mode (rescues indel phasing on error-prone long reads); omitting it falls back to lower-quality genotype-only phasing.\n- Phasing the VCF and haplotagging the BAM are SEPARATE steps; downstream read-level tools need the BAM HP tag.\n- `--max-coverage 15` (WhatsHap) is a runtime downsampling cap, not a minimum-depth requirement.\n\nIf code throws an error, introspect the installed tool (`whatshap phase --help`, `longphase --help`) and adapt the example to the actual API rather than retrying.\n\n# Read-Backed Haplotype Phasing\n\n**\"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.\n- CLI: `whatshap phase -o phased.vcf.gz --reference ref.fa --indels variants.vcf.gz aln.bam` then `whatshap haplotag -o haplotagged.bam --reference ref.fa phased.vcf.gz aln.bam`\n\nThis is read-backed (physical, panel-free) phasing of a single sample. Statistical\u002Freference-panel phasing for imputation lives in phasing-imputation\u002Fhaplotype-phasing; building phased haplotype contigs lives in genome-assembly\u002Fhifi-assembly.\n\n## 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\n\nRead-backed phasing is sample-intrinsic and panel-free (the haplotypes are exactly what this individual's reads physically witness), with two load-bearing consequences:\n\n1. **`phase` writes the VCF; `haplotag` writes the BAM - they are different products.** `whatshap phase` \u002F `longphase phase` set 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 HP` for allele-specific methylation, pb-CpG-tools `--hap-tag HP`, Severus for phased SVs, IGV color-by-HP, `whatshap split`) keys on the per-read `HP` tag that ONLY `haplotag` writes. A user who runs `phase` and 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:'`.\n2. **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\u002Fmapping 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.\n\n## Tool Decision Tree\n\nSwitch-error accuracy is comparable across read-based tools (~0.1-0.4% on long reads); choose on speed, SV\u002Fmod co-phasing, platform, and pedigree.\n\n| Scenario | Tool | Why |\n|----------|------|-----|\n| Careful default; indel phasing | WhatsHap (`--reference --indels`) | realignment mode rescues indels; widest downstream familiarity |\n| Parents\u002Fpedigree sequenced | WhatsHap `--ped` (PedMEC) | the gold standard - chromosome-scale, lowest switch error |\n| Whole-genome ONT speed | LongPhase (`--ont`) | ~10x faster; 30x human in ~1 min |\n| Co-phase SVs \u002F methylation into long blocks | LongPhase (`--sv-file`\u002F`--mod-file`) | a phased SV bridges het-sparse gaps; block N50 ~25 Mbp |\n| PacBio HiFi, joint small+SV+STR | HiPhase | PacBio-native one-pass phasing |\n| Multi-tech (Hi-C \u002F 10x) | HapCUT2 | models Hi-C\u002Flinked-read error |\n| Inside PEPPER-Margin-DeepVariant | margin | legacy embedded haplotagger |\n\nClair3 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).\n\n## The Tags (the central distinction)\n\n| Layer | Tag | Meaning |\n|-------|-----|---------|\n| VCF (per variant) | `GT` with `|` vs `\u002F` | `0|1` phased (order = which haplotype carries ALT); `0\u002F1` unphased |\n| VCF (per variant) | `FORMAT\u002FPS` (Integer) | phase-set \u002F block id; variants sharing a PS are phased relative to each other (conventionally the first variant's position) |\n| BAM (per read) | `HP:i:1` \u002F `HP:i:2` | the haplotype this read was assigned to (written by `haplotag`) |\n| BAM (per read) | `PS:i:\u003Cint>` | the phase set the read's assignment belongs to (matches the VCF PS) |\n\nUnassigned 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.\n\n## Phasing Quality - Report Block N50 AND Switch Error\n\n| Metric | Tool | Trap |\n|--------|------|------|\n| phase-block N50\u002FNG50 | `whatshap stats` | contiguity, not correctness; gameable by over-joining blocks (which raises switch errors) |\n| phased fraction | `whatshap stats` | a tool can phase fewer easy sites to look better |\n| switch error rate | `whatshap compare` | the primary accuracy number |\n| switch vs flip decomposition | `whatshap compare` | a long switch propagates (damaging); a flip\u002Fshort switch self-corrects (one wrong variant) - quote the decomposition |\n| Hamming distance | `whatshap compare` | hypersensitive to switch position (a switch near a block start flips half the block) |\n\nLong blocks with a high switch rate are worse, not better, than honest short blocks. Benchmark against a trio-\u002Fstrand-seq-phased GIAB truth.\n\n## Core Commands\n\n```bash\n# WhatsHap: phase (VCF), then haplotag (BAM). --reference enables realignment for indels.\nwhatshap phase -o phased.vcf.gz --reference ref.fa --indels variants.vcf.gz aln.bam\ntabix -p vcf phased.vcf.gz\nwhatshap haplotag -o haplotagged.bam --reference ref.fa \\\n    --output-haplotag-list htlist.tsv.gz phased.vcf.gz aln.bam\nsamtools index haplotagged.bam\n\n# Quality\nwhatshap stats --gtf blocks.gtf phased.vcf.gz                       # block N50, count, fraction\nwhatshap compare --names truth,mine truth.vcf.gz phased.vcf.gz      # switch error, flip decomposition\n\n# Trio (gold standard) - --ped takes a PED file, not mother\u002Ffather\u002Fchild args\nwhatshap phase -o trio.vcf.gz --reference ref.fa --ped family.ped joint.vcf.gz mother.bam father.bam child.bam\n\n# LongPhase: faster whole-genome, co-phase SNP+indel+SV(+5mC) into long blocks\nlongphase phase -s snps.vcf --indels --sv-file svs.vcf -b aln.bam -r ref.fa -o phased -t 16 --ont\nlongphase haplotag -s phased.vcf --sv-file phased_SV.vcf -b aln.bam -r ref.fa -o haplotagged -t 16\n\n# Downstream consumer example: allele-specific methylation\nmodkit pileup haplotagged.bam asm\u002F --ref ref.fa --cpg --combine-strands --partition-tag HP\n```\n\n## Per-Method Failure Modes\n\n### Phased VCF but no HP tags downstream\n**Trigger:** running `phase` and pointing a read-level tool at the original BAM. **Mechanism:** `phase` writes the VCF only; the BAM HP tag comes from `haplotag`. **Symptom:** modkit returns only an ungrouped partition; IGV shows one color; Severus reports no phased SVs - all with no error. **Fix:** run `haplotag`; verify `samtools view ... | grep HP:i:`.\n\n### Short blocks blamed on the tool\n**Trigger:** a homozygosity-rich or inbred sample phasing into many short blocks. **Mechanism:** no intervening hets to link across a long homozygous run - intrinsic, not tool failure. **Symptom:** low block N50 despite good reads. **Fix:** expect it; use ultra-long reads or co-phase SVs (LongPhase) to bridge sparse-het gaps; only trio\u002FHi-C makes it chromosome-scale.\n\n### Indels phased poorly\n**Trigger:** `whatshap phase` without `--reference`. **Mechanism:** without realignment, allele support for indels in error-prone reads is noisy. **Symptom:** low indel phasing \u002F errors. **Fix:** always pass `--reference ref.fa` (and `--indels`) on long reads.\n\n### Confident phasing of a haploid\u002FCNV region\n**Trigger:** phasing chrX\u002FY\u002FMT in an XY sample, or inside a CNV\u002Fsegdup. **Mechanism:** the two-haplotype model is false there (hemizygous, >2 or 1 haplotype, or collapsed paralogs). **Symptom:** spurious micro-blocks, HP counts far from 50\u002F50. **Fix:** treat phasing there as unreliable; do not interpret it as biology.\n\n### Quoting N50 alone\n**Trigger:** comparing phasers on block N50. **Mechanism:** N50 is inflated by over-joining, which raises switch errors. **Symptom:** \"longer blocks\" that are actually worse. **Fix:** report block N50 AND switch error together; use the flip decomposition.\n\n## Quantitative Thresholds\n\n| Threshold | Source | Rationale |\n|-----------|--------|-----------|\n| Total depth ~15-20x for confident phasing | phasing practice | per-haplotype depth is ~half; below ~10x blocks fragment |\n| `--max-coverage 15` is a runtime cap | WhatsHap | wMEC is exponential in per-site coverage; >15x is redundant, not required |\n| long-read switch error ~0.1-0.4% | benchmarks vs trio truth | the achievable accuracy band |\n| LongPhase SNP+SV block N50 ~25 Mbp | Lin 2022 | co-phasing SVs bridges het-sparse gaps (vs ~10-15 Mbp SNP-only) |\n| ASM wants ~20x total | methylation practice | each haplotype must clear the ~10x per-site floor |\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|-----------------|-------|----------|\n| `modkit --partition-tag HP` has only an ungrouped partition | BAM never haplotagged | run `whatshap haplotag` \u002F `longphase haplotag` |\n| `--trio` flag not recognized | the flag is `--ped` | pass a PED file: `--ped family.ped` |\n| Poor indel phasing | `--reference` omitted | add `--reference ref.fa --indels` |\n| 0 reads usable in phase | BAM @RG sample != VCF sample | `--ignore-read-groups` (or fix sample names) |\n| `longphase --platform ont` errors | platform is a bare flag | use `--ont` or `--pb` |\n| Spurious phasing on chrX\u002FCNV | diploid assumption violated | treat as unreliable; exclude haploid\u002FCNV regions |\n\n## References\n\n- Patterson M, Marschall T, Pisanti N, et al. 2015. WhatsHap: weighted haplotype assembly for future-generation sequencing reads. *J Comput Biol* 22(6):498-509.\n- Martin M, Patterson M, Garg S, et al. 2016. WhatsHap: fast and accurate read-based phasing. *bioRxiv* 085050.\n- Garg S, Martin M, Marschall T. 2016. Read-based phasing of related individuals (PedMEC). *Bioinformatics* 32(12):i234-i242.\n- Lin JH, Chen LC, Yu SC, Huang YT. 2022. LongPhase: an ultra-fast chromosome-scale phasing algorithm for small and large variants. *Bioinformatics* 38(7):1816-1822.\n- Holt JM, Saunders CT, Rowell WJ, et al. 2024. HiPhase: jointly phasing small, structural, and tandem repeat variants from HiFi sequencing. *Bioinformatics* 40(2):btae042.\n- Edge P, Bafna V, Bansal V. 2017. HapCUT2: robust and accurate haplotype assembly for diverse sequencing technologies. *Genome Res* 27(5):801-812.\n\n## Related Skills\n\n- clair3-variants - Produces the het VCF; Clair3 phases+haplotags internally via this mechanism\n- long-read-alignment - Produces the BAM (keep `-Y` so supplementaries are taggable)\n- nanopore-methylation - Allele-specific methylation via `modkit --partition-tag HP`\n- structural-variants - Severus consumes a haplotagged BAM for phased\u002Fsomatic SVs\n- basecalling - LongPhase can co-phase 5mC from a modBAM\n- phasing-imputation\u002Fhaplotype-phasing - Statistical\u002Freference-panel phasing for imputation\n- genome-assembly\u002Fhifi-assembly - Phased de novo haplotype contigs (trio\u002FHi-C)\n- hi-c-analysis\u002Fcontact-pairs - Hi-C long-range phasing (orthogonal)\n",{"name":5,"source":24,"license":15,"tool_type":25,"description":7,"imported_at":26,"source_path":27,"primary_tool":28,"source_repository":29},"https:\u002F\u002Fgithub.com\u002FGPTomics\u002FbioSkills","cli","2026-09-20","long-read-sequencing\u002Fhaplotype-phasing\u002FSKILL.md","whatshap","GPTomics\u002FbioSkills","main","2d1750717747097b602acf30bd09a7cbd4b4c6ea","awesome_skills\u002Fbiology\u002Fbio-long-read-sequencing-haplotype-phasing","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous","2026-11-09 11:45:36",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-long-read-sequencing-haplotype-phasing",{"tool":42,"command":43},"bunx","bunx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-long-read-sequencing-haplotype-phasing",{"tool":45,"command":46},"pnpm","pnpm dlx skills add Mr-Nobody-Anonymous\u002FAll-skills --skill bio-long-read-sequencing-haplotype-phasing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-long-read-sequencing-haplotype-phasing\u002FSKILL.md",true,[50,56,60],{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"examples\u002Flongphase_sv_cophasing.sh","SCRIPT","脚本",1571,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-long-read-sequencing-haplotype-phasing\u002Fexamples\u002Flongphase_sv_cophasing.sh",{"path":57,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":58,"sourceHtmlUrl":59},"examples\u002Fphase_and_haplotag.sh",1755,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-long-read-sequencing-haplotype-phasing\u002Fexamples\u002Fphase_and_haplotag.sh",{"path":61,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":64,"sourceHtmlUrl":65},"usage-guide.md","REFERENCE","参考文档",4407,"https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fbiology\u002Fbio-long-read-sequencing-haplotype-phasing\u002Fusage-guide.md",[67,75,82,89,96,103],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":74},"01M7FFFZPC2025JQQHPHDX154J","dei-assessment","Assess diversity, equity, and inclusion with metrics. TRIGGERS - Use when user needs help with dei-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-assessment\u002FSKILL.md",[],[],"2026-11-16 10:05:34",{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":74},"01M7FFFWN8H4WA7A6Y398QKB6J","dei-action-plan","Create DEI action plans with goals and initiatives. TRIGGERS - Use when user needs help with dei-action-plan related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fdei-action-plan\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":74},"01M7FFFSHTM0QZRVZ2NRJTJ0PY","culture-fit-assessment","Design culture add assessment processes. TRIGGERS - Use when user needs help with culture-fit-assessment related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fculture-fit-assessment\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":74},"01M7FFFMA12RKEQA38KHJSXXPS","cowork-to-code-bridge","Use an already-installed, independently verified cowork-to-code bridge to run narrowly approved actions on the user's own macOS, Linux, or WSL2 machine through a local file queue.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcowork-to-code-bridge\u002FSKILL.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":74},"01M7FFFH1F6M8YRGW5V487GH1K","counter-offer-response","Draft counter-offer responses for retention. TRIGGERS - Use when user needs help with counter-offer-response related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcounter-offer-response\u002FSKILL.md",[],[],{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":74},"01M7FFFDGEHV8Y7J9N40HZXW52","continuous-feedback-system","Design continuous feedback systems. TRIGGERS - Use when user needs help with continuous-feedback-system related tasks.","https:\u002F\u002Fgithub.com\u002FMr-Nobody-Anonymous\u002FAll-skills\u002Fblob\u002Fmain\u002Fawesome_skills\u002Fhr-people\u002Fcontinuous-feedback-system\u002FSKILL.md",[],[]]