@jbrowse/plugin-linear-genome-view 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/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +2 -3
- package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js +4 -4
- package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js.map +1 -1
- package/dist/BaseLinearDisplay/components/Block.js +1 -1
- package/dist/BaseLinearDisplay/components/Block.js.map +1 -1
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +11 -11
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -1
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +82 -7
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +43 -28
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
- package/dist/BaseLinearDisplay/models/configSchema.js +8 -0
- package/dist/BaseLinearDisplay/models/configSchema.js.map +1 -1
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +1 -1
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +9 -5
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -1
- package/dist/BaseLinearDisplay/models/util.js +2 -2
- package/dist/BaseLinearDisplay/models/util.js.map +1 -1
- package/dist/LaunchLinearGenomeView/index.js +1 -1
- package/dist/LaunchLinearGenomeView/index.js.map +1 -1
- package/dist/LinearBareDisplay/index.d.ts +2 -3
- package/dist/LinearBareDisplay/index.js +4 -2
- package/dist/LinearBareDisplay/index.js.map +1 -1
- package/dist/LinearBareDisplay/model.d.ts +61 -3
- package/dist/LinearBasicDisplay/index.d.ts +2 -3
- package/dist/LinearBasicDisplay/index.js +4 -2
- package/dist/LinearBasicDisplay/index.js.map +1 -1
- package/dist/LinearBasicDisplay/model.d.ts +82 -14
- package/dist/LinearGenomeView/components/CenterLine.js +2 -2
- package/dist/LinearGenomeView/components/CenterLine.js.map +1 -1
- package/dist/LinearGenomeView/components/Cytobands.d.ts +118 -0
- package/dist/LinearGenomeView/components/Cytobands.js +92 -0
- package/dist/LinearGenomeView/components/Cytobands.js.map +1 -0
- package/dist/LinearGenomeView/components/ExportSvgDialog.d.ts +1 -1
- package/dist/LinearGenomeView/components/ExportSvgDialog.js +24 -3
- package/dist/LinearGenomeView/components/ExportSvgDialog.js.map +1 -1
- package/dist/LinearGenomeView/components/Gridlines.js +1 -1
- package/dist/LinearGenomeView/components/Gridlines.js.map +1 -1
- package/dist/LinearGenomeView/components/Header.js +3 -4
- package/dist/LinearGenomeView/components/Header.js.map +1 -1
- package/dist/LinearGenomeView/components/ImportForm.d.ts +2 -2
- package/dist/LinearGenomeView/components/ImportForm.js +15 -19
- package/dist/LinearGenomeView/components/ImportForm.js.map +1 -1
- package/dist/LinearGenomeView/components/LinearGenomeView.js +1 -1
- package/dist/LinearGenomeView/components/MiniControls.js +5 -4
- package/dist/LinearGenomeView/components/MiniControls.js.map +1 -1
- package/dist/LinearGenomeView/components/OverviewRubberband.d.ts +3 -4
- package/dist/LinearGenomeView/components/OverviewRubberband.js +8 -11
- package/dist/LinearGenomeView/components/OverviewRubberband.js.map +1 -1
- package/dist/LinearGenomeView/components/OverviewScalebar.d.ts +4 -119
- package/dist/LinearGenomeView/components/OverviewScalebar.js +19 -103
- package/dist/LinearGenomeView/components/OverviewScalebar.js.map +1 -1
- package/dist/LinearGenomeView/components/RefNameAutocomplete.d.ts +2 -1
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js +35 -31
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -1
- package/dist/LinearGenomeView/components/RubberbandSpan.d.ts +2 -2
- package/dist/LinearGenomeView/components/RubberbandSpan.js +4 -18
- package/dist/LinearGenomeView/components/RubberbandSpan.js.map +1 -1
- package/dist/LinearGenomeView/components/SearchBox.js +3 -3
- package/dist/LinearGenomeView/components/SearchBox.js.map +1 -1
- package/dist/LinearGenomeView/components/TrackLabel.js +6 -7
- package/dist/LinearGenomeView/components/TrackLabel.js.map +1 -1
- package/dist/LinearGenomeView/components/TracksContainer.d.ts +2 -3
- package/dist/LinearGenomeView/components/TracksContainer.js +9 -8
- package/dist/LinearGenomeView/components/TracksContainer.js.map +1 -1
- package/dist/LinearGenomeView/components/ZoomControls.js +5 -4
- package/dist/LinearGenomeView/components/ZoomControls.js.map +1 -1
- package/dist/LinearGenomeView/components/hooks.d.ts +6 -1
- package/dist/LinearGenomeView/components/hooks.js +1 -1
- package/dist/LinearGenomeView/components/hooks.js.map +1 -1
- package/dist/LinearGenomeView/components/util.d.ts +6 -0
- package/dist/LinearGenomeView/components/util.js +11 -1
- package/dist/LinearGenomeView/components/util.js.map +1 -1
- package/dist/LinearGenomeView/index.js +8 -6
- package/dist/LinearGenomeView/index.js.map +1 -1
- package/dist/LinearGenomeView/model.d.ts +18 -12
- package/dist/LinearGenomeView/model.js +31 -34
- package/dist/LinearGenomeView/model.js.map +1 -1
- package/dist/LinearGenomeView/svgcomponents/SVGBackground.d.ts +6 -0
- package/dist/LinearGenomeView/svgcomponents/SVGBackground.js +13 -0
- package/dist/LinearGenomeView/svgcomponents/SVGBackground.js.map +1 -0
- package/dist/LinearGenomeView/svgcomponents/SVGHeader.d.ts +10 -0
- package/dist/LinearGenomeView/svgcomponents/SVGHeader.js +55 -0
- package/dist/LinearGenomeView/svgcomponents/SVGHeader.js.map +1 -0
- package/dist/LinearGenomeView/svgcomponents/SVGLinearGenomeView.d.ts +12 -0
- package/dist/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js +57 -0
- package/dist/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js.map +1 -0
- package/dist/LinearGenomeView/svgcomponents/SVGRegionSeparators.d.ts +8 -0
- package/dist/LinearGenomeView/svgcomponents/SVGRegionSeparators.js +13 -0
- package/dist/LinearGenomeView/svgcomponents/SVGRegionSeparators.js.map +1 -0
- package/dist/LinearGenomeView/svgcomponents/SVGRuler.d.ts +8 -0
- package/dist/LinearGenomeView/svgcomponents/SVGRuler.js +51 -0
- package/dist/LinearGenomeView/svgcomponents/SVGRuler.js.map +1 -0
- package/dist/LinearGenomeView/svgcomponents/SVGScalebar.d.ts +8 -0
- package/dist/LinearGenomeView/svgcomponents/SVGScalebar.js +22 -0
- package/dist/LinearGenomeView/svgcomponents/SVGScalebar.js.map +1 -0
- package/dist/LinearGenomeView/svgcomponents/SVGTrackLabel.d.ts +8 -0
- package/dist/LinearGenomeView/svgcomponents/SVGTrackLabel.js +16 -0
- package/dist/LinearGenomeView/svgcomponents/SVGTrackLabel.js.map +1 -0
- package/dist/LinearGenomeView/svgcomponents/SVGTracks.d.ts +23 -0
- package/dist/LinearGenomeView/svgcomponents/SVGTracks.js +30 -0
- package/dist/LinearGenomeView/svgcomponents/SVGTracks.js.map +1 -0
- package/dist/LinearGenomeView/util.js +2 -2
- package/dist/LinearGenomeView/util.js.map +1 -1
- package/dist/index.d.ts +157 -44
- package/dist/index.js +21 -13
- package/dist/index.js.map +1 -1
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +2 -3
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js +2 -3
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js.map +1 -1
- package/esm/BaseLinearDisplay/components/Block.js +1 -1
- package/esm/BaseLinearDisplay/components/Block.js.map +1 -1
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +11 -11
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -1
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +82 -7
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +44 -29
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
- package/esm/BaseLinearDisplay/models/configSchema.js +8 -0
- package/esm/BaseLinearDisplay/models/configSchema.js.map +1 -1
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +1 -1
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js +9 -5
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -1
- package/esm/BaseLinearDisplay/models/util.js +2 -2
- package/esm/BaseLinearDisplay/models/util.js.map +1 -1
- package/esm/LaunchLinearGenomeView/index.js +1 -1
- package/esm/LaunchLinearGenomeView/index.js.map +1 -1
- package/esm/LinearBareDisplay/index.d.ts +2 -3
- package/esm/LinearBareDisplay/index.js +2 -1
- package/esm/LinearBareDisplay/index.js.map +1 -1
- package/esm/LinearBareDisplay/model.d.ts +61 -3
- package/esm/LinearBasicDisplay/index.d.ts +2 -3
- package/esm/LinearBasicDisplay/index.js +2 -1
- package/esm/LinearBasicDisplay/index.js.map +1 -1
- package/esm/LinearBasicDisplay/model.d.ts +82 -14
- package/esm/LinearGenomeView/components/CenterLine.js +2 -2
- package/esm/LinearGenomeView/components/CenterLine.js.map +1 -1
- package/esm/LinearGenomeView/components/Cytobands.d.ts +118 -0
- package/esm/LinearGenomeView/components/Cytobands.js +87 -0
- package/esm/LinearGenomeView/components/Cytobands.js.map +1 -0
- package/esm/LinearGenomeView/components/ExportSvgDialog.d.ts +1 -1
- package/esm/LinearGenomeView/components/ExportSvgDialog.js +25 -4
- package/esm/LinearGenomeView/components/ExportSvgDialog.js.map +1 -1
- package/esm/LinearGenomeView/components/Gridlines.js +1 -1
- package/esm/LinearGenomeView/components/Gridlines.js.map +1 -1
- package/esm/LinearGenomeView/components/Header.js +5 -6
- package/esm/LinearGenomeView/components/Header.js.map +1 -1
- package/esm/LinearGenomeView/components/ImportForm.d.ts +2 -2
- package/esm/LinearGenomeView/components/ImportForm.js +16 -20
- package/esm/LinearGenomeView/components/ImportForm.js.map +1 -1
- package/esm/LinearGenomeView/components/LinearGenomeView.js +1 -1
- package/esm/LinearGenomeView/components/MiniControls.js +5 -4
- package/esm/LinearGenomeView/components/MiniControls.js.map +1 -1
- package/esm/LinearGenomeView/components/OverviewRubberband.d.ts +3 -4
- package/esm/LinearGenomeView/components/OverviewRubberband.js +8 -11
- package/esm/LinearGenomeView/components/OverviewRubberband.js.map +1 -1
- package/esm/LinearGenomeView/components/OverviewScalebar.d.ts +4 -119
- package/esm/LinearGenomeView/components/OverviewScalebar.js +16 -100
- package/esm/LinearGenomeView/components/OverviewScalebar.js.map +1 -1
- package/esm/LinearGenomeView/components/RefNameAutocomplete.d.ts +2 -1
- package/esm/LinearGenomeView/components/RefNameAutocomplete.js +36 -32
- package/esm/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -1
- package/esm/LinearGenomeView/components/RubberbandSpan.d.ts +2 -2
- package/esm/LinearGenomeView/components/RubberbandSpan.js +5 -20
- package/esm/LinearGenomeView/components/RubberbandSpan.js.map +1 -1
- package/esm/LinearGenomeView/components/SearchBox.js +3 -3
- package/esm/LinearGenomeView/components/SearchBox.js.map +1 -1
- package/esm/LinearGenomeView/components/TrackLabel.js +6 -7
- package/esm/LinearGenomeView/components/TrackLabel.js.map +1 -1
- package/esm/LinearGenomeView/components/TracksContainer.d.ts +2 -3
- package/esm/LinearGenomeView/components/TracksContainer.js +9 -8
- package/esm/LinearGenomeView/components/TracksContainer.js.map +1 -1
- package/esm/LinearGenomeView/components/ZoomControls.js +5 -4
- package/esm/LinearGenomeView/components/ZoomControls.js.map +1 -1
- package/esm/LinearGenomeView/components/hooks.d.ts +6 -1
- package/esm/LinearGenomeView/components/hooks.js +1 -1
- package/esm/LinearGenomeView/components/hooks.js.map +1 -1
- package/esm/LinearGenomeView/components/util.d.ts +6 -0
- package/esm/LinearGenomeView/components/util.js +9 -0
- package/esm/LinearGenomeView/components/util.js.map +1 -1
- package/esm/LinearGenomeView/index.js +8 -6
- package/esm/LinearGenomeView/index.js.map +1 -1
- package/esm/LinearGenomeView/model.d.ts +18 -12
- package/esm/LinearGenomeView/model.js +24 -28
- package/esm/LinearGenomeView/model.js.map +1 -1
- package/esm/LinearGenomeView/svgcomponents/SVGBackground.d.ts +6 -0
- package/esm/LinearGenomeView/svgcomponents/SVGBackground.js +7 -0
- package/esm/LinearGenomeView/svgcomponents/SVGBackground.js.map +1 -0
- package/esm/LinearGenomeView/svgcomponents/SVGHeader.d.ts +10 -0
- package/esm/LinearGenomeView/svgcomponents/SVGHeader.js +49 -0
- package/esm/LinearGenomeView/svgcomponents/SVGHeader.js.map +1 -0
- package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.d.ts +12 -0
- package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js +47 -0
- package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js.map +1 -0
- package/esm/LinearGenomeView/svgcomponents/SVGRegionSeparators.d.ts +8 -0
- package/esm/LinearGenomeView/svgcomponents/SVGRegionSeparators.js +7 -0
- package/esm/LinearGenomeView/svgcomponents/SVGRegionSeparators.js.map +1 -0
- package/esm/LinearGenomeView/svgcomponents/SVGRuler.d.ts +8 -0
- package/esm/LinearGenomeView/svgcomponents/SVGRuler.js +45 -0
- package/esm/LinearGenomeView/svgcomponents/SVGRuler.js.map +1 -0
- package/esm/LinearGenomeView/svgcomponents/SVGScalebar.d.ts +8 -0
- package/esm/LinearGenomeView/svgcomponents/SVGScalebar.js +16 -0
- package/esm/LinearGenomeView/svgcomponents/SVGScalebar.js.map +1 -0
- package/esm/LinearGenomeView/svgcomponents/SVGTrackLabel.d.ts +8 -0
- package/esm/LinearGenomeView/svgcomponents/SVGTrackLabel.js +10 -0
- package/esm/LinearGenomeView/svgcomponents/SVGTrackLabel.js.map +1 -0
- package/esm/LinearGenomeView/svgcomponents/SVGTracks.d.ts +23 -0
- package/esm/LinearGenomeView/svgcomponents/SVGTracks.js +24 -0
- package/esm/LinearGenomeView/svgcomponents/SVGTracks.js.map +1 -0
- package/esm/LinearGenomeView/util.js +2 -2
- package/esm/LinearGenomeView/util.js.map +1 -1
- package/esm/index.d.ts +157 -44
- package/esm/index.js +9 -5
- package/esm/index.js.map +1 -1
- package/package.json +3 -3
- package/src/BaseLinearDisplay/components/BaseLinearDisplay.tsx +4 -3
- package/src/BaseLinearDisplay/components/Block.tsx +1 -1
- package/src/BaseLinearDisplay/components/ServerSideRenderedBlockContent.tsx +11 -12
- package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +55 -40
- package/src/BaseLinearDisplay/models/configSchema.ts +8 -0
- package/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +15 -22
- package/src/BaseLinearDisplay/models/util.ts +2 -2
- package/src/LaunchLinearGenomeView/index.ts +1 -1
- package/src/LinearBareDisplay/index.ts +2 -1
- package/src/LinearBasicDisplay/index.ts +2 -1
- package/src/LinearGenomeView/components/CenterLine.tsx +2 -2
- package/src/LinearGenomeView/components/Cytobands.tsx +154 -0
- package/src/LinearGenomeView/components/ExportSvgDialog.tsx +56 -4
- package/src/LinearGenomeView/components/Gridlines.tsx +1 -1
- package/src/LinearGenomeView/components/Header.tsx +6 -13
- package/src/LinearGenomeView/components/ImportForm.tsx +17 -26
- package/src/LinearGenomeView/components/LinearGenomeView.test.tsx +8 -11
- package/src/LinearGenomeView/components/LinearGenomeView.tsx +1 -1
- package/src/LinearGenomeView/components/MiniControls.tsx +6 -7
- package/src/LinearGenomeView/components/OverviewRubberband.tsx +40 -49
- package/src/LinearGenomeView/components/OverviewScalebar.tsx +222 -385
- package/src/LinearGenomeView/components/RefNameAutocomplete.tsx +50 -48
- package/src/LinearGenomeView/components/RubberbandSpan.tsx +8 -25
- package/src/LinearGenomeView/components/SearchBox.tsx +3 -2
- package/src/LinearGenomeView/components/TrackLabel.tsx +76 -76
- package/src/LinearGenomeView/components/TracksContainer.tsx +8 -8
- package/src/LinearGenomeView/components/ZoomControls.tsx +3 -4
- package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.tsx.snap +1230 -1200
- package/src/LinearGenomeView/components/hooks.ts +7 -1
- package/src/LinearGenomeView/components/util.ts +13 -0
- package/src/LinearGenomeView/index.test.ts +12 -13
- package/src/LinearGenomeView/index.ts +8 -9
- package/src/LinearGenomeView/model.ts +41 -36
- package/src/LinearGenomeView/svgcomponents/SVGBackground.tsx +21 -0
- package/src/LinearGenomeView/svgcomponents/SVGHeader.tsx +93 -0
- package/src/LinearGenomeView/svgcomponents/SVGLinearGenomeView.tsx +114 -0
- package/src/LinearGenomeView/svgcomponents/SVGRegionSeparators.tsx +31 -0
- package/src/LinearGenomeView/svgcomponents/SVGRuler.tsx +125 -0
- package/src/LinearGenomeView/svgcomponents/SVGScalebar.tsx +57 -0
- package/src/LinearGenomeView/svgcomponents/SVGTrackLabel.tsx +47 -0
- package/src/LinearGenomeView/svgcomponents/SVGTracks.tsx +67 -0
- package/src/LinearGenomeView/util.test.ts +7 -4
- package/src/LinearGenomeView/util.ts +3 -3
- package/src/index.ts +22 -23
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.d.ts +0 -4
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js +0 -141
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js.map +0 -1
- package/dist/LinearGenomeView/components/Ruler.d.ts +0 -11
- package/dist/LinearGenomeView/components/Ruler.js +0 -39
- package/dist/LinearGenomeView/components/Ruler.js.map +0 -1
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.d.ts +0 -4
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js +0 -134
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js.map +0 -1
- package/esm/LinearGenomeView/components/Ruler.d.ts +0 -11
- package/esm/LinearGenomeView/components/Ruler.js +0 -34
- package/esm/LinearGenomeView/components/Ruler.js.map +0 -1
- package/src/LinearGenomeView/components/LinearGenomeViewSvg.tsx +0 -307
- package/src/LinearGenomeView/components/Ruler.tsx +0 -78
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { getTickDisplayStr } from '@jbrowse/core/util'
|
|
3
|
+
import { useTheme } from '@mui/material'
|
|
4
|
+
|
|
5
|
+
// locals
|
|
6
|
+
import { makeTicks } from '../util'
|
|
7
|
+
|
|
8
|
+
import { LinearGenomeViewModel } from '..'
|
|
9
|
+
import SVGRegionSeparators from './SVGRegionSeparators'
|
|
10
|
+
|
|
11
|
+
type LGV = LinearGenomeViewModel
|
|
12
|
+
|
|
13
|
+
function Ruler({
|
|
14
|
+
start,
|
|
15
|
+
end,
|
|
16
|
+
bpPerPx,
|
|
17
|
+
reversed = false,
|
|
18
|
+
major = true,
|
|
19
|
+
minor = true,
|
|
20
|
+
hideText = false,
|
|
21
|
+
}: {
|
|
22
|
+
start: number
|
|
23
|
+
end: number
|
|
24
|
+
bpPerPx: number
|
|
25
|
+
reversed?: boolean
|
|
26
|
+
major?: boolean
|
|
27
|
+
minor?: boolean
|
|
28
|
+
hideText?: boolean
|
|
29
|
+
}) {
|
|
30
|
+
const ticks = makeTicks(start, end, bpPerPx, major, minor)
|
|
31
|
+
const theme = useTheme()
|
|
32
|
+
return (
|
|
33
|
+
<>
|
|
34
|
+
{ticks.map(tick => {
|
|
35
|
+
const x = (reversed ? end - tick.base : tick.base - start) / bpPerPx
|
|
36
|
+
return (
|
|
37
|
+
<line
|
|
38
|
+
key={tick.base}
|
|
39
|
+
x1={x}
|
|
40
|
+
x2={x}
|
|
41
|
+
y1={0}
|
|
42
|
+
y2={tick.type === 'major' ? 6 : 4}
|
|
43
|
+
strokeWidth={1}
|
|
44
|
+
stroke={theme.palette.text.secondary}
|
|
45
|
+
/>
|
|
46
|
+
)
|
|
47
|
+
})}
|
|
48
|
+
{!hideText
|
|
49
|
+
? ticks
|
|
50
|
+
.filter(tick => tick.type === 'major')
|
|
51
|
+
.map(tick => {
|
|
52
|
+
const x =
|
|
53
|
+
(reversed ? end - tick.base : tick.base - start) / bpPerPx
|
|
54
|
+
return (
|
|
55
|
+
<text
|
|
56
|
+
x={x - 3}
|
|
57
|
+
y={7 + 11}
|
|
58
|
+
key={`label-${tick.base}`}
|
|
59
|
+
fontSize={11}
|
|
60
|
+
fill={theme.palette.text.primary}
|
|
61
|
+
>
|
|
62
|
+
{getTickDisplayStr(tick.base + 1, bpPerPx)}
|
|
63
|
+
</text>
|
|
64
|
+
)
|
|
65
|
+
})
|
|
66
|
+
: null}
|
|
67
|
+
</>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default function SVGRuler({
|
|
72
|
+
model,
|
|
73
|
+
fontSize,
|
|
74
|
+
}: {
|
|
75
|
+
model: LGV
|
|
76
|
+
fontSize: number
|
|
77
|
+
}) {
|
|
78
|
+
const {
|
|
79
|
+
dynamicBlocks: { contentBlocks },
|
|
80
|
+
offsetPx: viewOffsetPx,
|
|
81
|
+
bpPerPx,
|
|
82
|
+
} = model
|
|
83
|
+
const renderRuler = contentBlocks.length < 5
|
|
84
|
+
const theme = useTheme()
|
|
85
|
+
return (
|
|
86
|
+
<>
|
|
87
|
+
<SVGRegionSeparators model={model} height={30} />
|
|
88
|
+
{contentBlocks.map(block => {
|
|
89
|
+
const { start, end, key, reversed, offsetPx, refName, widthPx } = block
|
|
90
|
+
const offset = offsetPx - viewOffsetPx
|
|
91
|
+
const clipid = `clip-${key}`
|
|
92
|
+
return (
|
|
93
|
+
<g key={key}>
|
|
94
|
+
<defs>
|
|
95
|
+
<clipPath id={clipid}>
|
|
96
|
+
<rect x={0} y={0} width={widthPx} height={100} />
|
|
97
|
+
</clipPath>
|
|
98
|
+
</defs>
|
|
99
|
+
<g transform={`translate(${offset} 0)`}>
|
|
100
|
+
<g clipPath={`url(#${clipid})`}>
|
|
101
|
+
<text
|
|
102
|
+
x={4}
|
|
103
|
+
y={fontSize}
|
|
104
|
+
fontSize={fontSize}
|
|
105
|
+
fill={theme.palette.text.primary}
|
|
106
|
+
>
|
|
107
|
+
{refName}
|
|
108
|
+
</text>
|
|
109
|
+
<g transform="translate(0 20)">
|
|
110
|
+
<Ruler
|
|
111
|
+
hideText={!renderRuler}
|
|
112
|
+
start={start}
|
|
113
|
+
end={end}
|
|
114
|
+
bpPerPx={bpPerPx}
|
|
115
|
+
reversed={reversed}
|
|
116
|
+
/>
|
|
117
|
+
</g>
|
|
118
|
+
</g>
|
|
119
|
+
</g>
|
|
120
|
+
</g>
|
|
121
|
+
)
|
|
122
|
+
})}
|
|
123
|
+
</>
|
|
124
|
+
)
|
|
125
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { getBpDisplayStr } from '@jbrowse/core/util'
|
|
3
|
+
import { useTheme } from '@mui/material'
|
|
4
|
+
import { LinearGenomeViewModel } from '..'
|
|
5
|
+
|
|
6
|
+
type LGV = LinearGenomeViewModel
|
|
7
|
+
|
|
8
|
+
export default function SVGScalebar({
|
|
9
|
+
model,
|
|
10
|
+
fontSize,
|
|
11
|
+
}: {
|
|
12
|
+
model: LGV
|
|
13
|
+
fontSize: number
|
|
14
|
+
}) {
|
|
15
|
+
const {
|
|
16
|
+
offsetPx,
|
|
17
|
+
dynamicBlocks: { totalWidthPxWithoutBorders: totalWidthPx, totalBp },
|
|
18
|
+
} = model
|
|
19
|
+
const theme = useTheme()
|
|
20
|
+
const displayBp = getBpDisplayStr(totalBp)
|
|
21
|
+
const x0 = Math.max(-offsetPx, 0)
|
|
22
|
+
const x1 = x0 + totalWidthPx
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
<line
|
|
26
|
+
x1={x0}
|
|
27
|
+
x2={x1}
|
|
28
|
+
y1={10}
|
|
29
|
+
y2={10}
|
|
30
|
+
stroke={theme.palette.text.secondary}
|
|
31
|
+
/>
|
|
32
|
+
<line
|
|
33
|
+
x1={x0}
|
|
34
|
+
x2={x0}
|
|
35
|
+
y1={5}
|
|
36
|
+
y2={15}
|
|
37
|
+
stroke={theme.palette.text.secondary}
|
|
38
|
+
/>
|
|
39
|
+
<line
|
|
40
|
+
x1={x1}
|
|
41
|
+
x2={x1}
|
|
42
|
+
y1={5}
|
|
43
|
+
y2={15}
|
|
44
|
+
stroke={theme.palette.text.secondary}
|
|
45
|
+
/>
|
|
46
|
+
<text
|
|
47
|
+
x={x0 + (x1 - x0) / 2}
|
|
48
|
+
y={fontSize * 2}
|
|
49
|
+
textAnchor="middle"
|
|
50
|
+
fontSize={fontSize}
|
|
51
|
+
fill={theme.palette.text.primary}
|
|
52
|
+
>
|
|
53
|
+
{displayBp}
|
|
54
|
+
</text>
|
|
55
|
+
</>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useTheme } from '@mui/material'
|
|
3
|
+
|
|
4
|
+
export default function SVGTrackLabel({
|
|
5
|
+
trackLabels,
|
|
6
|
+
trackName,
|
|
7
|
+
fontSize,
|
|
8
|
+
trackLabelOffset,
|
|
9
|
+
x,
|
|
10
|
+
}: {
|
|
11
|
+
trackName: string
|
|
12
|
+
trackLabels: string
|
|
13
|
+
fontSize: number
|
|
14
|
+
trackLabelOffset: number
|
|
15
|
+
x: number
|
|
16
|
+
}) {
|
|
17
|
+
const theme = useTheme()
|
|
18
|
+
const fill = theme.palette.text.primary
|
|
19
|
+
const xoff = trackLabels === 'overlay' ? 5 : 0
|
|
20
|
+
const yoff = trackLabels === 'offset' ? 5 : 0
|
|
21
|
+
return trackLabels !== 'none' ? (
|
|
22
|
+
<g>
|
|
23
|
+
{trackLabels === 'left' ? (
|
|
24
|
+
<text
|
|
25
|
+
x={trackLabelOffset - 40}
|
|
26
|
+
y={20}
|
|
27
|
+
fill={fill}
|
|
28
|
+
fontSize={fontSize}
|
|
29
|
+
dominantBaseline="hanging"
|
|
30
|
+
textAnchor="end"
|
|
31
|
+
>
|
|
32
|
+
{trackName}
|
|
33
|
+
</text>
|
|
34
|
+
) : (
|
|
35
|
+
<text
|
|
36
|
+
x={x + xoff}
|
|
37
|
+
y={yoff}
|
|
38
|
+
fill={fill}
|
|
39
|
+
fontSize={fontSize}
|
|
40
|
+
dominantBaseline="hanging"
|
|
41
|
+
>
|
|
42
|
+
{trackName}
|
|
43
|
+
</text>
|
|
44
|
+
)}
|
|
45
|
+
</g>
|
|
46
|
+
) : null
|
|
47
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { AnyConfigurationModel } from '@jbrowse/core/configuration'
|
|
3
|
+
import { getTrackName } from '@jbrowse/core/util/tracks'
|
|
4
|
+
import { getSession } from '@jbrowse/core/util'
|
|
5
|
+
// locals
|
|
6
|
+
import { LinearGenomeViewModel } from '..'
|
|
7
|
+
import SVGRegionSeparators from './SVGRegionSeparators'
|
|
8
|
+
import SVGTrackLabel from './SVGTrackLabel'
|
|
9
|
+
|
|
10
|
+
type LGV = LinearGenomeViewModel
|
|
11
|
+
|
|
12
|
+
interface DisplayResult {
|
|
13
|
+
track: {
|
|
14
|
+
configuration: AnyConfigurationModel
|
|
15
|
+
displays: { height: number }[]
|
|
16
|
+
}
|
|
17
|
+
result: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// SVG component, tracks
|
|
21
|
+
export default function SVGTracks({
|
|
22
|
+
displayResults,
|
|
23
|
+
model,
|
|
24
|
+
offset,
|
|
25
|
+
textHeight,
|
|
26
|
+
fontSize,
|
|
27
|
+
trackLabels = 'offset',
|
|
28
|
+
trackLabelOffset = 0,
|
|
29
|
+
}: {
|
|
30
|
+
displayResults: DisplayResult[]
|
|
31
|
+
model: LGV
|
|
32
|
+
offset: number
|
|
33
|
+
textHeight: number
|
|
34
|
+
fontSize: number
|
|
35
|
+
trackLabels?: string
|
|
36
|
+
trackLabelOffset?: number
|
|
37
|
+
}) {
|
|
38
|
+
const session = getSession(model)
|
|
39
|
+
const textOffset = trackLabels === 'offset' ? textHeight : 0
|
|
40
|
+
return (
|
|
41
|
+
<>
|
|
42
|
+
{displayResults.map(({ track, result }) => {
|
|
43
|
+
const current = offset
|
|
44
|
+
const conf = track.configuration
|
|
45
|
+
const trackName = getTrackName(conf, session)
|
|
46
|
+
const display = track.displays[0]
|
|
47
|
+
const x = Math.max(-model.offsetPx, 0)
|
|
48
|
+
offset += display.height + textOffset
|
|
49
|
+
return (
|
|
50
|
+
<g key={conf.trackId} transform={`translate(0 ${current})`}>
|
|
51
|
+
<g transform={`translate(${trackLabelOffset} ${textOffset})`}>
|
|
52
|
+
<SVGRegionSeparators model={model} height={display.height} />
|
|
53
|
+
{result}
|
|
54
|
+
</g>
|
|
55
|
+
<SVGTrackLabel
|
|
56
|
+
trackName={trackName}
|
|
57
|
+
fontSize={fontSize}
|
|
58
|
+
trackLabels={trackLabels}
|
|
59
|
+
trackLabelOffset={trackLabelOffset}
|
|
60
|
+
x={x}
|
|
61
|
+
/>
|
|
62
|
+
</g>
|
|
63
|
+
)
|
|
64
|
+
})}
|
|
65
|
+
</>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
@@ -16,15 +16,18 @@ describe('tick calculation', () => {
|
|
|
16
16
|
{ type: 'minor', base: 8, index: 9 },
|
|
17
17
|
{ type: 'major', base: 9, index: 10 },
|
|
18
18
|
{ type: 'minor', base: 10, index: 11 },
|
|
19
|
+
{ type: 'minor', base: 11, index: 12 },
|
|
19
20
|
])
|
|
20
21
|
})
|
|
21
22
|
test('two', () => {
|
|
22
23
|
const result = Array.from(makeTicks(0, 50, 1))
|
|
23
24
|
expect(result).toEqual([
|
|
24
|
-
{ type: '
|
|
25
|
-
{ type: '
|
|
26
|
-
{ type: 'minor', base:
|
|
27
|
-
{ type: 'minor', base:
|
|
25
|
+
{ type: 'minor', base: -21, index: 0 },
|
|
26
|
+
{ type: 'major', base: -1, index: 1 },
|
|
27
|
+
{ type: 'minor', base: 19, index: 2 },
|
|
28
|
+
{ type: 'minor', base: 39, index: 3 },
|
|
29
|
+
{ type: 'minor', base: 59, index: 4 },
|
|
30
|
+
{ type: 'minor', base: 79, index: 5 },
|
|
28
31
|
])
|
|
29
32
|
})
|
|
30
33
|
})
|
|
@@ -10,7 +10,7 @@ export function chooseGridPitch(
|
|
|
10
10
|
) {
|
|
11
11
|
scale = Math.abs(scale)
|
|
12
12
|
const minMajorPitchBp = minMajorPitchPx * scale
|
|
13
|
-
const majorMagnitude = parseInt(
|
|
13
|
+
const majorMagnitude = Number.parseInt(
|
|
14
14
|
Number(minMajorPitchBp).toExponential().split(/e/i)[1],
|
|
15
15
|
10,
|
|
16
16
|
)
|
|
@@ -68,8 +68,8 @@ export function makeTicks(
|
|
|
68
68
|
let index = 0
|
|
69
69
|
const ticks = []
|
|
70
70
|
for (
|
|
71
|
-
let base = Math.
|
|
72
|
-
base < maxBase;
|
|
71
|
+
let base = Math.floor(minBase / iterPitch) * iterPitch;
|
|
72
|
+
base < Math.ceil(maxBase / iterPitch) * iterPitch + 1;
|
|
73
73
|
base += iterPitch
|
|
74
74
|
) {
|
|
75
75
|
if (emitMinor && base % (gridPitch.majorPitch * 2)) {
|
package/src/index.ts
CHANGED
|
@@ -9,26 +9,16 @@ import LineStyleIcon from '@mui/icons-material/LineStyle'
|
|
|
9
9
|
import {
|
|
10
10
|
BaseLinearDisplay,
|
|
11
11
|
BaseLinearDisplayComponent,
|
|
12
|
-
BlockModel,
|
|
13
|
-
BlockMsg,
|
|
14
12
|
baseLinearDisplayConfigSchema,
|
|
15
13
|
} from './BaseLinearDisplay'
|
|
16
|
-
import LinearBareDisplayF
|
|
17
|
-
configSchemaFactory as linearBareDisplayConfigSchemaFactory,
|
|
18
|
-
} from './LinearBareDisplay'
|
|
14
|
+
import LinearBareDisplayF from './LinearBareDisplay'
|
|
19
15
|
import LinearGenomeViewF, {
|
|
20
|
-
renderToSvg,
|
|
21
|
-
LinearGenomeViewModel,
|
|
22
|
-
LinearGenomeViewStateModel,
|
|
23
|
-
RefNameAutocomplete,
|
|
24
16
|
SearchBox,
|
|
25
17
|
ZoomControls,
|
|
26
18
|
LinearGenomeView,
|
|
27
19
|
} from './LinearGenomeView'
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
modelFactory as linearBasicDisplayModelFactory,
|
|
31
|
-
} from './LinearBasicDisplay'
|
|
20
|
+
|
|
21
|
+
import LinearBasicDisplayF from './LinearBasicDisplay'
|
|
32
22
|
|
|
33
23
|
import FeatureTrackF from './FeatureTrack'
|
|
34
24
|
import BasicTrackF from './BasicTrack'
|
|
@@ -68,19 +58,28 @@ export default class LinearGenomeViewPlugin extends Plugin {
|
|
|
68
58
|
}
|
|
69
59
|
}
|
|
70
60
|
|
|
61
|
+
export type { BaseLinearDisplayModel, BlockModel } from './BaseLinearDisplay'
|
|
62
|
+
|
|
63
|
+
export { configSchemaFactory as linearBareDisplayConfigSchemaFactory } from './LinearBareDisplay'
|
|
71
64
|
export {
|
|
65
|
+
BlockMsg,
|
|
72
66
|
baseLinearDisplayConfigSchema,
|
|
73
|
-
linearBareDisplayConfigSchemaFactory,
|
|
74
|
-
linearBasicDisplayConfigSchemaFactory,
|
|
75
|
-
linearBasicDisplayModelFactory,
|
|
76
|
-
renderToSvg,
|
|
77
67
|
BaseLinearDisplayComponent,
|
|
78
68
|
BaseLinearDisplay,
|
|
69
|
+
} from './BaseLinearDisplay'
|
|
70
|
+
export {
|
|
71
|
+
type LinearGenomeViewModel,
|
|
79
72
|
RefNameAutocomplete,
|
|
73
|
+
type LinearGenomeViewStateModel,
|
|
80
74
|
SearchBox,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
75
|
+
} from './LinearGenomeView'
|
|
76
|
+
export {
|
|
77
|
+
renderToSvg,
|
|
78
|
+
SVGTracks,
|
|
79
|
+
totalHeight,
|
|
80
|
+
SVGRuler,
|
|
81
|
+
} from './LinearGenomeView/svgcomponents/SVGLinearGenomeView'
|
|
82
|
+
export {
|
|
83
|
+
configSchema as linearBasicDisplayConfigSchemaFactory,
|
|
84
|
+
modelFactory as linearBasicDisplayModelFactory,
|
|
85
|
+
} from './LinearBasicDisplay'
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.renderToSvg = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const server_1 = require("react-dom/server");
|
|
9
|
-
const mobx_1 = require("mobx");
|
|
10
|
-
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
11
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
12
|
-
const util_1 = require("@jbrowse/core/util");
|
|
13
|
-
const Base1DViewModel_1 = __importDefault(require("@jbrowse/core/util/Base1DViewModel"));
|
|
14
|
-
// locals
|
|
15
|
-
const Ruler_1 = __importDefault(require("./Ruler"));
|
|
16
|
-
const __1 = require("..");
|
|
17
|
-
const OverviewScalebar_1 = require("./OverviewScalebar");
|
|
18
|
-
function Scalebar({ model, fontSize }) {
|
|
19
|
-
const { offsetPx, dynamicBlocks: { totalWidthPxWithoutBorders: totalWidthPx, totalBp }, } = model;
|
|
20
|
-
const displayBp = (0, util_1.getBpDisplayStr)(totalBp);
|
|
21
|
-
const x0 = Math.max(-offsetPx, 0);
|
|
22
|
-
const x1 = x0 + totalWidthPx;
|
|
23
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
24
|
-
react_1.default.createElement("line", { x1: x0, x2: x1, y1: 10, y2: 10, stroke: "black" }),
|
|
25
|
-
react_1.default.createElement("line", { x1: x0, x2: x0, y1: 5, y2: 15, stroke: "black" }),
|
|
26
|
-
react_1.default.createElement("line", { x1: x1, x2: x1, y1: 5, y2: 15, stroke: "black" }),
|
|
27
|
-
react_1.default.createElement("text", { x: x0 + (x1 - x0) / 2, y: fontSize * 2, textAnchor: "middle", fontSize: fontSize }, displayBp)));
|
|
28
|
-
}
|
|
29
|
-
function SVGRuler({ model, fontSize, width, }) {
|
|
30
|
-
const { dynamicBlocks: { contentBlocks }, offsetPx: viewOffsetPx, bpPerPx, } = model;
|
|
31
|
-
const renderRuler = contentBlocks.length < 5;
|
|
32
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
33
|
-
react_1.default.createElement("defs", null,
|
|
34
|
-
react_1.default.createElement("clipPath", { id: "clip-ruler" },
|
|
35
|
-
react_1.default.createElement("rect", { x: 0, y: 0, width: width, height: 20 }))),
|
|
36
|
-
contentBlocks.map(block => {
|
|
37
|
-
const { key, start, end, reversed, offsetPx, refName } = block;
|
|
38
|
-
const offsetLeft = offsetPx - viewOffsetPx;
|
|
39
|
-
return (react_1.default.createElement("g", { key: `${key}`, transform: `translate(${offsetLeft} 0)` },
|
|
40
|
-
react_1.default.createElement("text", { x: offsetLeft / bpPerPx, y: fontSize, fontSize: fontSize }, refName),
|
|
41
|
-
renderRuler ? (react_1.default.createElement("g", { transform: "translate(0 20)", clipPath: "url(#clip-ruler)" },
|
|
42
|
-
react_1.default.createElement(Ruler_1.default, { start: start, end: end, bpPerPx: bpPerPx, reversed: reversed }))) : (react_1.default.createElement("line", { strokeWidth: 1, stroke: "black", x1: start / bpPerPx, x2: end / bpPerPx, y1: 20, y2: 20 }))));
|
|
43
|
-
})));
|
|
44
|
-
}
|
|
45
|
-
const fontSize = 15;
|
|
46
|
-
const rulerHeight = 50;
|
|
47
|
-
const textHeight = fontSize + 5;
|
|
48
|
-
const paddingHeight = 20;
|
|
49
|
-
const headerHeight = textHeight + 20;
|
|
50
|
-
const cytobandHeightIfExists = 100;
|
|
51
|
-
const totalHeight = (tracks) => {
|
|
52
|
-
return tracks.reduce((accum, track) => {
|
|
53
|
-
const display = track.displays[0];
|
|
54
|
-
return accum + display.height + paddingHeight + textHeight;
|
|
55
|
-
}, 0);
|
|
56
|
-
};
|
|
57
|
-
// SVG component, ruler and assembly name
|
|
58
|
-
const SVGHeader = ({ model }) => {
|
|
59
|
-
const { width, assemblyNames, showCytobands, displayedRegions } = model;
|
|
60
|
-
const { assemblyManager } = (0, util_1.getSession)(model);
|
|
61
|
-
const assemblyName = assemblyNames.length > 1 ? '' : assemblyNames[0];
|
|
62
|
-
const assembly = assemblyManager.get(assemblyName);
|
|
63
|
-
const overview = Base1DViewModel_1.default.create({
|
|
64
|
-
displayedRegions: JSON.parse(JSON.stringify(displayedRegions)),
|
|
65
|
-
interRegionPaddingWidth: 0,
|
|
66
|
-
minimumBlockWidth: model.minimumBlockWidth,
|
|
67
|
-
});
|
|
68
|
-
const visibleRegions = model.dynamicBlocks.contentBlocks;
|
|
69
|
-
overview.setVolatileWidth(width);
|
|
70
|
-
overview.showAllRegions();
|
|
71
|
-
const block = overview.dynamicBlocks.contentBlocks[0];
|
|
72
|
-
const first = visibleRegions[0];
|
|
73
|
-
const firstOverviewPx = overview.bpToPx({
|
|
74
|
-
...first,
|
|
75
|
-
coord: first.reversed ? first.end : first.start,
|
|
76
|
-
}) || 0;
|
|
77
|
-
const last = visibleRegions[visibleRegions.length - 1];
|
|
78
|
-
const lastOverviewPx = overview.bpToPx({
|
|
79
|
-
...last,
|
|
80
|
-
coord: last.reversed ? last.start : last.end,
|
|
81
|
-
}) || 0;
|
|
82
|
-
const cytobandHeight = showCytobands ? cytobandHeightIfExists : 0;
|
|
83
|
-
return (react_1.default.createElement("g", { id: "header" },
|
|
84
|
-
react_1.default.createElement("text", { x: 0, y: fontSize, fontSize: fontSize }, assemblyName),
|
|
85
|
-
showCytobands ? (react_1.default.createElement("g", { transform: `translate(0 ${rulerHeight})` },
|
|
86
|
-
react_1.default.createElement(OverviewScalebar_1.Cytobands, { overview: overview, assembly: assembly, block: block }),
|
|
87
|
-
react_1.default.createElement("rect", { stroke: "red", fill: "rgb(255,0,0,0.1)", width: Math.max(lastOverviewPx - firstOverviewPx, 0.5), height: __1.HEADER_OVERVIEW_HEIGHT - 1, x: firstOverviewPx, y: 0.5 }),
|
|
88
|
-
react_1.default.createElement("g", { transform: `translate(0,${__1.HEADER_OVERVIEW_HEIGHT})` },
|
|
89
|
-
react_1.default.createElement(OverviewScalebar_1.Polygon, { overview: overview, model: model, useOffset: false })))) : null,
|
|
90
|
-
react_1.default.createElement("g", { transform: `translate(0 ${fontSize + cytobandHeight})` },
|
|
91
|
-
react_1.default.createElement(Scalebar, { model: model, fontSize: fontSize })),
|
|
92
|
-
react_1.default.createElement("g", { transform: `translate(0 ${rulerHeight + cytobandHeight})` },
|
|
93
|
-
react_1.default.createElement(SVGRuler, { model: model, fontSize: fontSize, width: width }))));
|
|
94
|
-
};
|
|
95
|
-
// SVG component, region separator
|
|
96
|
-
const SVGRegionSeparators = ({ model, height, }) => {
|
|
97
|
-
const { dynamicBlocks, offsetPx, interRegionPaddingWidth } = model;
|
|
98
|
-
return (react_1.default.createElement(react_1.default.Fragment, null, dynamicBlocks.contentBlocks.slice(1).map(block => (react_1.default.createElement("rect", { key: block.key, x: block.offsetPx - offsetPx - interRegionPaddingWidth, width: interRegionPaddingWidth, y: 0, height: height, stroke: "none", fill: "grey" })))));
|
|
99
|
-
};
|
|
100
|
-
// SVG component, tracks
|
|
101
|
-
function SVGTracks({ displayResults, model, offset, }) {
|
|
102
|
-
return (react_1.default.createElement(react_1.default.Fragment, null, displayResults.map(({ track, result }) => {
|
|
103
|
-
const current = offset;
|
|
104
|
-
const trackName = (0, configuration_1.getConf)(track, 'name') ||
|
|
105
|
-
`Reference sequence (${(0, configuration_1.readConfObject)((0, mobx_state_tree_1.getParent)(track.configuration), 'displayName') ||
|
|
106
|
-
(0, configuration_1.readConfObject)((0, mobx_state_tree_1.getParent)(track.configuration), 'name')})`;
|
|
107
|
-
const display = track.displays[0];
|
|
108
|
-
offset += display.height + paddingHeight + textHeight;
|
|
109
|
-
return (react_1.default.createElement("g", { key: track.configuration.trackId, transform: `translate(0 ${current})` },
|
|
110
|
-
react_1.default.createElement("text", { fontSize: fontSize, x: Math.max(-model.offsetPx, 0) }, trackName),
|
|
111
|
-
react_1.default.createElement("g", { transform: `translate(0 ${textHeight})` },
|
|
112
|
-
result,
|
|
113
|
-
react_1.default.createElement(SVGRegionSeparators, { model: model, height: display.height }))));
|
|
114
|
-
})));
|
|
115
|
-
}
|
|
116
|
-
// render LGV to SVG
|
|
117
|
-
async function renderToSvg(model, opts) {
|
|
118
|
-
await (0, mobx_1.when)(() => model.initialized);
|
|
119
|
-
const { Wrapper = ({ children }) => react_1.default.createElement(react_1.default.Fragment, null, children) } = opts;
|
|
120
|
-
const { width, tracks, showCytobands } = model;
|
|
121
|
-
const shift = 50;
|
|
122
|
-
const offset = headerHeight +
|
|
123
|
-
rulerHeight +
|
|
124
|
-
(showCytobands ? cytobandHeightIfExists : 0) +
|
|
125
|
-
20;
|
|
126
|
-
const height = totalHeight(tracks) + offset;
|
|
127
|
-
const displayResults = await Promise.all(tracks.map(async (track) => {
|
|
128
|
-
const display = track.displays[0];
|
|
129
|
-
await (0, mobx_1.when)(() => (display.ready !== undefined ? display.ready : true));
|
|
130
|
-
return { track, result: await display.renderSvg(opts) };
|
|
131
|
-
}));
|
|
132
|
-
// the xlink namespace is used for rendering <image> tag
|
|
133
|
-
return (0, server_1.renderToStaticMarkup)(react_1.default.createElement(Wrapper, null,
|
|
134
|
-
react_1.default.createElement("svg", { width: width, height: height, xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", viewBox: [0, 0, width + shift * 2, height].toString() },
|
|
135
|
-
react_1.default.createElement("rect", { width: width + shift * 2, height: height, fill: "white" }),
|
|
136
|
-
react_1.default.createElement("g", { stroke: "none", transform: `translate(${shift} ${fontSize})` },
|
|
137
|
-
react_1.default.createElement(SVGHeader, { model: model }),
|
|
138
|
-
react_1.default.createElement(SVGTracks, { model: model, displayResults: displayResults, offset: offset })))));
|
|
139
|
-
}
|
|
140
|
-
exports.renderToSvg = renderToSvg;
|
|
141
|
-
//# sourceMappingURL=LinearGenomeViewSvg.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LinearGenomeViewSvg.js","sourceRoot":"","sources":["../../../src/LinearGenomeView/components/LinearGenomeViewSvg.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,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C,MAAM,EAAC,SAAS,EAAE,aAAa,KAAK,IAAI,QAAQ,GAAG;gBAC3D,8BAAC,SAAS,IAAC,KAAK,EAAE,KAAK,GAAI;gBAC3B,8BAAC,SAAS,IACR,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,cAAc,EAC9B,MAAM,EAAE,MAAM,GACd,CACA,CACA,CACE,CACX,CAAA;AACH,CAAC;AA3CD,kCA2CC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
declare function Ruler({ start, end, bpPerPx, reversed, major, minor, }: {
|
|
3
|
-
start: number;
|
|
4
|
-
end: number;
|
|
5
|
-
bpPerPx: number;
|
|
6
|
-
reversed?: boolean;
|
|
7
|
-
major?: boolean;
|
|
8
|
-
minor?: boolean;
|
|
9
|
-
}): JSX.Element;
|
|
10
|
-
declare const _default: typeof Ruler;
|
|
11
|
-
export default _default;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const mui_1 = require("tss-react/mui");
|
|
8
|
-
const mobx_react_1 = require("mobx-react");
|
|
9
|
-
const util_1 = require("@jbrowse/core/util");
|
|
10
|
-
// locals
|
|
11
|
-
const util_2 = require("../util");
|
|
12
|
-
const useStyles = (0, mui_1.makeStyles)()({
|
|
13
|
-
majorTickLabel: {
|
|
14
|
-
fontSize: '11px',
|
|
15
|
-
},
|
|
16
|
-
majorTick: {
|
|
17
|
-
stroke: '#555',
|
|
18
|
-
},
|
|
19
|
-
minorTick: {
|
|
20
|
-
stroke: '#999',
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
function Ruler({ start, end, bpPerPx, reversed = false, major = true, minor = true, }) {
|
|
24
|
-
const { classes } = useStyles();
|
|
25
|
-
const ticks = (0, util_2.makeTicks)(start, end, bpPerPx, major, minor);
|
|
26
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
27
|
-
ticks.map(tick => {
|
|
28
|
-
const x = (reversed ? end - tick.base : tick.base - start) / bpPerPx;
|
|
29
|
-
return (react_1.default.createElement("line", { key: tick.base, x1: x, x2: x, y1: 0, y2: tick.type === 'major' ? 6 : 4, strokeWidth: 1, stroke: tick.type === 'major' ? '#555' : '#999', className: tick.type === 'major' ? classes.majorTick : classes.minorTick, "data-bp": tick.base }));
|
|
30
|
-
}),
|
|
31
|
-
ticks
|
|
32
|
-
.filter(tick => tick.type === 'major')
|
|
33
|
-
.map(tick => {
|
|
34
|
-
const x = (reversed ? end - tick.base : tick.base - start) / bpPerPx;
|
|
35
|
-
return (react_1.default.createElement("text", { x: x - 3, y: 7 + 11, key: `label-${tick.base}`, style: { fontSize: '11px' }, className: classes.majorTickLabel }, (0, util_1.getTickDisplayStr)(tick.base + 1, bpPerPx)));
|
|
36
|
-
})));
|
|
37
|
-
}
|
|
38
|
-
exports.default = (0, mobx_react_1.observer)(Ruler);
|
|
39
|
-
//# sourceMappingURL=Ruler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Ruler.js","sourceRoot":"","sources":["../../../src/LinearGenomeView/components/Ruler.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,uCAA0C;AAC1C,2CAAqC;AACrC,6CAAsD;AAEtD,SAAS;AACT,kCAAmC;AAEnC,MAAM,SAAS,GAAG,IAAA,gBAAU,GAAE,CAAC;IAC7B,cAAc,EAAE;QACd,QAAQ,EAAE,MAAM;KACjB;IACD,SAAS,EAAE;QACT,MAAM,EAAE,MAAM;KACf;IACD,SAAS,EAAE;QACT,MAAM,EAAE,MAAM;KACf;CACF,CAAC,CAAA;AAEF,SAAS,KAAK,CAAC,EACb,KAAK,EACL,GAAG,EACH,OAAO,EACP,Q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