Giter Site home page Giter Site logo

gosling-lang / gosling.js Goto Github PK

View Code? Open in Web Editor NEW
156.0 7.0 24.0 104.84 MB

Grammar of Scalable Linked Interactive Nucleotide Graphics

Home Page: https://gosling.js.org

License: MIT License

JavaScript 0.61% Jupyter Notebook 1.06% HTML 0.07% TypeScript 97.34% CSS 0.91%
gehlenborglab grammar dataviz higlass genomics visualization webgl typescript gosling hidivelab

gosling.js's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gosling.js's Issues

Add a `stack` option?

Can be useful for expressing lollipop plots, pileup tracks, and gene annotation tracks. Using this option, one do not have to transform the data in advance.

We could also consider merging bar and rect since one of the main difference between them is the ability to stack (e.g., using nominal color makes stacked bar charts with bar marks).

Open questions:

  • Technically, how to compute the bounding box of individual glyphs, rather than individual marks, and reposition them together?
    • (e.g., in gene annotation tracks, individual genes should move together).
    • We might need to add a id column so that visual marks having same ids can be considered to be belonged to a same glyph.
      • Grouping marks by id will help implementing other user interactions (e.g., selecting a glyph or seeing detailed info with a tooltip).
  • stack option would make the implementation much more complicated as we are directly mapping data w/ visual representations so far.

Support vertical tracks

