higlass 1.11.11 → 1.12.0

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.
Files changed (113) hide show
  1. package/README.md +19 -10
  2. package/app/scripts/{AddTrackDialog.js → AddTrackDialog.jsx} +27 -26
  3. package/app/scripts/{AddTrackPositionMenu.js → AddTrackPositionMenu.jsx} +18 -15
  4. package/app/scripts/{Autocomplete.js → Autocomplete.jsx} +1 -0
  5. package/app/scripts/{Button.js → Button.jsx} +7 -6
  6. package/app/scripts/CenterTiledPlot.jsx +7 -0
  7. package/app/scripts/{CenterTrack.js → CenterTrack.jsx} +42 -41
  8. package/app/scripts/ChromosomeGrid.js +8 -16
  9. package/app/scripts/CloseTrackMenu.jsx +27 -0
  10. package/app/scripts/CombinedTrack.js +16 -1
  11. package/app/scripts/{ConfigTrackMenu.js → ConfigTrackMenu.jsx} +12 -12
  12. package/app/scripts/{ConfigViewMenu.js → ConfigViewMenu.jsx} +35 -36
  13. package/app/scripts/{ConfigureSeriesMenu.js → ConfigureSeriesMenu.jsx} +2 -2
  14. package/app/scripts/{ContextMenuContainer.js → ContextMenuContainer.jsx} +5 -7
  15. package/app/scripts/ContextMenuItem.jsx +37 -0
  16. package/app/scripts/Cross.jsx +9 -0
  17. package/app/scripts/CustomTrackDialog.jsx +38 -0
  18. package/app/scripts/DataFetcher.js +6 -6
  19. package/app/scripts/{Dialog.js → Dialog.jsx} +40 -31
  20. package/app/scripts/{DragListeningDiv.js → DragListeningDiv.jsx} +10 -12
  21. package/app/scripts/{DraggableDiv.js → DraggableDiv.jsx} +25 -24
  22. package/app/scripts/{ExportLinkDialog.js → ExportLinkDialog.jsx} +2 -2
  23. package/app/scripts/{FixedTrack.js → FixedTrack.jsx} +0 -0
  24. package/app/scripts/{GalleryTracks.js → GalleryTracks.jsx} +10 -9
  25. package/app/scripts/{GenomePositionSearchBox.js → GenomePositionSearchBox.jsx} +14 -16
  26. package/app/scripts/{HeatmapOptions.js → HeatmapOptions.jsx} +0 -0
  27. package/app/scripts/HeatmapTiledPixiTrack.js +18 -30
  28. package/app/scripts/{HiGlassComponent.js → HiGlassComponent.jsx} +206 -85
  29. package/app/scripts/{HiGlassTrackComponent.js → HiGlassTrackComponent.jsx} +0 -0
  30. package/app/scripts/HorizontalChromosomeLabels.js +3 -6
  31. package/app/scripts/HorizontalHeatmapTrack.js +2 -6
  32. package/app/scripts/{HorizontalItem.js → HorizontalItem.jsx} +0 -0
  33. package/app/scripts/HorizontalRule.js +2 -0
  34. package/app/scripts/{HorizontalTiledPlot.js → HorizontalTiledPlot.jsx} +20 -19
  35. package/app/scripts/{HorizontalTrack.js → HorizontalTrack.jsx} +0 -0
  36. package/app/scripts/LeftTrackModifier.js +8 -0
  37. package/app/scripts/{ListWrapper.js → ListWrapper.jsx} +0 -0
  38. package/app/scripts/{Modal.js → Modal.jsx} +14 -9
  39. package/app/scripts/{MoveableTrack.js → MoveableTrack.jsx} +0 -0
  40. package/app/scripts/{NestedContextMenu.js → NestedContextMenu.jsx} +6 -7
  41. package/app/scripts/OSMTilesTrack.js +2 -6
  42. package/app/scripts/OverlayTrack.js +2 -0
  43. package/app/scripts/{PlotTypeChooser.js → PlotTypeChooser.jsx} +0 -0
  44. package/app/scripts/{PopupMenu.js → PopupMenu.jsx} +1 -1
  45. package/app/scripts/SearchField.js +5 -3
  46. package/app/scripts/{SeriesListItems.js → SeriesListItems.jsx} +6 -6
  47. package/app/scripts/{SeriesListMenu.js → SeriesListMenu.jsx} +29 -32
  48. package/app/scripts/{SeriesListSubmenuMixin.js → SeriesListSubmenuMixin.jsx} +0 -0
  49. package/app/scripts/{SketchInlinePicker.js → SketchInlinePicker.jsx} +0 -0
  50. package/app/scripts/{SortableList.js → SortableList.jsx} +0 -0
  51. package/app/scripts/Tiled1DPixiTrack.js +2 -5
  52. package/app/scripts/TiledPixiTrack.js +3 -1
  53. package/app/scripts/{TiledPlot.js → TiledPlot.jsx} +45 -17
  54. package/app/scripts/{TilesetFinder.js → TilesetFinder.jsx} +7 -7
  55. package/app/scripts/Track.js +17 -1
  56. package/app/scripts/{TrackArea.js → TrackArea.jsx} +0 -0
  57. package/app/scripts/{TrackControl.js → TrackControl.jsx} +44 -50
  58. package/app/scripts/{TrackRenderer.js → TrackRenderer.jsx} +44 -38
  59. package/app/scripts/{VerticalItem.js → VerticalItem.jsx} +0 -0
  60. package/app/scripts/VerticalRule.js +1 -0
  61. package/app/scripts/{VerticalTiledPlot.js → VerticalTiledPlot.jsx} +27 -18
  62. package/app/scripts/{VerticalTrack.js → VerticalTrack.jsx} +0 -0
  63. package/app/scripts/{ViewConfigEditor.js → ViewConfigEditor.jsx} +66 -58
  64. package/app/scripts/{ViewContextMenu.js → ViewContextMenu.jsx} +13 -13
  65. package/app/scripts/{ViewHeader.js → ViewHeader.jsx} +24 -23
  66. package/app/scripts/ViewportTracker2D.js +1 -2
  67. package/app/scripts/ViewportTrackerHorizontal.js +1 -2
  68. package/app/scripts/ViewportTrackerVertical.js +1 -2
  69. package/app/scripts/api.js +17 -10
  70. package/app/scripts/configs/available-for-plugins.js +4 -3
  71. package/app/scripts/configs/index.js +1 -47
  72. package/app/scripts/configs/positions-by-datatype.js +2 -0
  73. package/app/scripts/configs/primitives.js +47 -0
  74. package/app/scripts/configs/tracks-info.js +2 -2
  75. package/app/scripts/d3-context-menu.js +1 -0
  76. package/app/scripts/data-fetchers/get-data-fetcher.js +7 -2
  77. package/app/scripts/{hglib.js → hglib.jsx} +1 -1
  78. package/app/scripts/hocs/{with-modal.js → with-modal.jsx} +0 -0
  79. package/app/scripts/hocs/{with-pub-sub.js → with-pub-sub.jsx} +0 -0
  80. package/app/scripts/hocs/{with-theme.js → with-theme.jsx} +0 -0
  81. package/app/scripts/{icons.js → icons.jsx} +22 -12
  82. package/app/scripts/mixwith.js +2 -0
  83. package/app/scripts/services/tile-proxy.js +1 -5
  84. package/app/scripts/utils/abs-to-chr.js +1 -1
  85. package/app/scripts/utils/dec-to-hex-str.js +1 -1
  86. package/app/scripts/utils/dict-items.js +0 -1
  87. package/app/scripts/utils/dict-keys.js +0 -1
  88. package/app/scripts/utils/dict-values.js +0 -1
  89. package/app/scripts/utils/index.js +1 -0
  90. package/app/scripts/utils/range-query-2d.js +4 -1
  91. package/app/scripts/utils/selected-items-to-size.js +2 -3
  92. package/app/scripts/utils/{test-helpers.js → test-helpers.jsx} +32 -10
  93. package/app/scripts/utils/timeout.js +4 -1
  94. package/app/scripts/utils/value-to-color.js +14 -17
  95. package/app/scripts/worker.js +8 -4
  96. package/app/styles/GenomePositionSearchBox.module.scss +13 -15
  97. package/app/styles/HiGlass.scss +5 -5
  98. package/app/styles/TilesetFinder.css +94 -74
  99. package/app/styles/TrackControl.module.scss +17 -20
  100. package/app/styles/TrackOptions.css +23 -24
  101. package/app/styles/ViewHeader.module.scss +18 -18
  102. package/dist/hglib.css +1724 -1
  103. package/dist/hglib.js +80471 -154092
  104. package/dist/hglib.min.js +382 -2
  105. package/dist/index.html +251 -250
  106. package/package.json +57 -117
  107. package/CHANGELOG.md +0 -1415
  108. package/app/index.html +0 -273
  109. package/app/scripts/CenterTiledPlot.js +0 -5
  110. package/app/scripts/CloseTrackMenu.js +0 -25
  111. package/app/scripts/ContextMenuItem.js +0 -35
  112. package/app/scripts/Cross.js +0 -7
  113. package/app/scripts/factories/index.js +0 -1
