plantinformatics / pretzel

Javascript full-stack framework for Big Data visualisation and analysis
GNU General Public License v3.0
43 stars 13 forks source link

MVP of micro-chromosomes relations display using synteny blocks #257

Open Don-Isdale opened 3 years ago

Don-Isdale commented 3 years ago

Summary

Some of these items may be included in this branch before merging down, others will be in separate, subsequent, branches


After v2.10.0 :


from meeting 2021Sep09 :


Current Items

after 2.11.0 :


further developments :


for later


Branch

feature/uChr


Description

MVP of micro-chromosomes using synteny blocks


Discussion points


gabrielkg commented 3 years ago

Alignments after loading data as-is (only showing first few chromosomes from each genome, relationship between blocks represented by a single green line), commit ca68d065:

MicrosoftTeams-image

Don-Isdale commented 3 years ago

Showing the paths as trapezoids / synteny blocks, showing the whole interval at each end. This is enabled for blocks with dataset tagged SyntenyBlock. Commit 91ab169

Screenshot from 2021-08-03 12-59-00

gabrielkg commented 3 years ago

Testing discovered that order of axes affects display. For example, loading this alignment: NC_048298.1_3526451_344508617_CM026898.1_1209604_344009304

Displays:

image

And, if order of axes flipped:

image


This is fixed by commit c736a905 : showSynteny : check for adjacency in either direction result : Screenshot from 2021-08-04 18-42-19

Don-Isdale commented 3 years ago

add checkbox in view panel : hide axis titles and tick labels : commit 58f71e3f Screenshot from 2021-08-04 17-31-04

JTBoobs commented 3 years ago

image Latest view from loading and stacking axis. Functionality to rearrange axes and scaling axes by length may be worth discussion. Making the axis a larger rectangle may also be good for discussion.

Don-Isdale commented 3 years ago

re. the preceding comment :

  1. rearrange axes (within a stack) : the calculation would be fairly simple since it is just a re-ordering; the GUI action could be up/down arrow key after selecting the axis, or dragging along the length of the stack to the target location, or ...

Currently it is possible to re-arrange axes within a stack by dragging them out, not releasing the mouse button, dragging back in to the desired target zone of the stack, then releasing the mouse button.

  1. scaling axes by length : change this calculation in Stack.prototype.dropIn() : inserted.portion = 1/n;

  2. Making the axis a larger rectangle : increase stroke-width, e.g. : g.axis > path.domain { stroke-width: 5px; } result : Screenshot from 2021-08-04 18-48-58

Don-Isdale commented 3 years ago

Leave a small gap at the end of axis : commit 3c3d805 Screenshot from 2021-08-05 16-18-51 Screenshot from 2021-08-05 16-18-29

Don-Isdale commented 3 years ago

Screenshot from 2021-08-06 20-23-04

Result of these changes :

Don-Isdale commented 3 years ago

Screenshot from 2021-08-11 20-08-19 Screenshot from 2021-08-11 20-07-02

Result of these changes :

[4-12H/5H] select colour for synteny blocks : right click -> dialog with colour picker In the first instance, this will change just the current element - if the object is redrawn, it will return to the default colour. (To persist the colour change : could define colour map with key .data, colour function to use default if not in map). e53fab7

[/1.5H] style editor : colour multiple elements; select fill/stroke. da4a14f

[/1.5H] apply current colour when an element is added. d19cfd4

[/0.5H] add x button to close dialog. f7329ad

[/0.5H] selectedElements : show count and Clear. 0e36175

[/0.5H] toggle selected element when Ctrl. 7823cf4

Draft user guide for style-editor :

Click on a synteny block (graphic element) to show the style-editor. Click on the down-arrow beside the colour block to select a colour. Click Choose to apply this colour to the selected elements. Cancel closes without applying a colour change. The element remains selected after closing the dialog. Shift-click on another element to apply the same colour change and add it to the selection. Ctrl-click on another element to apply the same colour change and show the dialog. Ctrl-click is a toggle - if the element is already selected then it is removed from the selected elements and its colour reverts to default, otherwise it adds it to the selected elements and applies the current colour change. The dialog shows the number of selected elements; click Clear to clear the selection. By default the colour changes are applied to both the fill and stroke (body and border) of the graphic elements. Unchecking Fill and/or Stroke checkboxes means that subsequent colour changes won't apply to that attribute.


For discussion - some possible features for the colour / style-editor :

Don-Isdale commented 3 years ago

Screenshot from 2021-08-16 18-32-29

Result of :

[3-6H] in the GUI actions, separate selection from style-editor access : click is just select, and style-editor in side panel : accordion, lower right, additional tabs b123d63: frontend/package.json : add ember-split-view-modifier, used in following commit 1913b5e: style-editor : move from modal dialog to side-panel. a1bd1ca: style-editor : for shift-click, perform the same action on other elements on the same block-adj

[2-4H] in style-editor panel : bucket-fill button (select / apply) b795488: style-editor : radio buttons to choose mean of click : either selection or apply colour change


Updated Draft user guide for style-editor :