We can use a view prop called orientation (detailed discussions in #242).

We need to think about how to seamlessly support this in circular layouts. For example, it is not straightforward how _l views (one horizontal, and one vertical) should be displayed in circular layouts.

API to merge a compiled HiGlass spec with an existing viewConfig

This can be helpful when one already has a viewConfig but want to add geminid tracks.

For example, we can use this functionality to add a cytogenetic band on the top as an overview in Cistrome Explorer.

To be useful, this should allow...

  • determining the position of geminid tracks among the other views
  • linking between geminid tracks and existing HiGlass views (e.g., show rect-brush)

Zooming in very far in scatterplots makes points disappear sometimes

It seems to be due to an edge case of a shareScaleAcrossTracks function where domain of y-axis contains undefined when there is no marks in a first few tiles. We need to add a test for this to prevent similar bugs.

https://github.com/sehilyi/geminid/blob/cb131366ffbc7d2676e5f0a104db519862c6e7c0/src/higlass-geminid-track/geminid-plugin-track.ts#L125

Example spec:

{
    layout: {type: 'linear', direction: 'horizontal', columnSizes: 800},
    tracks: [
        {
            data: {
                type: 'json',
                values: [{column1: "chr10", column2: 1675492158, column3: 1675492349, column4: "peak5", column5: 8.09199},
                {column1: "chr1", column2: 197354819, column3: 197355017, column4: "peak3", column5: 16.59866},
                {column1: "chr1", column2: 1988820, column3: 1989013, column4: "peak1", column5: 10.37344},
                {column1: "chr1", column2: 206906930, column3: 206907124, column4: "peak4", column5: 14.71685},
                {column1: "chr12", column2: 1994241310, column3: 1994241502, column4: "peak6", column5: 8.86495},
                {column1: "chr14", column2: 2251226715, column3: 2251226907, column4: "peak7", column5: 11.24377},
                {column1: "chr14", column2: 2290828101, column3: 2290828293, column4: "peak8", column5: 11.59765},
                {column1: "chr1", column2: 7334981, column3: 7335172, column4: "peak2", column5: 7.74302},
                {column1: "chr19", column2: 2658902534, column3: 2658902726, column4: "peak9", column5: 10.88678},
                {column1: "chr2", column2: 402178574, column3: 402178768, column4: "peak11", column5: 13.89448},
                {column1: "chr2", column2: 443133037, column3: 443133228, column4: "peak12", column5: 8.07263},
                {column1: "chr2", column2: 281872500, column3: 281873014, column4: "peak10", column5: 13.99521},
                {column1: "chr3", column2: 584620282, column3: 584620721, column4: "peak13", column5: 14.68924},
                {column1: "chr5", column2: 959272251, column3: 959272447, column4: "peak14", column5: 15.45138},
                {column1: "chr9", column2: 1615304825, column3: 1615305022, column4: "peak15", column5: 16.80942},
                {column1: "chr9", column2: 1621778737, column3: 1621778929, column4: "peak16", column5: 11.17822},
                {column1: "chrKI270752.1", column2: "19", column3: "358", column4: "peak17", column5: 5.68613},
                {column1: "chrKI270752.1", column2: "20483", column3: "20810", column4: "peak18", column5: 10.67836},
                {column1: "chrX", column2: 2919283987, column3: 2919284179, column4: "peak19", column5: 11.59765},
                {column1: "chrX", column2: 2920007474, column3: 2920007672, column4: "peak20", column5: 14.53432},
                {column1: "", column5: NaN}],
                chromosomeField: 'column1',
                genomicFields: ['column2', 'column3'],
                quantitativeFields: ['column5']
            },
            tooltip: [
                {field: 'column4', type: 'nominal'}
            ],
            superpose: [
                {mark: "point", size: { value: 3 }, opacity: { value: 1 }},
                {mark: "bar", size: { value: 1 }},
            ],
            color: {value: "gray"},
            x: {
                field: "column2",
                type: "genomic",
                axis: "bottom"
            },
            xe: {
                field: "column3",
                type: "genomic"
            },
            y: {field: "column5", type: "quantitative"}
        }
    ]
};

Better cache already loaded tiles

When you zoom out and zoom in, and then quickly zoom out again on a track, you can see the white space on the left and right side since the track is taking some time to retrieve and render the tiles that had been already used previously. We could probably reduce this rendering time by properly caching the tiles.

Limit the total number of visual elements rendered?

Considering the performance, it might be necessary to (1) limit the total number of visual elements that are rendered in the entire views and/or (2) show some kinds of warning messages when there are too many elements to let one know that the rendering performance can be affected.

Support custom tooltips

Tooltip Support By Layout and Mark Type

Linear Layout

  • rect
  • bar
  • point
  • line
  • area
  • link
  • band
  • triangle
  • text
  • rule

Circular Layout

  • rect
  • bar
  • point
  • triangle
  • link
  • line
  • area
  • text
  • rule

Things To Support

  • Show multiple sets of information in a tooltip (i.e., when multiple visual marks are hovered at once). We currently capture all the visual marks that are being hovered (not only the one on the top), but we will need to visually organize such information well in a tooltip.

Add `juxtapose` similar to `superpose`

Genomic visualization often shows different data with the same visualization type (e.g., bar charts showing multiple samples or different genomic regions, like #8). However, defining this multi-view visualization makes the source code long with many duplicated definitions (e.g., parts of bar encoding), making it hard to be managed.

Similar to superpose, we could support juxtapose which helps one to shorten the source code of multiple visualizations with similar encoding:

tracks: [{
   ..., // common Track definition
   juxtapose: [A, B]
}]

is equal to

tracks: [{
   ..., // common Track definition
   A
},
{
   ..., // common Track definition
   B
}]

where A and B are the part of a track definition.

To make the design simple enough, superpose cannot be used inside juxtapose and vice versa, but both can be used together in a track definition:

tracks: [{
   ..., // common Track definition
   juxtapose: [A, B],
   superpose: [C, D]
}]

is semantically identical to

tracks: [{
   ..., // common Track definition
   A,
   superpose: [C, D]
},
{
   ..., // common Track definition
   B,
   superpose: [C, D]
}]

Support matrix view

We need to also discuss how we are going to do this with circular layouts. Given that it uses two genomic axes, it is not very straightforward showing it in a circular one.

On possible option would be to change to a horizontal matrix (#33), instead of not supporting circular layouts at all.

In order to support this, encoding two genomic axes should be supported. This means, we need to use a more generic track, like TiledPixiTrack, as a parent class of a geminid plugin track.

Incorrectly parsed chromosomes are assigned to `chr:1`

The chromosome name that is not parsed correctly (e.g., 12|NW_***), are assigned to the chromosome 1 incorrectly. Those should be entirely removed in the visualizations or correctly parsed (e.g., assign to chr:12?).

Screen Shot 2021-01-02 at 2 11 38 PM

Improve rendering performance

Some Initial Thoughts

  • Using HiGlass' data structure largely allows us to render visualization w/o too much cost because it pre-aggregates data and send Gosling the manageable amount of data values to display. But, still, improving rendering performance is really important (e.g., using many number of tracks w/ non-higlass data will significantly degrade the performance).
  • Performance can be largely improved If we render texture (sprite), instead of individual graphical elements, and stretch them upon zooming in/out until getting new tiles. Some challenges:
    • Not straightforward to apply this concept in circular layouts
    • Some marks (text and circles) would result in ugly or even unreadable appearance
    • We still need to update subset of graphical elements if mark-level visibility options are being used (i.e., visibility: [{..., target: "mark" }])
  • Sharing the same texture for identical-looking visual marks would be another option (Example)
    • e.g., use the same texture for the same color bars and just resize them.
  • Linking multiple higlass views looks to significantly decrease the zooming/panning performance
  • This rendering performance is especially important for dense matrix visualization (#38)
  • A constant/related problem that we encounter: #230

Resources

Rename properties for consistency

Consistent property names would improve the usability of our grammar:

  • circularLayout: boolean => layout: 'circular' | 'linear'
  • layout => arrangement (this is to make it more consistent to GenoCAT)
    • type: 'circular' | 'linear' currently in the layout should be moved out to the root-level spec (sibling w/ tracks)
  • Use either static or zoomable consistently

Use native `name` option of tracks

{  
    // higlass viewConfig
    "mousePositionColor": "#000000",
    "backgroundColor": "transparent",
    "name": "Local data",
    "fontSize": 12,
    "labelColor": "black",
    "labelPosition": "topLeft",
    "labelBackgroundColor": "#F6F6F6",
    "labelTextOpacity": 0.6,
    "labelLeftMargin": 4,
    "labelRightMargin": 0,
    "labelTopMargin": 2,
    "labelBottomMargin": 0
}

Support rotated 2D matrix

I do not yet have a good idea to support this in a grammar perspective.

Also, should support a higlass' matrix data type to visualize matrix.

Screen Shot 2020-12-16 at 6 46 49 PM

Add tests thoroughly

To make the grammar more stable, we must add tests for each components (grammar, editor, renderer) more thoroughly and collecting sets of good test examples.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.