bedtools intersect correct usage
1
0
Entering edit mode
3.8 years ago
storm1907 ▴ 30

Hello, I am trying to compare genome vcf file with bed file, to get out from genome file only these positions present in bed file

which syntax could be correct: bedtools intersect -a file.vcf -b file1.bed or bedtools intersect -a file1.bed -b file.vcf ?

I am confused, and also second variant seems to be correct, but is not working

genome • 1.4k views
ADD COMMENT
0
Entering edit mode
bcftools view --regions-file  file1.bed indexed.file.vcf.gz
ADD REPLY
0
Entering edit mode

Thank you! But now I got this:

Could not parse header line: ##VEP version: v101
Could not parse header line: ##dbSNP version: b154
ADD REPLY
0
Entering edit mode

this is not VCF file or a BED file. Show us the header of both files.

ADD REPLY
0
Entering edit mode
3.8 years ago
Rongxin ▴ 40

Hello! It would be better if you use the parameter -wa, which can report the original overlap entry in file A.

bedtools intersect -a file.vcf -b file1.bed -wa > res.txt

This command will report the positions in file.vcf that are overlapped with file1.bed.

The following pic would show you how -wa works. (Source: bedtools official website)

bedtools intersect

ADD COMMENT

Login before adding your answer.

Traffic: 1489 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6