How can I get an allele count table from a .vcf file?
3
0
Entering edit mode
4 months ago
mrk • 0

What's the most efficient way to generate a table of allele counts from a .vcf file? Ideally columns Chrom, Position, ref counts, and alt counts, across all sites in a vcf file? I think what I'm looking for is basically CollectAllelicCounts from GATK but on a vcf rather than bam file. Thanks.

GATK calling variant vcf • 622 views
ADD COMMENT
0
Entering edit mode
4 months ago
$ bcftools stats in.vcf.gz | grep -wF ST
# ST, Substitution types:
# ST    [2]id   [3]type [4]count
ST  0   A>C 5
ST  0   A>G 5
ST  0   A>T 3
ST  0   C>A 5
ST  0   C>G 2
ST  0   C>T 0
ST  0   G>A 1
ST  0   G>C 4
ST  0   G>T 2
ST  0   T>A 4
ST  0   T>C 4
ST  0   T>G 5
ADD COMMENT
0
Entering edit mode
4 months ago

With plink2:

plink2 --vcf in.vcf.gz --freq counts cols=chrom,pos,ref,alt,reffreq,altfreq

ADD COMMENT
0
Entering edit mode
4 months ago

With TileDB-VCF (where uri is a TileDB-VCF dataset)

tiledbvcf.read_allele_frequency(uri, region=None)
ADD COMMENT

Login before adding your answer.

Traffic: 1724 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6