gosling-lang / gosling.js

Grammar of Scalable Linked Interactive Nucleotide Graphics
https://gosling.js.org
MIT License
160 stars 27 forks source link

Overlaying a single track over multiple tracks #884

Open ThHarbig opened 1 year ago

ThHarbig commented 1 year ago

I think it would be useful to be able to add a single track as an overlay for multiple tracks. For example, for IslandViewer, where a point track is overlaid over multiple stacked tracks.

Island Viewer with overlaid point track

It is possible to implement this at the moment using multiple overlaid tracks with increasing y parameters.

Another use case for this would be overlaying a brush over multiple tracks. In the Gremlin example, this is done for each track individually, but I think it would be more intuitive to add the brush just once in a single overlay track.

sehilyi commented 1 year ago

Grammar-wise, we will need to allow StackedTracks in OverlaidTracks:

From

export interface OverlaidTracks extends CommonViewDef, Partial<SingleTrack> {
    alignment: 'overlay';
    tracks: PartialTrack[];
}

To

export interface OverlaidTracks extends CommonViewDef, Partial<SingleTrack> {
    alignment: 'overlay';
    tracks: (PartialTrack | StackedTracks)[];
}
sehilyi commented 1 year ago

This will be beneficial when a user wants to put a brush that spans across tracks in a view. At the moment, users have to put brushes on individual tracks for this.

A technical difficulty would be that (AFAIK) HiGlass does not allow overlaying a view on top of multiple views.