bio-vcf-manipulation
БесплатноЗапускает вложенные скриптыНе проверенMerge, concatenate, sort, intersect, and subset VCF files using bcftools. Use when combining variant files, comparing call sets, or restructuring VCF data.
от FridrichMethod★ 17 звёзд на GitHubОб этом скилле
Version Compatibility
Reference examples tested with: GATK 4.5+, bcftools 1.19+
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
If code throws ImportError, AttributeError, or TypeError, introspect the installed package and adapt the example to match the actual API rather than retrying.
VCF Manipulation
Merge, concat, sort, and compare VCF files using bcftools.
Operations Overview
| Operation | Command | Use Case |
|---|---|---|
| Merge | bcftools merge |
Combine samples from multiple VCFs |
| Concat | bcftools concat |
Combine regions from multiple VCFs |
| Sort | bcftools sort |
Sort unsorted VCF |
| Intersect | bcftools isec |
Compare/intersect call sets |
| Subset | bcftools view |
Extract samples or regions |
bcftools merge
Goal: Combine VCF files from different samples into a single multi-sample VCF.
Approach: Use bcftools merge to join files with different sample columns at shared genomic positions.
"Merge my per-sample VCFs into one file" → Combine variant records from multiple samples into a single multi-sample VCF.
Combine multiple VCF files with different samples at the same positions.
Basic Merge
bcftools merge sample1.vcf.gz sample2.vcf.gz -Oz -o merged.vcf.gz
Merge Multiple Files
bcftools merge *.vcf.gz -Oz -o all_samples.vcf.gz
Merge from File List
# files.txt: one VCF path per line
bcftools merge -l files.txt -Oz -o merged.vcf.gz
Handle Missing Genotypes
# Output missing genotypes as ./. (default)
bcftools merge sample1.vcf.gz sample2.vcf.gz -Oz -o merged.vcf.gz
# Output missing as reference (0/0)
bcftools merge --missing-to-ref sample1.vcf.gz sample2.vcf.gz -Oz -o merged.vcf.gz
Force Sample Names
When sample names conflict:
bcftools merge --force-samples sample1.vcf.gz sample2.vcf.gz -Oz -o merged.vcf.gz
Merge Specific Regions
bcftools merge -r chr1:1000000-2000000 sample1.vcf.gz sample2.vcf.gz -Oz -o merged.vcf.gz
bcftools concat
Goal: Concatenate VCF files that cover different genomic regions for the same samples.
Approach: Use bcftools concat to join region-split files (e.g., per-chromosome VCFs) in order.
Combine VCF files with same samples from different regions.
Concatenate Chromosomes
bcftools concat chr1.vcf.gz chr2.vcf.gz chr3.vcf.gz -Oz -o genome.vcf.gz
Concatenate All Chromosomes
bcftools concat chr*.vcf.gz -Oz -o genome.vcf.gz
From File List
# files.txt: one VCF path per line (in order)
bcftools concat -f files.txt -Oz -o concatenated.vcf.gz
Allow Overlapping Regions
bcftools concat -a chr1_part1.vcf.gz chr1_part2.vcf.gz -Oz -o chr1.vcf.gz
Remove Duplicates
bcftools concat -a -d all file1.vcf.gz file2.vcf.gz -Oz -o merged.vcf.gz
Options for -d:
snps- Remove duplicate SNPsindels- Remove duplicate indelsboth- Remove duplicate SNPs and indelsall- Remove all duplicatesexact- Remove exact duplicates only
bcftools sort
Goal: Sort a VCF file by chromosome and position.
Approach: Use bcftools sort with optional temp directory and memory limits for large files.
Sort VCF by chromosome and position.
Basic Sort
bcftools sort input.vcf -Oz -o sorted.vcf.gz
With Temporary Directory
For large files:
bcftools sort -T /tmp input.vcf.gz -Oz -o sorted.vcf.gz
Memory Limit
bcftools sort -m 4G input.vcf.gz -Oz -o sorted.vcf.gz
bcftools isec
Goal: Identify shared and private variants between two or more VCF files.
Approach: Use bcftools isec to partition variants into private-to-each-file and shared subsets.
"Find variants called by both GATK and bcftools" → Intersect two call sets to identify concordant and discordant variants.
Intersect and compare VCF files.
Find Shared Variants
bcftools isec -p output_dir sample1.vcf.gz sample2.vcf.gz
Creates:
0000.vcf- Private to sample10001.vcf- Private to sample20002.vcf- Shared (sample1 records)0003.vcf- Shared (sample2 records)
Output Compressed
bcftools isec -p output_dir -Oz sample1.vcf.gz sample2.vcf.gz
Intersection Only
bcftools isec -p output_dir -n=2 sample1.vcf.gz sample2.vcf.gz
# Only outputs variants present in exactly 2 files
Comparison Options
| Flag | Description |
|---|---|
-n=2 |
Present in exactly 2 files |
-n+2 |
Present in 2 or more files |
-n-2 |
Present in fewer than 2 files |
-n~11 |
Boolean: file1 AND file2 |
-n~10 |
Boolean: file1 AND NOT file2 |
Two-File Intersection
# Variants in both files
bcftools isec -n=2 -w1 sample1.vcf.gz sam
Установить bio-vcf-manipulation в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл bio-vcf-manipulation?
Merge, concatenate, sort, intersect, and subset VCF files using bcftools. Use when combining variant files, comparing call sets, or restructuring VCF data.
Как установить скилл bio-vcf-manipulation?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл bio-vcf-manipulation запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
Create 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…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic