Filter variants in vcf file according to genotype of particular samples?
3
0
Entering edit mode
6.7 years ago
arsala521 ▴ 60

Hello

I have a multi-sample vcf file having data of eight samples. I want to exclude that variants which are homozygous in six of these samples. Please tell me if there is any way we can filter the variants in vcf file based on genotypes of particular samples. I am unable to find any such option in bcftools and vcftools.

Thank you

variant filtration genotype • 4.7k views
ADD COMMENT
0
Entering edit mode

this post from bcftools github may help you: https://github.com/samtools/bcftools/issues/118

ADD REPLY
0
Entering edit mode
6.7 years ago
Tm ★ 1.1k

You can filter the SNPs based on their GT value. i.e if the GT is 0/1 then it is heterogous and if GT is 1/1 then it is homozygous. Thus you can just use simple grep command or VCF tool for fetching particular value. You can also refer similar biostar post

ADD COMMENT
0
Entering edit mode
6.7 years ago

using vcffilterjdk: http://lindenb.github.io/jvarkit/VcfFilterJdk.html

  • 3 sample names: S1, S2,S3
  • convert to stream of name
  • convert each name to a genotype
  • check that all genotypes are HOM_REF
$ java -jar dist/vcffilterjdk.jar -e 'return Arrays.asList("S1","S2","S3").stream().map(S->variant.getGenotype(S)).allMatch(G->G.isHomRef());' src/test/resources/rotavirus_rf.vcf.gz
ADD COMMENT
0
Entering edit mode
6.7 years ago

Hello arsala521,

you can filter with SnpSift. Especially have a look at the part "Available operands and functions".

fin swimmer

ADD COMMENT

Login before adding your answer.

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