Question: How to create ID field in vcf with vcftools
0
gravatar for gen
3.8 years ago by
gen0
Seoul
gen0 wrote:

vcftools is really good at extracting some information from vcf files.

However, I have some missing information in the output file when I try this: 

vcftools --vcf my.vcf --get-INFO AF --out my.out.vcf

my.out should keep "ID" field (rsID) as in the original my.vcf, but it doesn't.

 

Is there any vcftools option or other ways to keep ID in the result vcf?

I've cosulted many documentations but no one can answer it.

 

Thanks in advance.

 

 

 

 

 

software error • 2.8k views
ADD COMMENTlink modified 3.7 years ago by Biostar ♦♦ 20 • written 3.8 years ago by gen0
0
gravatar for Jorge Amigo
3.8 years ago by
Jorge Amigo11k
Santiago de Compostela, Spain
Jorge Amigo11k wrote:

the --get-INFO option from vcftools generates a tabulated file with the mandatory columns (CHROM, POS, REF, ALT) plus the variable of the INFO column that you require. unfortunately the ID is not usually contained in the INFO column, so extracting it would have to be done manually by scripting or programming an ad hoc solution.

but the best way to my knowledge to get the desired output from a vcf file is through bcftools query:

bcftools query -f '%CHROM\t%POS\t%ID\t%REF\t%ALT\t%INFO/AF\n' my.vcf > my.out.tab

it still generates a tabulated file, but it contains all the columns you seem to be interested in.

ADD COMMENTlink modified 3.8 years ago • written 3.8 years ago by Jorge Amigo11k

Hi Jorge,

I am having the same problem at the moment and have tried your solution but for some reason I was unable to open the output file from the bcftools. It just came up empty. Any ideas as to why this may be so? Thanks in advance.

ADD REPLYlink written 2.5 years ago by noor.suaini0

the output can only be empty if the input file or the command is wrong. check that there aren't any errors in the command line (such as "no such tag defined" or "fail to open file"), and that the input file is a valid vcf file.

ADD REPLYlink written 2.5 years ago by Jorge Amigo11k

Great, thanks Jorge!

ADD REPLYlink written 2.5 years ago by noor.suaini0
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: 1287 users visited in the last hour