Question: Filter variants in vcf file according to genotype of particular samples?
0
gravatar for arsala521
5 weeks ago by
arsala5210
arsala5210 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

ADD COMMENTlink modified 5 weeks ago by finswimmer2.1k • written 5 weeks ago by arsala5210

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

ADD REPLYlink written 5 weeks ago by cpad01125.3k
0
gravatar for toralmanvar
5 weeks ago by
toralmanvar300
toralmanvar300 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 5 weeks ago by toralmanvar300
0
gravatar for Pierre Lindenbaum
5 weeks ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum107k 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 5 weeks ago • written 5 weeks ago by Pierre Lindenbaum107k
0
gravatar for finswimmer
5 weeks ago by
finswimmer2.1k
Germany
finswimmer2.1k wrote:

Hello arsala521,

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

fin swimmer

ADD COMMENTlink modified 5 weeks ago • written 5 weeks ago by finswimmer2.1k
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: 629 users visited in the last hour