dasmoth / dalliance

Interactive web-based genome browser.
http://www.biodalliance.org/
BSD 2-Clause "Simplified" License
226 stars 68 forks source link

Feature request: reverse-complement view #58

Open parlar opened 10 years ago

parlar commented 10 years ago

To enable viewing of genes/exons in the forward order (5'->3') if present on the minus strand.

With reference to google groups discussion (https://groups.google.com/forum/#!topic/biodalliance-dev/OjYwCAk2XFo).

Kind regards,

Pär

ymen commented 10 years ago

@dasmoth I was experimenting with this using a mapping chainset, and wanted to check with you what's the expected behavior for mapping with strand flip.

Here's a hypothetical illustration... Suppose there's a 3-exon gene on the reverse strand of chrZ.

screen shot 2014-08-21 at 11 38 33 am

If I do a mapping using a chainset that flips the strand in this region

 chrZ 1000 1800 + chrZ 1000 1800 - 1 0 0 800

I believe Dalliance will give a lift-over in the form below. This is not really what we want for this use case.

screen shot 2014-08-21 at 11 39 10 am

An alternative interpretation of the liftover coordinates might give us something like this, which is visually what we want but with meaningless coordinates

screen shot 2014-08-21 at 11 41 59 am

I don't think either is actually what par wants, but just wanted to clarify with you what's the expected behavior with mapping segments with strand flip.

dasmoth commented 10 years ago

Well, let's be slightly more specific here: I can draw your test gene structure with the following line of BED data:

    chrZ 1001 1800 test 1000 - 0 0 0,0,0 3 100,200,300 0,200,500

In Dalliance, this looks like:

image

...which I think matches what you expect. If I now map this using your suggested chain.bed fragment (I edited very slightly to make the target chromosome "chrZr" rather than "chrZ", to make it clear we're looking at the flipped version). Back in Dalliance, what I see is:

image

...which matches your second (green) mapped version and (unlike the red version) still makes biological sense.

How does this differ from what @parlar is looking for?

The one bit I don't understand is why you seem to have a mapping file which just flips the region around a single gene. Doesn't it make more sense to flip the whole chromosome? If this turns out to be a generally useful feature, we should then build some UI elements to indicate to the user that they're looking at a flipped view (the obvious one that springs to mind is that the genome ruler should probably display "real" chromosome coordinates -- descending from left to right -- rather than coordinate on the virtual flipped chromosome).

Or am I missing something here...?

ymen commented 10 years ago

No, I'm the one missing on stuff here :( I should have tested this more thoroughly, I apologize for that, and thanks for taking the time to reply.

The one bit I don't understand is why you seem to have a mapping file which just flips the region around a single gene.

That was a contrived example. Yes, the idea will be to flip every chromosome in full.

We should then build some UI elements to indicate to the user that they're looking at a flipped view

Yes, I'm mainly worried about the coordinates (both the ruler as well as the actual positions that show up if you click on a feature). If people are used to what reverse does in UCSC which uses real coordinates, this might be misleading.

I guess it's possible to get the chromosome sizes (from the chainset or just store it inside the browser) and transform the imaginary coordinates in the ruler and feature pop-ups.... not sure if that's too hacky of an approach though. What do you think?

dasmoth commented 10 years ago

That is an important point regarding the info popups. Probably needs a flag somewhere to say "want unmapped coords in the info popups". I imagine that might also be important for #63.