Question: Filtering on the minor allele in VCFtools
gravatar for outlier95
4.3 years ago by
outlier9510 wrote:

Wondering how I can get the number of informative sites in a .vcf file using VCFtools. By informative I mean at least two samples share a variant. Any suggestions? Thanks.

vcftools snps • 1.9k views
ADD COMMENTlink modified 4.3 years ago by Adam1000 • written 4.3 years ago by outlier9510

Not sure about VCFtools, but if you are up for trying something new, the Variant Effect Predictor gives you information on MAF for data in .vcf files. Look at the Filtering options available for the VEP including frequency i.e. MAF.

ADD REPLYlink written 4.3 years ago by Denise CS5.1k
gravatar for Pierre Lindenbaum
4.3 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum130k wrote:

using vcffilterjs: add INFORMATIVE in the FILTER column for the variant having less than two samples having more than one genotype hom-ref or het. extract the FILTER column, count the number of line containing INFORMATIVE

cat input.vcf |\
java -jar dist/vcffilterjs.jar -F INFORMATIVE -e 'function accept(v) { var f=0,i;for(i=0;i<v.getNSamples();++i) {var g=v.getGenotype(i); f+=(g.isHomVar() || g.isHet()?1:0);} return f<2;}accept(variant);' |\
grep -v "^#" | cut -f 7 | grep -c INFORMATIVE

ADD COMMENTlink written 4.3 years ago by Pierre Lindenbaum130k
gravatar for Adam
4.3 years ago by
United States
Adam1000 wrote:
vcftools --gzvcf vcf_file --mac 2 --stdout --recode | fgrep -v '#' | wc -l
ADD COMMENTlink written 4.3 years ago by Adam1000

MOD-EDIT: OP has opened a new question for this here: Identifying private and shared SNPs using VCFtools

ADD REPLYlink modified 4.3 years ago • written 4.3 years ago by outlier9510

If I remove singletons and private doubletons via --singletons and --positions using VCFtools, then take the difference in the number of SNPs before and after filtering, should that amount to the number of informative SNPs (per my definition)? Many thanks.

ADD REPLYlink modified 4.2 years ago • written 4.3 years ago by outlier9510
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 591 users visited in the last hour