higlass 1.13.6 → 2.0.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.
- package/app/scripts/AddTrackDialog.jsx +8 -1
- package/app/scripts/AddTrackPositionMenu.jsx +26 -5
- package/app/scripts/Annotations1dTrack.js +90 -251
- package/app/scripts/Annotations2dTrack.js +9 -2
- package/app/scripts/Autocomplete.jsx +1 -9
- package/app/scripts/BedLikeTrack.js +549 -441
- package/app/scripts/ContextMenuContainer.jsx +3 -0
- package/app/scripts/ContextMenuItem.jsx +13 -2
- package/app/scripts/FilledLine.js +349 -0
- package/app/scripts/GenomePositionSearchBox.jsx +178 -477
- package/app/scripts/HiGlassComponent.jsx +443 -349
- package/app/scripts/HiGlassComponentContext.js +5 -0
- package/app/scripts/SeriesListMenu.jsx +94 -44
- package/app/scripts/SeriesListSubmenuMixin.jsx +1 -0
- package/app/scripts/Tiled1DPixiTrack.js +0 -1
- package/app/scripts/TiledPixiTrack.js +72 -63
- package/app/scripts/TiledPlot.jsx +530 -77
- package/app/scripts/TrackRenderer.jsx +2 -2
- package/app/scripts/ViewContextMenu.jsx +50 -2
- package/app/scripts/ViewHeader.jsx +3 -2
- package/app/scripts/api.js +87 -6
- package/app/scripts/configs/index.js +6 -1
- package/app/scripts/configs/primitives.js +2 -0
- package/app/scripts/configs/tracks-info.js +1 -0
- package/app/scripts/data-fetchers/genbank-fetcher.js +9 -14
- package/app/scripts/data-fetchers/local-tile-fetcher.js +8 -2
- package/app/scripts/hglib.jsx +61 -70
- package/app/scripts/options-info.js +49 -11
- package/app/scripts/services/tile-proxy.js +0 -4
- package/app/scripts/services/worker.js +1 -0
- package/app/scripts/test-helpers/index.js +2 -1
- package/app/scripts/test-helpers/test-helpers.jsx +154 -66
- package/app/scripts/types.ts +68 -3
- package/app/scripts/utils/copy-text-to-clipboard.js +36 -0
- package/app/scripts/utils/decompress.js +33 -0
- package/app/scripts/utils/default-tracks.js +46 -0
- package/app/scripts/utils/get-default-track-for-datatype.js +2 -1
- package/app/scripts/utils/get-default-tracks-for-datatype.ts +46 -0
- package/app/scripts/utils/index.js +1 -0
- package/app/scripts/utils/positioned-tracks-to-all-tracks.js +55 -0
- package/app/scripts/utils/show-mouse-position.js +0 -16
- package/app/scripts/utils/visit-positioned-tracks.js +4 -1
- package/app/styles/AddTrackPositionMenu.module.scss +37 -0
- package/app/styles/HiGlass.module.scss +3 -1
- package/app/styles/TiledPlot.module.scss +20 -0
- package/dist/app/schema.json +525 -0
- package/dist/app/scripts/AddTrackDialog.d.ts +64 -0
- package/dist/app/scripts/AddTrackPositionMenu.d.ts +5 -0
- package/dist/app/scripts/Annotations1dTrack.d.ts +15 -0
- package/dist/app/scripts/Annotations2dTrack.d.ts +95 -0
- package/dist/app/scripts/ArrowheadDomainsTrack.d.ts +36 -0
- package/dist/app/scripts/Autocomplete.d.ts +102 -0
- package/dist/app/scripts/AxisPixi.d.ts +25 -0
- package/dist/app/scripts/BarTrack.d.ts +28 -0
- package/dist/app/scripts/BedLikeTrack.d.ts +84 -0
- package/dist/app/scripts/Button.d.ts +3 -0
- package/dist/app/scripts/CNVIntervalTrack.d.ts +12 -0
- package/dist/app/scripts/CenterTiledPlot.d.ts +3 -0
- package/dist/app/scripts/CenterTrack.d.ts +92 -0
- package/dist/app/scripts/Chromosome2DAnnotations.d.ts +10 -0
- package/dist/app/scripts/Chromosome2DLabels.d.ts +13 -0
- package/dist/app/scripts/ChromosomeGrid.d.ts +24 -0
- package/dist/app/scripts/ChromosomeInfo.d.ts +14 -0
- package/dist/app/scripts/CloseTrackMenu.d.ts +10 -0
- package/dist/app/scripts/CombinedTrack.d.ts +32 -0
- package/dist/app/scripts/ConfigTrackMenu.d.ts +10 -0
- package/dist/app/scripts/ConfigViewMenu.d.ts +34 -0
- package/dist/app/scripts/ConfigureSeriesMenu.d.ts +3 -0
- package/dist/app/scripts/ContextMenuContainer.d.ts +36 -0
- package/dist/app/scripts/ContextMenuItem.d.ts +34 -0
- package/dist/app/scripts/Cross.d.ts +3 -0
- package/dist/app/scripts/CrossRule.d.ts +24 -0
- package/dist/app/scripts/CustomTrackDialog.d.ts +17 -0
- package/dist/app/scripts/Dialog.d.ts +5 -0
- package/dist/app/scripts/DivergentBarTrack.d.ts +4 -0
- package/dist/app/scripts/DragListeningDiv.d.ts +32 -0
- package/dist/app/scripts/DraggableDiv.d.ts +63 -0
- package/dist/app/scripts/ExportLinkDialog.d.ts +21 -0
- package/dist/app/scripts/FilledLine.d.ts +5 -0
- package/dist/app/scripts/FixedTrack.d.ts +5 -0
- package/dist/app/scripts/GalleryTracks.d.ts +20 -0
- package/dist/app/scripts/GenomePositionSearchBox.d.ts +95 -0
- package/dist/app/scripts/HeatmapOptions.d.ts +30 -0
- package/dist/app/scripts/HeatmapTiledPixiTrack.d.ts +184 -0
- package/dist/app/scripts/HiGlassComponent.d.ts +762 -0
- package/dist/app/scripts/HiGlassComponentContext.d.ts +3 -0
- package/dist/app/scripts/HiGlassTrackComponent.d.ts +37 -0
- package/dist/app/scripts/Horizontal1dHeatmapTrack.d.ts +9 -0
- package/dist/app/scripts/Horizontal2DDomainsTrack.d.ts +21 -0
- package/dist/app/scripts/HorizontalChromosomeLabels.d.ts +47 -0
- package/dist/app/scripts/HorizontalGeneAnnotationsTrack.d.ts +25 -0
- package/dist/app/scripts/HorizontalHeatmapTrack.d.ts +12 -0
- package/dist/app/scripts/HorizontalItem.d.ts +3 -0
- package/dist/app/scripts/HorizontalLine1DPixiTrack.d.ts +23 -0
- package/dist/app/scripts/HorizontalMultivecTrack.d.ts +50 -0
- package/dist/app/scripts/HorizontalPoint1DPixiTrack.d.ts +5 -0
- package/dist/app/scripts/HorizontalRule.d.ts +22 -0
- package/dist/app/scripts/HorizontalTiled1DPixiTrack.d.ts +26 -0
- package/dist/app/scripts/HorizontalTiledPlot.d.ts +49 -0
- package/dist/app/scripts/HorizontalTrack.d.ts +6 -0
- package/dist/app/scripts/Id2DTiledPixiTrack.d.ts +10 -0
- package/dist/app/scripts/IdHorizontal1DTiledPixiTrack.d.ts +6 -0
- package/dist/app/scripts/IdVertical1DTiledPixiTrack.d.ts +7 -0
- package/dist/app/scripts/LeftAxisTrack.d.ts +9 -0
- package/dist/app/scripts/LeftTrackModifier.d.ts +29 -0
- package/dist/app/scripts/ListWrapper.d.ts +64 -0
- package/dist/app/scripts/MapboxTilesTrack.d.ts +9 -0
- package/dist/app/scripts/Modal.d.ts +5 -0
- package/dist/app/scripts/MoveableTrack.d.ts +18 -0
- package/dist/app/scripts/NestedContextMenu.d.ts +7 -0
- package/dist/app/scripts/OSMTileIdsTrack.d.ts +5 -0
- package/dist/app/scripts/OSMTilesTrack.d.ts +129 -0
- package/dist/app/scripts/OverlayTrack.d.ts +13 -0
- package/dist/app/scripts/PixiTrack.d.ts +174 -0
- package/dist/app/scripts/PlotTypeChooser.d.ts +25 -0
- package/dist/app/scripts/PopupMenu.d.ts +28 -0
- package/dist/app/scripts/RasterTilesTrack.d.ts +9 -0
- package/dist/app/scripts/RuleMixin.d.ts +2 -0
- package/dist/app/scripts/SVGTrack.d.ts +15 -0
- package/dist/app/scripts/SearchField.d.ts +13 -0
- package/dist/app/scripts/SeriesListItems.d.ts +2 -0
- package/dist/app/scripts/SeriesListMenu.d.ts +51 -0
- package/dist/app/scripts/SeriesListSubmenuMixin.d.ts +2 -0
- package/dist/app/scripts/SketchInlinePicker.d.ts +25 -0
- package/dist/app/scripts/SortableList.d.ts +22 -0
- package/dist/app/scripts/SquareMarkersTrack.d.ts +22 -0
- package/dist/app/scripts/Tiled1DPixiTrack.d.ts +60 -0
- package/dist/app/scripts/TiledPixiTrack.d.ts +369 -0
- package/dist/app/scripts/TiledPlot.d.ts +313 -0
- package/dist/app/scripts/TilesetFinder.d.ts +65 -0
- package/dist/app/scripts/TopAxisTrack.d.ts +9 -0
- package/dist/app/scripts/Track.d.ts +196 -0
- package/dist/app/scripts/TrackArea.d.ts +26 -0
- package/dist/app/scripts/TrackControl.d.ts +5 -0
- package/dist/app/scripts/TrackRenderer.d.ts +724 -0
- package/dist/app/scripts/UnknownPixiTrack.d.ts +7 -0
- package/dist/app/scripts/ValueIntervalTrack.d.ts +6 -0
- package/dist/app/scripts/VerticalItem.d.ts +3 -0
- package/dist/app/scripts/VerticalRule.d.ts +21 -0
- package/dist/app/scripts/VerticalTiled1DPixiTrack.d.ts +6 -0
- package/dist/app/scripts/VerticalTiledPlot.d.ts +50 -0
- package/dist/app/scripts/VerticalTrack.d.ts +6 -0
- package/dist/app/scripts/ViewConfigEditor.d.ts +53 -0
- package/dist/app/scripts/ViewContextMenu.d.ts +17 -0
- package/dist/app/scripts/ViewHeader.d.ts +75 -0
- package/dist/app/scripts/ViewportTracker2D.d.ts +17 -0
- package/dist/app/scripts/ViewportTracker2DPixi.d.ts +11 -0
- package/dist/app/scripts/ViewportTrackerHorizontal.d.ts +17 -0
- package/dist/app/scripts/ViewportTrackerVertical.d.ts +17 -0
- package/dist/app/scripts/api.d.ts +640 -0
- package/dist/app/scripts/configs/available-track-types.d.ts +2 -0
- package/dist/app/scripts/configs/colormaps.d.ts +2 -0
- package/dist/app/scripts/configs/datatype-to-track-type.d.ts +4 -0
- package/dist/app/scripts/configs/default-tracks-for-datatype.d.ts +38 -0
- package/dist/app/scripts/configs/dense-data-extrema-config.d.ts +2 -0
- package/dist/app/scripts/configs/globals.d.ts +5 -0
- package/dist/app/scripts/configs/index.d.ts +16 -0
- package/dist/app/scripts/configs/positions-by-datatype.d.ts +2 -0
- package/dist/app/scripts/configs/primitives.d.ts +20 -0
- package/dist/app/scripts/configs/themes.d.ts +3 -0
- package/dist/app/scripts/configs/tracks-info-by-type.d.ts +4 -0
- package/dist/app/scripts/configs/tracks-info.d.ts +24 -0
- package/dist/app/scripts/d3-context-menu.d.ts +2 -0
- package/dist/app/scripts/data-fetchers/DataFetcher.d.ts +151 -0
- package/dist/app/scripts/data-fetchers/genbank-fetcher.d.ts +86 -0
- package/dist/app/scripts/data-fetchers/index.d.ts +3 -0
- package/dist/app/scripts/data-fetchers/local-tile-fetcher.d.ts +47 -0
- package/dist/app/scripts/gosling-exports.d.ts +17 -0
- package/dist/app/scripts/hglib.d.ts +24 -0
- package/dist/app/scripts/hocs/with-modal.d.ts +19 -0
- package/dist/app/scripts/hocs/with-pub-sub.d.ts +22 -0
- package/dist/app/scripts/hocs/with-theme.d.ts +13 -0
- package/dist/app/scripts/icons.d.ts +161 -0
- package/dist/app/scripts/mixwith.d.ts +27 -0
- package/dist/app/scripts/options-info.d.ts +1355 -0
- package/dist/app/scripts/plugins/available-for-plugins.d.ts +2338 -0
- package/dist/app/scripts/plugins/get-data-fetcher.d.ts +2 -0
- package/dist/app/scripts/plugins/index.d.ts +2 -0
- package/dist/app/scripts/services/chrom-info.d.ts +10 -0
- package/dist/app/scripts/services/dom-event.d.ts +7 -0
- package/dist/app/scripts/services/element-resize-listener.d.ts +5 -0
- package/dist/app/scripts/services/index.d.ts +5 -0
- package/dist/app/scripts/services/tile-proxy.d.ts +180 -0
- package/dist/app/scripts/services/worker.d.ts +157 -0
- package/dist/app/scripts/symbol.d.ts +13 -0
- package/dist/app/scripts/test-helpers/index.d.ts +1 -0
- package/dist/app/scripts/test-helpers/test-helpers.d.ts +33 -0
- package/dist/app/scripts/track-utils.d.ts +73 -0
- package/dist/app/scripts/types.d.ts +199 -0
- package/dist/app/scripts/utils/DenseDataExtrema1D.d.ts +88 -0
- package/dist/app/scripts/utils/DenseDataExtrema2D.d.ts +97 -0
- package/dist/app/scripts/utils/LruCache.d.ts +44 -0
- package/dist/app/scripts/utils/abs-to-chr.d.ts +14 -0
- package/dist/app/scripts/utils/accessor-transposition.d.ts +14 -0
- package/dist/app/scripts/utils/add-arrays.d.ts +18 -0
- package/dist/app/scripts/utils/add-class.d.ts +8 -0
- package/dist/app/scripts/utils/add-event-listener-once.d.ts +11 -0
- package/dist/app/scripts/utils/assert.d.ts +17 -0
- package/dist/app/scripts/utils/background-task-scheduler.d.ts +47 -0
- package/dist/app/scripts/utils/base64-to-canvas.d.ts +9 -0
- package/dist/app/scripts/utils/chr-to-abs.d.ts +10 -0
- package/dist/app/scripts/utils/chrom-info-bisector.d.ts +4 -0
- package/dist/app/scripts/utils/clone-event.d.ts +12 -0
- package/dist/app/scripts/utils/color-domain-to-rgba-array.d.ts +13 -0
- package/dist/app/scripts/utils/color-to-hex.d.ts +9 -0
- package/dist/app/scripts/utils/color-to-rgba.d.ts +9 -0
- package/dist/app/scripts/utils/copy-text-to-clipboard.d.ts +2 -0
- package/dist/app/scripts/utils/data-to-genomic-loci.d.ts +11 -0
- package/dist/app/scripts/utils/debounce.d.ts +5 -0
- package/dist/app/scripts/utils/dec-to-hex-str.d.ts +8 -0
- package/dist/app/scripts/utils/decompress.d.ts +27 -0
- package/dist/app/scripts/utils/default-tracks.d.ts +3 -0
- package/dist/app/scripts/utils/dict-from-tuples.d.ts +11 -0
- package/dist/app/scripts/utils/dict-items.d.ts +18 -0
- package/dist/app/scripts/utils/dict-keys.d.ts +10 -0
- package/dist/app/scripts/utils/dict-values.d.ts +8 -0
- package/dist/app/scripts/utils/download.d.ts +7 -0
- package/dist/app/scripts/utils/expand-combined-tracks.d.ts +11 -0
- package/dist/app/scripts/utils/fake-pub-sub.d.ts +11 -0
- package/dist/app/scripts/utils/fill-in-min-widths.d.ts +44 -0
- package/dist/app/scripts/utils/flatten.d.ts +9 -0
- package/dist/app/scripts/utils/for-each.d.ts +9 -0
- package/dist/app/scripts/utils/forward-event.d.ts +7 -0
- package/dist/app/scripts/utils/genome-loci-to-pixels.d.ts +9 -0
- package/dist/app/scripts/utils/genomic-range-to-chromosome-chunks.d.ts +21 -0
- package/dist/app/scripts/utils/get-aggregation-function.d.ts +10 -0
- package/dist/app/scripts/utils/get-default-track-for-datatype.d.ts +21 -0
- package/dist/app/scripts/utils/get-default-tracks-for-datatype.d.ts +3 -0
- package/dist/app/scripts/utils/get-element-dim.d.ts +7 -0
- package/dist/app/scripts/utils/get-higlass-components.d.ts +7 -0
- package/dist/app/scripts/utils/get-track-by-uid.d.ts +7 -0
- package/dist/app/scripts/utils/get-track-conf-from-hgc.d.ts +10 -0
- package/dist/app/scripts/utils/get-track-obj-by-id.d.ts +2 -0
- package/dist/app/scripts/utils/get-track-position-by-uid.d.ts +13 -0
- package/dist/app/scripts/utils/get-xylofon.d.ts +2 -0
- package/dist/app/scripts/utils/gradient.d.ts +14 -0
- package/dist/app/scripts/utils/has-class.d.ts +8 -0
- package/dist/app/scripts/utils/has-parent.d.ts +9 -0
- package/dist/app/scripts/utils/hex-string-to-int.d.ts +14 -0
- package/dist/app/scripts/utils/index.d.ts +89 -0
- package/dist/app/scripts/utils/interval-tree.d.ts +109 -0
- package/dist/app/scripts/utils/into-the-void.d.ts +6 -0
- package/dist/app/scripts/utils/is-track-or-child-track.d.ts +7 -0
- package/dist/app/scripts/utils/is-track-range-selectable.d.ts +2 -0
- package/dist/app/scripts/utils/is-within.d.ts +12 -0
- package/dist/app/scripts/utils/lat-to-y.d.ts +9 -0
- package/dist/app/scripts/utils/lng-to-x.d.ts +8 -0
- package/dist/app/scripts/utils/load-chrom-infos.d.ts +8 -0
- package/dist/app/scripts/utils/map.d.ts +13 -0
- package/dist/app/scripts/utils/max-non-zero.d.ts +6 -0
- package/dist/app/scripts/utils/max.d.ts +10 -0
- package/dist/app/scripts/utils/min-non-zero.d.ts +6 -0
- package/dist/app/scripts/utils/min.d.ts +10 -0
- package/dist/app/scripts/utils/mod.d.ts +9 -0
- package/dist/app/scripts/utils/ndarray-assign.d.ts +2 -0
- package/dist/app/scripts/utils/ndarray-flatten.d.ts +2 -0
- package/dist/app/scripts/utils/ndarray-to-list.d.ts +2 -0
- package/dist/app/scripts/utils/numericify-version.d.ts +6 -0
- package/dist/app/scripts/utils/obj-vals.d.ts +8 -0
- package/dist/app/scripts/utils/or.d.ts +8 -0
- package/dist/app/scripts/utils/parse-chromsizes-rows.d.ts +34 -0
- package/dist/app/scripts/utils/pixi-text-to-svg.d.ts +2 -0
- package/dist/app/scripts/utils/positioned-tracks-to-all-tracks.d.ts +26 -0
- package/dist/app/scripts/utils/q.d.ts +18 -0
- package/dist/app/scripts/utils/rad-to-deg.d.ts +7 -0
- package/dist/app/scripts/utils/range-query-2d.d.ts +17 -0
- package/dist/app/scripts/utils/reduce.d.ts +14 -0
- package/dist/app/scripts/utils/rel-to-abs-chrom-pos.d.ts +10 -0
- package/dist/app/scripts/utils/remove-class.d.ts +7 -0
- package/dist/app/scripts/utils/reset-d3-brush-style.d.ts +10 -0
- package/dist/app/scripts/utils/rgb-to-hex.d.ts +8 -0
- package/dist/app/scripts/utils/scales-center-and-k.d.ts +12 -0
- package/dist/app/scripts/utils/scales-to-genome-loci.d.ts +3 -0
- package/dist/app/scripts/utils/segments-to-rows.d.ts +15 -0
- package/dist/app/scripts/utils/selected-items-to-cum-weights.d.ts +12 -0
- package/dist/app/scripts/utils/selected-items-to-size.d.ts +13 -0
- package/dist/app/scripts/utils/show-mouse-position.d.ts +54 -0
- package/dist/app/scripts/utils/some.d.ts +10 -0
- package/dist/app/scripts/utils/sum.d.ts +8 -0
- package/dist/app/scripts/utils/svg-line.d.ts +2 -0
- package/dist/app/scripts/utils/throttle-and-debounce.d.ts +33 -0
- package/dist/app/scripts/utils/tile-to-canvas.d.ts +9 -0
- package/dist/app/scripts/utils/timeout.d.ts +3 -0
- package/dist/app/scripts/utils/to-void.d.ts +3 -0
- package/dist/app/scripts/utils/total-track-pixel-height.d.ts +27 -0
- package/dist/app/scripts/utils/trim-trailing-slash.d.ts +7 -0
- package/dist/app/scripts/utils/type-guards.d.ts +36 -0
- package/dist/app/scripts/utils/value-to-color.d.ts +12 -0
- package/dist/app/scripts/utils/visit-positioned-tracks.d.ts +18 -0
- package/dist/app/scripts/utils/visit-tracks.d.ts +9 -0
- package/dist/esm.html +1 -3
- package/dist/hglib.js +65302 -79868
- package/dist/hglib.min.js +104 -112
- package/dist/higlass.mjs +64214 -78780
- package/dist/index.html +1 -3
- package/dist/package.json +134 -0
- package/package.json +13 -10
|
@@ -1,17 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
import clsx from 'clsx';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
|
|
5
5
|
// Styles
|
|
6
6
|
import classes from '../styles/ContextMenu.module.scss';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @typedef ContextMenuItemProps
|
|
10
|
+
* @prop {string} [className]
|
|
11
|
+
* @prop {(evt: React.MouseEvent) => void} onClick
|
|
12
|
+
* @prop {(evt: React.MouseEvent) => void} onMouseEnter
|
|
13
|
+
* @prop {(evt: React.MouseEvent) => void} onMouseLeave
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param {React.PropsWithChildren<ContextMenuItemProps>} props
|
|
18
|
+
*/
|
|
8
19
|
function ContextMenuItem(props) {
|
|
9
20
|
return (
|
|
10
21
|
<div
|
|
11
22
|
data-menu-item-for={
|
|
12
23
|
typeof props.children === 'string' ? props.children : null
|
|
13
24
|
}
|
|
14
|
-
className={classes['context-menu-item']}
|
|
25
|
+
className={clsx(classes['context-menu-item'], props.className)}
|
|
15
26
|
onClick={(e) => props.onClick(e)}
|
|
16
27
|
onMouseEnter={(e) => props.onMouseEnter(e)}
|
|
17
28
|
onMouseLeave={(e) => props.onMouseLeave(e)}
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import { scaleLinear } from 'd3-scale';
|
|
3
|
+
import HorizontalLine1DPixiTrack from './HorizontalLine1DPixiTrack';
|
|
4
|
+
import { colorToHex } from './utils';
|
|
5
|
+
|
|
6
|
+
class FilledLine extends HorizontalLine1DPixiTrack {
|
|
7
|
+
drawRange(tile, row, tileXScale, offsetValue) {
|
|
8
|
+
const tileValues = tile.tileData.dense;
|
|
9
|
+
// draw a single row from this matrix
|
|
10
|
+
let currentSegment = [];
|
|
11
|
+
let mv = 0;
|
|
12
|
+
|
|
13
|
+
for (let i = 0; i < tile.tileData.shape[1]; i++) {
|
|
14
|
+
const rowStart = row * tile.tileData.shape[1];
|
|
15
|
+
const pos = rowStart + i;
|
|
16
|
+
|
|
17
|
+
if (tileValues[pos] > mv) {
|
|
18
|
+
mv = tileValues[pos];
|
|
19
|
+
}
|
|
20
|
+
const xPos = this._xScale(tileXScale(i));
|
|
21
|
+
const yPos = this.valueScale(tileValues[pos] + offsetValue);
|
|
22
|
+
|
|
23
|
+
if (
|
|
24
|
+
(this.options.valueScaling === 'log' && tileValues[pos] === 0) ||
|
|
25
|
+
Number.isNaN(yPos)
|
|
26
|
+
) {
|
|
27
|
+
if (currentSegment.length > 1) {
|
|
28
|
+
tile.segments.push(currentSegment);
|
|
29
|
+
}
|
|
30
|
+
// Just ignore 1-element segments.
|
|
31
|
+
currentSegment = [];
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (tileXScale(i) > this.tilesetInfo.max_pos[0]) {
|
|
36
|
+
// Data is in the last tile and extends beyond the coordinate system.
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
currentSegment.push([xPos, yPos]);
|
|
41
|
+
}
|
|
42
|
+
if (currentSegment.length > 1) {
|
|
43
|
+
tile.segments.push(currentSegment);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
drawTile(tile) {
|
|
48
|
+
super.drawTile(tile);
|
|
49
|
+
|
|
50
|
+
if (!tile.graphics) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (!tile.tileData || !tile.tileData.dense) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const graphics = tile.graphics;
|
|
59
|
+
|
|
60
|
+
const { tileX, tileWidth } = this.getTilePosAndDimensions(
|
|
61
|
+
tile.tileData.zoomLevel,
|
|
62
|
+
tile.tileData.tilePos,
|
|
63
|
+
tile.tileData.shape[1],
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const tileValues = tile.tileData.dense;
|
|
67
|
+
|
|
68
|
+
if (tileValues.length === 0) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const [vs, offsetValue] = this.makeValueScale(
|
|
73
|
+
this.minValue(),
|
|
74
|
+
this.medianVisibleValue,
|
|
75
|
+
this.maxValue(),
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
this.valueScale = vs;
|
|
79
|
+
|
|
80
|
+
graphics.clear();
|
|
81
|
+
|
|
82
|
+
this.drawAxis(this.valueScale);
|
|
83
|
+
|
|
84
|
+
if (
|
|
85
|
+
this.options.valueScaling === 'log' &&
|
|
86
|
+
this.valueScale.domain()[1] < 0
|
|
87
|
+
) {
|
|
88
|
+
console.warn(
|
|
89
|
+
'Negative values present when using a log scale',
|
|
90
|
+
this.valueScale.domain(),
|
|
91
|
+
);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const stroke = colorToHex(
|
|
96
|
+
this.options.lineStrokeColor ? this.options.lineStrokeColor : 'blue',
|
|
97
|
+
);
|
|
98
|
+
// this scale should go from an index in the data array to
|
|
99
|
+
// a position in the genome coordinates
|
|
100
|
+
if (!this.tilesetInfo.tile_size && !this.tilesetInfo.bins_per_dimension) {
|
|
101
|
+
console.warn(
|
|
102
|
+
'No tileset_info.tile_size or tileset_info.bins_per_dimension',
|
|
103
|
+
this.tilesetInfo,
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const tileSize =
|
|
108
|
+
this.tilesetInfo.tile_size || this.tilesetInfo.bins_per_dimension;
|
|
109
|
+
|
|
110
|
+
const tileXScale = scaleLinear()
|
|
111
|
+
.domain([0, tileSize])
|
|
112
|
+
.range([tileX, tileX + tileWidth]);
|
|
113
|
+
|
|
114
|
+
const strokeWidth =
|
|
115
|
+
this.options.lineStrokeWidth !== undefined
|
|
116
|
+
? this.options.lineStrokeWidth
|
|
117
|
+
: 1;
|
|
118
|
+
|
|
119
|
+
tile.segments = [];
|
|
120
|
+
|
|
121
|
+
tile.minYs = [];
|
|
122
|
+
tile.maxYs = [];
|
|
123
|
+
tile.xs = [];
|
|
124
|
+
|
|
125
|
+
for (let i = 0; i < tile.tileData.shape[0]; i++) {
|
|
126
|
+
// for (let i = 0; i < 1; i++) {
|
|
127
|
+
this.drawRange(tile, i, tileXScale, offsetValue);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
for (let j = 0; j < tile.tileData.shape[1]; j++) {
|
|
131
|
+
tile.minYs.push(Number.MAX_SAFE_INTEGER);
|
|
132
|
+
tile.maxYs.push(-Number.MAX_SAFE_INTEGER);
|
|
133
|
+
tile.xs.push(this._xScale(tileXScale(j)));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// find minimum and maximum values
|
|
137
|
+
for (const segment of tile.segments) {
|
|
138
|
+
let counter = 0;
|
|
139
|
+
|
|
140
|
+
const first = segment[0];
|
|
141
|
+
|
|
142
|
+
if (first[1] < tile.minYs[counter]) tile.minYs[counter] = first[1];
|
|
143
|
+
if (first[1] > tile.maxYs[counter]) tile.maxYs[counter] = first[1];
|
|
144
|
+
|
|
145
|
+
const rest = segment.slice(1);
|
|
146
|
+
for (const point of rest) {
|
|
147
|
+
counter += 1;
|
|
148
|
+
|
|
149
|
+
if (point[1] < tile.minYs[counter]) tile.minYs[counter] = point[1];
|
|
150
|
+
if (point[1] > tile.maxYs[counter]) tile.maxYs[counter] = point[1];
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// we have to do something funky here to make sure that
|
|
155
|
+
// discontinuous sections are rendered as such
|
|
156
|
+
let startI = 0;
|
|
157
|
+
|
|
158
|
+
const color = this.options.fillColor || 'grey';
|
|
159
|
+
const colorHex = colorToHex(color);
|
|
160
|
+
|
|
161
|
+
const opacity =
|
|
162
|
+
'fillOpacity' in this.options ? this.options.fillOpacity : 0.5;
|
|
163
|
+
|
|
164
|
+
while (startI < tile.xs.length) {
|
|
165
|
+
graphics.beginFill(colorHex, opacity);
|
|
166
|
+
graphics.moveTo(tile.xs[startI], tile.minYs[startI]);
|
|
167
|
+
// draw a filled area around the whole region
|
|
168
|
+
let i = startI + 1;
|
|
169
|
+
|
|
170
|
+
for (; i < tile.xs.length; i++) {
|
|
171
|
+
if (tile.minYs[i] < Number.MAX_SAFE_INTEGER)
|
|
172
|
+
graphics.lineTo(tile.xs[i], tile.minYs[i]);
|
|
173
|
+
else break;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
for (let j = i; j >= startI; j--) {
|
|
177
|
+
if (tile.maxYs[j] > -Number.MAX_SAFE_INTEGER) {
|
|
178
|
+
// console.log('to', xs[i], maxYs[i]);
|
|
179
|
+
graphics.lineTo(tile.xs[j], tile.maxYs[j]);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
graphics.endFill();
|
|
184
|
+
|
|
185
|
+
while (tile.minYs[i] === Number.MAX_SAFE_INTEGER && i < tile.xs.length)
|
|
186
|
+
i++;
|
|
187
|
+
startI = i;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (
|
|
191
|
+
this.options.strokeSingleSeries &&
|
|
192
|
+
this.options.strokeSingleSeries !== 'all'
|
|
193
|
+
) {
|
|
194
|
+
graphics.lineStyle(strokeWidth, stroke, 0);
|
|
195
|
+
} else {
|
|
196
|
+
graphics.lineStyle(strokeWidth, stroke, 1);
|
|
197
|
+
}
|
|
198
|
+
// draw the boundary values
|
|
199
|
+
for (let i = 0; i < tile.segments.length; i++) {
|
|
200
|
+
if (
|
|
201
|
+
this.options.strokeSingleSeries &&
|
|
202
|
+
this.options.strokeSingleSeries !== 'all'
|
|
203
|
+
) {
|
|
204
|
+
// we're only going to be drawing one of these series
|
|
205
|
+
if (this.options.strokeSingleSeries === i + 1) {
|
|
206
|
+
graphics.lineStyle(strokeWidth, stroke, 1);
|
|
207
|
+
} else {
|
|
208
|
+
graphics.lineStyle(0, stroke, 0);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const segment = tile.segments[i];
|
|
213
|
+
const first = segment[0];
|
|
214
|
+
const rest = segment.slice(1);
|
|
215
|
+
graphics.moveTo(first[0], first[1]);
|
|
216
|
+
for (const point of rest) {
|
|
217
|
+
graphics.lineTo(point[0], point[1]);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Export an SVG representation of this track
|
|
224
|
+
*
|
|
225
|
+
* @returns {Array} The two returned DOM nodes are both SVG
|
|
226
|
+
* elements [base,track]. Base is a parent which contains track as a
|
|
227
|
+
* child. Track is clipped with a clipping rectangle contained in base.
|
|
228
|
+
*
|
|
229
|
+
*/
|
|
230
|
+
exportSVG() {
|
|
231
|
+
let track = null;
|
|
232
|
+
let base = null;
|
|
233
|
+
|
|
234
|
+
if (super.exportSVG) {
|
|
235
|
+
[base, track] = super.exportSVG();
|
|
236
|
+
} else {
|
|
237
|
+
base = document.createElement('g');
|
|
238
|
+
track = base;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
base.setAttribute('class', 'exported-line-track');
|
|
242
|
+
const output = document.createElement('g');
|
|
243
|
+
|
|
244
|
+
track.appendChild(output);
|
|
245
|
+
output.setAttribute(
|
|
246
|
+
'transform',
|
|
247
|
+
`translate(${this.position[0]},${this.position[1]})`,
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
const stroke = this.options.lineStrokeColor
|
|
251
|
+
? this.options.lineStrokeColor
|
|
252
|
+
: 'blue';
|
|
253
|
+
|
|
254
|
+
this.visibleAndFetchedTiles().forEach((tile) => {
|
|
255
|
+
// draw the filled area
|
|
256
|
+
const color = this.options.fillColor || 'grey';
|
|
257
|
+
|
|
258
|
+
const opacity =
|
|
259
|
+
'fillOpacity' in this.options ? this.options.fillOpacity : 0.5;
|
|
260
|
+
|
|
261
|
+
let startI = 0;
|
|
262
|
+
|
|
263
|
+
while (startI < tile.xs.length) {
|
|
264
|
+
const g1 = document.createElement('path');
|
|
265
|
+
g1.setAttribute('opacity', opacity);
|
|
266
|
+
g1.setAttribute('fill', color);
|
|
267
|
+
g1.setAttribute('stroke', 'transparent');
|
|
268
|
+
|
|
269
|
+
let d = `M${tile.xs[startI]},${tile.minYs[startI]}`;
|
|
270
|
+
// draw a filled area around the whole region
|
|
271
|
+
let i = startI + 1;
|
|
272
|
+
|
|
273
|
+
for (; i < tile.xs.length; i++) {
|
|
274
|
+
if (tile.minYs[i] < Number.MAX_SAFE_INTEGER)
|
|
275
|
+
d += `L${tile.xs[i]},${tile.minYs[i]}`;
|
|
276
|
+
else break;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
for (let j = i; j >= startI; j--) {
|
|
280
|
+
if (tile.maxYs[j] > -Number.MAX_SAFE_INTEGER) {
|
|
281
|
+
// console.log('to', xs[i], maxYs[i]);
|
|
282
|
+
d += `L${tile.xs[j]},${tile.maxYs[j]}`;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
g1.setAttribute('d', d);
|
|
287
|
+
output.appendChild(g1);
|
|
288
|
+
|
|
289
|
+
while (tile.minYs[i] === Number.MAX_SAFE_INTEGER && i < tile.xs.length)
|
|
290
|
+
i++;
|
|
291
|
+
startI = i;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// draw the lines
|
|
295
|
+
const g = document.createElement('path');
|
|
296
|
+
g.setAttribute('fill', 'transparent');
|
|
297
|
+
g.setAttribute('stroke', stroke);
|
|
298
|
+
let d = '';
|
|
299
|
+
|
|
300
|
+
for (const segment of tile.segments) {
|
|
301
|
+
const first = segment[0];
|
|
302
|
+
const rest = segment.slice(1);
|
|
303
|
+
d += `M${first[0]} ${first[1]}`;
|
|
304
|
+
for (const point of rest) {
|
|
305
|
+
d += `L${point[0]} ${point[1]}`;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
g.setAttribute('d', d);
|
|
310
|
+
output.appendChild(g);
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
const gAxis = document.createElement('g');
|
|
314
|
+
gAxis.setAttribute('id', 'axis');
|
|
315
|
+
|
|
316
|
+
// append the axis to base so that it's not clipped
|
|
317
|
+
base.appendChild(gAxis);
|
|
318
|
+
gAxis.setAttribute(
|
|
319
|
+
'transform',
|
|
320
|
+
`translate(${this.axis.pAxis.position.x}, ${this.axis.pAxis.position.y})`,
|
|
321
|
+
);
|
|
322
|
+
|
|
323
|
+
// add the axis to the export
|
|
324
|
+
if (
|
|
325
|
+
this.options.axisPositionHorizontal === 'left' ||
|
|
326
|
+
this.options.axisPositionVertical === 'top'
|
|
327
|
+
) {
|
|
328
|
+
// left axis are shown at the beginning of the plot
|
|
329
|
+
const gDrawnAxis = this.axis.exportAxisLeftSVG(
|
|
330
|
+
this.valueScale,
|
|
331
|
+
this.dimensions[1],
|
|
332
|
+
);
|
|
333
|
+
gAxis.appendChild(gDrawnAxis);
|
|
334
|
+
} else if (
|
|
335
|
+
this.options.axisPositionHorizontal === 'right' ||
|
|
336
|
+
this.options.axisPositionVertical === 'bottom'
|
|
337
|
+
) {
|
|
338
|
+
const gDrawnAxis = this.axis.exportAxisRightSVG(
|
|
339
|
+
this.valueScale,
|
|
340
|
+
this.dimensions[1],
|
|
341
|
+
);
|
|
342
|
+
gAxis.appendChild(gDrawnAxis);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
return [base, track];
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export default FilledLine;
|