Question: Extracting Specific Reads From Vcf File
2
gravatar for Bnfoguy
6.8 years ago by
Bnfoguy70
New Jersey, USA
Bnfoguy70 wrote:

Hello,

I am trying to extract indels with coverage ~1 and they are in a VCF file. How do I write a python script or a shell commnad to extract those indels with coverage 1 only?

This is the data:

chr1    1548545 .       T       TAGATCG 22.5    .       INDEL;DP=2;VDB=0.0251;AF1=1;AC1=2;DP4=0,0,1,0;MQ=60;FQ=-37.5    GT:PL:GQ        1/1:60,3,0:6
chr1    1573532 .       C       CT      4.42    .       INDEL;DP=1;AF1=1;AC1=2;DP4=0,0,0,1;MQ=44;FQ=-37.5       GT:PL:GQ        0/1:40,3,0:3
chr1    1577221 .       AAC     AACAAAC 81.2    .       INDEL;DP=2;VDB=0.0201;AF1=1;AC1=2;DP4=0,0,1,1;MQ=60;FQ=-40.5    GT:PL:GQ        1/1:120,6,0:10
chr1    1577223 .       C       CAAAC   81.2    .       INDEL;DP=2;VDB=0.0185;AF1=1;AC1=2;DP4=0,0,1,1;MQ=60;FQ=-40.5    GT:PL:GQ        1/1:120,6,0:10
chr1    1584063 .       T       TT      3.25    .       INDEL;DP=1;AF1=1;AC1=2;DP4=0,0,1,0;MQ=60;FQ=-37.5       GT:PL:GQ        0/1:38,3,0:4
chr1    1635699 .       AA      A       3.66    .       INDEL;DP=2;VDB=0.0231;AF1=1;AC1=2;DP4=0,0,1,1;MQ=20;FQ=-40.5    GT:PL:GQ        1/1:40,6,0:4
chr1    1637760 .       T       TTTCTTT 22.5    .       INDEL;DP=1;AF1=1;AC1=2;DP4=0,0,0,1;MQ=60;FQ=-37.5       GT:PL:GQ        1/1:60,3,0:6

Thank you for your help!

vcf indel script file python • 3.0k views
ADD COMMENTlink modified 22 months ago by Begali0 • written 6.8 years ago by Bnfoguy70
2
gravatar for Pierre Lindenbaum
6.8 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum119k wrote:

something like

awk -F '      '       '(!($4 ~ /[ATGC]/ && $5 ~/[ATGC]/ ))' < your.vcf | grep "DP=1;"

or better

grep INDEL < your.vcf | grep "DP=1;"
ADD COMMENTlink modified 6.8 years ago • written 6.8 years ago by Pierre Lindenbaum119k

Thanks Mr. Lindenbaum. You are a lifesaver!

ADD REPLYlink written 6.8 years ago by Bnfoguy70
0
gravatar for tommy.carstensen
6.7 years ago by
tommy.carstensen30 wrote:

Alternatively: awk '/INDEL/ && /DP=1/' your.vcf

ADD COMMENTlink written 6.7 years ago by tommy.carstensen30
0
gravatar for bioinfo
6.7 years ago by
bioinfo690
EU
bioinfo690 wrote:

I prefer ( I assume the vcf file contains just Indels not SNPs)

more indel.vcf | grep "DP=1" &gt > filtered.indel.vcf

If you have SNPs and indel together in the same vcf file then

more indel.vcf | grep "INDEL" | grep "DP=1" &gt > filtered.indel.vcf
ADD COMMENTlink modified 21 months ago • written 6.7 years ago by bioinfo690
0
gravatar for Begali
22 months ago by
Begali0
Begali0 wrote:

hi

I am new for tools such as samtools, bcftools, BWA and GATK and I am working on RADSeq I reach for point call variants which include ( INDEL and SNP) now time to filter them I could not do that by GATK with VQSR which reuired resources bundle folder which are not available for my organisms plant ( 5 samples for Cardamine hirsuta and 197 samples for Arabidopsis thaliana ) so only can do Hard-filtering however I need to plot my data to see my original distribution so I can determine thresholds which need to be filtered by considering lower est thresholds ... so I need to grep only INFO col first then how to select DP ,VDB ;AF1;MQ and so one so I can obtain file for each one which will be easier to plot then in R ...

Thanks in advance

ADD COMMENTlink written 22 months ago by Begali0
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: 695 users visited in the last hour