It is easy to get allele frequency for a site (mutation/snp etc.) from a bam file. How do we get the allele frequency of a gene (in some metric) from a .bam file, like dominant allele frequency of a gene, for instance? Any advice from population genetics people here? Thanks!
call the position of your gene with samtools http://www.htslib.org/workflow/
samtools mpileup -ugf ref.fa -r "chr1:1234-2345" your.bam | bcftools call -vm -o out.vcf
your should get the variants with the AF fields
For one chromosome, I ran the command: samtools mpileup -ugf GRCz10.fasta mutant_chr12.bam | bcftools call -vm -o chr12.mut.raw.vcf
I seem to have used the same options for mpileup and bcftools call, but I do not seem to get the AF field in my output vcf files. I do get the DP4 field nested in the info column, but is there a way to get a seperate column for AF or at least a seperate column for DP4 in the vcf file?