Hi, I want to calculate B allele frequency from a vcf file. I found that vcftools can be used to estimate allele frequency of REF allele and ALT allele. I wonder if vcftools could also estimate B allele frequency. Are there other tools that we could use for calculation BAF from vcf file?
If you are using R, you can take a look at the CopyNumberPlots Bioconductor package. Its focused on generating plots of BAF, LRR and copy-number segments from SNP-array and NGS, but it has a handy function to compute the BAF from a VCF where it will autodetect the presence of AD, GT and other formats for the allele depth. Just bear in mind that you need to set mirror.baf to false, since it will flip half of the allele frequencies to mimic the effect of the B-allele definition in Illumina arrays.