Question: Filter variants in vcf file according to genotype of particular samples?
0
gravatar for arsala521
6 months 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 6 months ago by finswimmer6.2k • written 6 months ago by arsala5210

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

ADD REPLYlink written 6 months ago by cpad01129.3k
0
gravatar for toralmanvar
6 months ago by
toralmanvar650
toralmanvar650 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 6 months ago by toralmanvar650
0
gravatar for Pierre Lindenbaum
6 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum113k 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 6 months ago • written 6 months ago by Pierre Lindenbaum113k
0
gravatar for finswimmer
6 months ago by
finswimmer6.2k
Germany
finswimmer6.2k wrote:

Hello arsala521,

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

fin swimmer

ADD COMMENTlink modified 6 months ago • written 6 months ago by finswimmer6.2k
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: 1151 users visited in the last hour