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.
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 consulted many documentations but no one can answer it.
Thanks in advance
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.
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.
Log in to answer this question.