Colours of synteny block (graphic element) can be changed using the style-editor, which is shown in the lower right panel. In the Style Editor : Click on the down-arrow beside the colour block to select a colour. Clicking on the spectrum on the right changes the shown colour square; clicking within the colour square changes the chosen colour. Click Choose to apply this colour to the selected elements; if a colour choice was not made, by clicking in the colour square, this has no effect. Cancel closes without applying a colour change. The element remains selected after applying the change.

Changing the mode from Select to Apply enables the chosen colour to be applied to further elements, simply by clicking on them.

Choosing a colour in the Style Editor will apply it to the currently selected elements.

Using left-click is sufficient to change colours of elements, and there is no need to use the following which describes making coordinated adjustments to a selection of elements.

Ctrl-click on another element adds it to the selection. If it is already in the selection then it is removed from the selection and its colour reverts to default.

Analogous to shift-click in MS-Windows which selects the rows or text from the last click to the current click, Shift-click selects the group of synteny blocks connecting 2 chromosomes. As with Ctrl- it is a toggle - if the clicked element is already selected them remove it and its sibling elements from the selection.

The dialog shows the number of selected elements; click Clear to clear the selection.

By default the colour changes are applied to both the fill and stroke (body and border) of the graphic elements. Unchecking Fill and/or Stroke checkboxes means that subsequent colour changes won't apply to that attribute.

Don-Isdale commented 3 years ago

Screenshot from 2021-08-17 12-32-47 Screenshot from 2021-08-17 12-32-37

Result of :

[/0.1H] add a toggle to show the selections / advanced mode. 66d26159
Don-Isdale commented 3 years ago

Screenshot from 2021-08-23 11-07-51 Screenshot from 2021-08-23 11-26-33 Screenshot from 2021-08-23 11-28-24 Screenshot from 2021-08-23 11-30-23

Result of :


Updated Draft user guide for style-editor :

Colours of synteny block (graphic element) can be changed using the style-editor, which is shown in the lower right panel. In the Style Editor : Click on the colour block to select a colour. This shows a square Saturation / Lightness colour block, and a spectrum for choosing Hue. Clicking on the spectrum on the right changes the shown colour square; clicking within the colour square changes the chosen colour. Click Choose to apply this colour to the selected elements; if a colour choice was not made, by clicking in the colour square, this has no effect. Cancel closes without changing the chosen colour. Clicking on the paint-bucket button enters a mode for applying the chosen colour to clicked graphic elements. The cursor appears as a paint-bucket over graphic elements which it can be applied to (synteny blocks), and 'not-allowed' cursor elsewhere. Operations within the graph which require mouse-button click are disabled in this mode; only colour application is enabled. Mousewheel zoom / pan and axis dragging are not disabled, and operations in the left and right panels outside the graph area are not affected. The paint-bucket button is highlighted with a blue background while in this mode. To exit the mode, click the button again.

(the ability to select a group of graphic elements, shown in earlier versions, is not currently surfaced).


Creating data for synteny blocks :

Don-Isdale commented 3 years ago

result of : [1-3H/6.5H] synteny blocks size text : threshold slider : enter a number. 66dd119, 1140ecb

Screenshot from 2021-09-03 19-27-36


Discussion of completing the filtering of synteny blocks :

re. the above item : synteny blocks zoom : off screen, use Paths 'Show all' toggle the filter was implemented yesterday, but it should be controlled by a view panel control. I initially thought the Paths 'Show all' toggle would be sufficient, but as discussed the synteny blocks may completely contain the zoomed area, and the users may want to toggle those off because they become solid blocks of colour when zoomed in. That is the idea of the 'contain' toggle in this mock-up. Also : having recently added the brush checking of end-position, there are 3 cases there : the [start,end] overlaps the brush, or contains it, or is contained by it. So these 2 toggles can be used for filtering of features / paths / synteny blocks, by brush and by zoomed scope.

Currently we have just 'Show All' which chooses between 'tick' and 'nothing', but with synteny blocks we currently show the whole path, hence the 3rd option.

Motivation / Discussion

Filtering for synteny blocks by the above item (793aadb), but the single control 'Show All' (in the view panel) doesn't support the range of possibilities. The driver for this is the synteny blocks, which because of their length may partially overlap the brush or zoom scope, or may contain it completely, which were less significant for features and paths, but the same controls can apply to those. The first part of the control indicates what constitutes an overlap : does the feature have to be completely contained in the brush/zoom interval, or is partial overlap also of interest; also the feature (especially a synteny block) may completely contain the brush/zoom interval, in which case the user may wish to filter it out or in.

The 2nd part of the control indicates how a path or synteny block should be displayed if one end matches the brush/zoom and the other doesn't. Currently we have the 'Show All' flag which indicates that those with 1 end in should appear as ticks on that axes, and the path is not shown. Currently for synteny blocks, we display the block if either end is in. The controls would offer those 3 choices : either a tick at one end, or show the whole path / synteny block, or nothing.

The effort involved for this is minor - the GUI is implemented in the mockup, and all that remains is to connect the flags to the corresponding code. (there are already functions for overlapInterval and subInterval).

Mock Up of this proposal :

Screenshot from 2021-09-03 20-14-25