Question: minor allele frequency (MAF) from vcf
1
gravatar for panbar
4.6 years ago by
panbar20
panbar20 wrote:

How minor allele frequency (MAF) is calculated from the DP4 fields of vcf file? Can anyone help with a unix shell script?

sequencing snp next-gen genome • 4.9k views
ADD COMMENTlink modified 4.3 years ago • written 4.6 years ago by panbar20
2

Obtain MAF from VCF

ADD REPLYlink written 4.5 years ago by stolarek.ir650

Its a problematic situation.

ADD REPLYlink written 4.3 years ago by lovedohurt0

Testing the leveling comment.

ADD REPLYlink written 4.3 years ago by lovedohurt0

That's cool man..! Its working fine.

ADD REPLYlink written 4.3 years ago by lovedohurt0
1
gravatar for panbar
4.3 years ago by
panbar20
panbar20 wrote:

It is easy to do with awk. I found an easy way as follows. for single input snv vcf file

awk '$1=="#CHROM" {print $0 "\tMAF"; next}; NF { info=$8; gsub(/.*;DP4=|;MQ=.*/, "", info); split(info, a, /,/); print $0 "\t" (a[3]+a[4])/(a[1]+a[2]+a[3]+a[4])}' inputfile.vcf > outputfile.vcf

for multiple input snv vcf files

awk '$1=="#CHROM" {print $0 "\tMAF" > FILENAME".MAF.vcf"; next}; NF { info=$8; gsub(/.*;DP4=|;MQ=.*/, "", info); split(info, a, /,/); print $0 "\t" (a[3]+a[4])/(a[1]+a[2]+a[3]+a[4]) > FILENAME".MAF.vcf"}' inputfile1.vcf inputfile2.vcf

ADD COMMENTlink modified 4.3 years ago • written 4.3 years ago by panbar20
0
gravatar for alexisdereeper
4.5 years ago by
alexisdereeper30 wrote:

The SNiPlay online pipeline implements VCFtools that calculates MAF from a VCF file: http://sniplay.southgreen.fr/cgi-bin/analysis_v3.cgi

ADD COMMENTlink written 4.5 years ago by alexisdereeper30
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1506 users visited in the last hour