Skip to content
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

Upgrade RGL and support allowOverlap #1046

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

sehilyi
Copy link
Member

@sehilyi sehilyi commented Aug 23, 2021

Description

This PR adds a root-level option of viewConfig, called allowOverlap:

{
   ...,
   allowOverla: true,
   views: [ ... ]
}

This uses react-grid-layout's recently released option, allowOverlap.

When a user sets allowOverlap to true (default false), higlass views can be overlapped. While this functionality may not be needed for most cases, this can be useful if a user wants to overlay multiple visualizations that show different genomic intervals (e.g., superpose a matrix that shows a part of chr1 and another matrix that shows a part of chr2). In Gosling, we would like to create for example multiple circular ideograms of different chromosomes at once (gosling-lang/gosling.js#422).

I've upgrade RGL, from 0.16.6 to 1.3.0, for this update. To make HiGlass compatible with the new version of RGL, I also had to edit one part of the code in HiGlassComponent.js:

// Line 4385
+ const tiledAreasDiv = document.getElementById(
+   `tiled-area-${views[i].uid}`,
+ );
+ if (!tiledAreasDiv) {
+   // we do not have the DIV container
+   continue;
+ }
+ const area = tiledAreasDiv.getBoundingClientRect();
- const area = this.tiledAreasDivs[views[i].uid].getBoundingClientRect();

// Line 5098
return (
  <div
    key={view.uid}
+  id={`tiled-area-${view.uid}`}
    // `ref` callback function is not triggered for the children of RGL in the more recet version
    // (https://github.com/react-grid-layout/react-grid-layout/issues/1457)
-   ref={(c) => {
-     this.tiledAreasDivs[view.uid] = c;
-   }}
    styleName="styles.tiled-area"
    {multiTrackHeader}
    {tiledPlot}
    {overlay}
  </div>
);

Other than this issue, I think the new version is compatible by judging from the CHANGELOG.md, especially the "Breaking Updates" parts.

@pkerpedjiev, do you think we can upgrade RGL?

Screen Shot 2021-08-27 at 11 33 05 AM

Checklist

  • Set proper GitHub labels (e.g. v1.6+, ignore if you don't know)
  • Unit tests added or updated
  • Documentation added or updated
  • Example(s) added or updated
  • Update schema.json if there are changes to the viewconf JSON structure format
  • Screenshot for visual changes (e.g. new tracks or UI changes)
  • Updated CHANGELOG.md

@sehilyi sehilyi changed the title [draft] Add allowOverlap for React Grid Layout [draft] Add allowOverlap for React Grid Layout Aug 23, 2021
@sehilyi sehilyi changed the title [draft] Add allowOverlap for React Grid Layout Add allowOverlap for React Grid Layout Aug 27, 2021
@sehilyi sehilyi requested review from pkerpedjiev and removed request for pkerpedjiev August 27, 2021 15:54
@sehilyi sehilyi changed the title Add allowOverlap for React Grid Layout [draft] Add allowOverlap for React Grid Layout Aug 27, 2021
@sehilyi sehilyi changed the title [draft] Add allowOverlap for React Grid Layout [draft] Upgrade RGL and support allowOverlap Aug 27, 2021
@sehilyi sehilyi changed the title [draft] Upgrade RGL and support allowOverlap Upgrade RGL and support allowOverlap Aug 27, 2021
@pkerpedjiev
Copy link
Member

Hi Sehi, I think updating rgl is great! I'm not so sure about having overlapping views. We don't allow transparency so one matrix would just occlude the other. What's the use case?

Also AFAICT zooming doesn't work because all of the events are caught by the topmost view. If you wanted to enable this in gosling, why not just create two separate higlass components and overlay them?

@sehilyi
Copy link
Member Author

sehilyi commented Aug 31, 2021

Hi Pete,

I guess it may not be useful for now, but I was thinking about potential use cases with additional encoding functionality integrated (e.g., left-bottom half of the diagonal shows chr1 and the other side shows chr2). But, I am not sure if this kind of cross-region comparison makes sense at all in the HiC analysis...

Yes, the interaction does not work, and it is something that I wanted to somehow address as well in the future.

I previously tried with multiple HiGlass components, but since using one component showed better performance with multiple zoom and location locks with multiple views, I was trying to use only one component as much as possible.

@flekschas
Copy link
Member

flekschas commented Aug 31, 2021

We don't allow transparency so one matrix would just occlude the other. What's the use case?

I think we do support transparency. At least back in 2019 at Scipy we overlayed a heatmap onto a worldmap.

I understand the basic idea: compare two regions through superimposition, however, I do share the concern with Pete that it's not clear at all how interactions are suppose to work in that case. I wonder if this special case could also be handles through a meta-track like scalable-insets did.

Other than that I appreciate the update of RGL 🎉

@sehilyi
Copy link
Member Author

sehilyi commented Aug 31, 2021

Thank you both for reviewing the PR! @pkerpedjiev @flekschas

I think it was not a good idea to add documentation already without proper interactions supported. Regarding interactions, I was thinking of using location locks (with offsets) and zoom locks so that navigation on the top view affects the other, or allowing users to somehow interactively change the z-index of superposed visualizations. But, I would need to think about this more with some potential use cases.

If you think it does not hurt to have allowOverlap and can be potentially useful with proper interactions integrated, do you think we can remove the documentation for now but still have the allowOverlap as a root-level property?

@pkerpedjiev
Copy link
Member

pkerpedjiev commented Sep 1, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants