higlass 1.13.0 → 1.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -91,6 +91,7 @@ const SCROLL_TIMEOUT = 100;
91
91
  /** @typedef {import('./types').Scale} Scale */
92
92
  /** @typedef {import('./types').TrackConfig} TrackConfig */
93
93
  /** @typedef {import('./types').TrackObject} TrackObject */
94
+ /** @typedef {import('./types').TilesetInfo} TilesetInfo */
94
95
 
95
96
  /** @typedef {TrackRenderer["setCenter"]} SetCentersFunction */
96
97
  /** @typedef {(x: Scale, y: Scale) => [Scale, Scale]} ProjectorFunction */
@@ -104,8 +105,6 @@ const SCROLL_TIMEOUT = 100;
104
105
  * @property {number} left
105
106
  */
106
107
 
107
- /** @typedef {Record<string, unknown>} TilesetInfo */
108
-
109
108
  /**
110
109
  * @typedef MetaPluginTrackContext
111
110
  * @property {(trackId: string) => TrackObject | undefined} getTrackObject
@@ -133,7 +132,7 @@ const SCROLL_TIMEOUT = 100;
133
132
  * @property {() => void} onMouseMoveZoom
134
133
  * @property {string} chromInfoPath
135
134
  * @property {() => boolean} isShowGlobalMousePosition
136
- * @property {() => (string | typeof THEME_DARK)} getTheme
135
+ * @property {() => import('./types').Theme} getTheme
137
136
  * @property {unknown=} AVAILABLE_FOR_PLUGINS
138
137
  * @property {(HTMLDivElement | null)=} baseEl
139
138
  * @property {TrackConfig=} definition
@@ -197,7 +196,7 @@ const SCROLL_TIMEOUT = 100;
197
196
  * @property {import('pub-sub-es').PubSub} pubSub
198
197
  * @property {(func: SetCentersFunction) => void} setCentersFunction
199
198
  * @property {HTMLElement} svgElement
200
- * @property {string | typeof THEME_DARK} theme
199
+ * @property {import('./types').Theme} theme
201
200
  * @property {number} topHeight
202
201
  * @property {number} topHeightNoGallery
203
202
  * @property {{ backgroundColor?: string }} viewOptions
@@ -1856,17 +1855,15 @@ class TrackRenderer extends React.Component {
1856
1855
  context.projectionYDomain = track.projectionYDomain;
1857
1856
  }
1858
1857
 
1859
- const options = track.options;
1860
-
1861
1858
  switch (track.type) {
1862
1859
  case 'left-axis':
1863
- return new LeftAxisTrack(context, options);
1860
+ return new LeftAxisTrack(context, track.options);
1864
1861
 
1865
1862
  case 'top-axis':
1866
- return new TopAxisTrack(context, options);
1863
+ return new TopAxisTrack(context, track.options);
1867
1864
 
1868
1865
  case 'heatmap':
1869
- return new HeatmapTiledPixiTrack(context, options);
1866
+ return new HeatmapTiledPixiTrack(context, track.options);
1870
1867
 
1871
1868
  case 'multivec':
1872
1869
  case 'vector-heatmap':
@@ -1874,46 +1871,46 @@ class TrackRenderer extends React.Component {
1874
1871
  case 'horizontal-vector-heatmap': // legacy, included for backwards compatiblity
1875
1872
  case 'vertical-multivec': // legacy, included for backwards compatiblity
1876
1873
  case 'vertical-vector-heatmap': // legacy, included for backwards compatiblity
1877
- return new HorizontalMultivecTrack(context, options);
1874
+ return new HorizontalMultivecTrack(context, track.options);
1878
1875
 
1879
1876
  case '1d-heatmap':
1880
1877
  case 'horizontal-1d-heatmap': // legacy, included for backwards compatiblity
1881
1878
  case 'vertical-1d-heatmap': // legacy, included for backwards compatiblity
1882
- return new Horizontal1dHeatmapTrack(context, options);
1879
+ return new Horizontal1dHeatmapTrack(context, track.options);
1883
1880
 
1884
1881
  case 'line':
1885
1882
  case 'horizontal-line': // legacy, included for backwards compatiblity
1886
1883
  case 'vertical-line': // legacy, included for backwards compatiblity
1887
- return new HorizontalLine1DPixiTrack(context, options);
1884
+ return new HorizontalLine1DPixiTrack(context, track.options);
1888
1885
 
1889
1886
  case 'point':
1890
1887
  case 'horizontal-point': // legacy, included for backwards compatiblity
1891
1888
  case 'vertical-point': // legacy, included for backwards compatiblity
1892
- return new HorizontalPoint1DPixiTrack(context, options);
1889
+ return new HorizontalPoint1DPixiTrack(context, track.options);
1893
1890
 
1894
1891
  case 'bar':
1895
1892
  case 'horizontal-bar': // legacy, included for backwards compatiblity
1896
1893
  case 'vertical-bar': // legacy, included for backwards compatiblity
1897
- return new BarTrack(context, options);
1894
+ return new BarTrack(context, track.options);
1898
1895
 
1899
1896
  case 'divergent-bar':
1900
1897
  case 'horizontal-divergent-bar': // legacy, included for backwards compatiblity
1901
1898
  case 'vertical-divergent-bar': // legacy, included for backwards compatiblity
1902
- return new DivergentBarTrack(context, options);
1899
+ return new DivergentBarTrack(context, track.options);
1903
1900
 
1904
1901
  case 'horizontal-1d-tiles':
1905
- return new IdHorizontal1DTiledPixiTrack(context, options);
1902
+ return new IdHorizontal1DTiledPixiTrack(context, track.options);
1906
1903
 
1907
1904
  case 'vertical-1d-tiles':
1908
- return new IdVertical1DTiledPixiTrack(context, options);
1905
+ return new IdVertical1DTiledPixiTrack(context, track.options);
1909
1906
 
1910
1907
  case '2d-tiles':
1911
- return new Id2DTiledPixiTrack(context, options);
1908
+ return new Id2DTiledPixiTrack(context, track.options);
1912
1909
 
1913
1910
  case 'stacked-interval':
1914
1911
  case 'top-stacked-interval': // legacy, included for backwards compatiblity
1915
1912
  case 'left-stacked-interval': // legacy, included for backwards compatiblity
1916
- return new CNVIntervalTrack(context, options);
1913
+ return new CNVIntervalTrack(context, track.options);
1917
1914
 
1918
1915
  case 'viewport-projection-center':
1919
1916
  // TODO: Fix this so that these functions are defined somewhere else
@@ -1925,9 +1922,9 @@ class TrackRenderer extends React.Component {
1925
1922
  context.registerViewportChanged = track.registerViewportChanged;
1926
1923
  context.removeViewportChanged = track.removeViewportChanged;
1927
1924
  context.setDomainsCallback = track.setDomainsCallback;
1928
- return new ViewportTracker2D(context, options);
1925
+ return new ViewportTracker2D(context, track.options);
1929
1926
  }
1930
- return new Track(context);
1927
+ return new Track(context, {});
1931
1928
 
1932
1929
  case 'viewport-projection-horizontal':
1933
1930
  // TODO: Fix this so that these functions are defined somewhere else
@@ -1939,9 +1936,9 @@ class TrackRenderer extends React.Component {
1939
1936
  context.registerViewportChanged = track.registerViewportChanged;
1940
1937
  context.removeViewportChanged = track.removeViewportChanged;
1941
1938
  context.setDomainsCallback = track.setDomainsCallback;
1942
- return new ViewportTrackerHorizontal(context, options);
1939
+ return new ViewportTrackerHorizontal(context, track.options);
1943
1940
  }
1944
- return new Track(context);
1941
+ return new Track(context, {});
1945
1942
 
1946
1943
  case 'viewport-projection-vertical':
1947
1944
  // TODO: Fix this so that these functions are defined somewhere else
@@ -1953,37 +1950,37 @@ class TrackRenderer extends React.Component {
1953
1950
  context.registerViewportChanged = track.registerViewportChanged;
1954
1951
  context.removeViewportChanged = track.removeViewportChanged;
1955
1952
  context.setDomainsCallback = track.setDomainsCallback;
1956
- return new ViewportTrackerVertical(context, options);
1953
+ return new ViewportTrackerVertical(context, track.options);
1957
1954
  }
1958
- return new Track(context);
1955
+ return new Track(context, {});
1959
1956
 
1960
1957
  case 'gene-annotations':
1961
1958
  case 'horizontal-gene-annotations': // legacy, included for backwards compatiblity
1962
1959
  case 'vertical-gene-annotations': // legacy, included for backwards compatiblity
1963
- return new HorizontalGeneAnnotationsTrack(context, options);
1960
+ return new HorizontalGeneAnnotationsTrack(context, track.options);
1964
1961
 
1965
1962
  case '2d-rectangle-domains':
1966
1963
  case 'arrowhead-domains':
1967
- return new ArrowheadDomainsTrack(context, options);
1964
+ return new ArrowheadDomainsTrack(context, track.options);
1968
1965
 
1969
1966
  case 'horizontal-1d-annotations':
1970
- return new Annotations1dTrack(context, options);
1967
+ return new Annotations1dTrack(context, track.options);
1971
1968
 
1972
1969
  case 'vertical-1d-annotations':
1973
1970
  // Fix this: LeftTrackModifier is doing a whole bunch of things not
1974
1971
  // needed by this track but the current setup is not consistent.
1975
- return new Annotations1dTrack(context, options, true);
1972
+ return new Annotations1dTrack(context, track.options, true);
1976
1973
 
1977
1974
  case '2d-annotations':
1978
- return new Annotations2dTrack(context, options);
1975
+ return new Annotations2dTrack(context, track.options);
1979
1976
 
1980
1977
  case 'linear-2d-rectangle-domains':
1981
1978
  case 'horizontal-2d-rectangle-domains': // legacy, included for backwards compatiblity
1982
1979
  case 'vertical-2d-rectangle-domains': // legacy, included for backwards compatiblity
1983
- return new Horizontal2DDomainsTrack(context, options);
1980
+ return new Horizontal2DDomainsTrack(context, track.options);
1984
1981
 
1985
1982
  case 'square-markers':
1986
- return new SquareMarkersTrack(context, options);
1983
+ return new SquareMarkersTrack(context, track.options);
1987
1984
 
1988
1985
  case 'combined':
1989
1986
  // @ts-expect-error - FIXME: Our typing should be able to narrow track config
@@ -1993,80 +1990,84 @@ class TrackRenderer extends React.Component {
1993
1990
  return new CombinedTrack(context);
1994
1991
 
1995
1992
  case '2d-chromosome-labels':
1996
- return new Chromosome2DLabels(context, options);
1993
+ return new Chromosome2DLabels(context, track.options);
1997
1994
 
1998
1995
  case 'horizontal-chromosome-grid':
1999
1996
  context.orientation = '1d-horizontal';
2000
- return new ChromosomeGrid(context, options);
1997
+ return new ChromosomeGrid(context, track.options);
2001
1998
 
2002
1999
  case 'vertical-chromosome-grid':
2003
2000
  context.orientation = '1d-vertical';
2004
- return new ChromosomeGrid(context, options);
2001
+ return new ChromosomeGrid(context, track.options);
2005
2002
 
2006
2003
  case '2d-chromosome-grid':
2007
- return new ChromosomeGrid(context, options);
2004
+ return new ChromosomeGrid(context, track.options);
2008
2005
 
2009
2006
  case 'chromosome-labels':
2010
2007
  case 'horizontal-chromosome-labels': // legacy, included for backwards compatiblity
2011
2008
  case 'vertical-chromosome-labels': // legacy, included for backwards compatiblity
2012
2009
  // chromInfoPath is passed in for backwards compatibility
2013
2010
  // it can be used to provide custom chromosome sizes
2014
- return new HorizontalChromosomeLabels(context, options);
2011
+ return new HorizontalChromosomeLabels(context, track.options);
2015
2012
 
2016
2013
  case 'linear-heatmap':
2017
2014
  case 'horizontal-heatmap': // legacy, included for backwards compatiblity
2018
2015
  case 'vertical-heatmap': // legacy, included for backwards compatiblity
2019
- return new HorizontalHeatmapTrack(context, options);
2016
+ return new HorizontalHeatmapTrack(context, track.options);
2020
2017
 
2021
2018
  case '2d-chromosome-annotations':
2022
- return new Chromosome2DAnnotations(context, options);
2019
+ return new Chromosome2DAnnotations(context, track.options);
2023
2020
 
2024
2021
  case '1d-value-interval':
2025
2022
  case 'horizontal-1d-value-interval': // legacy, included for backwards compatiblity
2026
2023
  case 'vertical-1d-value-interval': // legacy, included for backwards compatiblity
2027
- return new ValueIntervalTrack(context, options);
2024
+ return new ValueIntervalTrack(context, track.options);
2028
2025
 
2029
2026
  case 'osm':
2030
2027
  case 'osm-tiles':
2031
- return new OSMTilesTrack(context, options);
2028
+ return new OSMTilesTrack(context, track.options);
2032
2029
 
2033
2030
  case 'osm-2d-tile-ids':
2034
- return new OSMTileIdsTrack(context, options);
2031
+ return new OSMTileIdsTrack(context, track.options);
2035
2032
 
2036
2033
  case 'mapbox':
2037
2034
  case 'mapbox-tiles':
2038
- return new MapboxTilesTrack(context, options);
2035
+ return new MapboxTilesTrack(context, track.options);
2039
2036
 
2040
2037
  case 'raster-tiles':
2041
- return new RasterTilesTrack(context, options);
2038
+ return new RasterTilesTrack(context, track.options);
2042
2039
 
2043
2040
  case 'bedlike':
2044
2041
  case 'vertical-bedlike': // legacy, included for backwards compatiblity
2045
- return new BedLikeTrack(context, options);
2042
+ return new BedLikeTrack(context, track.options);
2046
2043
 
2047
2044
  case 'overlay-track':
2048
- return new OverlayTrack(context, options);
2045
+ return new OverlayTrack(context, track.options);
2049
2046
 
2050
2047
  case 'overlay-chromosome-grid-track':
2051
2048
  context.isOverlay = true;
2052
- return new ChromosomeGrid(context, options);
2049
+ return new ChromosomeGrid(context, track.options);
2053
2050
 
2054
2051
  case 'horizontal-rule':
2055
- return new HorizontalRule(context, options);
2052
+ return new HorizontalRule(context, track.options);
2056
2053
 
2057
2054
  case 'vertical-rule':
2058
- return new VerticalRule(context, options);
2055
+ return new VerticalRule(context, track.options);
2059
2056
 
2060
2057
  case 'cross-rule':
2061
2058
  // This needs to be harmonized.
2062
2059
  context.x = track.x;
2063
2060
  context.y = track.y;
2064
- return new CrossRule(context, options);
2061
+ return new CrossRule(context, track.options);
2065
2062
 
2066
2063
  case 'simple-svg':
2067
- return new SVGTrack(context, options);
2068
- case 'empty':
2064
+ return new SVGTrack(context, track.options);
2065
+ case 'empty': {
2066
+ /** @type {import('./PixiTrack').PixiTrackOptions} */
2067
+ // @ts-expect-error - We need a way to relate the track type and track.options.
2068
+ const options = track.options;
2069
2069
  return new PixiTrack(context, options);
