Question: bedtools intersect mistakes
0
gravatar for schelarina
4.0 years ago by
schelarina30
European Union
schelarina30 wrote:

Hello,

I am using the following command 

bedtools intersect -wb -a file1.bed -b file2.gff3 > output.txt

In the output I have more entries that are not even present in the file1.bed!

I have tried with sorting and also changing the extension of the file2gff3 to bed but again the same output..

What is the problem?

Is there another tool i can use to do the same? or  awk ?

Thank you

bedtools • 4.3k views
ADD COMMENTlink modified 4.0 years ago by QVINTVS_FABIVS_MAXIMVS2.3k • written 4.0 years ago by schelarina30
1
gravatar for QVINTVS_FABIVS_MAXIMVS
4.0 years ago by
USA SoCal
QVINTVS_FABIVS_MAXIMVS2.3k wrote:
bedtools intersect -wb -a file1.bed -b file2.gff3 > output.txt

Will write out all instances of B that overlaps with A

If you want to return all unique B that overlap with A it's this

bedtools intersect -wb -a file1.bed -b file2.gff3 | sort | uniq > output.txt

If you are interested in A and want to find all unique overlap to B it's this

bedtools intersect -wa -a file1.bed -b file2.gff3 | sort |uniq > output.txt

If you want to find the base pair overlap in A with each element in B

bedtools intersect -wao -a file1.bed -b file2.gff3 | sort | uniq  > output.txt
ADD COMMENTlink written 4.0 years ago by QVINTVS_FABIVS_MAXIMVS2.3k
0
gravatar for Devon Ryan
4.0 years ago by
Devon Ryan91k
Freiburg, Germany
Devon Ryan91k wrote:

That doesn't sound like a mistake, but rather that you're getting the correct output. You'll get >=1 line of output for every line in file1.bed, since if a line overlaps multiple entries in file2.gff3 then you'll get each of those. Since you're intersecting with a gff file, it'd be surprising not to see this sort of behaviour and all tools will and should act like this.

Perhaps you just want to intersect with unique exons.

ADD COMMENTlink written 4.0 years ago by Devon Ryan91k
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: 738 users visited in the last hour