@jbrowse/plugin-wiggle 1.6.5 → 1.6.6
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/dist/BigWigAdapter/configSchema.d.ts +1 -1
- package/dist/DensityRenderer/index.d.ts +1 -1
- package/dist/LinePlotRenderer/LinePlotRenderer.d.ts +1 -1
- package/dist/LinePlotRenderer/configSchema.d.ts +1 -1
- package/dist/LinePlotRenderer/index.d.ts +1 -1
- package/dist/LinearWiggleDisplay/components/Tooltip.d.ts +2 -2
- package/dist/LinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +2 -4
- package/dist/LinearWiggleDisplay/components/YScaleBar.d.ts +7 -0
- package/dist/LinearWiggleDisplay/models/configSchema.d.ts +1 -1
- package/dist/LinearWiggleDisplay/models/model.d.ts +4 -4
- package/dist/WiggleBaseRenderer.d.ts +1 -1
- package/dist/XYPlotRenderer/index.d.ts +1 -1
- package/dist/configSchema.d.ts +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/plugin-wiggle.cjs.development.js +48 -64
- package/dist/plugin-wiggle.cjs.development.js.map +1 -1
- package/dist/plugin-wiggle.cjs.production.min.js +1 -1
- package/dist/plugin-wiggle.cjs.production.min.js.map +1 -1
- package/dist/plugin-wiggle.esm.js +50 -66
- package/dist/plugin-wiggle.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/LinearWiggleDisplay/components/Tooltip.tsx +3 -3
- package/src/LinearWiggleDisplay/components/WiggleDisplayComponent.tsx +18 -23
- package/src/LinearWiggleDisplay/components/YScaleBar.tsx +26 -0
- package/src/LinearWiggleDisplay/models/configSchema.ts +5 -0
- package/src/LinearWiggleDisplay/models/model.tsx +26 -29
- package/src/WiggleBaseRenderer.tsx +2 -2
- package/src/WiggleRPC/rpcMethods.ts +2 -9
- package/src/XYPlotRenderer/XYPlotRenderer.ts +3 -7
- package/src/declare.d.ts +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
|
|
2
2
|
import TrackType from '@jbrowse/core/pluggableElementTypes/TrackType';
|
|
3
3
|
import Plugin from '@jbrowse/core/Plugin';
|
|
4
|
-
import { ConfigurationSchema, readConfObject,
|
|
4
|
+
import { ConfigurationSchema, readConfObject, getConf, ConfigurationReference } from '@jbrowse/core/configuration';
|
|
5
5
|
import { createBaseTrackConfig, createBaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models';
|
|
6
6
|
import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType';
|
|
7
7
|
import FeatureRendererType from '@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType';
|
|
@@ -9,13 +9,13 @@ import { renderToAbstractCanvas } from '@jbrowse/core/util/offscreenCanvasUtils'
|
|
|
9
9
|
import { observer } from 'mobx-react';
|
|
10
10
|
import React, { useRef, useState, useMemo, lazy } from 'react';
|
|
11
11
|
import { PrerenderedCanvas } from '@jbrowse/core/ui';
|
|
12
|
-
import { featureSpanPx, getSession, isSelectionContainer, isAbortException,
|
|
12
|
+
import { featureSpanPx, getContainingView, measureText, getContainingTrack, getSession, isSelectionContainer, isAbortException, renameRegionsIfNeeded, updateStatus } from '@jbrowse/core/util';
|
|
13
13
|
import { scaleLinear, scaleLog, scaleQuantize } from 'd3-scale';
|
|
14
14
|
import { types, getEnv, addDisposer, isAlive } from 'mobx-state-tree';
|
|
15
15
|
import { baseLinearDisplayConfigSchema, BaseLinearDisplayComponent, BaseLinearDisplay } from '@jbrowse/plugin-linear-genome-view';
|
|
16
16
|
import { getRpcSessionId, getFileName } from '@jbrowse/core/util/tracks';
|
|
17
|
-
import {
|
|
18
|
-
import { Axis, LEFT, RIGHT, axisPropsFromTickScale } from 'react-d3-axis';
|
|
17
|
+
import { autorun, when } from 'mobx';
|
|
18
|
+
import { Axis, LEFT, RIGHT, axisPropsFromTickScale } from 'react-d3-axis-mod';
|
|
19
19
|
import { Portal, makeStyles, alpha, Dialog as Dialog$1, DialogTitle as DialogTitle$1, IconButton as IconButton$1, DialogContent as DialogContent$1, FormControlLabel, Radio, Typography as Typography$1, DialogActions, Button as Button$1 } from '@material-ui/core';
|
|
20
20
|
import { usePopper } from 'react-popper';
|
|
21
21
|
import Color from 'color';
|
|
@@ -1614,6 +1614,11 @@ function WiggleConfigFactory(pluginManager) {
|
|
|
1614
1614
|
model: types.enumeration('Autoscale type', ['global', 'local', 'globalsd', 'localsd', 'zscore']),
|
|
1615
1615
|
description: 'global/local using their min/max values or w/ standard deviations (globalsd/localsd)'
|
|
1616
1616
|
},
|
|
1617
|
+
minimalTicks: {
|
|
1618
|
+
type: 'boolean',
|
|
1619
|
+
defaultValue: false,
|
|
1620
|
+
description: 'use the minimal amount of ticks'
|
|
1621
|
+
},
|
|
1617
1622
|
minScore: {
|
|
1618
1623
|
type: 'number',
|
|
1619
1624
|
defaultValue: Number.MIN_VALUE,
|
|
@@ -1681,7 +1686,7 @@ var useStyles = /*#__PURE__*/makeStyles(function (theme) {
|
|
|
1681
1686
|
color: theme.palette.common.white,
|
|
1682
1687
|
fontFamily: theme.typography.fontFamily,
|
|
1683
1688
|
padding: '4px 8px',
|
|
1684
|
-
fontSize: theme.typography.pxToRem(
|
|
1689
|
+
fontSize: theme.typography.pxToRem(12),
|
|
1685
1690
|
lineHeight: "".concat(round(14 / 10), "em"),
|
|
1686
1691
|
maxWidth: 300,
|
|
1687
1692
|
wordWrap: 'break-word'
|
|
@@ -1787,25 +1792,32 @@ var YScaleBar = /*#__PURE__*/observer(function (_ref) {
|
|
|
1787
1792
|
var model = _ref.model,
|
|
1788
1793
|
orientation = _ref.orientation;
|
|
1789
1794
|
var ticks = model.ticks;
|
|
1790
|
-
return React.createElement(Axis, Object.assign({}, ticks, {
|
|
1795
|
+
return ticks ? React.createElement(Axis, Object.assign({}, ticks, {
|
|
1796
|
+
shadow: 2,
|
|
1791
1797
|
format: function format(n) {
|
|
1792
1798
|
return n;
|
|
1793
1799
|
},
|
|
1794
1800
|
style: {
|
|
1795
1801
|
orient: orientation === 'left' ? LEFT : RIGHT
|
|
1796
1802
|
}
|
|
1797
|
-
}));
|
|
1803
|
+
})) : null;
|
|
1798
1804
|
});
|
|
1805
|
+
|
|
1799
1806
|
var LinearWiggleDisplay = /*#__PURE__*/observer(function (props) {
|
|
1800
1807
|
var model = props.model;
|
|
1801
1808
|
var stats = model.stats,
|
|
1802
1809
|
height = model.height,
|
|
1803
|
-
needsScalebar = model.needsScalebar;
|
|
1810
|
+
needsScalebar = model.needsScalebar; // @ts-ignore
|
|
1811
|
+
|
|
1812
|
+
var _getContainingView = getContainingView(model),
|
|
1813
|
+
trackLabels = _getContainingView.trackLabels;
|
|
1814
|
+
|
|
1815
|
+
var left = trackLabels === 'overlapping' ? measureText(getConf(getContainingTrack(model), 'name'), 12.8) + 100 : 50;
|
|
1804
1816
|
return React.createElement("div", null, React.createElement(BaseLinearDisplayComponent, Object.assign({}, props)), stats && needsScalebar ? React.createElement("svg", {
|
|
1805
1817
|
style: {
|
|
1806
1818
|
position: 'absolute',
|
|
1807
1819
|
top: 0,
|
|
1808
|
-
left:
|
|
1820
|
+
left: left,
|
|
1809
1821
|
pointerEvents: 'none',
|
|
1810
1822
|
height: height,
|
|
1811
1823
|
width: 50
|
|
@@ -1826,15 +1838,6 @@ var YSCALEBAR_LABEL_OFFSET = 5; // using a map because it preserves order
|
|
|
1826
1838
|
|
|
1827
1839
|
var rendererTypes = /*#__PURE__*/new Map([['xyplot', 'XYPlotRenderer'], ['density', 'DensityRenderer'], ['line', 'LinePlotRenderer']]);
|
|
1828
1840
|
|
|
1829
|
-
function logb(x, y) {
|
|
1830
|
-
return Math.log(y) / Math.log(x);
|
|
1831
|
-
}
|
|
1832
|
-
|
|
1833
|
-
function round$1(v) {
|
|
1834
|
-
var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1.5;
|
|
1835
|
-
return (v >= 0 ? 1 : -1) * Math.pow(b, 1 + Math.floor(logb(b, Math.abs(v))));
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
1841
|
var stateModelFactory = function stateModelFactory(pluginManager, configSchema) {
|
|
1839
1842
|
return types.compose('LinearWiggleDisplay', BaseLinearDisplay, types.model({
|
|
1840
1843
|
type: types.literal('LinearWiggleDisplay'),
|
|
@@ -1858,17 +1861,25 @@ var stateModelFactory = function stateModelFactory(pluginManager, configSchema)
|
|
|
1858
1861
|
return {
|
|
1859
1862
|
statsReady: false,
|
|
1860
1863
|
message: undefined,
|
|
1861
|
-
stats:
|
|
1864
|
+
stats: {
|
|
1862
1865
|
scoreMin: 0,
|
|
1863
1866
|
scoreMax: 50
|
|
1864
|
-
}
|
|
1867
|
+
},
|
|
1865
1868
|
statsFetchInProgress: undefined
|
|
1866
1869
|
};
|
|
1867
1870
|
}).actions(function (self) {
|
|
1868
1871
|
return {
|
|
1869
|
-
updateStats: function updateStats(
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
+
updateStats: function updateStats(_ref) {
|
|
1873
|
+
var scoreMin = _ref.scoreMin,
|
|
1874
|
+
scoreMax = _ref.scoreMax;
|
|
1875
|
+
|
|
1876
|
+
if (self.stats.scoreMin !== scoreMin || self.stats.scoreMax !== scoreMax) {
|
|
1877
|
+
self.stats = {
|
|
1878
|
+
scoreMin: scoreMin,
|
|
1879
|
+
scoreMax: scoreMax
|
|
1880
|
+
};
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1872
1883
|
self.statsReady = true;
|
|
1873
1884
|
},
|
|
1874
1885
|
setColor: function setColor(color) {
|
|
@@ -2013,25 +2024,16 @@ var stateModelFactory = function stateModelFactory(pluginManager, configSchema)
|
|
|
2013
2024
|
scaleType = self.scaleType,
|
|
2014
2025
|
minScore = self.minScore,
|
|
2015
2026
|
maxScore = self.maxScore;
|
|
2027
|
+
var scoreMin = stats.scoreMin,
|
|
2028
|
+
scoreMax = stats.scoreMax;
|
|
2016
2029
|
var ret = getNiceDomain({
|
|
2017
|
-
domain: [
|
|
2030
|
+
domain: [scoreMin, scoreMax],
|
|
2018
2031
|
bounds: [minScore, maxScore],
|
|
2019
2032
|
scaleType: scaleType
|
|
2020
|
-
});
|
|
2021
|
-
var headroom = getConf(self, 'headroom') || 0; // avoid weird scalebar if log value and empty region displayed
|
|
2033
|
+
}); // avoid weird scalebar if log value and empty region displayed
|
|
2022
2034
|
|
|
2023
2035
|
if (scaleType === 'log' && ret[1] === Number.MIN_VALUE) {
|
|
2024
2036
|
return [0, Number.MIN_VALUE];
|
|
2025
|
-
} // heuristic to just give some extra headroom on bigwig scores if no
|
|
2026
|
-
// maxScore/minScore specified (they have MAX_VALUE/MIN_VALUE if so)
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
if (maxScore === Number.MAX_VALUE && ret[1] > 1.0) {
|
|
2030
|
-
ret[1] = round$1(ret[1] + headroom);
|
|
2031
|
-
}
|
|
2032
|
-
|
|
2033
|
-
if (minScore === Number.MIN_VALUE && ret[0] < -1.0) {
|
|
2034
|
-
ret[0] = round$1(ret[0] - headroom);
|
|
2035
2037
|
} // avoid returning a new object if it matches the old value
|
|
2036
2038
|
|
|
2037
2039
|
|
|
@@ -2075,6 +2077,7 @@ var stateModelFactory = function stateModelFactory(pluginManager, configSchema)
|
|
|
2075
2077
|
var scaleType = self.scaleType,
|
|
2076
2078
|
domain = self.domain,
|
|
2077
2079
|
height = self.height;
|
|
2080
|
+
var minimalTicks = getConf(self, 'minimalTicks');
|
|
2078
2081
|
var range = [height - YSCALEBAR_LABEL_OFFSET, YSCALEBAR_LABEL_OFFSET];
|
|
2079
2082
|
var scale = getScale({
|
|
2080
2083
|
scaleType: scaleType,
|
|
@@ -2082,8 +2085,10 @@ var stateModelFactory = function stateModelFactory(pluginManager, configSchema)
|
|
|
2082
2085
|
range: range,
|
|
2083
2086
|
inverted: getConf(self, 'inverted')
|
|
2084
2087
|
});
|
|
2085
|
-
var ticks =
|
|
2086
|
-
return
|
|
2088
|
+
var ticks = axisPropsFromTickScale(scale, 4);
|
|
2089
|
+
return height < 100 || minimalTicks ? _objectSpread2(_objectSpread2({}, ticks), {}, {
|
|
2090
|
+
values: domain
|
|
2091
|
+
}) : ticks;
|
|
2087
2092
|
}
|
|
2088
2093
|
|
|
2089
2094
|
};
|
|
@@ -2175,10 +2180,10 @@ var stateModelFactory = function stateModelFactory(pluginManager, configSchema)
|
|
|
2175
2180
|
})
|
|
2176
2181
|
}] : []), [{
|
|
2177
2182
|
label: 'Autoscale type',
|
|
2178
|
-
subMenu: [['local', 'Local']].concat(_toConsumableArray(self.hasGlobalStats ? [['global', 'Global'], ['globalsd', 'Global ± 3σ']] : []), [['localsd', 'Local ± 3σ']]).map(function (
|
|
2179
|
-
var
|
|
2180
|
-
val =
|
|
2181
|
-
label =
|
|
2183
|
+
subMenu: [['local', 'Local']].concat(_toConsumableArray(self.hasGlobalStats ? [['global', 'Global'], ['globalsd', 'Global ± 3σ']] : []), [['localsd', 'Local ± 3σ']]).map(function (_ref2) {
|
|
2184
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
2185
|
+
val = _ref3[0],
|
|
2186
|
+
label = _ref3[1];
|
|
2182
2187
|
|
|
2183
2188
|
return {
|
|
2184
2189
|
label: label,
|
|
@@ -2492,7 +2497,7 @@ var XYPlotRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
|
|
|
2492
2497
|
scaleOpts = props.scaleOpts,
|
|
2493
2498
|
unadjustedHeight = props.height,
|
|
2494
2499
|
config = props.config,
|
|
2495
|
-
|
|
2500
|
+
ticks = props.ticks,
|
|
2496
2501
|
displayCrossHatches = props.displayCrossHatches;
|
|
2497
2502
|
|
|
2498
2503
|
var _regions = _slicedToArray(regions, 1),
|
|
@@ -2536,10 +2541,6 @@ var XYPlotRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
|
|
|
2536
2541
|
feature: feature
|
|
2537
2542
|
});
|
|
2538
2543
|
};
|
|
2539
|
-
ctx.strokeStyle = 'grey';
|
|
2540
|
-
ctx.moveTo(0, toY(0));
|
|
2541
|
-
ctx.lineTo(width, toY(0));
|
|
2542
|
-
ctx.stroke();
|
|
2543
2544
|
var crossingOrigin = niceMin < pivotValue && niceMax > pivotValue;
|
|
2544
2545
|
|
|
2545
2546
|
var _iterator = _createForOfIteratorHelper(features.values()),
|
|
@@ -2614,7 +2615,7 @@ var XYPlotRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
|
|
|
2614
2615
|
if (displayCrossHatches) {
|
|
2615
2616
|
ctx.lineWidth = 1;
|
|
2616
2617
|
ctx.strokeStyle = 'rgba(200,200,200,0.8)';
|
|
2617
|
-
values.forEach(function (tick) {
|
|
2618
|
+
ticks.values.forEach(function (tick) {
|
|
2618
2619
|
ctx.beginPath();
|
|
2619
2620
|
ctx.moveTo(0, Math.round(toY(tick)));
|
|
2620
2621
|
ctx.lineTo(width, Math.round(toY(tick)));
|
|
@@ -2838,26 +2839,9 @@ var WiggleGetGlobalStats = /*#__PURE__*/function (_RpcMethodType) {
|
|
|
2838
2839
|
case 6:
|
|
2839
2840
|
_yield$getAdapter = _context2.sent;
|
|
2840
2841
|
dataAdapter = _yield$getAdapter.dataAdapter;
|
|
2841
|
-
|
|
2842
|
-
if (!(dataAdapter instanceof BaseFeatureDataAdapter)) {
|
|
2843
|
-
_context2.next = 12;
|
|
2844
|
-
break;
|
|
2845
|
-
}
|
|
2846
|
-
|
|
2847
|
-
if (!dataAdapter.capabilities.includes('hasGlobalStats')) {
|
|
2848
|
-
_context2.next = 11;
|
|
2849
|
-
break;
|
|
2850
|
-
}
|
|
2851
|
-
|
|
2852
2842
|
return _context2.abrupt("return", dataAdapter.getGlobalStats(deserializedArgs));
|
|
2853
2843
|
|
|
2854
|
-
case
|
|
2855
|
-
throw new Error('Data adapter does not support global stats');
|
|
2856
|
-
|
|
2857
|
-
case 12:
|
|
2858
|
-
throw new Error('Data adapter not found');
|
|
2859
|
-
|
|
2860
|
-
case 13:
|
|
2844
|
+
case 9:
|
|
2861
2845
|
case "end":
|
|
2862
2846
|
return _context2.stop();
|
|
2863
2847
|
}
|