Question: Intersecting vcf files with bedtools
0
gravatar for Maj
4.0 years ago by
Maj0
Maj0 wrote:

Hello,

I want to intersect two vcf files :

File 1 :

CHROM  POS     ID      REF     ALT     QUAL    FILTER  INFO    FORMAT  7.bam

Scaffold_1        223     .       G       T       10.8428 . DP=7;DPR=5,2;VDB=0.18;SGB=-0.453602;RPB=0.8;MQB=1;MQSB=1;BQB=0.9;MQ0F=0;ICB=1;HOB=0.5;AC=1;AN=2;DP4=5,0,0,2;MQ=60 GT:PL:DP:DV:SP:DP4:DPR   0/1:44,0,110:7:2:13:5,0,0,2:5,2

Scaffold_1        435     .       T       C       20.145  .       DP=3;DPR=1,2;VDB=0.1;SGB=-0.453602;RPB=1;MQB=1;MQSB=1;BQB=1;MQ0F=0;ICB=1;HOB=0.5;AC=1;AN=2;DP4=0,1,2,0;MQ=60    GT:PL:DP:DV:SP:DP4:DPR     0/1:53,0,30:3:2:0:0,1,2,0:1,2

File 2 : 

CHROM  POS     ID      REF     ALT     QUAL    FILTER  INFO    FORMAT  S07

scaffold_11       651457  929888  G       T       .       PASS    Ty=SNP;Rk=1;UL=.;UR=.;CL=.;CR=.;Genome=C;Sd=1   GT:DP:PL:AD:HQ  0/0:4:4,16,84:4,0:70,0

scaffold_1188     2186    894758  T       G       .       PASS    Ty=SNP;Rk=1;UL=.;UR=.;CL=.;CR=.;Genome=T;Sd=1   GT:DP:PL:AD:HQ  1/1:4:84,16,4:0,4:0,70

This is the error :

bedtools intersect -a 7.variant_snp.vcf -b 7.variant_snp2.vcf | head

ERROR: file 7.variant_snp.vcf has non positional records, which are only valid for the groupBy tool.

I don't know how to deal with this issue. Does anyone have experience of this kind of error?

Thanks in advance

intersectbed vcf bedtools • 2.6k views
ADD COMMENTlink modified 4.0 years ago by harold.smith.tarheel4.6k • written 4.0 years ago by Maj0

might be worth simply parsing the "VCF" files into a BED format? Should be able to just include the POS field twice to stand in for the Start & Stop positions.

ADD REPLYlink written 4.0 years ago by steve2.9k
0
gravatar for Manvendra Singh
4.0 years ago by
Manvendra Singh2.1k
Berlin, Germany
Manvendra Singh2.1k wrote:

First may be you get rid of headers As per I remember, I always used one vcf and one bed file to intersect by bedtools

May be you use vcftools to intersect two vcf files

It has nice command as "vcf-isec" Creates intersections and complements of two or more VCF files Nice documentation is here

ADD COMMENTlink written 4.0 years ago by Manvendra Singh2.1k

Thank you :) I tried it but now i have a new error "The command "tabix" not found, please add it to your PATH" I'm trying to fix it. Thank you again

ADD REPLYlink written 4.0 years ago by Maj0
0
gravatar for harold.smith.tarheel
4.0 years ago by
United States
harold.smith.tarheel4.6k wrote:

The examples you show do not match the VCF format specs. The header line (beginning with 'CHROM') should be preceded by a hash '#'. Otherwise, 'POS' is read as a value that should be an integer but is not (i.e., non-positional).

ADD COMMENTlink written 4.0 years ago by harold.smith.tarheel4.6k

Also, bedtools 'intersect' does not output headers by default, and using the output for subsequent 'intersect' operations can produce errors. You can include by using the '-header' flag.

ADD REPLYlink written 4.0 years ago by harold.smith.tarheel4.6k
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: 1717 users visited in the last hour
_