Question: Filter variants in vcf file according to genotype of particular samples?
0
gravatar for arsala521
2.9 years ago by
arsala52110
arsala52110 wrote:

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

genotype variant filtration • 2.5k views
ADD COMMENTlink modified 2.9 years ago by finswimmer14k • written 2.9 years ago by arsala52110

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

ADD REPLYlink written 2.9 years ago by cpad011215k
0
gravatar for toralmanvar
2.9 years ago by
toralmanvar910
toralmanvar910 wrote:

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 COMMENTlink written 2.9 years ago by toralmanvar910
0
gravatar for Pierre Lindenbaum
2.9 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum134k wrote:

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 COMMENTlink modified 2.9 years ago • written 2.9 years ago by Pierre Lindenbaum134k
0
gravatar for finswimmer
2.9 years ago by
finswimmer14k
Germany
finswimmer14k wrote:

Hello arsala521,

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

fin swimmer

ADD COMMENTlink modified 2.9 years ago • written 2.9 years ago by finswimmer14k
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: 2588 users visited in the last hour
_