Entering edit mode
6.6 years ago
sacha
★
2.4k
Hi,
I m doing a BAM viewer. I wonder how to set read position in vertical axis ?
I mean, given N reads , How can I display all of them to fit the space and allow smooth horizontal scrolling ?
So how to get y-coordinate given:
- read width
- read position
- region viewport ( start, end )
I may need a pure function . Something like :
int ypos(region_start, region_end, read_size, read_begin ... )
But I m not sure.. See example in IGV bellow to understand
A genuine question. What would be 1 thing about your proposed viewer that would make a compelling use case for it when we have IGV/IGB/tablet on one end and asciigenome at the other.
An application build with C++/Qt and seqan library under GPL license.
You could look at the source of other genome browsers (e.g. samtools tview, IGV, etc) to find out how they approached this problem. Also, search for
pack rectangles
, you will find plenty of resources - I think displaying reads on a genome browser is a particular case of rectangle packing.It works ! Thanks guys for your help ! I just need some optimization now.
don't use the read length, you'lll have to calculate the 'end' position using the cigar string.
Isn't that something you decide (based on what a user is doing in terms of clicking/selecting to zoom-in and out). You set the coordinates of the region user is looking at and that allows you to lookup how many reads there are in that windows and associated max depth? Not being a programmer perhaps I am missing something?
See the picture example bellow. I would like to know where to draw the red read. ( bottom or top)
pack the rectangle
has already answered that part. I assume you will also be providing a feature to "group reads according to read strand"? Then it may need to go at the bottom, if color represents read strand.