Convert a VCF-file in a user specific Format
1
0
Entering edit mode
3.3 years ago

Hello everyone,

I am curious if it is possible to convert a VCF-File (with multiple samples) in a Format whith 5 columns.

  1. Column should be Sample ID
  2. Column: Position on the chromosome
  3. Genotyp
  4. Number of reads covering site
  5. QUAL phred-scaled quality score for the assertion made in ALT.

May there is allready a tool which can perform this, or if I need to do it myself may you can recommend me a good programm (like awk or sed) and recommend me a code.

Aim of this should be that afterwards i can filter variants via Quality score and number of reads covering site.

Thanks a lot in advance

VCF • 1.4k views
ADD COMMENT
0
Entering edit mode

Can you post a few (2-3 lines of your .vcf + all of the header?). I can give you a solution then.

ADD REPLY
0
Entering edit mode

Thank you very much Jorges answer was allready very helpful

ADD REPLY
3
Entering edit mode
3.3 years ago

That's precisely what bcftools query was designed for. You just have to build your desired output format using the existing VCF variables. I'm guessing from your query that this command should be helpful:

bcftools query -f '[%SAMPLE\t%POS\t%GT\t%DP\t%QUAL\n]' file.vcf.gz
ADD COMMENT
0
Entering edit mode

This is absolutely what bcftools query was designed for. Thank you very much, it helps a lot:)

ADD REPLY

Login before adding your answer.

Traffic: 1588 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