-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add canvas feature renderer #2671
base: main
Are you sure you want to change the base?
Conversation
Use color Box glyph Misc Back to main updates Updates Incremental Canvas glyph types Misc Label Remove updateStaticElement Correct positioning Start rendering text System for rendering labels at proper place Crazy code Misc Updates Testing
one concern that could be brought up is that some users have created infrastructure around svg being the default renderer. possibly, in that case, we would need to fork stuff in a (very) similar way to jbrowse 1 and make a CanvasFeatures track and an SvgFeatures track, which FeatureTrack being the default with svg renderer. |
just for the record, this is definitely way faster === more pleasant to use imo. if there are considerations before pushing forward on this, feel free to add, but could be worth pushing over the finish line |
from meeting just now, thinking about how to allow pluggable Glyphs. two ways of doing this I can think of:
|
@cmdcolin is this still on the radar? I would like to configure something that looks like the chromHMM track in jbrowse2, e.g. see https://jbrowse.org/code/JBrowse-1.16.11/?data=sample_data%2Fjson%2Fvolvox&loc=ctgA%3A9898..32508&%3Btracks=DNA%2CTranscript%2Cvolvox-sorted-vcf%2Cvolvox-sorted_bam%2Cvolvox_microarray_bw_xyplot%2Cvolvox_microarray_bw_density&%3Bdata=sample_data%2Fjson%2Fvolvox&%3Bhighlight=&tracks=DNA%2CTranscript%2Cvolvox_microarray_bw_density%2Cvolvox_microarray_bw_xyplot%2Cvolvox-sorted-vcf%2CChromHMM&highlight= |
@thomasvangurp Many of the JBrowse 1 CanvasFeatures renderer features are already available in our SvgFeatureRenderer in JBrowse 2. For example, here is a link to a JBrowse 2 session with an example of a track like the ChromHMM track you linked: Also, here is the configuration for that track: {
"type": "FeatureTrack",
"trackId": "chromhmm",
"name": "ChromHMM",
"assemblyNames": [
"volvox"
],
"adapter": {
"type": "BedAdapter",
"bedLocation": {
"locationType": "UriLocation",
"uri": "https://s3.amazonaws.com/jbrowse.org/code/JBrowse-1.16.11/sample_data/raw/volvox/volvox_segment.bed"
}
},
"displays": [
{
"type": "LinearBasicDisplay",
"displayId": "chromhmm-LinearBasicDisplay",
"renderer": {
"type": "SvgFeatureRenderer",
"color1": "jexl:get(feature,'name')=='1_TssA'?'red':get(feature,'name')=='2_TssAFlnk'?'pink':get(feature,'name')=='3_TxFlnk'?'purple':get(feature,'name')=='4_Tx'?'orange':get(feature,'name')=='5_TxWk'?'darkorange':get(feature,'name')=='6_EnhG'?'yellow':get(feature,'name')=='7_Enh'?'gold':get(feature,'name')=='8_ZNFRpts'?'blue':get(feature,'name')=='9_Het'?'darkgreen':get(feature,'name')=='10_TssBiv'?'green':get(feature,'name')=='11_BivFlnk'?'lightgreen':get(feature,'name')=='12_EnhBiv'?'purple':get(feature,'name')=='13_ReprPC'?'lightblue':get(feature,'name')=='14_ReprPCWk'?'salmon':get(feature,'name')=='15_Quies'?'lightgrey':black",
"labels": {
"name": ""
},
"displayMode": "collapse"
}
}
]
} |
Misc Update snaps Collapse intron p1 Properly size linear genome view after creation Bump deps
f3afd08
to
4d7d672
Compare
1e9c443
to
26dfea7
Compare
71ee113
to
7024825
Compare
attempting to push this PR forward a bit, still wip but some updates floating labelsThis PR changes it so that all the labels are rendered separately from the features at the display level, aggregating across a variable called display.layoutFeatures I made it so that the "floating labels" rendering is moved to what I might call a more "principled" approach The current feature label rendering is done on a block by block basis, with a fair number of hacks to make it stay on the screen in a "floating way" this separated rendering also makes font rendering separate from feature drawing, which allows us to use plain html divs for text rendering, which is generally looks better and less pixelated than canvas font rendering collapsed intronssome motivation with the above floating label refactoring is that "collapsed intron" display is handled better. previously, the label rendering in "collapsed intron" scenarios (which have many displayedRegion boundaries) was glitchy. now pretty much seemless large regionwhen rendering large amounts of genes, the canvas renderer should be much faster and noticeably less laggy |
68c9d5d
to
def3bf9
Compare
This is a draft PR for canvas feature rendering
I am observing that SVG feature rendering is pretty slow in some cases especially if we are moderately zoomed out. the process of creating a react component for every subfeature, with config callbacks, color emphasize routines, is labor intensive, and bloats the dom node count, and it runs basically the full render on both the worker (ssr) and client thread (hydrate also does a full render).
Also this PR has floating feature labels which is a good benefit.
Some todos include just a general code review and adding UTR
Fixes #674