GMOD / jbrowse-components

Source code for JBrowse 2, a modern React-based genome browser
https://jbrowse.org/jb2
Apache License 2.0
202 stars 61 forks source link

Make breakpoint split view/synteny view tolerant of having multiple refNames in single row #724

Closed cmdcolin closed 4 years ago

cmdcolin commented 4 years ago

Currently there is a raw bpToPx that takes a genome coordinate and turns it into a pixel offset for drawing the squiggles/polygons

This is only working for when there is a single refName

When there are multiple refNames, it actually has to look at the displayedRegion list, find where it is in there, and get the offset

The kicker is that this requires refname-renaming-tolerant lookup of the feature's refName to the canonical refName in the displayedRegions. The LinearGenomeView.bpToPx can do this operation but it does not handle renamed refNames.

Also, this step is could be kind of slow if it is not implemented carefully, so I would worry about making bpToPx just do a getCanonicalRefName

Options for this include

a) Attaching "canonical refName" (e.g. the one from the reference genome) to all features, or making refName equal to the "canonical refName" in all cases b) Making getCanonicalRefName fast and not async

cmdcolin commented 4 years ago

There is probably a "(c) something else" type solution also

cmdcolin commented 4 years ago

Note that this TODO comment basically is this issue https://github.com/GMOD/jbrowse-components/blob/master/packages/breakpoint-split-view/src/util.ts#L29-L31

rbuels commented 4 years ago

Option b sounds like the better way to go. What if we had something like ‘async getRefNameMap’ that returns an object that supports a fast synchronous getCanonicalRefName?

On Sat, Dec 7, 2019 at 11:22 AM Colin Diesh notifications@github.com wrote:

Currently there is a raw bpToPx that takes a genome coordinate and turns it into a pixel offset for drawing the squiggles/polygons

This is only working for when there is a single refName

When there are multiple refNames, it actually has to look at the displayedRegion list, find where it is in there, and get the offset

The kicker is that this requires refname renaming tolerant lookup of the features refName to the one that is in displayed regions. The LinearGenomeView.bpToPx can do this operation but it does not handle renamed refNames.

Also, this step is could be kind of slow if it is not implemented carefully, so I would worry about making bpToPx just do a getCanonicalRefName

Options for this include

a) Attaching "canonical refName" (e.g. the one from the reference genome) to all features, or making refName equal to the "canonical refName" in all cases b) Making getCanonicalRefName fast and not async

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GMOD/jbrowse-components/issues/724?email_source=notifications&email_token=AAASAFLU4BATCIUXYQMX4QLQXPZYVA5CNFSM4JXRBP32YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H62534Q, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAASAFO42K7PUX45DEIX7H3QXPZYVANCNFSM4JXRBP3Q .

cmdcolin commented 4 years ago

I attempted an option 3 which is looking up the block that a feature comes from (it doesn't really matter which block if it spans multiple) in order to get the blocks refname

cmdcolin commented 4 years ago

See #726

cmdcolin commented 4 years ago

Solved in synteny view