Ah wonderful, good to know! Brilliant answer and thanks for the code / outputs to back it up.
Bedtools intersect 0- and 1-based coordinate files
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!
• 2,073 views
•
link
1 answer
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 . +
• 0 views
•
link
• 0 views
•
link
Log in to answer this question.