Bedtools intersect 0- and 1-based coordinate files
1
0
Entering edit mode
3.5 years ago
maxrwjones ▴ 60

Hi all,

I'm using bedtools intersect for the first time and am wondering if it performs correctly when provided with an 'A' (query) file in BAM format (which has 0-based coordinates) and a 'B' (reference) file in GFF3 format (which has 1-based coordinates).

Does bedtools intersect automatically take this difference into account? i.e. can it re-coordinate one of the files on the fly to ensure intersects are accurate to nucleotide resolution?

Cheers!

gff intersect bedtools bam • 1.4k views
ADD COMMENT
2
Entering edit mode
3.5 years ago
ATpoint 85k

Does bedtools intersect automatically take this difference into account?

Yes, it is quite a smart one.

Example (BED vs GTF, random files I had on disk):

$ cat test.gtf 
chr1    rtracklayer exon    1   2   .   +   .   exon_id "ENSMUSE00001343744.1"; exon_rank 1; transcript_id "ENSMUST00000193812.1"; gene_id "ENSMUSG00000102693.1"; ID "ENSMUST00000193812.1"

$ cat test.bed 
chr1    0   1   featureA    .   +

$ bedtools intersect -a test.bed -b test.gtf 
chr1    0   1   featureA    .   +
ADD COMMENT
0
Entering edit mode

Ah wonderful, good to know! Brilliant answer and thanks for the code / outputs to back it up.

ADD REPLY

Login before adding your answer.

Traffic: 1718 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