Question: How to only show SNPs in vcf files
0
gravatar for Joe
4 months ago by
Joe30
USA
Joe30 wrote:

I have some vcf file generated by using GATK Unified Genotyper (--output_mode EMIT_ALL_SITES), it looks like

chr15 21138918 . C . 46.23 . . GT:DP 0/0:6

chr15 21138919 . C . 46.23 . . GT:DP 0/0:6

chr15 21138920 . T . 46.23 . . GT:DP 0/0:6

chr15 21138921 . C . 46.23 . . GT:DP 0/0:6

chr15 21138922 . A . 46.23 . . GT:DP 0/0:6

chr15 21138923 . A . 46.23 . . GT:DP 0/0:6

chr15 21138924 rs116806596 C T 173.84 . . GT:AD:DP:GQ:PL 1/1:0,6:6:18:202,18,0 chr15 21138925 . T . 43.23 . . GT:DP 0/0:6

chr15 21138926 . G . 46.23 . . GT:DP 0/0:6

chr15 21170494 . T . 34.23 . . GT:DP 0/0:5

chr15 21170495 . G . 34.23 . . GT:DP 0/0:5

chr15 21170496 . A . 34.23 . . GT:DP 0/0:5

My question is: Is there bcftools or vcftools could simply filter this vcf file to only show SNPs (eg, chr15 21138924 rs116806596 C T 173.84 . . GT:AD:DP:GQ:PL 1/1:0,6:6:18:202,18,0)?

I know that I can rerun GATK Unified Genotyper by using EMIT_VARIANTS_ONLY, but I have so many files, it is very time consuming.

Thanks.

snp gatk vcf • 223 views
ADD COMMENTlink modified 4 months ago by Pierre Lindenbaum99k • written 4 months ago by Joe30
1
java -jar  SnpSift.jar  filter --inverse  "( ALT = '.')" test.vcf.gz

Will work with vcf too. Last lines from output:

##SnpSiftVersion="SnpSift 4.3p (build 2017-06-06 09:55), by Pablo Cingolani"
##SnpSiftCmd=""
##FILTER=<ID=SnpSift,Description="SnpSift 4.3p (build 2017-06-06 09:55), by Pablo Cingolani, Expression used: ( ALT = '.')">
#CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  NA00001
chr15   21138924    rs116806596 C   T   173.84  .   .   GT:AD:DP:GQ:PL  1/1:0,6:6:18:202,18,0
ADD REPLYlink modified 4 months ago • written 4 months ago by cpad01122.3k

It works! Thanks a lot.

ADD REPLYlink written 3 months ago by Joe30
1
gravatar for Pierre Lindenbaum
4 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum99k wrote:
for F in *.vcf; do  awk  -F '\t' '($0 ~ /^#/ || $5!=".")' $F  > ${F}.2.vcf ; done
ADD COMMENTlink written 4 months ago by Pierre Lindenbaum99k
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: 1392 users visited in the last hour