bio-variant-normalization
БесплатноЗапускает вложенные скриптыНе проверенLeft-align and trim indels to parsimonious canonical form, decompose MNPs (atomize), and split multiallelic variants with bcftools norm. Use when comparing…
от lilinji★ 18 звёзд на GitHubОб этом скилле
Version Compatibility
Reference examples tested with: bcftools 1.19+, cyvcf2 0.30+
Before using code patterns, verify installed versions match. If versions differ:
- Python:
pip show <package>thenhelp(module.function)to check signatures - CLI:
<tool> --versionthen<tool> --helpto confirm flags
The --atomize/--old-rec-tag flags require bcftools 1.12+ (--keep-sum requires 1.11+). Earlier versions require vt decompose_blocksub as an alternative.
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
Variant Normalization
Left-align indels, decompose MNPs, and split multiallelic sites using bcftools norm.
"Put my VCF in canonical form before comparing, annotating, or merging" -> Enforce one representation per biological event so tuple-keyed operations recognize the same variant across sources.
- CLI:
bcftools norm -m-any -f ref.fa(split multiallelic, then left-align + parsimony each biallelic) - Alternatives:
vt normalize+vt decompose; GATKLeftAlignAndTrimVariants
The Normalized Form (governing principle)
A variant is normalized if and only if it is BOTH (Tan, Abecasis & Kang 2015):
- Parsimonious (minimal representation). No base can be trimmed from either end of REF/ALT without creating a zero-length allele or changing the variant. Indels keep exactly ONE anchor base (VCF forbids empty alleles), so a deletion of
Ais writtenREF=CA ALT=C, notREF=A ALT=. - Left-aligned. POS cannot be shifted further left while keeping the allele lengths and the reference-relative meaning unchanged.
Both are required: parsimony alone leaves an indel positionally ambiguous inside a repeat; left-alignment alone can leave redundant shared bases. Together they define a single canonical (CHROM, POS, REF, ALT) key, and normalization is idempotent -- normalizing an already-normalized VCF changes nothing. That idempotence is what makes the key safe to join, merge, and match on.
The algorithm (as in vt normalize and bcftools norm):
- Right-trim: while all alleles end in the same base AND all have length >= 2, drop the last base of each.
- Left-extend: while any allele has length 0, prepend the reference base immediately to the left to every allele and decrement POS.
- Left-trim: while all alleles start with the same base AND all have length >= 2, drop the first base of each and increment POS.
The right-trim-then-left-roll loop is exactly what shifts an indel through a repeat to its leftmost equivalent position.
When Normalization is Mandatory
Not normalizing before certain operations leads to missed matches and false discordance. Normalization is required:
- Before comparing variants from different callers. Each caller may represent the same indel at different positions or encode MNPs differently. Without normalization, identical variants appear discordant.
- Before database annotation. dbSNP, ClinVar, and gnomAD store variants in canonical left-aligned, parsimonious representation. A right-aligned or non-parsimonious indel will fail to match its database entry.
- Before merging VCF files from different sources.
bcftools mergematches on CHROM/POS/REF/ALT; different representations of the same variant produce duplicate entries instead of a single merged record. - Before any variant set operations. Intersection (
bcftools isec), complement, and union operations all rely on exact positional matching. Non-normalized variants silently fall through set comparisons.
Normalization is generally safe to skip only when a single caller produced all variants and no cross-file comparison or database lookup is needed.
Why Left-Alignment Matters in Repeats (the silent miss)
The same variant can be written multiple ways:
chr1 100 ATCG A (right-aligned)
chr1 100 ATC A (left-aligned, parsimonious -- the canonical form)
chr1 101 TCG T (shifted position, different anchor base)
The ambiguity is worst in homopolymers and tandem repeats. In reference ...AAAAAAA..., a single-base A deletion is positionally ambiguous: deleting ANY one of the seven A's yields the identical alternate haplotype, so different callers/aligners emit it at different POS. Left-alignment defines the canonical (leftmost) position, giving the one biological event one representation.
The load-bearing consequence: a one-base-off (non-left-aligned) indel in a homopolymer is a valid VCF line that produces a different (CHROM, POS, REF, ALT) tuple. Annotation and matching keyed on that tuple then silently miss the dbSNP/ClinVar/gnomAD entry that sits at the canonical coordinate -- a clinically actionable variant is reported as absent or novel, with no error thrown. The VCF is structurally valid; the numbers are wrong. bcftools merge of a normalized and an un-normalized cohort likewise emits duplicate rows f
Установить bio-variant-normalization в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл bio-variant-normalization?
Left-align and trim indels to parsimonious canonical form, decompose MNPs (atomize), and split multiallelic variants with bcftools norm. Use when comparing variants across callers or cohorts, preparing a VCF for database annotation or ClinVar/dbSNP matching, merging VCFs, reconciling vt-vs-bcftools representation discordance, or resolving the VCF-left-align vs HGVS-3'-rule clash.
Как установить скилл bio-variant-normalization?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл bio-variant-normalization запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic