@jbrowse/plugin-wiggle 2.3.4 → 2.4.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/dist/BigWigAdapter/BigWigAdapter.js +5 -6
- package/dist/BigWigAdapter/BigWigAdapter.js.map +1 -1
- package/dist/CreateMultiWiggleExtension/ConfirmDialog.js +1 -1
- package/dist/CreateMultiWiggleExtension/ConfirmDialog.js.map +1 -1
- package/dist/CreateMultiWiggleExtension/index.js +1 -3
- package/dist/CreateMultiWiggleExtension/index.js.map +1 -1
- package/dist/LinearWiggleDisplay/components/Tooltip.d.ts +2 -2
- package/dist/LinearWiggleDisplay/components/Tooltip.js +2 -1
- package/dist/LinearWiggleDisplay/components/Tooltip.js.map +1 -1
- package/dist/LinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +1 -2
- package/dist/LinearWiggleDisplay/components/WiggleDisplayComponent.js +3 -2
- package/dist/LinearWiggleDisplay/components/WiggleDisplayComponent.js.map +1 -1
- package/dist/LinearWiggleDisplay/index.d.ts +3 -4
- package/dist/LinearWiggleDisplay/index.js +7 -5
- package/dist/LinearWiggleDisplay/index.js.map +1 -1
- package/dist/LinearWiggleDisplay/models/model.d.ts +99 -28
- package/dist/LinearWiggleDisplay/models/model.js +3 -8
- package/dist/LinearWiggleDisplay/models/model.js.map +1 -1
- package/dist/MultiDensityRenderer/MultiDensityRenderer.js +2 -2
- package/dist/MultiDensityRenderer/MultiDensityRenderer.js.map +1 -1
- package/dist/MultiLineRenderer/MultiLineRenderer.js +2 -2
- package/dist/MultiLineRenderer/MultiLineRenderer.js.map +1 -1
- package/dist/MultiLinearWiggleDisplay/components/DraggableDialog.js +1 -1
- package/dist/MultiLinearWiggleDisplay/components/DraggableDialog.js.map +1 -1
- package/dist/MultiLinearWiggleDisplay/components/SetColorDialog.js +4 -4
- package/dist/MultiLinearWiggleDisplay/components/SetColorDialog.js.map +1 -1
- package/dist/MultiLinearWiggleDisplay/components/Tooltip.d.ts +2 -2
- package/dist/MultiLinearWiggleDisplay/components/Tooltip.js +2 -1
- package/dist/MultiLinearWiggleDisplay/components/Tooltip.js.map +1 -1
- package/dist/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +3 -4
- package/dist/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.js +10 -10
- package/dist/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.js.map +1 -1
- package/dist/MultiLinearWiggleDisplay/models/configSchema.js +7 -0
- package/dist/MultiLinearWiggleDisplay/models/configSchema.js.map +1 -1
- package/dist/MultiLinearWiggleDisplay/models/model.d.ts +63 -5
- package/dist/MultiLinearWiggleDisplay/models/model.js +1 -7
- package/dist/MultiLinearWiggleDisplay/models/model.js.map +1 -1
- package/dist/MultiRowLineRenderer/MultiRowLineRenderer.js +2 -2
- package/dist/MultiRowLineRenderer/MultiRowLineRenderer.js.map +1 -1
- package/dist/MultiRowXYPlotRenderer/MultiRowXYPlotRenderer.js +2 -2
- package/dist/MultiRowXYPlotRenderer/MultiRowXYPlotRenderer.js.map +1 -1
- package/dist/MultiWiggleAdapter/MultiWiggleAdapter.d.ts +2 -1
- package/dist/MultiWiggleAdapter/MultiWiggleAdapter.js +2 -2
- package/dist/MultiWiggleAdapter/MultiWiggleAdapter.js.map +1 -1
- package/dist/MultiWiggleAddTrackWidget/AddTrackWorkflow.js +2 -2
- package/dist/MultiWiggleAddTrackWidget/AddTrackWorkflow.js.map +1 -1
- package/dist/MultiXYPlotRenderer/MultiXYPlotRenderer.js +5 -5
- package/dist/MultiXYPlotRenderer/MultiXYPlotRenderer.js.map +1 -1
- package/dist/WiggleBaseRenderer.d.ts +2 -2
- package/dist/WiggleBaseRenderer.js +3 -3
- package/dist/WiggleBaseRenderer.js.map +1 -1
- package/dist/WiggleRPC/rpcMethods.js +2 -2
- package/dist/WiggleRPC/rpcMethods.js.map +1 -1
- package/dist/XYPlotRenderer/index.d.ts +3 -4
- package/dist/XYPlotRenderer/index.js +7 -4
- package/dist/XYPlotRenderer/index.js.map +1 -1
- package/dist/drawxy.js +4 -8
- package/dist/drawxy.js.map +1 -1
- package/dist/index.d.ts +73 -11
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/shared/YScaleBar.d.ts +9 -0
- package/dist/{MultiLinearWiggleDisplay/components → shared}/YScaleBar.js +4 -3
- package/dist/shared/YScaleBar.js.map +1 -0
- package/dist/util.d.ts +1 -1
- package/dist/util.js +6 -5
- package/dist/util.js.map +1 -1
- package/esm/BigWigAdapter/BigWigAdapter.js +5 -6
- package/esm/BigWigAdapter/BigWigAdapter.js.map +1 -1
- package/esm/CreateMultiWiggleExtension/ConfirmDialog.js +1 -1
- package/esm/CreateMultiWiggleExtension/ConfirmDialog.js.map +1 -1
- package/esm/CreateMultiWiggleExtension/index.js +1 -3
- package/esm/CreateMultiWiggleExtension/index.js.map +1 -1
- package/esm/LinearWiggleDisplay/components/Tooltip.d.ts +2 -2
- package/esm/LinearWiggleDisplay/components/Tooltip.js +1 -1
- package/esm/LinearWiggleDisplay/components/Tooltip.js.map +1 -1
- package/esm/LinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +1 -2
- package/esm/LinearWiggleDisplay/components/WiggleDisplayComponent.js +2 -2
- package/esm/LinearWiggleDisplay/components/WiggleDisplayComponent.js.map +1 -1
- package/esm/LinearWiggleDisplay/index.d.ts +3 -4
- package/esm/LinearWiggleDisplay/index.js +3 -2
- package/esm/LinearWiggleDisplay/index.js.map +1 -1
- package/esm/LinearWiggleDisplay/models/model.d.ts +99 -28
- package/esm/LinearWiggleDisplay/models/model.js +2 -7
- package/esm/LinearWiggleDisplay/models/model.js.map +1 -1
- package/esm/MultiDensityRenderer/MultiDensityRenderer.js +2 -2
- package/esm/MultiDensityRenderer/MultiDensityRenderer.js.map +1 -1
- package/esm/MultiLineRenderer/MultiLineRenderer.js +2 -2
- package/esm/MultiLineRenderer/MultiLineRenderer.js.map +1 -1
- package/esm/MultiLinearWiggleDisplay/components/DraggableDialog.js +1 -1
- package/esm/MultiLinearWiggleDisplay/components/DraggableDialog.js.map +1 -1
- package/esm/MultiLinearWiggleDisplay/components/SetColorDialog.js +4 -4
- package/esm/MultiLinearWiggleDisplay/components/SetColorDialog.js.map +1 -1
- package/esm/MultiLinearWiggleDisplay/components/Tooltip.d.ts +2 -2
- package/esm/MultiLinearWiggleDisplay/components/Tooltip.js +1 -1
- package/esm/MultiLinearWiggleDisplay/components/Tooltip.js.map +1 -1
- package/esm/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +3 -4
- package/esm/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.js +9 -10
- package/esm/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.js.map +1 -1
- package/esm/MultiLinearWiggleDisplay/models/configSchema.js +7 -0
- package/esm/MultiLinearWiggleDisplay/models/configSchema.js.map +1 -1
- package/esm/MultiLinearWiggleDisplay/models/model.d.ts +63 -5
- package/esm/MultiLinearWiggleDisplay/models/model.js +1 -7
- package/esm/MultiLinearWiggleDisplay/models/model.js.map +1 -1
- package/esm/MultiRowLineRenderer/MultiRowLineRenderer.js +2 -2
- package/esm/MultiRowLineRenderer/MultiRowLineRenderer.js.map +1 -1
- package/esm/MultiRowXYPlotRenderer/MultiRowXYPlotRenderer.js +2 -2
- package/esm/MultiRowXYPlotRenderer/MultiRowXYPlotRenderer.js.map +1 -1
- package/esm/MultiWiggleAdapter/MultiWiggleAdapter.d.ts +2 -1
- package/esm/MultiWiggleAdapter/MultiWiggleAdapter.js +2 -2
- package/esm/MultiWiggleAdapter/MultiWiggleAdapter.js.map +1 -1
- package/esm/MultiWiggleAddTrackWidget/AddTrackWorkflow.js +2 -2
- package/esm/MultiWiggleAddTrackWidget/AddTrackWorkflow.js.map +1 -1
- package/esm/MultiXYPlotRenderer/MultiXYPlotRenderer.js +5 -5
- package/esm/MultiXYPlotRenderer/MultiXYPlotRenderer.js.map +1 -1
- package/esm/WiggleBaseRenderer.d.ts +2 -2
- package/esm/WiggleBaseRenderer.js +3 -3
- package/esm/WiggleBaseRenderer.js.map +1 -1
- package/esm/WiggleRPC/rpcMethods.js +2 -2
- package/esm/WiggleRPC/rpcMethods.js.map +1 -1
- package/esm/XYPlotRenderer/index.d.ts +3 -4
- package/esm/XYPlotRenderer/index.js +3 -1
- package/esm/XYPlotRenderer/index.js.map +1 -1
- package/esm/drawxy.js +4 -8
- package/esm/drawxy.js.map +1 -1
- package/esm/index.d.ts +73 -11
- package/esm/index.js +4 -3
- package/esm/index.js.map +1 -1
- package/esm/shared/YScaleBar.d.ts +9 -0
- package/esm/{LinearWiggleDisplay/components → shared}/YScaleBar.js +4 -3
- package/esm/shared/YScaleBar.js.map +1 -0
- package/esm/util.d.ts +1 -1
- package/esm/util.js +6 -5
- package/esm/util.js.map +1 -1
- package/package.json +3 -3
- package/src/BigWigAdapter/BigWigAdapter.ts +5 -6
- package/src/CreateMultiWiggleExtension/ConfirmDialog.tsx +1 -1
- package/src/CreateMultiWiggleExtension/index.ts +1 -3
- package/src/DensityRenderer/DensityRenderer.test.ts +3 -3
- package/src/LinearWiggleDisplay/components/Tooltip.tsx +2 -1
- package/src/LinearWiggleDisplay/components/WiggleDisplayComponent.tsx +2 -2
- package/src/LinearWiggleDisplay/index.ts +3 -2
- package/src/LinearWiggleDisplay/models/model.tsx +2 -6
- package/src/MultiDensityRenderer/MultiDensityRenderer.ts +2 -2
- package/src/MultiLineRenderer/MultiLineRenderer.ts +2 -2
- package/src/MultiLinearWiggleDisplay/components/DraggableDialog.tsx +1 -1
- package/src/MultiLinearWiggleDisplay/components/SetColorDialog.tsx +4 -4
- package/src/MultiLinearWiggleDisplay/components/Tooltip.tsx +2 -1
- package/src/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.tsx +175 -182
- package/src/MultiLinearWiggleDisplay/models/configSchema.ts +8 -0
- package/src/MultiLinearWiggleDisplay/models/model.tsx +1 -6
- package/src/MultiRowLineRenderer/MultiRowLineRenderer.ts +2 -2
- package/src/MultiRowXYPlotRenderer/MultiRowXYPlotRenderer.ts +2 -2
- package/src/MultiWiggleAdapter/MultiWiggleAdapter.ts +3 -2
- package/src/MultiWiggleAddTrackWidget/AddTrackWorkflow.tsx +2 -2
- package/src/MultiXYPlotRenderer/MultiXYPlotRenderer.ts +5 -5
- package/src/WiggleBaseRenderer.tsx +13 -15
- package/src/WiggleRPC/rpcMethods.ts +2 -2
- package/src/WiggleRendering.test.js +1 -1
- package/src/XYPlotRenderer/XYPlotRenderer.test.ts +3 -3
- package/src/XYPlotRenderer/index.ts +4 -1
- package/src/drawxy.ts +6 -8
- package/src/index.ts +8 -9
- package/src/shared/YScaleBar.tsx +25 -0
- package/src/util.ts +5 -4
- package/dist/LinearWiggleDisplay/components/YScaleBar.d.ts +0 -7
- package/dist/LinearWiggleDisplay/components/YScaleBar.js +0 -14
- package/dist/LinearWiggleDisplay/components/YScaleBar.js.map +0 -1
- package/dist/MultiLinearWiggleDisplay/components/YScaleBar.d.ts +0 -7
- package/dist/MultiLinearWiggleDisplay/components/YScaleBar.js.map +0 -1
- package/esm/LinearWiggleDisplay/components/YScaleBar.d.ts +0 -7
- package/esm/LinearWiggleDisplay/components/YScaleBar.js.map +0 -1
- package/esm/MultiLinearWiggleDisplay/components/YScaleBar.d.ts +0 -7
- package/esm/MultiLinearWiggleDisplay/components/YScaleBar.js +0 -9
- package/esm/MultiLinearWiggleDisplay/components/YScaleBar.js.map +0 -1
- package/src/LinearWiggleDisplay/components/YScaleBar.tsx +0 -26
- package/src/MultiLinearWiggleDisplay/components/YScaleBar.tsx +0 -25
|
@@ -81,21 +81,20 @@ export default class BigWigAdapter extends BaseFeatureDataAdapter {
|
|
|
81
81
|
basesPerSpan: bpPerPx / resolution,
|
|
82
82
|
})
|
|
83
83
|
|
|
84
|
-
for (
|
|
85
|
-
const data = feats[i]
|
|
84
|
+
for (const data of feats) {
|
|
86
85
|
if (source) {
|
|
87
|
-
// @ts-
|
|
86
|
+
// @ts-expect-error
|
|
88
87
|
data.source = source
|
|
89
88
|
}
|
|
90
89
|
const uniqueId = `${source}:${region.refName}:${data.start}-${data.end}`
|
|
91
|
-
// @ts-
|
|
90
|
+
// @ts-expect-error
|
|
92
91
|
data.refName = refName
|
|
93
92
|
data.uniqueId = uniqueId
|
|
94
93
|
observer.next({
|
|
95
|
-
// @ts-
|
|
94
|
+
// @ts-expect-error
|
|
96
95
|
get: (str: string) => (data as Record<string, unknown>)[str],
|
|
97
96
|
id: () => uniqueId,
|
|
98
|
-
// @ts-
|
|
97
|
+
// @ts-expect-error
|
|
99
98
|
toJSON: () => data,
|
|
100
99
|
})
|
|
101
100
|
}
|
|
@@ -19,7 +19,7 @@ const ConfirmDialog = ({
|
|
|
19
19
|
tracks: AnyConfigurationModel[]
|
|
20
20
|
onClose: (arg: boolean, arg1?: { name: string }) => void
|
|
21
21
|
}) => {
|
|
22
|
-
const [val, setVal] = useState(
|
|
22
|
+
const [val, setVal] = useState(`MultiWiggle ${Date.now()}`)
|
|
23
23
|
const allQuant = tracks.every(t => t.type === 'QuantitativeTrack')
|
|
24
24
|
return (
|
|
25
25
|
<Dialog
|
|
@@ -26,9 +26,7 @@ export default function (pm: PluginManager) {
|
|
|
26
26
|
.map((c, idx) => ({ ...c, source: trackIds[idx] }))
|
|
27
27
|
const assemblyNames = [
|
|
28
28
|
...new Set(
|
|
29
|
-
tracks
|
|
30
|
-
.map(c => readConfObject(c, 'assemblyNames'))
|
|
31
|
-
.flat(),
|
|
29
|
+
tracks.flatMap(c => readConfObject(c, 'assemblyNames')),
|
|
32
30
|
),
|
|
33
31
|
]
|
|
34
32
|
const now = +Date.now()
|
|
@@ -6,10 +6,10 @@ import ReactComponent from '../WiggleRendering'
|
|
|
6
6
|
|
|
7
7
|
import { Image, createCanvas } from 'canvas'
|
|
8
8
|
|
|
9
|
-
// @ts-
|
|
9
|
+
// @ts-expect-error
|
|
10
10
|
global.nodeImage = Image
|
|
11
11
|
|
|
12
|
-
// @ts-
|
|
12
|
+
// @ts-expect-error
|
|
13
13
|
global.nodeCreateCanvas = createCanvas
|
|
14
14
|
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -53,7 +53,7 @@ test('inverted mode and reversed', async () => {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
const res = await renderToAbstractCanvas(1000, 200, renderProps, ctx =>
|
|
56
|
-
// @ts-
|
|
56
|
+
// @ts-expect-error
|
|
57
57
|
renderer.draw(ctx, renderProps),
|
|
58
58
|
)
|
|
59
59
|
expect(res).toMatchSnapshot({
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
|
|
14
14
|
// locals
|
|
15
15
|
import { WiggleDisplayModel } from '../models/model'
|
|
16
|
-
import YScaleBar from '
|
|
16
|
+
import YScaleBar from '../../shared/YScaleBar'
|
|
17
17
|
|
|
18
18
|
type LGV = LinearGenomeViewModel
|
|
19
19
|
|
|
@@ -50,4 +50,4 @@ const LinearWiggleDisplay = observer((props: { model: WiggleDisplayModel }) => {
|
|
|
50
50
|
|
|
51
51
|
export default LinearWiggleDisplay
|
|
52
52
|
|
|
53
|
-
export { YScaleBar }
|
|
53
|
+
export { default as YScaleBar } from '../../shared/YScaleBar'
|
|
@@ -4,7 +4,6 @@ import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType'
|
|
|
4
4
|
import configSchemaFactory from './models/configSchema'
|
|
5
5
|
import modelFactory from './models/model'
|
|
6
6
|
import ReactComponent from './components/WiggleDisplayComponent'
|
|
7
|
-
import Tooltip from './components/Tooltip'
|
|
8
7
|
|
|
9
8
|
export default (pluginManager: PluginManager) => {
|
|
10
9
|
pluginManager.addDisplayType(() => {
|
|
@@ -22,4 +21,6 @@ export default (pluginManager: PluginManager) => {
|
|
|
22
21
|
})
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
export {
|
|
24
|
+
export { default as Tooltip } from './components/Tooltip'
|
|
25
|
+
export { default as ReactComponent } from './components/WiggleDisplayComponent'
|
|
26
|
+
export { default as modelFactory } from './models/model'
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
} from '../../util'
|
|
31
31
|
|
|
32
32
|
import Tooltip from '../components/Tooltip'
|
|
33
|
-
import
|
|
33
|
+
import YScaleBar from '../../shared/YScaleBar'
|
|
34
34
|
|
|
35
35
|
const SetMinMaxDlg = lazy(() => import('../../shared/SetMinMaxDialog'))
|
|
36
36
|
const SetColorDlg = lazy(() => import('../components/SetColorDialog'))
|
|
@@ -216,11 +216,7 @@ function stateModelFactory(
|
|
|
216
216
|
* #action
|
|
217
217
|
*/
|
|
218
218
|
toggleLogScale() {
|
|
219
|
-
|
|
220
|
-
self.scale = 'log'
|
|
221
|
-
} else {
|
|
222
|
-
self.scale = 'linear'
|
|
223
|
-
}
|
|
219
|
+
self.scale = self.scale === 'log' ? 'linear' : 'log'
|
|
224
220
|
},
|
|
225
221
|
|
|
226
222
|
/**
|
|
@@ -6,7 +6,7 @@ import WiggleBaseRenderer, {
|
|
|
6
6
|
import { drawDensity } from '../drawxy'
|
|
7
7
|
|
|
8
8
|
export default class MultiXYPlotRenderer extends WiggleBaseRenderer {
|
|
9
|
-
// @ts-
|
|
9
|
+
// @ts-expect-error
|
|
10
10
|
async draw(ctx: CanvasRenderingContext2D, props: MultiArgs) {
|
|
11
11
|
const { bpPerPx, sources, regions, features } = props
|
|
12
12
|
const [region] = regions
|
|
@@ -31,7 +31,7 @@ export default class MultiXYPlotRenderer extends WiggleBaseRenderer {
|
|
|
31
31
|
ctx.lineTo(width, height)
|
|
32
32
|
ctx.stroke()
|
|
33
33
|
ctx.translate(0, height)
|
|
34
|
-
feats = feats
|
|
34
|
+
feats = [...feats, ...reducedFeatures]
|
|
35
35
|
})
|
|
36
36
|
ctx.restore()
|
|
37
37
|
return { reducedFeatures: feats }
|
|
@@ -7,7 +7,7 @@ import WiggleBaseRenderer, {
|
|
|
7
7
|
} from '../WiggleBaseRenderer'
|
|
8
8
|
|
|
9
9
|
export default class MultiLineRenderer extends WiggleBaseRenderer {
|
|
10
|
-
// @ts-
|
|
10
|
+
// @ts-expect-error
|
|
11
11
|
async draw(ctx: CanvasRenderingContext2D, props: MultiArgs) {
|
|
12
12
|
const { sources, features } = props
|
|
13
13
|
const groups = groupBy([...features.values()], f => f.get('source'))
|
|
@@ -22,7 +22,7 @@ export default class MultiLineRenderer extends WiggleBaseRenderer {
|
|
|
22
22
|
features,
|
|
23
23
|
colorCallback: () => source.color || 'blue',
|
|
24
24
|
})
|
|
25
|
-
feats = feats
|
|
25
|
+
feats = [...feats, ...reducedFeatures]
|
|
26
26
|
})
|
|
27
27
|
return { reducedFeatures: feats }
|
|
28
28
|
}
|
|
@@ -141,7 +141,7 @@ function SourcesGrid({
|
|
|
141
141
|
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null)
|
|
142
142
|
const [selected, setSelected] = useState([] as string[])
|
|
143
143
|
|
|
144
|
-
// @ts-
|
|
144
|
+
// @ts-expect-error
|
|
145
145
|
const { name: _name, color: _color, baseUri: _baseUri, ...rest } = rows[0]
|
|
146
146
|
|
|
147
147
|
// similar to BaseFeatureDetail data-grid for auto-measuring columns
|
|
@@ -178,7 +178,7 @@ function SourcesGrid({
|
|
|
178
178
|
const { value } = params
|
|
179
179
|
return isUriLocation(value) ? <UriLink value={value} /> : getStr(value)
|
|
180
180
|
},
|
|
181
|
-
// @ts-
|
|
181
|
+
// @ts-expect-error
|
|
182
182
|
width: measureGridWidth(rows.map(r => r[val])),
|
|
183
183
|
})),
|
|
184
184
|
]
|
|
@@ -266,9 +266,9 @@ function SourcesGrid({
|
|
|
266
266
|
onChange(
|
|
267
267
|
field
|
|
268
268
|
? [...rows].sort((a, b) => {
|
|
269
|
-
// @ts-
|
|
269
|
+
// @ts-expect-error
|
|
270
270
|
const aa = getStr(a[field])
|
|
271
|
-
// @ts-
|
|
271
|
+
// @ts-expect-error
|
|
272
272
|
const bb = getStr(b[field])
|
|
273
273
|
return idx === 1
|
|
274
274
|
? aa.localeCompare(bb)
|
|
@@ -13,7 +13,7 @@ import { observer } from 'mobx-react'
|
|
|
13
13
|
|
|
14
14
|
// locals
|
|
15
15
|
import { WiggleDisplayModel } from '../models/model'
|
|
16
|
-
import YScaleBar from '
|
|
16
|
+
import YScaleBar from '../../shared/YScaleBar'
|
|
17
17
|
|
|
18
18
|
type LGV = LinearGenomeViewModel
|
|
19
19
|
|
|
@@ -29,37 +29,35 @@ function getOffset(model: WiggleDisplayModel) {
|
|
|
29
29
|
: 10
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const Wrapper = observer(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
)
|
|
32
|
+
const Wrapper = observer(function ({
|
|
33
|
+
children,
|
|
34
|
+
model,
|
|
35
|
+
exportSVG,
|
|
36
|
+
}: {
|
|
37
|
+
model: WiggleDisplayModel
|
|
38
|
+
children: React.ReactNode
|
|
39
|
+
exportSVG?: boolean
|
|
40
|
+
}) {
|
|
41
|
+
if (exportSVG) {
|
|
42
|
+
return <>{children}</>
|
|
43
|
+
} else {
|
|
44
|
+
const { height } = model
|
|
45
|
+
return (
|
|
46
|
+
<svg
|
|
47
|
+
style={{
|
|
48
|
+
position: 'absolute',
|
|
49
|
+
top: 0,
|
|
50
|
+
left: 0,
|
|
51
|
+
pointerEvents: 'none',
|
|
52
|
+
height,
|
|
53
|
+
width: getContainingView(model).width,
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
{children}
|
|
57
|
+
</svg>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
})
|
|
63
61
|
|
|
64
62
|
const RectBg = (props: {
|
|
65
63
|
x: number
|
|
@@ -91,161 +89,158 @@ const ScoreLegend = observer(({ model }: { model: WiggleDisplayModel }) => {
|
|
|
91
89
|
)
|
|
92
90
|
})
|
|
93
91
|
|
|
94
|
-
const ColorLegend = observer(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
)
|
|
171
|
-
|
|
172
|
-
export const StatBars = observer(
|
|
173
|
-
(props: {
|
|
174
|
-
model: WiggleDisplayModel
|
|
175
|
-
orientation?: string
|
|
176
|
-
exportSVG?: boolean
|
|
177
|
-
}) => {
|
|
178
|
-
const { model, orientation, exportSVG } = props
|
|
179
|
-
const {
|
|
180
|
-
stats,
|
|
181
|
-
needsCustomLegend,
|
|
182
|
-
needsFullHeightScalebar,
|
|
183
|
-
rowHeightTooSmallForScalebar,
|
|
184
|
-
rowHeight,
|
|
185
|
-
sources,
|
|
186
|
-
ticks,
|
|
187
|
-
} = model
|
|
188
|
-
const svgFontSize = Math.min(rowHeight, 12)
|
|
189
|
-
const canDisplayLabel = rowHeight > 11
|
|
190
|
-
const { width: viewWidth } = getContainingView(model) as LGV
|
|
191
|
-
const minWidth = 20
|
|
192
|
-
|
|
193
|
-
const ready = stats && sources
|
|
194
|
-
if (!ready) {
|
|
195
|
-
return null
|
|
196
|
-
}
|
|
92
|
+
const ColorLegend = observer(function ({
|
|
93
|
+
model,
|
|
94
|
+
rowHeight,
|
|
95
|
+
labelWidth,
|
|
96
|
+
exportSVG,
|
|
97
|
+
}: {
|
|
98
|
+
model: WiggleDisplayModel
|
|
99
|
+
rowHeight: number
|
|
100
|
+
labelWidth: number
|
|
101
|
+
exportSVG?: boolean
|
|
102
|
+
}) {
|
|
103
|
+
const {
|
|
104
|
+
needsCustomLegend,
|
|
105
|
+
needsScalebar,
|
|
106
|
+
needsFullHeightScalebar,
|
|
107
|
+
rowHeightTooSmallForScalebar,
|
|
108
|
+
renderColorBoxes,
|
|
109
|
+
sources,
|
|
110
|
+
} = model
|
|
111
|
+
const svgFontSize = Math.min(rowHeight, 12)
|
|
112
|
+
const canDisplayLabel = rowHeight > 11
|
|
113
|
+
const colorBoxWidth = renderColorBoxes ? 15 : 0
|
|
114
|
+
const legendWidth = labelWidth + colorBoxWidth + 5
|
|
115
|
+
const svgOffset = exportSVG ? 10 : 0
|
|
116
|
+
const extraOffset =
|
|
117
|
+
svgOffset || (needsScalebar && !rowHeightTooSmallForScalebar ? 50 : 0)
|
|
118
|
+
|
|
119
|
+
return sources ? (
|
|
120
|
+
<>
|
|
121
|
+
{
|
|
122
|
+
/* 0.25 for hanging letters like g */
|
|
123
|
+
needsFullHeightScalebar ? (
|
|
124
|
+
<RectBg
|
|
125
|
+
y={0}
|
|
126
|
+
x={extraOffset}
|
|
127
|
+
width={legendWidth}
|
|
128
|
+
height={(sources.length + 0.25) * rowHeight}
|
|
129
|
+
/>
|
|
130
|
+
) : null
|
|
131
|
+
}
|
|
132
|
+
{sources.map((source, idx) => {
|
|
133
|
+
const boxHeight = Math.min(20, rowHeight)
|
|
134
|
+
return (
|
|
135
|
+
<React.Fragment key={`${source.name}-${idx}`}>
|
|
136
|
+
{needsFullHeightScalebar ? null : (
|
|
137
|
+
<RectBg
|
|
138
|
+
y={idx * rowHeight + 1}
|
|
139
|
+
x={extraOffset}
|
|
140
|
+
width={legendWidth}
|
|
141
|
+
height={boxHeight}
|
|
142
|
+
/>
|
|
143
|
+
)}
|
|
144
|
+
{source.color ? (
|
|
145
|
+
<RectBg
|
|
146
|
+
y={idx * rowHeight + 1}
|
|
147
|
+
x={extraOffset}
|
|
148
|
+
width={colorBoxWidth}
|
|
149
|
+
height={needsCustomLegend ? rowHeight : boxHeight}
|
|
150
|
+
color={source.color}
|
|
151
|
+
/>
|
|
152
|
+
) : null}
|
|
153
|
+
{canDisplayLabel ? (
|
|
154
|
+
<text
|
|
155
|
+
y={idx * rowHeight + 13}
|
|
156
|
+
x={extraOffset + colorBoxWidth + 2}
|
|
157
|
+
fontSize={svgFontSize}
|
|
158
|
+
>
|
|
159
|
+
{source.name}
|
|
160
|
+
</text>
|
|
161
|
+
) : null}
|
|
162
|
+
</React.Fragment>
|
|
163
|
+
)
|
|
164
|
+
})}
|
|
165
|
+
</>
|
|
166
|
+
) : null
|
|
167
|
+
})
|
|
197
168
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
169
|
+
export const StatBars = observer(function (props: {
|
|
170
|
+
model: WiggleDisplayModel
|
|
171
|
+
orientation?: string
|
|
172
|
+
exportSVG?: boolean
|
|
173
|
+
}) {
|
|
174
|
+
const { model, orientation, exportSVG } = props
|
|
175
|
+
const {
|
|
176
|
+
stats,
|
|
177
|
+
needsCustomLegend,
|
|
178
|
+
needsFullHeightScalebar,
|
|
179
|
+
rowHeightTooSmallForScalebar,
|
|
180
|
+
rowHeight,
|
|
181
|
+
sources,
|
|
182
|
+
ticks,
|
|
183
|
+
} = model
|
|
184
|
+
const svgFontSize = Math.min(rowHeight, 12)
|
|
185
|
+
const canDisplayLabel = rowHeight > 11
|
|
186
|
+
const { width: viewWidth } = getContainingView(model) as LGV
|
|
187
|
+
const minWidth = 20
|
|
188
|
+
|
|
189
|
+
const ready = stats && sources
|
|
190
|
+
if (!ready) {
|
|
191
|
+
return null
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const labelWidth = Math.max(
|
|
195
|
+
...(sources
|
|
196
|
+
.map(s => measureText(s.name, svgFontSize))
|
|
197
|
+
.map(width => (canDisplayLabel ? width : minWidth)) || [0]),
|
|
198
|
+
)
|
|
203
199
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
<ColorLegend
|
|
213
|
-
exportSVG={exportSVG}
|
|
214
|
-
model={model}
|
|
215
|
-
rowHeight={12}
|
|
216
|
-
labelWidth={labelWidth}
|
|
217
|
-
/>
|
|
218
|
-
</g>
|
|
219
|
-
</>
|
|
220
|
-
) : (
|
|
221
|
-
<>
|
|
200
|
+
return (
|
|
201
|
+
<Wrapper {...props}>
|
|
202
|
+
{needsFullHeightScalebar ? (
|
|
203
|
+
<>
|
|
204
|
+
<g transform={`translate(${!exportSVG ? getOffset(model) : 0},0)`}>
|
|
205
|
+
<YScaleBar model={model} orientation={orientation} />
|
|
206
|
+
</g>
|
|
207
|
+
<g transform={`translate(${viewWidth - labelWidth - 100},0)`}>
|
|
222
208
|
<ColorLegend
|
|
223
209
|
exportSVG={exportSVG}
|
|
224
210
|
model={model}
|
|
225
|
-
rowHeight={
|
|
211
|
+
rowHeight={12}
|
|
226
212
|
labelWidth={labelWidth}
|
|
227
213
|
/>
|
|
214
|
+
</g>
|
|
215
|
+
</>
|
|
216
|
+
) : (
|
|
217
|
+
<>
|
|
218
|
+
<ColorLegend
|
|
219
|
+
exportSVG={exportSVG}
|
|
220
|
+
model={model}
|
|
221
|
+
rowHeight={model.rowHeight}
|
|
222
|
+
labelWidth={labelWidth}
|
|
223
|
+
/>
|
|
224
|
+
|
|
225
|
+
{rowHeightTooSmallForScalebar || needsCustomLegend ? (
|
|
226
|
+
<ScoreLegend {...props} />
|
|
227
|
+
) : (
|
|
228
|
+
sources.map((_source, idx) => (
|
|
229
|
+
<g
|
|
230
|
+
transform={`translate(0 ${rowHeight * idx})`}
|
|
231
|
+
key={`${JSON.stringify(ticks)}-${idx}`}
|
|
232
|
+
>
|
|
233
|
+
<YScaleBar model={model} orientation={orientation} />
|
|
234
|
+
</g>
|
|
235
|
+
))
|
|
236
|
+
)}
|
|
237
|
+
</>
|
|
238
|
+
)}
|
|
239
|
+
</Wrapper>
|
|
240
|
+
)
|
|
241
|
+
})
|
|
228
242
|
|
|
229
|
-
|
|
230
|
-
<ScoreLegend {...props} />
|
|
231
|
-
) : (
|
|
232
|
-
sources.map((_source, idx) => (
|
|
233
|
-
<g
|
|
234
|
-
transform={`translate(0 ${rowHeight * idx})`}
|
|
235
|
-
key={JSON.stringify(ticks) + '-' + idx}
|
|
236
|
-
>
|
|
237
|
-
<YScaleBar model={model} orientation={orientation} />
|
|
238
|
-
</g>
|
|
239
|
-
))
|
|
240
|
-
)}
|
|
241
|
-
</>
|
|
242
|
-
)}
|
|
243
|
-
</Wrapper>
|
|
244
|
-
)
|
|
245
|
-
},
|
|
246
|
-
)
|
|
247
|
-
|
|
248
|
-
const LinearWiggleDisplay = observer((props: { model: WiggleDisplayModel }) => {
|
|
243
|
+
export default observer((props: { model: WiggleDisplayModel }) => {
|
|
249
244
|
const { model } = props
|
|
250
245
|
|
|
251
246
|
return (
|
|
@@ -256,6 +251,4 @@ const LinearWiggleDisplay = observer((props: { model: WiggleDisplayModel }) => {
|
|
|
256
251
|
)
|
|
257
252
|
})
|
|
258
253
|
|
|
259
|
-
export default
|
|
260
|
-
|
|
261
|
-
export { YScaleBar }
|
|
254
|
+
export { default as YScaleBar } from '../../shared/YScaleBar'
|
|
@@ -122,6 +122,14 @@ export default function WiggleConfigFactory(pluginManager: PluginManager) {
|
|
|
122
122
|
MultiLineRenderer: MultiLineRendererConfigSchema,
|
|
123
123
|
MultiRowLineRenderer: MultiRowLineRendererConfigSchema,
|
|
124
124
|
}),
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* #slot
|
|
128
|
+
*/
|
|
129
|
+
height: {
|
|
130
|
+
type: 'number',
|
|
131
|
+
defaultValue: 200,
|
|
132
|
+
},
|
|
125
133
|
},
|
|
126
134
|
{
|
|
127
135
|
/**
|
|
@@ -77,7 +77,6 @@ const stateModelFactory = (
|
|
|
77
77
|
resolution: types.optional(types.number, 1),
|
|
78
78
|
fill: types.maybe(types.boolean),
|
|
79
79
|
minSize: types.maybe(types.number),
|
|
80
|
-
height: 200,
|
|
81
80
|
color: types.maybe(types.string),
|
|
82
81
|
posColor: types.maybe(types.string),
|
|
83
82
|
negColor: types.maybe(types.string),
|
|
@@ -177,11 +176,7 @@ const stateModelFactory = (
|
|
|
177
176
|
},
|
|
178
177
|
|
|
179
178
|
toggleLogScale() {
|
|
180
|
-
|
|
181
|
-
self.scale = 'log'
|
|
182
|
-
} else {
|
|
183
|
-
self.scale = 'linear'
|
|
184
|
-
}
|
|
179
|
+
self.scale = self.scale === 'log' ? 'linear' : 'log'
|
|
185
180
|
},
|
|
186
181
|
|
|
187
182
|
setScaleType(scale?: string) {
|
|
@@ -6,7 +6,7 @@ import WiggleBaseRenderer, {
|
|
|
6
6
|
} from '../WiggleBaseRenderer'
|
|
7
7
|
|
|
8
8
|
export default class MultiRowLineRenderer extends WiggleBaseRenderer {
|
|
9
|
-
// @ts-
|
|
9
|
+
// @ts-expect-error
|
|
10
10
|
async draw(ctx: CanvasRenderingContext2D, props: MultiArgs) {
|
|
11
11
|
const { bpPerPx, sources, regions, features } = props
|
|
12
12
|
const [region] = regions
|
|
@@ -28,7 +28,7 @@ export default class MultiRowLineRenderer extends WiggleBaseRenderer {
|
|
|
28
28
|
ctx.lineTo(width, height)
|
|
29
29
|
ctx.stroke()
|
|
30
30
|
ctx.translate(0, height)
|
|
31
|
-
feats = feats
|
|
31
|
+
feats = [...feats, ...reducedFeatures]
|
|
32
32
|
})
|
|
33
33
|
ctx.restore()
|
|
34
34
|
return { reducedFeatures: feats }
|