[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73BBA7Q8D0HX8T22EA08KHC":3,"skill-same:01M73BBA7Q8D0HX8T22EA08KHC":48},{"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":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M73BBA7Q8D0HX8T22EA08KHC","bcftools-variant-manipulation",null,"CLI for VCF\u002FBCF: filter, merge, annotate, query, normalize, compute stats. Core post-variant-calling: quality filtering, multi-sample merging, rsID annotation, genotype extraction. Samtools companion in HTSlib. Use GATK for complex indel realignment during calling; use VCFtools for population genetics stats.","bg-szy\u002FTOP-SKILLS","bg-szy","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F106576190?v=4","01M73A4E8KPV67SFXRY8XZGNBX","ShuZhiyong","01M73A4E96MQ294MHM74TZBVQD",6,"MIT","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fawesome-skills\u002Fbcftools-variant-manipulation\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: \"bcftools-variant-manipulation\"\ndescription: \"CLI for VCF\u002FBCF: filter, merge, annotate, query, normalize, compute stats. Core post-variant-calling: quality filtering, multi-sample merging, rsID annotation, genotype extraction. Samtools companion in HTSlib. Use GATK for complex indel realignment during calling; use VCFtools for population genetics stats.\"\nlicense: \"MIT\"\n---\n\n# bcftools — VCF\u002FBCF Variant Manipulation Toolkit\n\n## Overview\n\nbcftools is the standard command-line toolkit for processing VCF (Variant Call Format) and BCF (Binary Call Format) files in the HTSlib ecosystem. It covers the complete post-variant-calling workflow: format conversion, quality filtering, variant normalization, multi-sample merging, annotation with external databases, genotype extraction, and QC statistics. bcftools uses streaming by design — most commands read from stdin and write to stdout, making it ideal for memory-efficient pipelines on large cohorts.\n\n## When to Use\n\n- Filtering variants by quality (QUAL, DP, AF) after variant calling\n- Merging VCF files from multiple samples into a joint call set\n- Adding rsIDs or gene annotations to variant calls\n- Extracting specific fields (genotypes, allele depths) as tabular output\n- Normalizing indel representations and splitting multi-allelic records\n- Calling variants from pileup output (mpileup + call)\n- Computing per-sample and overall VCF QC statistics\n- Use `GATK HaplotypeCaller` instead when calling variants with local realignment in human samples\n- Use `VCFtools` instead for population genetics statistics (Fst, LD, Hardy-Weinberg)\n- Use `bcftools` in the HTSlib pipeline; use `picard` for duplicate-marking and library metrics\n\n## Prerequisites\n\n- **Installation**: bcftools 1.17+ (part of HTSlib suite with samtools)\n- **Input requirements**: VCF or BGzipped+tabix-indexed VCF (`.vcf.gz + .vcf.gz.tbi`) for region queries\n- **Companion tools**: `samtools` for BAM processing; `tabix` for VCF indexing\n\n> **Check before installing**: The tool may already be available in the current environment (e.g., inside a `pixi` \u002F `conda` env). Run `command -v bcftools` first and skip the install commands below if it returns a path. When running inside a pixi project, invoke the tool via `pixi run bcftools` rather than bare `bcftools`.\n\n```bash\n# Bioconda (recommended — installs HTSlib suite)\nconda install -c bioconda bcftools\n\n# Homebrew (macOS)\nbrew install bcftools\n\n# Verify\nbcftools --version | head -1\n# bcftools 1.20\n\n# Index a VCF for region queries\nbcftools index -t variants.vcf.gz   # creates .tbi\nbcftools index -c variants.vcf.gz   # creates .csi (for chromosomes > 512 Mb)\n```\n\n## Pre-flight Interview\n\nSettle these with the user before writing any analysis code.\n\n```yaml\ndecisions:\n  - id: D1\n    param: filterExpression\n    kind: required\n    source: user\n    ask: \"Which variants should survive - by depth, genotype quality, allele balance, or population frequency?\"\n    default: null\n\n  - id: D2\n    param: multiallelicHandling\n    kind: required\n    source: user\n    ask: \"Should multi-allelic records be split into one row per alternate allele before filtering and annotation?\"\n    default: \"split - most annotation and comparison tools assume one alternate per row\"\n\n  - id: D3\n    param: leftAlignment\n    kind: required\n    source: upstream\n    depends_on: [D2]\n    ask: \"Should indels be left-aligned against the reference so the same variant is written identically across callers?\"\n    default: \"left-aligned when a reference FASTA is available\"\n\n  - id: D4\n    param: sampleSubset\n    kind: optional\n    source: user\n    ask: \"Should the output be restricted to particular samples?\"\n    default: \"all samples\"\n\n  - id: D5\n    param: regionSubset\n    kind: optional\n    source: user\n    ask: \"Should records be restricted to particular regions?\"\n    default: \"whole file\"\n\n  - id: D6\n    param: outputFormat\n    kind: optional\n    source: upstream\n    ask: \"Which container should the result be written in?\"\n    default: \"bgzip-compressed VCF with an index\"\n\n  - id: D7\n    param: threads\n    kind: never_ask\n    source: data\n    reason: \"Compression threads affect runtime only, not the records\"\n    default: \"min(4, available_cores)\"\n```\n\nD2 and D3 together decide whether two VCFs of the same sample can be compared\nat all. Unsplit multi-allelic rows and right-aligned indels produce apparent\nprivate variants that are the same variant written differently - and every\ndownstream intersection then reports a difference that does not exist.\n\n## Quick Start\n\n```bash\n# Typical post-calling workflow: normalize → filter → annotate → extract\nbcftools norm -d any -f reference.fa variants.vcf.gz \\\n  | bcftools filter -i 'QUAL>20 && DP>10' \\\n  | bcftools annotate -a dbSNP.vcf.gz -c ID \\\n  | bcftools view -O z -o final.vcf.gz\n\n# Index the output\nbcftools index -t final.vcf.gz\n\n# Count variants at each stage\nbcftools stats final.vcf.gz | grep \"^SN\"\n```\n\n## Core API\n\n### Module 1: VCF\u002FBCF I\u002FO and Format Conversion\n\nConvert between text VCF and binary BCF; compress and index for random access.\n\n```bash\n# VCF → compressed BCF (fastest format for piping)\nbcftools view -O b -o variants.bcf variants.vcf\n\n# BCF → VCF (for human-readable output)\nbcftools view -O v -o variants.vcf variants.bcf\n\n# VCF → bgzipped + indexed (standard archive format)\nbcftools view -O z -W -o variants.vcf.gz variants.vcf\n# -W automatically creates .tbi index after writing\n```\n\n```bash\n# Extract specific samples\nbcftools view -s sample1,sample2 -O z -o subset.vcf.gz variants.vcf.gz\n\n# Exclude samples (prefix with ^)\nbcftools view -s ^outlier_sample -O z -o cleaned.vcf.gz variants.vcf.gz\n\n# Extract by region (fast; requires index)\nbcftools view -r chr1:1000000-2000000 variants.vcf.gz -O v -o chr1_region.vcf\n\n# Streaming pipeline: no intermediate files\nsamtools mpileup -Ou input.bam | bcftools call -m -Oz -o calls.vcf.gz\n```\n\n### Module 2: Variant Filtering\n\nApply quality thresholds and FLAG-based filters to retain high-confidence calls.\n\n```bash\n# Expression-based filter (include)\nbcftools filter -i 'QUAL>20 && DP>10' variants.vcf.gz -O z -o filtered.vcf.gz\n\n# Expression-based filter (exclude)\nbcftools filter -e 'QUAL\u003C10 || DP\u003C5' variants.vcf.gz -O v -o filtered.vcf\n\n# Soft filter: mark but keep (sets FILTER field to label)\nbcftools filter -s LowQual -e 'QUAL\u003C20' variants.vcf.gz -O z -o soft_filtered.vcf.gz\n# Variants with QUAL\u003C20 get FILTER=\"LowQual\"; others get FILTER=PASS\n```\n\n```bash\n# Keep only PASS variants\nbcftools view -f PASS variants.vcf.gz -O z -o pass_only.vcf.gz\n\n# SNP-only output\nbcftools view --type snps variants.vcf.gz -O z -o snps.vcf.gz\n\n# Indel-only output\nbcftools view --type indels variants.vcf.gz -O z -o indels.vcf.gz\n\n# Filter by allele frequency and depth\nbcftools filter -i 'AF>0.1 && DP>20 && MQ>40' variants.vcf.gz -O z -o confident.vcf.gz\n\n# Remove SNPs within 3 bp of indels\nbcftools filter --SnpGap 3 variants.vcf.gz -O z -o gapfiltered.vcf.gz\n```\n\n### Module 3: VCF Query and Extraction\n\nTransform VCF content into tabular text for downstream analysis.\n\n```bash\n# Extract chrom, position, ref, alt, quality\nbcftools query -f '%CHROM\\t%POS\\t%REF\\t%ALT\\t%QUAL\\n' variants.vcf.gz > variants.txt\n\n# With header row (-H adds #-prefixed column names)\nbcftools query -H -f '%CHROM\\t%POS\\t%REF\\t%ALT\\t%QUAL\\n' variants.vcf.gz > variants.tsv\n\n# Per-sample genotypes and allele depths\nbcftools query -f '[%SAMPLE\\t%GT\\t%AD\\n]' variants.vcf.gz > genotypes.txt\n# Output: sample1  0\u002F1  25,18  (ref_depth,alt_depth)\n```\n\n```bash\n# Rare variants (AF \u003C 1%)\nbcftools query -i 'AF\u003C0.01' -f '%CHROM\\t%POS\\t%REF\\t%ALT\\t%AF\\n' \\\n    variants.vcf.gz > rare_variants.txt\n\n# Count variants per chromosome\nbcftools query -f '%CHROM\\n' variants.vcf.gz | sort | uniq -c | sort -rn\n\n# Extract genotype matrix across all samples\nbcftools query -f '%CHROM:%POS\\t[%GT\\t]\\n' -H variants.vcf.gz > genotype_matrix.tsv\n```\n\n### Module 4: Multi-file Operations\n\nCombine VCF files from multiple samples (merge) or chromosomes (concat).\n\n```bash\n# Merge: join VCFs from DIFFERENT sample sets (same variants)\nbcftools merge sample1.vcf.gz sample2.vcf.gz sample3.vcf.gz \\\n    -O z -o cohort.vcf.gz\n\n# Merge with auto-indexing and threading\nbcftools merge -O b -W --threads 4 sample*.vcf.gz > cohort.bcf\n\n# Concat: join VCFs from SAME sample set (different chromosomes or batches)\nbcftools concat chr1.vcf.gz chr2.vcf.gz chr3.vcf.gz -O z -o full.vcf.gz\n\n# Concat with overlap handling (from batched calling)\nbcftools concat -a --threads 4 batch*.vcf.gz -O z -o concat.vcf.gz\n```\n\n```bash\n# Pipeline: merge → filter → normalize\nbcftools merge sample1.vcf.gz sample2.vcf.gz \\\n    | bcftools filter -i 'QUAL>20' \\\n    | bcftools norm -d any -f genome.fa \\\n    | bcftools view -O z -o merged_clean.vcf.gz\nbcftools index -t merged_clean.vcf.gz\n\n# Extract genotype matrix from merged cohort\nbcftools merge cohort*.vcf.gz | bcftools query -f '[%GT\\t]\\n' > gt_matrix.tsv\n```\n\n### Module 5: Variant Annotation\n\nAdd identifiers, gene annotations, or external data to VCF records.\n\n```bash\n# Add rsIDs from dbSNP\nbcftools annotate -a dbSNP.vcf.gz -c ID variants.vcf.gz -O z -o rsid_annotated.vcf.gz\n\n# Annotate with BED file (adds gene names)\nbcftools annotate -a genes.bed.gz \\\n    -h \u003C(echo '##INFO=\u003CID=GENE,Number=1,Type=String,Description=\"Gene name\">') \\\n    -c CHROM,FROM,TO,GENE \\\n    variants.vcf.gz -O z -o gene_annotated.vcf.gz\n\n# Remove unwanted INFO fields\nbcftools annotate -x INFO\u002FAC,INFO\u002FAN,INFO\u002FMQ variants.vcf.gz -O v -o stripped.vcf\n```\n\n```bash\n# Normalize: left-align indels, split multi-allelic records\nbcftools norm -f reference.fa variants.vcf.gz -O v -o normalized.vcf\n\n# Split multi-allelic sites into separate records\nbcftools norm -m -any variants.vcf.gz -O v -o split.vcf\n\n# Deduplicate overlapping records\nbcftools norm -d any variants.vcf.gz -O z -o deduped.vcf.gz\n\n# Full normalize pipeline\nbcftools norm -m -any variants.vcf.gz | \\\n    bcftools norm -d any -f reference.fa | \\\n    bcftools view -O z -o normalized_split.vcf.gz\n```\n\n### Module 6: Statistics and QC\n\nGenerate summary metrics and per-sample variant counts.\n\n```bash\n# Full VCF statistics report\nbcftools stats variants.vcf.gz > qc.stats.txt\n\n# Extract Summary Numbers section only\ngrep \"^SN\" qc.stats.txt | cut -f3,4\n# number of records:    45231\n# number of SNPs:       38941\n# number of indels:     6290\n# ...\n\n# Per-sample stats (PSC = per-sample counts)\nbcftools stats -s - variants.vcf.gz | grep \"^PSC\" > per_sample.txt\n# cols: id  sample  hom_RR  het  hom_AA  ts  tv  indel  missing  singleton\n```\n\n```bash\n# Transition\u002Ftransversion ratio (genome-wide QC)\nbcftools stats variants.vcf.gz | grep \"Ts\u002FTv\"\n# Ts\u002FTv ratio: 2.06 (healthy WGS; \u003C1.8 or >2.2 suggests quality issues)\n\n# Check for sample contamination (F-statistic per sample)\nbcftools stats -s - variants.vcf.gz | grep \"^PSC\" | awk '{print $2, $9}'\n# sample  F_missing (high = poor sample quality)\n\n# Variant calling (mpileup → call pipeline)\nsamtools mpileup -Ou -f genome.fa *.bam | bcftools call -m -v -Oz -o calls.vcf.gz\nbcftools stats calls.vcf.gz | grep \"^SN\"\n```\n\n## Key Concepts\n\n### Output Format Flags\n\n```\n-O v  → VCF text (uncompressed)       default for human inspection\n-O z  → bgzipped VCF (.vcf.gz)        standard for archiving\n-O b  → binary BCF (compressed)        fastest for piping\n-O u  → binary BCF (uncompressed)      fastest output (no compression)\n```\n\n**Rule**: Use `-O b` or `-O u` for intermediate pipeline steps (no I\u002FO overhead). Use `-O z` for files you will store or index with tabix.\n\n### Filter Expression Syntax\n\nExpressions use INFO and FORMAT fields with comparison operators:\n\n```bash\n# INFO fields (one value per variant)\nQUAL>20          # quality score\nDP>10            # total depth\nAF\u003C0.05          # allele frequency\nMQ>40            # mapping quality\n\n# FORMAT fields (per-sample; use [] to iterate)\nGT==\"1\u002F1\"        # homozygous alternate\nAD[1]>5          # alt allele depth > 5\nGQ>20            # genotype quality\n\n# Combined\nQUAL>20 && DP>10 && AF>0.01\n(GT==\"0\u002F0\" || GT==\"1\u002F1\") && GQ>30\n```\n\n## Common Workflows\n\n### Workflow 1: Variant QC and Filtering Pipeline\n\n**Goal**: Normalize, filter, and annotate a raw variant call set for downstream analysis.\n\n```bash\n#!\u002Fbin\u002Fbash\nVCF=\"raw_calls.vcf.gz\"\nREF=\"reference.fa\"\nDBSNP=\"dbSNP_hg38.vcf.gz\"\nFINAL=\"variants_filtered_annotated.vcf.gz\"\n\n# 1. Normalize: left-align indels, split multi-allelic, deduplicate\nbcftools norm -m -any $VCF \\\n    | bcftools norm -d any -f $REF \\\n    | bcftools view -O z -o normalized.vcf.gz\nbcftools index -t normalized.vcf.gz\n\n# 2. Filter by quality and depth\nbcftools filter -i 'QUAL>20 && DP>10' normalized.vcf.gz \\\n    | bcftools filter --SnpGap 3 \\\n    | bcftools view -f PASS -O z -o filtered.vcf.gz\nbcftools index -t filtered.vcf.gz\n\n# 3. Annotate with rsIDs\nbcftools annotate -a $DBSNP -c ID filtered.vcf.gz -O z -o $FINAL\nbcftools index -t $FINAL\n\n# Report variant counts\necho \"Final variant count:\"\nbcftools stats $FINAL | grep \"number of records\"\n```\n\n### Workflow 2: Multi-sample Cohort Merging and Genotype Extraction\n\n**Goal**: Merge per-sample VCFs into a cohort VCF; extract a genotype matrix for GWAS.\n\n```bash\n#!\u002Fbin\u002Fbash\nSAMPLES=(sample1 sample2 sample3 sample4 sample5)\n\n# 1. Ensure all VCFs are indexed\nfor s in \"${SAMPLES[@]}\"; do\n    bcftools index -t ${s}.vcf.gz\ndone\n\n# 2. Merge into cohort VCF (only sites present in ALL samples: -m none)\nbcftools merge -m none \"${SAMPLES[@]\u002F%\u002F.vcf.gz}\" \\\n    -O z --threads 8 -o cohort.vcf.gz\nbcftools index -t cohort.vcf.gz\n\n# 3. Filter: PASS, SNPs only, MAF > 1%\nbcftools view -f PASS --type snps cohort.vcf.gz \\\n    | bcftools filter -i 'AF>0.01 && AF\u003C0.99' \\\n    | bcftools view -O z -o cohort_snps_filtered.vcf.gz\n\n# 4. Extract numeric genotype matrix (for plink\u002FR\u002FPython)\nbcftools query -H \\\n    -f '%CHROM\\t%POS\\t%REF\\t%ALT\\t[%GT\\t]\\n' \\\n    cohort_snps_filtered.vcf.gz > genotype_matrix.tsv\necho \"Genotype matrix: $(wc -l \u003C genotype_matrix.tsv) variants x ${#SAMPLES[@]} samples\"\n```\n\n## Key Parameters\n\n| Parameter | Command | Default | Range\u002FOptions | Effect |\n|-----------|---------|---------|---------------|--------|\n| `-O` | Most | `v` | `v`,`z`,`b`,`u` | Output format: VCF, bgzip-VCF, BCF, uncompressed BCF |\n| `-r` | Most | — | `chr:pos-end` | Region filter (requires tabix index) |\n| `-s` | Most | All | sample names | Include specific samples (prefix `^` to exclude) |\n| `-i` | filter | — | expression | Include variants matching expression |\n| `-e` | filter | — | expression | Exclude variants matching expression |\n| `-f` | query | — | format string | Custom output format string |\n| `--threads` | Most | 1 | 1–N | Compression\u002Fdecompression threads |\n| `-a` | annotate | — | file path | Annotation source (BED, VCF, TSV) |\n| `-m` | norm | none | `-any`, `+any` | Split (−) or join (+) multi-allelic records |\n| `-d` | norm | — | `all`,`any`,`snps` | Deduplication strategy |\n| `-W` | view | — | flag | Auto-create index after writing |\n| `-v` | call | — | flag | Output variant sites only (skip reference sites) |\n\n## Best Practices\n\n1. **Index before region queries**: `bcftools view -r chr1:...` requires a `.tbi` or `.csi` index. Always run `bcftools index -t output.vcf.gz` after creating any bgzipped VCF.\n\n2. **Normalize before merging or annotation**: Different callers represent the same indel differently. Run `bcftools norm -m -any | bcftools norm -d any -f ref.fa` before merging to prevent duplicate records.\n\n3. **Use `-O u` for pipeline intermediates**: Uncompressed BCF output (`-O u`) eliminates compression\u002Fdecompression overhead in multi-step pipes — typically 2-3× faster than `-O z`.\n\n4. **Verify Ts\u002FTv ratio after calling**: `bcftools stats variants.vcf.gz | grep Ts\u002FTv`. For human WGS, expect 2.0–2.1; exome 2.5–3.0. Values outside these ranges indicate quality problems.\n\n5. **Filter before merge for large cohorts**: Filtering per-sample VCFs before merging reduces memory and I\u002FO. Apply site-level QC (`QUAL>20 && DP>5`) to each sample before `bcftools merge`.\n\n6. **Check chromosome naming consistency**: bcftools fails silently if merging `chr1`-style with `1`-style VCFs. Verify with `bcftools view -h file.vcf.gz | grep \"^##contig\"`.\n\n## Common Recipes\n\n### Recipe: Count Variants Before and After Filtering\n\n```bash\necho \"Before:\" $(bcftools view -c 1 raw.vcf.gz | wc -l)\necho \"PASS only:\" $(bcftools view -f PASS raw.vcf.gz | bcftools view -c 1 | wc -l)\necho \"SNPs PASS:\" $(bcftools view -f PASS --type snps raw.vcf.gz | bcftools view -c 1 | wc -l)\n```\n\n### Recipe: Extract Heterozygous Sites for One Sample\n\n```bash\nbcftools view -s SAMPLE_A variants.vcf.gz \\\n    | bcftools filter -i 'GT=\"0\u002F1\"' \\\n    | bcftools query -f '%CHROM\\t%POS\\t%REF\\t%ALT\\n' > het_sites.txt\necho \"$(wc -l \u003C het_sites.txt) heterozygous sites\"\n```\n\n### Recipe: Compare Two VCF Files for Concordance\n\n```bash\n# Find variants unique to each file and shared\nbcftools isec -p isec_dir file1.vcf.gz file2.vcf.gz\nls isec_dir\u002F\n# 0000.vcf: private to file1\n# 0001.vcf: private to file2\n# 0002.vcf: shared (from file1 perspective)\n# 0003.vcf: shared (from file2 perspective)\necho \"Shared: $(wc -l \u003C isec_dir\u002F0002.vcf) variants\"\n```\n\n## Troubleshooting\n\n| Problem | Cause | Solution |\n|---------|-------|----------|\n| `Missing index` error | VCF not indexed (needed for `-r` region queries) | Run `bcftools index -t file.vcf.gz` |\n| `[E::vcf_parse_format]` parse error | Malformed VCF FORMAT or INFO field | Validate: `bcftools view file.vcf.gz 2>&1 \\| head -5`; check source tool version |\n| Empty filter output | Expression too strict or field missing | Test expression: `bcftools view -h file.vcf.gz \\| grep \"##INFO=\u003CID=QUAL\"` |\n| Merge: sample duplication | Duplicate sample names across input VCFs | Rename with `bcftools reheader -s new_names.txt sample.vcf.gz` before merging |\n| Wrong Ts\u002FTv ratio (\u003C1.8) | Low-quality calls or poor coverage | Apply stricter quality filter (`QUAL>30 && DP>15`); check alignment quality |\n| `concat` fails with overlap | Overlapping regions in input VCFs | Use `-a` flag: `bcftools concat -a file1.vcf.gz file2.vcf.gz` |\n| Annotation mismatch | chr naming conflict (chr1 vs 1) | Check: `bcftools view -h file.vcf.gz \\| grep contig`; rename with `bcftools annotate --rename-chrs` |\n| `query` returns empty fields | FORMAT field not populated for sample | Check VCF header: `bcftools view -h file.vcf.gz \\| grep FORMAT` |\n\n## Related Skills\n\n- **samtools-bam-processing** — BAM processing that feeds into bcftools variant calling pipeline\n- **bedtools-genomic-intervals** — intersecting VCF variants with genomic features (genes, regions)\n- **gget-genomic-databases** — Ensembl\u002FNCBI queries to annotate variant gene context\n\n## References\n\n- [bcftools documentation](https:\u002F\u002Fsamtools.github.io\u002Fbcftools\u002Fbcftools.html) — complete command reference\n- [GitHub: samtools\u002Fbcftools](https:\u002F\u002Fgithub.com\u002Fsamtools\u002Fbcftools) — source code, releases, issue tracker\n- Danecek et al. (2021) \"Twelve years of SAMtools and BCFtools\" — [GigaScience 10(2)](https:\u002F\u002Fdoi.org\u002F10.1093\u002Fgigascience\u002Fgiab008)\n- [VCF file format specification](https:\u002F\u002Fsamtools.github.io\u002Fhts-specs\u002FVCFv4.3.pdf) — field definitions and encoding rules\n","# bcftools — VCF\u002FBCF Variant Manipulation Toolkit\n\n## Overview\n\nbcftools is the standard command-line toolkit for processing VCF (Variant Call Format) and BCF (Binary Call Format) files in the HTSlib ecosystem. It covers the complete post-variant-calling workflow: format conversion, quality filtering, variant normalization, multi-sample merging, annotation with external databases, genotype extraction, and QC statistics. bcftools uses streaming by design — most commands read from stdin and write to stdout, making it ideal for memory-efficient pipelines on large cohorts.\n\n## When to Use\n\n- Filtering variants by quality (QUAL, DP, AF) after variant calling\n- Merging VCF files from multiple samples into a joint call set\n- Adding rsIDs or gene annotations to variant calls\n- Extracting specific fields (genotypes, allele depths) as tabular output\n- Normalizing indel representations and splitting multi-allelic records\n- Calling variants from pileup output (mpileup + call)\n- Computing per-sample and overall VCF QC statistics\n- Use `GATK HaplotypeCaller` instead when calling variants with local realignment in human samples\n- Use `VCFtools` instead for population genetics statistics (Fst, LD, Hardy-Weinberg)\n- Use `bcftools` in the HTSlib pipeline; use `picard` for duplicate-marking and library metrics\n\n## Prerequisites\n\n- **Installation**: bcftools 1.17+ (part of HTSlib suite with samtools)\n- **Input requirements**: VCF or BGzipped+tabix-indexed VCF (`.vcf.gz + .vcf.gz.tbi`) for region queries\n- **Companion tools**: `samtools` for BAM processing; `tabix` for VCF indexing\n\n> **Check before installing**: The tool may already be available in the current environment (e.g., inside a `pixi` \u002F `conda` env). Run `command -v bcftools` first and skip the install commands below if it returns a path. When running inside a pixi project, invoke the tool via `pixi run bcftools` rather than bare `bcftools`.\n\n```bash\n# Bioconda (recommended — installs HTSlib suite)\nconda install -c bioconda bcftools\n\n# Homebrew (macOS)\nbrew install bcftools\n\n# Verify\nbcftools --version | head -1\n# bcftools 1.20\n\n# Index a VCF for region queries\nbcftools index -t variants.vcf.gz   # creates .tbi\nbcftools index -c variants.vcf.gz   # creates .csi (for chromosomes > 512 Mb)\n```\n\n## Pre-flight Interview\n\nSettle these with the user before writing any analysis code.\n\n```yaml\ndecisions:\n  - id: D1\n    param: filterExpression\n    kind: required\n    source: user\n    ask: \"Which variants should survive - by depth, genotype quality, allele balance, or population frequency?\"\n    default: null\n\n  - id: D2\n    param: multiallelicHandling\n    kind: required\n    source: user\n    ask: \"Should multi-allelic records be split into one row per alternate allele before filtering and annotation?\"\n    default: \"split - most annotation and comparison tools assume one alternate per row\"\n\n  - id: D3\n    param: leftAlignment\n    kind: required\n    source: upstream\n    depends_on: [D2]\n    ask: \"Should indels be left-aligned against the reference so the same variant is written identically across callers?\"\n    default: \"left-aligned when a reference FASTA is available\"\n\n  - id: D4\n    param: sampleSubset\n    kind: optional\n    source: user\n    ask: \"Should the output be restricted to particular samples?\"\n    default: \"all samples\"\n\n  - id: D5\n    param: regionSubset\n    kind: optional\n    source: user\n    ask: \"Should records be restricted to particular regions?\"\n    default: \"whole file\"\n\n  - id: D6\n    param: outputFormat\n    kind: optional\n    source: upstream\n    ask: \"Which container should the result be written in?\"\n    default: \"bgzip-compressed VCF with an index\"\n\n  - id: D7\n    param: threads\n    kind: never_ask\n    source: data\n    reason: \"Compression threads affect runtime only, not the records\"\n    default: \"min(4, available_cores)\"\n```\n\nD2 and D3 together decide whether two VCFs of the same sample can be compared\nat all. Unsplit multi-allelic rows and right-aligned indels produce apparent\nprivate variants that are the same variant written differently - and every\ndownstream intersection then reports a difference that does not exist.\n\n## Quick Start\n\n```bash\n# Typical post-calling workflow: normalize → filter → annotate → extract\nbcftools norm -d any -f reference.fa variants.vcf.gz \\\n  | bcftools filter -i 'QUAL>20 && DP>10' \\\n  | bcftools annotate -a dbSNP.vcf.gz -c ID \\\n  | bcftools view -O z -o final.vcf.gz\n\n# Index the output\nbcftools index -t final.vcf.gz\n\n# Count variants at each stage\nbcftools stats final.vcf.gz | grep \"^SN\"\n```\n\n## Core API\n\n### Module 1: VCF\u002FBCF I\u002FO and Format Conversion\n\nConvert between text VCF and binary BCF; compress and index for random access.\n\n```bash\n# VCF → compressed BCF (fastest format for piping)\nbcftools view -O b -o variants.bcf variants.vcf\n\n# BCF → VCF (for human-readable output)\nbcftools view -O v -o variants.vcf variants.bcf\n\n# VCF → bgzipped + indexed (standard archive format)\nbcftools view -O z -W -o variants.vcf.gz variants.vcf\n# -W automatically creates .tbi index after writing\n```\n\n```bash\n# Extract specific samples\nbcftools view -s sample1,sample2 -O z -o subset.vcf.gz variants.vcf.gz\n\n# Exclude samples (prefix with ^)\nbcftools view -s ^outlier_sample -O z -o cleaned.vcf.gz variants.vcf.gz\n\n# Extract by region (fast; requires index)\nbcftools view -r chr1:1000000-2000000 variants.vcf.gz -O v -o chr1_region.vcf\n\n# Streaming pipeline: no intermediate files\nsamtools mpileup -Ou input.bam | bcftools call -m -Oz -o calls.vcf.gz\n```\n\n### Module 2: Variant Filtering\n\nApply quality thresholds and FLAG-based filters to retain high-confidence calls.\n\n```bash\n# Expression-based filter (include)\nbcftools filter -i 'QUAL>20 && DP>10' variants.vcf.gz -O z -o filtered.vcf.gz\n\n# Expression-based filter (exclude)\nbcftools filter -e 'QUAL\u003C10 || DP\u003C5' variants.vcf.gz -O v -o filtered.vcf\n\n# Soft filter: mark but keep (sets FILTER field to label)\nbcftools filter -s LowQual -e 'QUAL\u003C20' variants.vcf.gz -O z -o soft_filtered.vcf.gz\n# Variants with QUAL\u003C20 get FILTER=\"LowQual\"; others get FILTER=PASS\n```\n\n```bash\n# Keep only PASS variants\nbcftools view -f PASS variants.vcf.gz -O z -o pass_only.vcf.gz\n\n# SNP-only output\nbcftools view --type snps variants.vcf.gz -O z -o snps.vcf.gz\n\n# Indel-only output\nbcftools view --type indels variants.vcf.gz -O z -o indels.vcf.gz\n\n# Filter by allele frequency and depth\nbcftools filter -i 'AF>0.1 && DP>20 && MQ>40' variants.vcf.gz -O z -o confident.vcf.gz\n\n# Remove SNPs within 3 bp of indels\nbcftools filter --SnpGap 3 variants.vcf.gz -O z -o gapfiltered.vcf.gz\n```\n\n### Module 3: VCF Query and Extraction\n\nTransform VCF content into tabular text for downstream analysis.\n\n```bash\n# Extract chrom, position, ref, alt, quality\nbcftools query -f '%CHROM\\t%POS\\t%REF\\t%ALT\\t%QUAL\\n' variants.vcf.gz > variants.txt\n\n# With header row (-H adds #-prefixed column names)\nbcftools query -H -f '%CHROM\\t%POS\\t%REF\\t%ALT\\t%QUAL\\n' variants.vcf.gz > variants.tsv\n\n# Per-sample genotypes and allele depths\nbcftools query -f '[%SAMPLE\\t%GT\\t%AD\\n]' variants.vcf.gz > genotypes.txt\n# Output: sample1  0\u002F1  25,18  (ref_depth,alt_depth)\n```\n\n```bash\n# Rare variants (AF \u003C 1%)\nbcftools query -i 'AF\u003C0.01' -f '%CHROM\\t%POS\\t%REF\\t%ALT\\t%AF\\n' \\\n    variants.vcf.gz > rare_variants.txt\n\n# Count variants per chromosome\nbcftools query -f '%CHROM\\n' variants.vcf.gz | sort | uniq -c | sort -rn\n\n# Extract genotype matrix across all samples\nbcftools query -f '%CHROM:%POS\\t[%GT\\t]\\n' -H variants.vcf.gz > genotype_matrix.tsv\n```\n\n### Module 4: Multi-file Operations\n\nCombine VCF files from multiple samples (merge) or chromosomes (concat).\n\n```bash\n# Merge: join VCFs from DIFFERENT sample sets (same variants)\nbcftools merge sample1.vcf.gz sample2.vcf.gz sample3.vcf.gz \\\n    -O z -o cohort.vcf.gz\n\n# Merge with auto-indexing and threading\nbcftools merge -O b -W --threads 4 sample*.vcf.gz > cohort.bcf\n\n# Concat: join VCFs from SAME sample set (different chromosomes or batches)\nbcftools concat chr1.vcf.gz chr2.vcf.gz chr3.vcf.gz -O z -o full.vcf.gz\n\n# Concat with overlap handling (from batched calling)\nbcftools concat -a --threads 4 batch*.vcf.gz -O z -o concat.vcf.gz\n```\n\n```bash\n# Pipeline: merge → filter → normalize\nbcftools merge sample1.vcf.gz sample2.vcf.gz \\\n    | bcftools filter -i 'QUAL>20' \\\n    | bcftools norm -d any -f genome.fa \\\n    | bcftools view -O z -o merged_clean.vcf.gz\nbcftools index -t merged_clean.vcf.gz\n\n# Extract genotype matrix from merged cohort\nbcftools merge cohort*.vcf.gz | bcftools query -f '[%GT\\t]\\n' > gt_matrix.tsv\n```\n\n### Module 5: Variant Annotation\n\nAdd identifiers, gene annotations, or external data to VCF records.\n\n```bash\n# Add rsIDs from dbSNP\nbcftools annotate -a dbSNP.vcf.gz -c ID variants.vcf.gz -O z -o rsid_annotated.vcf.gz\n\n# Annotate with BED file (adds gene names)\nbcftools annotate -a genes.bed.gz \\\n    -h \u003C(echo '##INFO=\u003CID=GENE,Number=1,Type=String,Description=\"Gene name\">') \\\n    -c CHROM,FROM,TO,GENE \\\n    variants.vcf.gz -O z -o gene_annotated.vcf.gz\n\n# Remove unwanted INFO fields\nbcftools annotate -x INFO\u002FAC,INFO\u002FAN,INFO\u002FMQ variants.vcf.gz -O v -o stripped.vcf\n```\n\n```bash\n# Normalize: left-align indels, split multi-allelic records\nbcftools norm -f reference.fa variants.vcf.gz -O v -o normalized.vcf\n\n# Split multi-allelic sites into separate records\nbcftools norm -m -any variants.vcf.gz -O v -o split.vcf\n\n# Deduplicate overlapping records\nbcftools norm -d any variants.vcf.gz -O z -o deduped.vcf.gz\n\n# Full normalize pipeline\nbcftools norm -m -any variants.vcf.gz | \\\n    bcftools norm -d any -f reference.fa | \\\n    bcftools view -O z -o normalized_split.vcf.gz\n```\n\n### Module 6: Statistics and QC\n\nGenerate summary metrics and per-sample variant counts.\n\n```bash\n# Full VCF statistics report\nbcftools stats variants.vcf.gz > qc.stats.txt\n\n# Extract Summary Numbers section only\ngrep \"^SN\" qc.stats.txt | cut -f3,4\n# number of records:    45231\n# number of SNPs:       38941\n# number of indels:     6290\n# ...\n\n# Per-sample stats (PSC = per-sample counts)\nbcftools stats -s - variants.vcf.gz | grep \"^PSC\" > per_sample.txt\n# cols: id  sample  hom_RR  het  hom_AA  ts  tv  indel  missing  singleton\n```\n\n```bash\n# Transition\u002Ftransversion ratio (genome-wide QC)\nbcftools stats variants.vcf.gz | grep \"Ts\u002FTv\"\n# Ts\u002FTv ratio: 2.06 (healthy WGS; \u003C1.8 or >2.2 suggests quality issues)\n\n# Check for sample contamination (F-statistic per sample)\nbcftools stats -s - variants.vcf.gz | grep \"^PSC\" | awk '{print $2, $9}'\n# sample  F_missing (high = poor sample quality)\n\n# Variant calling (mpileup → call pipeline)\nsamtools mpileup -Ou -f genome.fa *.bam | bcftools call -m -v -Oz -o calls.vcf.gz\nbcftools stats calls.vcf.gz | grep \"^SN\"\n```\n\n## Key Concepts\n\n### Output Format Flags\n\n```\n-O v  → VCF text (uncompressed)       default for human inspection\n-O z  → bgzipped VCF (.vcf.gz)        standard for archiving\n-O b  → binary BCF (compressed)        fastest for piping\n-O u  → binary BCF (uncompressed)      fastest output (no compression)\n```\n\n**Rule**: Use `-O b` or `-O u` for intermediate pipeline steps (no I\u002FO overhead). Use `-O z` for files you will store or index with tabix.\n\n### Filter Expression Syntax\n\nExpressions use INFO and FORMAT fields with comparison operators:\n\n```bash\n# INFO fields (one value per variant)\nQUAL>20          # quality score\nDP>10            # total depth\nAF\u003C0.05          # allele frequency\nMQ>40            # mapping quality\n\n# FORMAT fields (per-sample; use [] to iterate)\nGT==\"1\u002F1\"        # homozygous alternate\nAD[1]>5          # alt allele depth > 5\nGQ>20            # genotype quality\n\n# Combined\nQUAL>20 && DP>10 && AF>0.01\n(GT==\"0\u002F0\" || GT==\"1\u002F1\") && GQ>30\n```\n\n## Common Workflows\n\n### Workflow 1: Variant QC and Filtering Pipeline\n\n**Goal**: Normalize, filter, and annotate a raw variant call set for downstream analysis.\n\n```bash\n#!\u002Fbin\u002Fbash\nVCF=\"raw_calls.vcf.gz\"\nREF=\"reference.fa\"\nDBSNP=\"dbSNP_hg38.vcf.gz\"\nFINAL=\"variants_filtered_annotated.vcf.gz\"\n\n# 1. Normalize: left-align indels, split multi-allelic, deduplicate\nbcftools norm -m -any $VCF \\\n    | bcftools norm -d any -f $REF \\\n    | bcftools view -O z -o normalized.vcf.gz\nbcftools index -t normalized.vcf.gz\n\n# 2. Filter by quality and depth\nbcftools filter -i 'QUAL>20 && DP>10' normalized.vcf.gz \\\n    | bcftools filter --SnpGap 3 \\\n    | bcftools view -f PASS -O z -o filtered.vcf.gz\nbcftools index -t filtered.vcf.gz\n\n# 3. Annotate with rsIDs\nbcftools annotate -a $DBSNP -c ID filtered.vcf.gz -O z -o $FINAL\nbcftools index -t $FINAL\n\n# Report variant counts\necho \"Final variant count:\"\nbcftools stats $FINAL | grep \"number of records\"\n```\n\n### Workflow 2: Multi-sample Cohort Merging and Genotype Extraction\n\n**Goal**: Merge per-sample VCFs into a cohort VCF; extract a genotype matrix for GWAS.\n\n```bash\n#!\u002Fbin\u002Fbash\nSAMPLES=(sample1 sample2 sample3 sample4 sample5)\n\n# 1. Ensure all VCFs are indexed\nfor s in \"${SAMPLES[@]}\"; do\n    bcftools index -t ${s}.vcf.gz\ndone\n\n# 2. Merge into cohort VCF (only sites present in ALL samples: -m none)\nbcftools merge -m none \"${SAMPLES[@]\u002F%\u002F.vcf.gz}\" \\\n    -O z --threads 8 -o cohort.vcf.gz\nbcftools index -t cohort.vcf.gz\n\n# 3. Filter: PASS, SNPs only, MAF > 1%\nbcftools view -f PASS --type snps cohort.vcf.gz \\\n    | bcftools filter -i 'AF>0.01 && AF\u003C0.99' \\\n    | bcftools view -O z -o cohort_snps_filtered.vcf.gz\n\n# 4. Extract numeric genotype matrix (for plink\u002FR\u002FPython)\nbcftools query -H \\\n    -f '%CHROM\\t%POS\\t%REF\\t%ALT\\t[%GT\\t]\\n' \\\n    cohort_snps_filtered.vcf.gz > genotype_matrix.tsv\necho \"Genotype matrix: $(wc -l \u003C genotype_matrix.tsv) variants x ${#SAMPLES[@]} samples\"\n```\n\n## Key Parameters\n\n| Parameter | Command | Default | Range\u002FOptions | Effect |\n|-----------|---------|---------|---------------|--------|\n| `-O` | Most | `v` | `v`,`z`,`b`,`u` | Output format: VCF, bgzip-VCF, BCF, uncompressed BCF |\n| `-r` | Most | — | `chr:pos-end` | Region filter (requires tabix index) |\n| `-s` | Most | All | sample names | Include specific samples (prefix `^` to exclude) |\n| `-i` | filter | — | expression | Include variants matching expression |\n| `-e` | filter | — | expression | Exclude variants matching expression |\n| `-f` | query | — | format string | Custom output format string |\n| `--threads` | Most | 1 | 1–N | Compression\u002Fdecompression threads |\n| `-a` | annotate | — | file path | Annotation source (BED, VCF, TSV) |\n| `-m` | norm | none | `-any`, `+any` | Split (−) or join (+) multi-allelic records |\n| `-d` | norm | — | `all`,`any`,`snps` | Deduplication strategy |\n| `-W` | view | — | flag | Auto-create index after writing |\n| `-v` | call | — | flag | Output variant sites only (skip reference sites) |\n\n## Best Practices\n\n1. **Index before region queries**: `bcftools view -r chr1:...` requires a `.tbi` or `.csi` index. Always run `bcftools index -t output.vcf.gz` after creating any bgzipped VCF.\n\n2. **Normalize before merging or annotation**: Different callers represent the same indel differently. Run `bcftools norm -m -any | bcftools norm -d any -f ref.fa` before merging to prevent duplicate records.\n\n3. **Use `-O u` for pipeline intermediates**: Uncompressed BCF output (`-O u`) eliminates compression\u002Fdecompression overhead in multi-step pipes — typically 2-3× faster than `-O z`.\n\n4. **Verify Ts\u002FTv ratio after calling**: `bcftools stats variants.vcf.gz | grep Ts\u002FTv`. For human WGS, expect 2.0–2.1; exome 2.5–3.0. Values outside these ranges indicate quality problems.\n\n5. **Filter before merge for large cohorts**: Filtering per-sample VCFs before merging reduces memory and I\u002FO. Apply site-level QC (`QUAL>20 && DP>5`) to each sample before `bcftools merge`.\n\n6. **Check chromosome naming consistency**: bcftools fails silently if merging `chr1`-style with `1`-style VCFs. Verify with `bcftools view -h file.vcf.gz | grep \"^##contig\"`.\n\n## Common Recipes\n\n### Recipe: Count Variants Before and After Filtering\n\n```bash\necho \"Before:\" $(bcftools view -c 1 raw.vcf.gz | wc -l)\necho \"PASS only:\" $(bcftools view -f PASS raw.vcf.gz | bcftools view -c 1 | wc -l)\necho \"SNPs PASS:\" $(bcftools view -f PASS --type snps raw.vcf.gz | bcftools view -c 1 | wc -l)\n```\n\n### Recipe: Extract Heterozygous Sites for One Sample\n\n```bash\nbcftools view -s SAMPLE_A variants.vcf.gz \\\n    | bcftools filter -i 'GT=\"0\u002F1\"' \\\n    | bcftools query -f '%CHROM\\t%POS\\t%REF\\t%ALT\\n' > het_sites.txt\necho \"$(wc -l \u003C het_sites.txt) heterozygous sites\"\n```\n\n### Recipe: Compare Two VCF Files for Concordance\n\n```bash\n# Find variants unique to each file and shared\nbcftools isec -p isec_dir file1.vcf.gz file2.vcf.gz\nls isec_dir\u002F\n# 0000.vcf: private to file1\n# 0001.vcf: private to file2\n# 0002.vcf: shared (from file1 perspective)\n# 0003.vcf: shared (from file2 perspective)\necho \"Shared: $(wc -l \u003C isec_dir\u002F0002.vcf) variants\"\n```\n\n## Troubleshooting\n\n| Problem | Cause | Solution |\n|---------|-------|----------|\n| `Missing index` error | VCF not indexed (needed for `-r` region queries) | Run `bcftools index -t file.vcf.gz` |\n| `[E::vcf_parse_format]` parse error | Malformed VCF FORMAT or INFO field | Validate: `bcftools view file.vcf.gz 2>&1 \\| head -5`; check source tool version |\n| Empty filter output | Expression too strict or field missing | Test expression: `bcftools view -h file.vcf.gz \\| grep \"##INFO=\u003CID=QUAL\"` |\n| Merge: sample duplication | Duplicate sample names across input VCFs | Rename with `bcftools reheader -s new_names.txt sample.vcf.gz` before merging |\n| Wrong Ts\u002FTv ratio (\u003C1.8) | Low-quality calls or poor coverage | Apply stricter quality filter (`QUAL>30 && DP>15`); check alignment quality |\n| `concat` fails with overlap | Overlapping regions in input VCFs | Use `-a` flag: `bcftools concat -a file1.vcf.gz file2.vcf.gz` |\n| Annotation mismatch | chr naming conflict (chr1 vs 1) | Check: `bcftools view -h file.vcf.gz \\| grep contig`; rename with `bcftools annotate --rename-chrs` |\n| `query` returns empty fields | FORMAT field not populated for sample | Check VCF header: `bcftools view -h file.vcf.gz \\| grep FORMAT` |\n\n## Related Skills\n\n- **samtools-bam-processing** — BAM processing that feeds into bcftools variant calling pipeline\n- **bedtools-genomic-intervals** — intersecting VCF variants with genomic features (genes, regions)\n- **gget-genomic-databases** — Ensembl\u002FNCBI queries to annotate variant gene context\n\n## References\n\n- [bcftools documentation](https:\u002F\u002Fsamtools.github.io\u002Fbcftools\u002Fbcftools.html) — complete command reference\n- [GitHub: samtools\u002Fbcftools](https:\u002F\u002Fgithub.com\u002Fsamtools\u002Fbcftools) — source code, releases, issue tracker\n- Danecek et al. (2021) \"Twelve years of SAMtools and BCFtools\" — [GigaScience 10(2)](https:\u002F\u002Fdoi.org\u002F10.1093\u002Fgigascience\u002Fgiab008)\n- [VCF file format specification](https:\u002F\u002Fsamtools.github.io\u002Fhts-specs\u002FVCFv4.3.pdf) — field definitions and encoding rules\n",{"name":5,"license":15,"description":7},"master","fd76f882a04e445e899d5cfb2732f2105ea054ee","skills\u002Fawesome-skills\u002Fbcftools-variant-manipulation",0,"https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS","https:\u002F\u002Fbg-szy.github.io\u002FTOP-SKILLS\u002F","https:\u002F\u002Fgithub.com\u002Fbg-szy","https:\u002F\u002Fwww.ecust.edu.cn\u002F","a student of East China University of Science and Technology","2026-11-15 03:38:02",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add bg-szy\u002FTOP-SKILLS --skill bcftools-variant-manipulation",{"tool":40,"command":41},"bunx","bunx skills add bg-szy\u002FTOP-SKILLS --skill bcftools-variant-manipulation",{"tool":43,"command":44},"pnpm","pnpm dlx skills add bg-szy\u002FTOP-SKILLS --skill bcftools-variant-manipulation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fawesome-skills\u002Fbcftools-variant-manipulation\u002FSKILL.md",true,[],[49,57,64,71,78,85],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":56},"01M7DXW9N826PKXK174PVW3038","serpmaven","Scrape Google search results (SERP) to JSON with SERP Maven (serpmaven) - a real Chrome browser on a residential proxy with sticky sessions. Run it as a CLI, a Python library, a local HTTP search API (`serve`), an MCP server or a Docker image; set the proxy login, workers, pages and cost tracking. Use when the user wants Google results, rank tracking, a self-hosted SERP API, or live Google search for an AI agent.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Fserpmaven\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":56},"01M7DXVHSTWDV65475QEQ915M7","revnu-landing-page-audit","Find out why a landing page isn't turning visitors into signups, demos or sales. Audits one page against what the ad, post or search that sends people there promised, then checks the first screen, proof, call to action, friction and mobile. Returns at most 7 prioritized fixes, plus what is fine and what could not be checked; rewrites specific lines and fixes the page in the repo when asked. Never promises a conversion lift. Works without a Revnu account. Use when the user says or asks: \"audit my landing page\", \"why isn't this page converting\", \"review my homepage\", \"my ads get clicks but no signups\", \"people bounce from the pricing page\", \"CRO review\", \"improve conversion rate\", \"is my hero section clear\", \"roast my landing page\", \"rewrite my headline\", \"what's wrong with this page\", \"landing page feedback\", \"make the signup page convert better\". Not for SEO or AI-search audits, page speed engineering on its own, or building a new page from scratch.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-landing-page-audit\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":56},"01M7DXV8X2D7B3VTD4HHYYHTGR","revnu-growth-context","Write down once who buys, what they're stuck on, what it costs, what proof you have and what you've already tried, so every growth task starts from facts instead of a questionnaire. Creates or updates .agents\u002Frevnu-growth.md from the repo, the live site and the user, and imports an existing product-marketing.md. Use when the user says \"set up our marketing context\", \"who is our ideal customer\", \"write our ICP\", \"describe the product for marketing\", \"positioning doc\", \"what's our brand voice\", \"remember this about our customers\", \"log what we tried\", \"what have we learned from marketing\", \"we changed pricing, update the context\", \"update our growth notes\", \"summarize the business for the agent\", \"import my product-marketing.md\", \"start a growth doc\", or before a first marketing, SEO, outreach or launch task when no context file exists. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-growth-context\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":56},"01M7DXV0DGJ1G0A60PAHC6J3C5","revnu-get-listed","Get onto the third-party pages AI answers and search cite when buyers ask for the best tool in your category: \"best X\" roundups, directories, review sites, GitHub awesome lists, community threads and comparison pages. Finds which ones are cited, ranks them by fit and effort, and drafts each submission, PR or pitch by the target's own rules. Use when the user says \"get us listed\", \"which directories should we submit to\", \"how do we get into best-of lists\", \"why does ChatGPT recommend competitors and not us\", \"get mentioned in AI answers\", \"submit to awesome lists\", \"get on G2\", \"where are our competitors listed\", \"pitch listicle authors\", \"find backlink opportunities\", \"launch directories\", \"get into roundups\", \"Product Hunt alternatives\", \"where should we be listed\", \"get cited by Perplexity\". Never submits, pays or posts without a yes. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-get-listed\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":56},"01M7DXTSPMGT9D6DSS0HP9BSTA","revnu-ai-readiness-audit","Audit whether your website gives ChatGPT, Perplexity, Claude, Gemini and Google's AI Overviews something worth quoting, and fix the pages that don't. Use when the user says or asks \"is my site ready for AI search\", \"audit my site for AI answers\", \"AEO audit\", \"GEO audit\", \"why doesn't ChatGPT quote our pricing\", \"make our pages citable by AI\", \"do I need llms.txt\", \"does schema help with ChatGPT\", \"check our structured data\", \"is our content visible without JavaScript\", \"AI SEO audit\", \"optimize our homepage for AI answers\", \"LLM SEO check\", \"why does AI get our product wrong\", \"fix our site for AI Overviews\". Checks fetchability and indexability, answers in the raw HTML, entity facts, schema (including JS-injected markup), headings, dates and llms.txt, then gives at most 10 prioritised fixes and edits the repo when asked. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-ai-readiness-audit\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":56},"01M7DXSZHCVTRS620GC3S97JZV","proxy-troubleshooting","Diagnose residential proxy failures, with NodeMaven's gateway as the reference - 407 with correct credentials, 406, 410, 500, a connection that hangs, ERR_TUNNEL_CONNECTION_FAILED in a browser, Playwright or Puppeteer ignoring proxy credentials, a sticky session that changes IP, geo-targeting that is silently ignored, passwords with special characters, and unexpected traffic from headless Chrome. Use when a proxy connection fails, returns the wrong location, or costs more traffic than expected.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Fproxy-troubleshooting\u002FSKILL.md",[],[]]