Filter VCF file for variant alleles
0
0
Entering edit mode
10 months ago

Hello everyone,

I am looking to filter my VCF file with multiple samples to keep those variants that vary with respect to the reference (i.e., not 0/0) in more than x samples. For example, if x is 10, I want to only keep SNPs that vary in more than 5 samples in my dataset. Thanks in advance

VCF bcftools vcftools • 562 views
ADD COMMENT
2
Entering edit mode

use a filtering expression https://samtools.github.io/bcftools/bcftools.html#expressions , something like;

bcftools view -i 'COUNT(GT="AR")+COUNT(GT="AA") >=3' 
ADD REPLY
0
Entering edit mode

What have you tried? You've mentioned bcftools as a tag, have you read the manual?

ADD REPLY
0
Entering edit mode

I've tried bcftools, which seems to be the closest I've got, but I can't find anything to do this. I have also found vcftools --max-non-ref-ac, which I think might be able to do this, but I am not really sure how to use it, and was wondering if anyone has any experience here. Thanks

ADD REPLY
0
Entering edit mode

can't find anything to do this

It's in there. If you had looked a little deeper, you would have found - on your own - exactly what Pierre has pointed to below.

ADD REPLY

Login before adding your answer.

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