@@ -3,13 +3,18 @@ import LocalDataFetcher from './local-tile-fetcher';
3
3
  import DataFetcher from '../DataFetcher';
4
4
  import { AVAILABLE_FOR_PLUGINS } from '../configs';
5
5
 
6
- const getDataFetcher = (dataConfig, pubSub, pluginDataFetchers) => {
6
+ const getDataFetcher = (
7
+ dataConfig,
8
+ pubSub,
9
+ pluginDataFetchers,
10
+ availableForPlugins = AVAILABLE_FOR_PLUGINS,
11
+ ) => {
7
12
  // Check if a plugin data fetcher is available.
8
13
  const pluginDataFetcher = pluginDataFetchers[dataConfig.type];
9
14
  if (pluginDataFetcher) {
10
15
  // eslint-disable-next-line new-cap
11
16
  return new pluginDataFetcher.dataFetcher(
12
- AVAILABLE_FOR_PLUGINS,
17
+ availableForPlugins,
13
18
  dataConfig,
14
19
  pubSub,
15
20
  );
@@ -32,7 +32,7 @@ export {
32
32
  getTrackObjectFromHGC,
33
33
  } from './utils';
34
34
 
35
- export const version = VERSION;
35
+ export { version } from '../../package.json';
36
36
 
37
37
  const launch = (element, config, options) => {
38
38
  /**
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { select } from 'd3-selection';
3
- import '../styles/ViewHeader.module.scss';
3
+ import classes from '../styles/ViewHeader.module.scss';
4
4
 
5
5
  export const COG = {
6
6
  id: 'cog',
@@ -160,8 +160,10 @@ const parser = new DOMParser();
160
160
 
161
161
  const svgGeoMapStr =
162
162
  '<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="1.5"><path d="M4 2.1L.5 3.5v12l5-2 5 2 5-2v-12l-5 2-3.17-1.268M10.5 3.5v12" fill="none" stroke="currentColor"/><path d="M5.5 13.5v-7" fill="none" stroke="currentColor" stroke-width=".9969299999999999"/><path d="M5.494 0c-1.803 0-3.26 1.496-3.26 3.35 0 .427.124.97.264 1.343L5.5 11l3.003-6.306c.142-.375.263-.916.263-1.342C8.766 1.496 7.3 0 5.494 0zM5.5 4.64c-.76 0-1.375-.616-1.375-1.374 0-.76.616-1.376 1.375-1.376.76 0 1.374.616 1.374 1.376 0 .758-.614 1.375-1.374 1.375z" fill="currentColor"/></svg>';
163
- export const svgGeoMapIcon = parser.parseFromString(svgGeoMapStr, 'text/xml')
164
- .documentElement;
163
+ export const svgGeoMapIcon = parser.parseFromString(
164
+ svgGeoMapStr,
165
+ 'text/xml',
166
+ ).documentElement;
165
167
 
166
168
  const horizontal1dHeatmap = `
167
169
  <svg width="20px" height="20px" viewBox="0 0 20 20">
@@ -225,8 +227,10 @@ const tiles2DIconStr = `
225
227
  </svg>
226
228
  `;
227
229
 
228
- export const svg2DTilesIcon = parser.parseFromString(tiles2DIconStr, 'text/xml')
229
- .documentElement;
230
+ export const svg2DTilesIcon = parser.parseFromString(
231
+ tiles2DIconStr,
232
+ 'text/xml',
233
+ ).documentElement;
230
234
 
231
235
  const heatmap2DStr = `
232
236
  <svg width="20px" height="20px" viewBox="0 0 90 90" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
@@ -258,8 +262,10 @@ const heatmap2DStr = `
258
262
  </svg>
259
263
  `;
260
264
 
261
- export const svg2DHeatmapIcon = parser.parseFromString(heatmap2DStr, 'text/xml')
262
- .documentElement;
265
+ export const svg2DHeatmapIcon = parser.parseFromString(
266
+ heatmap2DStr,
267
+ 'text/xml',
268
+ ).documentElement;
263
269
 
264
270
  const axis1D = `
265
271
  <svg width="20px" height="20px" viewBox="0 0 77 33" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
@@ -273,8 +279,10 @@ const axis1D = `
273
279
  </svg>
274
280
  `;
275
281
 
276
- export const svg1DAxisIcon = parser.parseFromString(axis1D, 'text/xml')
277
- .documentElement;
282
+ export const svg1DAxisIcon = parser.parseFromString(
283
+ axis1D,
284
+ 'text/xml',
285
+ ).documentElement;
278
286
  export const svgVertical1DAxisIcon = select(
279
287
  parser.parseFromString(axis1D, 'text/xml').documentElement,
280
288
  )
@@ -337,8 +345,10 @@ const tiles1DIconStr = `
337
345
  </svg>
338
346
  `;
339
347
 
340
- export const svg1DTilesIcon = parser.parseFromString(tiles1DIconStr, 'text/xml')
341
- .documentElement;
348
+ export const svg1DTilesIcon = parser.parseFromString(
349
+ tiles1DIconStr,
350
+ 'text/xml',
351
+ ).documentElement;
342
352
  export const svgVertical1DTilesIcon = select(
343
353
  parser.parseFromString(tiles1DIconStr, 'text/xml').documentElement,
344
354
  )
@@ -375,7 +385,7 @@ export const svgArrowheadDomainsIcon = parser.parseFromString(
375
385
  export function SearchIcon({ theStyle }) {
376
386
  return (
377
387
  <svg
378
- styleName={theStyle}
388
+ className={classes[theStyle]}
379
389
  viewBox="0 0 12 13"
380
390
  xmlns="http://www.w3.org/2000/svg"
381
391
  >
@@ -1,3 +1,5 @@
1
+ /* eslint-disable max-classes-per-file */
2
+
1
3
  // used by apply() and isApplicationOf()
2
4
  const _appliedMixin = '__mixwith_appliedMixin';
3
5
  // used by wrap() and unwrap()
@@ -3,7 +3,7 @@ import slugid from 'slugid';
3
3
 
4
4
  import { workerGetTiles, workerSetPix } from '../worker';
5
5
 
6
- import { trimTrailingSlash as tts } from '../utils';
6
+ import { trimTrailingSlash as tts, timeout as sleep } from '../utils';
7
7
 
8
8
  // Config
9
9
  import { TILE_FETCH_DEBOUNCE } from '../configs';
@@ -674,10 +674,6 @@ function text(url, callback, pubSub) {
674
674
  return fetchEither(url, callback, 'text', pubSub);
675
675
  }
676
676
 
677
- function sleep(ms) {
678
- return new Promise((resolve) => setTimeout(resolve, ms));
679
- }
680
-
681
677
  /**
682
678
  * Send a JSON request and mark it so that we can tell how many are in flight
683
679
  *
@@ -1,4 +1,4 @@
1
- import { chromInfoBisector } from '.';
1
+ import chromInfoBisector from './chrom-info-bisector';
2
2
 
3
3
  const absToChr = (absPosition, chromInfo) => {
4
4
  if (!chromInfo || !chromInfo.cumPositions || !chromInfo.cumPositions.length) {
@@ -1,3 +1,3 @@
1
- const decToHexStr = dec => (dec + 16 ** 6).toString(16).substr(-6);
1
+ const decToHexStr = (dec) => (dec + 16 ** 6).toString(16).substr(-6);
2
2
 
3
3
  export default decToHexStr;
@@ -7,7 +7,6 @@ const dictItems = (dictionary) => {
7
7
 
8
8
  for (const key in dictionary) {
9
9
  if (dictionary.hasOwnProperty(key)) {
10
- // eslint-disable-line no-prototype-builtins
11
10
  keyValues.push([key, dictionary[key]]);
12
11
  }
13
12
  }
@@ -6,7 +6,6 @@ export default function dictKeys(dictionary) {
6
6
 
7
7
  for (const key in dictionary) {
8
8
  if (dictionary.hasOwnProperty(key)) {
9
- // eslint-disable-line no-prototype-builtins
10
9
  keys.push(key);
11
10
  }
12
11
  }
@@ -6,7 +6,6 @@ export default function dictValues(dictionary) {
6
6
 
7
7
  for (const key in dictionary) {
8
8
  if (dictionary.hasOwnProperty(key)) {
9
- // eslint-disable-line no-prototype-builtins
10
9
  values.push(dictionary[key]);
11
10
  }
12
11
  }
@@ -93,5 +93,6 @@ export {
93
93
  waitForTilesLoaded,
94
94
  waitForTransitionsFinished,
95
95
  mountHGComponent,
96
+ mountHGComponentAsync,
96
97
  removeHGComponent,
97
98
  } from './test-helpers';
@@ -1,4 +1,5 @@
1
- import { addArrays, accessorTransposition } from '.';
1
+ import addArrays from './add-arrays';
2
+ import accessorTransposition from './accessor-transposition';
2
3
 
3
4
  /**
4
5
  * Perform a 2D query on a 1D array
@@ -22,7 +23,9 @@ const rangeQuery2d = (
22
23
  xRange,
23
24
  yRange,
24
25
  mirrored,
26
+ /* eslint-disable-next-line default-param-last */
25
27
  xOff = 0,
28
+ /* eslint-disable-next-line default-param-last */
26
29
  yOff = 0,
27
30
  outList,
28
31
  ) => {
@@ -8,11 +8,10 @@
8
8
  * @returns {number} The computed size value.
9
9
  * Between 0 and the total number of items in the (flattened) input array.
10
10
  */
11
- const selectedItemsToSize = (selectedItems, withRelativeSize) => {
12
- return selectedItems.reduce(
11
+ const selectedItemsToSize = (selectedItems, withRelativeSize) =>
12
+ selectedItems.reduce(
13
13
  (a, h) => a + (Array.isArray(h) && withRelativeSize ? h.length : 1),
14
14
  0,
15
15
  );
16
- };
17
16
 
18
17
  export default selectedItemsToSize;
@@ -170,7 +170,6 @@ export const waitForTilesLoaded = (hgc, tilesLoadedCallback) => {
170
170
  * -------
171
171
  * Nothing
172
172
  */
173
- // console.log('jasmine.DEFAULT_TIMEOUT_INTERVAL', jasmine.DEFAULT_TIMEOUT_INTERVAL);
174
173
  if (isWaitingOnTiles(hgc)) {
175
174
  setTimeout(() => {
176
175
  waitForTilesLoaded(hgc, tilesLoadedCallback);
@@ -184,12 +183,24 @@ export const waitForTilesLoaded = (hgc, tilesLoadedCallback) => {
184
183
  /**
185
184
  * Mount a new HiGlassComponent and unmount the previously visible one.
186
185
  *
187
- * @param {HTML Element} div A div element to detach and recreate for the component
188
- * @param {Enzyme wrapped HiGlass component} prevHgc An already mounted
186
+ * @param {HTMLElement | null} prevDiv A div element to detach and recreate for the component
187
+ * @param {import('enzyme').ReactWrapper | null} prevHgc An already mounted
189
188
  * hgc component
190
189
  * @param {function} done The callback to call when the component is fully loaded
191
190
  */
192
- export const mountHGComponent = (prevDiv, prevHgc, viewConf, done, options) => {
191
+ export const mountHGComponent = (
192
+ prevDiv,
193
+ prevHgc,
194
+ viewConf,
195
+ done,
196
+ options = {},
197
+ ) => {
198
+ const {
199
+ style = 'width:800px; background-color: lightgreen;',
200
+ bounded = false,
201
+ extendedDelay = false,
202
+ } = options;
203
+
193
204
  if (prevHgc) {
194
205
  prevHgc.unmount();
195
206
  prevHgc.detach();
@@ -199,10 +210,6 @@ export const mountHGComponent = (prevDiv, prevHgc, viewConf, done, options) => {
199
210
  global.document.body.removeChild(prevDiv);
200
211
  }
201
212
 
202
- const style =
203
- (options && options.style) || 'width:800px; background-color: lightgreen;';
204
- const bounded = (options && options.bounded) || false;
205
-
206
213
  // console.log('check:', options && options.style)
207
214
  // console.log('style:', style, "options:", options, "style", options.style);
208
215
 
@@ -220,7 +227,7 @@ export const mountHGComponent = (prevDiv, prevHgc, viewConf, done, options) => {
220
227
  hgc.update();
221
228
 
222
229
  waitForJsonComplete(() => {
223
- if (options && options.extendedDelay) {
230
+ if (extendedDelay) {
224
231
  // Waiting for tiles to be loaded does not always mean
225
232
  // that the compoment is mounted (especially if we load the tiles
226
233
  // from the filesystem, which is quick). Wait 1000ms to make sure
@@ -236,7 +243,7 @@ export const mountHGComponent = (prevDiv, prevHgc, viewConf, done, options) => {
236
243
  }
237
244
  });
238
245
 
239
- return [div, hgc];
246
+ return /** @type {const} */ ([div, hgc]);
240
247
  };
241
248
 
242
249
  export const removeHGComponent = (div) => {
@@ -245,3 +252,18 @@ export const removeHGComponent = (div) => {
245
252
  ReactDOM.unmountComponentAtNode(div);
246
253
  document.body.removeChild(div);
247
254
  };
255
+
256
+ // ideally the "await-ers" avoid would be promises (rather than polling)
257
+ // and that way `mountHGComponent` would be async by default.
258
+ export async function mountHGComponentAsync(
259
+ prevDiv,
260
+ prevHgc,
261
+ viewConf,
262
+ options,
263
+ ) {
264
+ let res;
265
+ await new Promise((resolve) => {
266
+ res = mountHGComponent(prevDiv, prevHgc, viewConf, resolve, options);
267
+ });
268
+ return res;
269
+ }
@@ -1,3 +1,6 @@
1
- const timeout = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
1
+ const timeout = (ms) =>
2
+ new Promise((resolve) => {
3
+ setTimeout(resolve, ms);
4
+ });
2
5
 
3
6
  export default timeout;
@@ -8,24 +8,21 @@
8
8
  * @param {Number} eps Epsilon.
9
9
  * @return {Array} RGB color array.
10
10
  */
11
- const valueToColor = (
12
- valueScale,
13
- colorScale,
14
- pseudoCounts = 0,
15
- eps = 0.000001,
16
- ) => (value) => {
17
- let rgbIdx = 255;
11
+ const valueToColor =
12
+ (valueScale, colorScale, pseudoCounts = 0, eps = 0.000001) =>
13
+ (value) => {
14
+ let rgbIdx = 255;
18
15
 
19
- if (value > eps) {
20
- // values less than espilon are considered NaNs and made transparent
21
- // (rgbIdx 255)
22
- rgbIdx = Math.max(
23
- 0,
24
- Math.min(255, Math.floor(valueScale(value + pseudoCounts))),
25
- );
26
- }
16
+ if (value > eps) {
17
+ // values less than espilon are considered NaNs and made transparent
18
+ // (rgbIdx 255)
19
+ rgbIdx = Math.max(
20
+ 0,
21
+ Math.min(255, Math.floor(valueScale(value + pseudoCounts))),
22
+ );
23
+ }
27
24
 
28
- return colorScale[rgbIdx];
29
- };
25
+ return colorScale[rgbIdx];
26
+ };
30
27
 
31
28
  export default valueToColor;
@@ -163,6 +163,12 @@ export function workerSetPix(
163
163
  const tileWidth = shape ? shape[1] : Math.sqrt(size);
164
164
  const pixData = new Uint8ClampedArray(filteredSize * 4);
165
165
 
166
+ const dToRgbIdx = (x) => {
167
+ const v = valueScale(x);
168
+ if (Number.isNaN(v)) return 254;
169
+ return Math.max(0, Math.min(254, Math.floor(v)));
170
+ };
171
+
166
172
  /**
167
173
  * Set the ith element of the pixData array, using value d.
168
174
  * (well not really, since i is scaled to make space for each rgb value).
@@ -182,11 +188,9 @@ export function workerSetPix(
182
188
  !Number.isNaN(+d)
183
189
  ) {
184
190
  // values less than espilon are considered NaNs and made transparent (rgbIdx 255)
185
- rgbIdx = Math.max(
186
- 0,
187
- Math.min(254, Math.floor(valueScale(d + pseudocount))),
188
- );
191
+ rgbIdx = dToRgbIdx(d + pseudocount);
189
192
  }
193
+
190
194
  // let rgbIdx = qScale(d); //Math.max(0, Math.min(255, Math.floor(valueScale(ct))))
191
195
  if (rgbIdx < 0 || rgbIdx > 255) {
192
196
  console.warn(
@@ -10,14 +10,12 @@ $unit: 24px;
10
10
  align-items: stretch;
11
11
  height: 100%;
12
12
  margin-bottom: 0px;
13
- font-size: $unit / 1.75;
14
- transition: box-shadow $fast $ease,
15
- font-size $fast $ease;
13
+ font-size: calc($unit / 1.75);
14
+ transition: box-shadow $fast $ease, font-size $fast $ease;
16
15
  }
17
16
 
18
17
  .genome-position-search-focus {
19
- box-shadow: 0 0 0 1px $active,
20
- 0 0 3px 1px $active;
18
+ box-shadow: 0 0 0 1px $active, 0 0 3px 1px $active;
21
19
  }
22
20
 
23
21
  .genome-position-search-bar {
@@ -25,12 +23,12 @@ $unit: 24px;
25
23
  box-sizing: border-box;
26
24
  width: 100%;
27
25
  height: 100%;
28
- padding: $unit / 8;
26
+ padding: calc($unit / 8);
29
27
  color: #666;
30
28
  font-size: inherit;
31
29
  line-height: $unit;
32
30
  border: 0;
33
- border-radius: $unit / 8 0 0 $unit / 8;
31
+ border-radius: calc($unit / 8) 0 0 calc($unit / 8);
34
32
  background: transparent;
35
33
 
36
34
  &:focus {
@@ -39,20 +37,21 @@ $unit: 24px;
39
37
  }
40
38
  }
41
39
  .genome-position-search-dark .genome-position-search-bar {
42
- &:focus { color: $gray-lighter; }
40
+ &:focus {
41
+ color: $gray-lighter;
42
+ }
43
43
  }
44
44
 
45
45
  .genome-position-search-bar-button,
46
46
  .genome-position-search-bar-button-focus {
47
47
  display: block;
48
48
  height: 100%;
49
- padding: 0 $unit / 3 !important;
49
+ padding: 0 calc($unit / 3) !important;
50
50
  color: $gray;
51
51
  border: 0 !important;
52
52
  border-radius: 0 !important;
53
53
  background: transparent;
54
- transition: background $fast $ease,
55
- color $fast $ease;
54
+ transition: background $fast $ease, color $fast $ease;
56
55
 
57
56
  &:active,
58
57
  &:focus,
@@ -74,7 +73,7 @@ $unit: 24px;
74
73
  transition: color $fast $ease;
75
74
 
76
75
  &:first-child {
77
- margin-left: $unit / 4;
76
+ margin-left: calc($unit / 4);
78
77
  margin-right: 2px;
79
78
  }
80
79
 
@@ -91,8 +90,7 @@ $unit: 24px;
91
90
  .genome-position-search-bar-suggestions {
92
91
  position: fixed;
93
92
  border-radius: 3px;
94
- box-shadow: 0 0 3px 0 $gray-lighter-rgba,
95
- 0 1px 5px 0 $gray-lightest-rgba;
93
+ box-shadow: 0 0 3px 0 $gray-lighter-rgba, 0 1px 5px 0 $gray-lightest-rgba;
96
94
  background-color: rgba(255, 255, 255, 0.95);
97
95
  border: 1px solid $gray-lighter-rgba;
98
96
  padding: 2px 0;
@@ -104,7 +102,7 @@ $unit: 24px;
104
102
  .btn {
105
103
  display: inline-block;
106
104
  margin-bottom: 0;
107
- font-size: $unit / 1.75;
105
+ font-size: calc($unit / 1.75);
108
106
  font-weight: 400;
109
107
  line-height: 1.42857143;
110
108
  text-align: center;
@@ -1,9 +1,9 @@
1
- .higlass {
2
- // Third party styles should be added here so that they are name spaces
3
- @import '../../node_modules/react-grid-layout/css/styles.css';
4
- @import '../../node_modules/react-resizable/css/styles.css';
1
+ // Third party styles should be added here so that they are name spaces
2
+ @import 'react-grid-layout/css/styles.css';
3
+ @import 'react-resizable/css/styles.css';
4
+ @import 'prism.css';
5
5
 
6
- @import 'prism.css';
6
+ .higlass {
7
7
 
8
8
  // Enforce to avoid big-finger mode in Jupyter Lab
9
9
  * {