How to filter INFO on a vcf file with bcftools
1
1
Entering edit mode
4.4 years ago
borarc3 ▴ 10

Hello,

I want to filter a vcf file by eliminating all the SNPs which have INFO <= 0.4.

In the shell, I therefore enter the following command : bcftools filter -e 'INFO<=0.4' myfile.vcf.gz The command runs for a veeeeeeery long time and, at the end, the file remains exactly the same. I have the feeling that it just reads all my file but nothing is filtered.

How could I modify my command to get a real filtering ? Thanks for any help.

bcftools vcf INFO imputation • 13k views
ADD COMMENT
0
Entering edit mode

what is the definition in the header of this 'INFO' field ?

bcftools view --header-only input.vcf | grep "ID=INFO"
ADD REPLY
0
Entering edit mode

I get this :

INFO=<ID=INFO,Number=1,Type=Float,Description="IMPUTE2 info score">
ADD REPLY
0
Entering edit mode

So, is it uppercase INFO or lowercase info ??

ADD REPLY
0
Entering edit mode

I have paste the response as I got it. But clearly it is uppercase because if I try to enter the command with 'info', I get : Error: the tag "info" is not defined in the VCF header.

ADD REPLY
0
Entering edit mode

Question! After getting vcf files back from the Michigan server, I noticed I don't have any 'ID=INFO' within my header (running your command above outputs nothing). Would you know the reason why this happens/a way around it?

ADD REPLY
0
Entering edit mode

Hi,

I am trying to filter all SVTYPE=BND variants and this is what i tried

bcftools query -i SVTYPE!="BND" wgs_HG001-lumpy.vcf.gz -f "%CHROM\t%POS0\t%END\t%SVTYPE\n" wgs_HG001-lumpy.vcf.gz >nobnd_wgs_HG001-lumpy.vcf.gz
[filter.c:1379 filters_init1] Error: the tag "INFO/BND" is not defined in the VCF header.

I could do it through grep -v but I am seeing if I could use bcftools

ADD REPLY
0
Entering edit mode

Please do not add answers unless they actually do answer the question. Just in case, try surrounding your expression in quotes: -i 'SVTYPE!="BND"'. Also, if SVTYPE is an INFO field, use -i 'INFO/SVTYPE!="BND"'.

ADD REPLY
4
Entering edit mode
4.4 years ago
bcftools filter -e 'INFO/info<=0.4' myfile.vcf.gz
ADD COMMENT
0
Entering edit mode

Question! After getting vcf files back from the Michigan server, I noticed I don't have an 'INFO/info' value. Checking within my headers, this command:

bcftools view --header-only input.vcf | grep "ID=INFO"

Doesn't produce anything. Would you know the reason why this happens/a way around it?

ADD REPLY
0
Entering edit mode

It could be because the info is in lower case. Try grep "ID=info"

ADD REPLY
0
Entering edit mode

I thought the same a while ago but nothing was outputted. Additionally, using

bcftools query - f 'INFO \n'

Didn't bring about the 'info' value/field. I created a separate post about it if you happen to know why/want a further explanation.

ADD REPLY

Login before adding your answer.

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