2070
+ }
2070
2071
 
2071
2072
  default: {
2072
2073
  // Check if a plugin track is available
@@ -2091,7 +2092,7 @@ class TrackRenderer extends React.Component {
2091
2092
  return new pluginTrack.track( // eslint-disable-line new-cap
2092
2093
  this.availableForPlugins,
2093
2094
  context,
2094
- options,
2095
+ track.options,
2095
2096
  );
2096
2097
  } catch (e) {
2097
2098
  console.error(
@@ -2,11 +2,13 @@ import React from 'react';
2
2
 
3
3
  import { toVoid } from '../utils';
4
4
 
5
+ /** @type {import('pub-sub-es').PubSub & { __fake__: true }} */
5
6
  const fake = {
6
7
  __fake__: true,
7
8
  publish: toVoid,
8
- subscribe: toVoid,
9
+ subscribe: () => ({ event: 'fake', handler: toVoid }),
9
10
  unsubscribe: toVoid,
11
+ clear: toVoid,
10
12
  };
11
13
 
12
14
  const { Provider, Consumer } = React.createContext(fake);
@@ -1,5 +1,7 @@
1
1
  /* eslint-disable */
2
2
 
3
+ import type { THEME_DARK, THEME_LIGHT } from "./configs";
4
+
3
5
  export type Scale = import("d3-scale").ScaleContinuousNumeric<number, number>;
4
6
 
5
7
  export type TrackPosition = typeof import('./configs/primitives').TRACK_LOCATIONS[number];
@@ -77,3 +79,27 @@ export interface TrackObject {
77
79
  movedY(extent: number): void;
78
80
  zoomedY(yPosition: number, wheelDelta: number): void;
79
81
  }
82
+
83
+ export type Theme = typeof THEME_DARK | typeof THEME_LIGHT;
84
+
85
+ type TilesetInfoBase = {
86
+ name: string;
87
+ coordSystem: string;
88
+ min_pos: number[];
89
+ max_pos: number[];
90
+ max_zoom: number;
91
+ tile_size?: number;
92
+ max_tile_width?: number;
93
+ transforms?: { name: string, value: string }[];
94
+ }
95
+
96
+ export type LegacyTilesetInfo = TilesetInfoBase & {
97
+ max_width: number;
98
+ bins_per_dimension?: number;
99
+ }
100
+
101
+ export type ResolutionsTilesetInfo = TilesetInfoBase & {
102
+ resolutions: number[];
103
+ }
104
+
105
+ export type TilesetInfo = LegacyTilesetInfo | ResolutionsTilesetInfo;
@@ -15,3 +15,27 @@ export function isCombinedTrackConfig(trackConfig) {
15
15
  export function isWheelEvent(event) {
16
16
  return 'deltaY' in event && 'deltaMode' in event;
17
17
  }
18
+
19
+ /**
20
+ * @param {unknown} obj
21
+ * @returns {obj is {}}
22
+ */
23
+ export function isObject(obj) {
24
+ return obj !== null && typeof obj === 'object';
25
+ }
26
+
27
+ /**
28
+ * @param {import('../types').TilesetInfo | undefined} info
29
+ * @returns {info is import('../types').LegacyTilesetInfo}
30
+ */
31
+ export function isLegacyTilesetInfo(info) {
32
+ return isObject(info) && 'max_width' in info;
33
+ }
34
+
35
+ /**
36
+ * @param {import('../types').TilesetInfo | undefined} info
37
+ * @returns {info is import('../types').ResolutionsTilesetInfo}
38
+ */
39
+ export function isResolutionsTilesetInfo(info) {
40
+ return isObject(info) && 'resolutions' in info;
41
+ }
package/dist/esm.html ADDED
@@ -0,0 +1,283 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <title>HiGlass</title>
7
+ <style type="text/css">
8
+ #demo {
9
+ position: absolute;
10
+ left: 1rem;
11
+ top: 1rem;
12
+ bottom: 1rem;
13
+ right: 1rem;
14
+ overflow: hidden;
15
+ }
16
+ </style>
17
+ <link rel="stylesheet" href="./hglib.css">
18
+ <script type="importmap">
19
+ {
20
+ "imports": {
21
+ "react": "https://esm.sh/react@17",
22
+ "react-dom": "https://esm.sh/react-dom@17",
23
+ "pixi.js": "https://esm.sh/pixi.js@6"
24
+ }
25
+ }
26
+ </script>
27
+ <script type="module">
28
+ import * as hglib from "./higlass.mjs";
29
+ globalThis.hglib = hglib;
30
+ </script>
31
+
32
+ </head>
33
+
34
+ <body>
35
+ <div id="demo"></div>
36
+ </body>
37
+
38
+ <script type="module">
39
+ const viewConfig = {
40
+ zoomFixed: false,
41
+ views: [
42
+ {
43
+ layout: {
44
+ w: 12,
45
+ h: 7,
46
+ x: 0,
47
+ y: 0
48
+ },
49
+ uid: 'aa',
50
+ initialYDomain: [
51
+ 2534823997.9776945,
52
+ 2547598956.834603
53
+ ],
54
+ initialXDomain: [
55
+ 2521015726.4619913,
56
+ 2558682921.8435397
57
+ ],
58
+ tracks: {
59
+ left: [],
60
+ top: [
61
+ {
62
+ uid: 'genes',
63
+ tilesetUid: 'OHJakQICQD6gTD7skx4EWA',
64
+ server: 'http://higlass.io/api/v1',
65
+ type: 'horizontal-gene-annotations',
66
+ height: 48,
67
+ options: {
68
+ labelColor: 'black',
69
+ plusStrandColor: 'black',
70
+ labelPosition: 'hidden',
71
+ minusStrandColor: 'black',
72
+ fontSize: 11,
73
+ trackBorderWidth: 0,
74
+ trackBorderColor: 'black',
75
+ showMousePosition: true,
76
+ mousePositionColor: '#000000',
77
+ geneAnnotationHeight: 10,
78
+ geneLabelPosition: 'outside',
79
+ geneStrandSpacing: 4
80
+ },
81
+ },
82
+ {
83
+ uid: 'line1',
84
+ tilesetUid: 'PjIJKXGbSNCalUZO21e_HQ',
85
+ height: 20,
86
+ server: 'http://higlass.io/api/v1',
87
+ type: 'horizontal-line',
88
+ options: {
89
+ valueScaling: 'linear',
90
+ lineStrokeWidth: 2,
91
+ lineStrokeColor: '#4a35fc',
92
+ labelPosition: 'topLeft',
93
+ labelColor: 'black',
94
+ axisPositionHorizontal: 'right',
95
+ trackBorderWidth: 0,
96
+ trackBorderColor: 'black',
97
+ labelTextOpacity: 0.4,
98
+ showMousePosition: true,
99
+ mousePositionColor: '#000000',
100
+ showTooltip: false
101
+ }
102
+ },
103
+ {
104
+ uid: 'line2',
105
+ tilesetUid: 'PdAaSdibTLK34hCw7ubqKA',
106
+ height: 20,
107
+ server: 'http://higlass.io/api/v1',
108
+ type: 'horizontal-line',
109
+ options: {
110
+ valueScaling: 'linear',
111
+ lineStrokeWidth: 2,
112
+ lineStrokeColor: '#d104fa',
113
+ labelPosition: 'topLeft',
114
+ labelColor: 'black',
115
+ axisPositionHorizontal: 'right',
116
+ trackBorderWidth: 0,
117
+ trackBorderColor: 'black',
118
+ labelTextOpacity: 0.4,
119
+ showMousePosition: true,
120
+ mousePositionColor: '#000000',
121
+ showTooltip: false
122
+ },
123
+ },
124
+ {
125
+ uid: 'line3',
126
+ tilesetUid: 'e0DYtZBSTqiMLHoaimsSpg',
127
+ height: 20,
128
+ server: 'http://higlass.io/api/v1',
129
+ type: 'horizontal-line',
130
+ options: {
131
+ valueScaling: 'linear',
132
+ lineStrokeWidth: 2,
133
+ lineStrokeColor: '#ff0000',
134
+ labelPosition: 'topLeft',
135
+ labelColor: 'black',
136
+ axisPositionHorizontal: 'right',
137
+ trackBorderWidth: 0,
138
+ trackBorderColor: 'black',
139
+ labelTextOpacity: 0.4,
140
+ showMousePosition: true,
141
+ mousePositionColor: '#000000',
142
+ showTooltip: false
143
+ },
144
+ },
145
+ {
146
+ uid: 'line4',
147
+ tilesetUid: 'cE0nGyd0Q_yVYSyBUe89Ww',
148
+ height: 20,
149
+ server: 'http://higlass.io/api/v1',
150
+ type: 'horizontal-line',
151
+ options: {
152
+ valueScaling: 'linear',
153
+ lineStrokeWidth: 2,
154
+ lineStrokeColor: 'orange',
155
+ labelPosition: 'topLeft',
156
+ labelColor: 'black',
157
+ axisPositionHorizontal: 'right',
158
+ trackBorderWidth: 0,
159
+ trackBorderColor: 'black',
160
+ labelTextOpacity: 0.4,
161
+ showMousePosition: true,
162
+ mousePositionColor: '#000000',
163
+ showTooltip: false
164
+ },
165
+ },
166
+ {
167
+ uid: 'chroms',
168
+ height: 18,
169
+ chromInfoPath: '//s3.amazonaws.com/pkerp/data/hg19/chromSizes.tsv',
170
+ type: 'horizontal-chromosome-labels',
171
+ options: {
172
+ color: '#777777',
173
+ stroke: '#FFFFFF',
174
+ fontSize: 11,
175
+ fontIsLeftAligned: true,
176
+ showMousePosition: true,
177
+ mousePositionColor: '#000000'
178
+ },
179
+ }
180
+ ],
181
+ right: [],
182
+ center: [
183
+ {
184
+ uid: 'center',
185
+ type: 'combined',
186
+ contents: [
187
+ {
188
+ server: 'http://higlass.io/api/v1',
189
+ tilesetUid: 'dVBREuC2SvO01uXYMUh2aQ',
190
+ type: 'heatmap',
191
+ uid: 'Yqetzqw6Qfy-hREAJhAXEA',
192
+ options: {
193
+ backgroundColor: '#eeeeee',
194
+ labelPosition: 'topLeft',
195
+ labelTextOpacity: 0.4,
196
+ colorRange: [
197
+ 'white',
198
+ 'rgba(245,166,35,1.0)',
199
+ 'rgba(208,2,27,1.0)',
200
+ 'black'
201
+ ],
202
+ maxZoom: null,
203
+ colorbarPosition: 'topRight',
204
+ trackBorderWidth: 0,
205
+ trackBorderColor: 'black',
206
+ heatmapValueScaling: 'log',
207
+ showMousePosition: true,
208
+ mousePositionColor: '#000000',
209
+ showTooltip: true,
210
+ scaleStartPercent: '0.00000',
211
+ scaleEndPercent: '1.00000',
212
+ showMousePositionGlobally: true,
213
+ },
214
+ }
215
+ ],
216
+ }
217
+ ],
218
+ bottom: [],
219
+ whole: [],
220
+ gallery: []
221
+ },
222
+ chromInfoPath: '//s3.amazonaws.com/pkerp/data/hg19/chromSizes.tsv',
223
+ genomePositionSearchBox: {
224
+ visible: true,
225
+ chromInfoServer: 'http://higlass.io/api/v1',
226
+ chromInfoId: 'hg19',
227
+ autocompleteServer: 'http://higlass.io/api/v1',
228
+ autocompleteId: 'OHJakQICQD6gTD7skx4EWA'
229
+ }
230
+ }
231
+ ],
232
+ editable: true,
233
+ viewEditable: true,
234
+ tracksEditable: true,
235
+ exportViewUrl: '/api/v1/viewconfs',
236
+ zoomLocks: {
237
+ locksByViewUid: {},
238
+ locksDict: {}
239
+ },
240
+ trackSourceServers: [
241
+ 'http://higlass.io/api/v1'
242
+ ],
243
+ locationLocks: {
244
+ locksByViewUid: {
245
+ aa: 'PkNgAl3mSIqttnSsCewngw',
246
+ ewZvJwlDSei_dbpIAkGMlg: 'PkNgAl3mSIqttnSsCewngw'
247
+ },
248
+ locksDict: {
249
+ PkNgAl3mSIqttnSsCewngw: {
250
+ aa: [
251
+ 1550000000,
252
+ 1550000000,
253
+ 3380588.876772046
254
+ ],
255
+ ewZvJwlDSei_dbpIAkGMlg: [
256
+ 1550000000.0000002,
257
+ 1549999999.9999993,
258
+ 3380588.876772046
259
+ ],
260
+ uid: 'PkNgAl3mSIqttnSsCewngw'
261
+ }
262
+ }
263
+ },
264
+ valueScaleLocks: {
265
+ locksByViewUid: {},
266
+ locksDict: {}
267
+ }
268
+ };
269
+
270
+ const hgApi = window.hgApi = hglib.viewer(
271
+ document.getElementById('demo'),
272
+ viewConfig,
273
+ { bounded: true },
274
+ );
275
+
276
+ hgApi.setBroadcastMousePositionGlobally(true);
277
+
278
+ hgApi.on('viewConfig', () => {
279
+ console.log('View Config changed');
280
+ });
281
+
282
+ </script>
283
+ </html>