This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Bedtools intersect -u or -wa causing issues

I'm trying to intersect two tracks and only keep the transcripts from input a that overlap with input b. In this case intersect -u or -wa would work well for me.

Shown in pink are the two tracks I want to intersect. -a is on top and -b is on bottom. Both in pink.

https://imgur.com/hrStWrw

Now, shown in blue is the result from the intersection. Note how some of the transcripts at the very top look like they lose their exon and intron identification they are just one solid dark blue bar. what is going on? why does this happen?

https://imgur.com/ViPjSbE

I have a second issue. The input -b track only lists exons and not introns, however, IGV magically draws introns between them. How do I stop IGV displaying these introns?

code in case you want to see it.

from pybedtools import BedTool
mcf7 = BedTool('MCF7hg19.gtf')
transposons = BedTool('UniqueTransposonsMCF7vsGENCODE.gtf')

TranscriptsTransposons = mcf7.intersect(transposons, wa=True) 

TranscriptsTransposons.saveas('pyTranscriptsWithTransposonsinMCF.gtf')

Thanks, Alex

bedtools python igv pybedtools

1 answer

Introns are not annotated in GTF/GFF files directly. They are assumed to be inter-exonic regions of one gene, which is displayed by IGV in case you supply GTF/GFF. One possibility would be to convert your intersection result to the BED format, e.g. with gff2bed from BEDOPS. Then, I think, only the exons should be displayed.

So, I just tried your suggestion. The result I got was not good. Please see below. Do you know why I am getting all of these solid lines that are neither exonic nor interexonic?

https://imgur.com/MiNSYOq

gtf2bed <pyTranscriptsWithTransposonsinMCF.gtf> pyTranscriptsWithTransposonsinMCF.bed

Sorry, I wasn't thinking correctly. Your suggestion of converting bed to gif does work. I was accidentally converting the incorrect file leading to the garbage output.

https://imgur.com/a/SaBO8du

Moved ATpoint's comment to an Answer.

If this was helpful you should upvote it; if it resolves your question you should mark it as accepted. Upvote|Bookmark|Accept

Log in to answer this question.