@jbrowse/plugin-linear-genome-view 2.3.3 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +74 -4
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +41 -22
- 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 +5 -0
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -1
- package/dist/LinearBareDisplay/model.d.ts +62 -4
- package/dist/LinearBasicDisplay/model.d.ts +72 -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/GetSequenceDialog.js +4 -1
- package/dist/LinearGenomeView/components/GetSequenceDialog.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/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/OverviewScalebar.d.ts +1 -115
- package/dist/LinearGenomeView/components/OverviewScalebar.js +15 -99
- package/dist/LinearGenomeView/components/OverviewScalebar.js.map +1 -1
- package/dist/LinearGenomeView/components/RubberbandSpan.js +2 -2
- package/dist/LinearGenomeView/components/RubberbandSpan.js.map +1 -1
- package/dist/LinearGenomeView/components/TrackLabel.js +6 -5
- package/dist/LinearGenomeView/components/TrackLabel.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/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/model.d.ts +10 -2
- package/dist/LinearGenomeView/model.js +6 -6
- 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 +13 -0
- package/dist/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js +56 -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 +15 -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 +1 -1
- package/dist/LinearGenomeView/util.js.map +1 -1
- package/dist/index.d.ts +133 -18
- package/dist/index.js +6 -2
- package/dist/index.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 +74 -4
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +42 -23
- 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 +5 -0
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -1
- package/esm/LinearBareDisplay/model.d.ts +62 -4
- package/esm/LinearBasicDisplay/model.d.ts +72 -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/GetSequenceDialog.js +4 -1
- package/esm/LinearGenomeView/components/GetSequenceDialog.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/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/OverviewScalebar.d.ts +1 -115
- package/esm/LinearGenomeView/components/OverviewScalebar.js +12 -96
- package/esm/LinearGenomeView/components/OverviewScalebar.js.map +1 -1
- package/esm/LinearGenomeView/components/RubberbandSpan.js +2 -2
- package/esm/LinearGenomeView/components/RubberbandSpan.js.map +1 -1
- package/esm/LinearGenomeView/components/TrackLabel.js +6 -5
- package/esm/LinearGenomeView/components/TrackLabel.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/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/model.d.ts +10 -2
- package/esm/LinearGenomeView/model.js +4 -4
- 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 +13 -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 +9 -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 +1 -1
- package/esm/LinearGenomeView/util.js.map +1 -1
- package/esm/index.d.ts +133 -18
- package/esm/index.js +3 -2
- package/esm/index.js.map +1 -1
- package/package.json +3 -3
- package/src/BaseLinearDisplay/components/Block.tsx +1 -1
- package/src/BaseLinearDisplay/components/ServerSideRenderedBlockContent.tsx +11 -12
- package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +53 -35
- package/src/BaseLinearDisplay/models/configSchema.ts +8 -0
- package/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +9 -17
- 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/GetSequenceDialog.tsx +5 -1
- package/src/LinearGenomeView/components/Gridlines.tsx +1 -1
- package/src/LinearGenomeView/components/Header.tsx +6 -13
- 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/OverviewScalebar.tsx +218 -381
- package/src/LinearGenomeView/components/RubberbandSpan.tsx +2 -2
- package/src/LinearGenomeView/components/TrackLabel.tsx +3 -5
- package/src/LinearGenomeView/components/ZoomControls.tsx +3 -4
- package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.tsx.snap +1240 -1203
- package/src/LinearGenomeView/components/util.ts +13 -0
- package/src/LinearGenomeView/index.test.ts +9 -5
- package/src/LinearGenomeView/model.ts +16 -5
- 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 +45 -0
- package/src/LinearGenomeView/svgcomponents/SVGTracks.tsx +67 -0
- package/src/LinearGenomeView/util.test.ts +7 -4
- package/src/LinearGenomeView/util.ts +2 -2
- package/src/index.ts +10 -1
- 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
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { renderToStaticMarkup } from 'react-dom/server'
|
|
3
|
-
import { when } from 'mobx'
|
|
4
|
-
import { getParent } from 'mobx-state-tree'
|
|
5
|
-
import { getConf, readConfObject } from '@jbrowse/core/configuration'
|
|
6
|
-
import { getSession, getBpDisplayStr } from '@jbrowse/core/util'
|
|
7
|
-
import { AnyConfigurationModel } from '@jbrowse/core/configuration/configurationSchema'
|
|
8
|
-
import Base1DView from '@jbrowse/core/util/Base1DViewModel'
|
|
9
|
-
|
|
10
|
-
// locals
|
|
11
|
-
import Ruler from './Ruler'
|
|
12
|
-
import {
|
|
13
|
-
LinearGenomeViewModel,
|
|
14
|
-
ExportSvgOptions,
|
|
15
|
-
HEADER_OVERVIEW_HEIGHT,
|
|
16
|
-
} from '..'
|
|
17
|
-
import { Polygon, Cytobands } from './OverviewScalebar'
|
|
18
|
-
|
|
19
|
-
type LGV = LinearGenomeViewModel
|
|
20
|
-
|
|
21
|
-
function Scalebar({ model, fontSize }: { model: LGV; fontSize: number }) {
|
|
22
|
-
const {
|
|
23
|
-
offsetPx,
|
|
24
|
-
dynamicBlocks: { totalWidthPxWithoutBorders: totalWidthPx, totalBp },
|
|
25
|
-
} = model
|
|
26
|
-
const displayBp = getBpDisplayStr(totalBp)
|
|
27
|
-
const x0 = Math.max(-offsetPx, 0)
|
|
28
|
-
const x1 = x0 + totalWidthPx
|
|
29
|
-
return (
|
|
30
|
-
<>
|
|
31
|
-
<line x1={x0} x2={x1} y1={10} y2={10} stroke="black" />
|
|
32
|
-
<line x1={x0} x2={x0} y1={5} y2={15} stroke="black" />
|
|
33
|
-
<line x1={x1} x2={x1} y1={5} y2={15} stroke="black" />
|
|
34
|
-
<text
|
|
35
|
-
x={x0 + (x1 - x0) / 2}
|
|
36
|
-
y={fontSize * 2}
|
|
37
|
-
textAnchor="middle"
|
|
38
|
-
fontSize={fontSize}
|
|
39
|
-
>
|
|
40
|
-
{displayBp}
|
|
41
|
-
</text>
|
|
42
|
-
</>
|
|
43
|
-
)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function SVGRuler({
|
|
47
|
-
model,
|
|
48
|
-
fontSize,
|
|
49
|
-
width,
|
|
50
|
-
}: {
|
|
51
|
-
model: LGV
|
|
52
|
-
fontSize: number
|
|
53
|
-
width: number
|
|
54
|
-
}) {
|
|
55
|
-
const {
|
|
56
|
-
dynamicBlocks: { contentBlocks },
|
|
57
|
-
offsetPx: viewOffsetPx,
|
|
58
|
-
bpPerPx,
|
|
59
|
-
} = model
|
|
60
|
-
const renderRuler = contentBlocks.length < 5
|
|
61
|
-
return (
|
|
62
|
-
<>
|
|
63
|
-
<defs>
|
|
64
|
-
<clipPath id="clip-ruler">
|
|
65
|
-
<rect x={0} y={0} width={width} height={20} />
|
|
66
|
-
</clipPath>
|
|
67
|
-
</defs>
|
|
68
|
-
{contentBlocks.map(block => {
|
|
69
|
-
const { key, start, end, reversed, offsetPx, refName } = block
|
|
70
|
-
const offsetLeft = offsetPx - viewOffsetPx
|
|
71
|
-
return (
|
|
72
|
-
<g key={`${key}`} transform={`translate(${offsetLeft} 0)`}>
|
|
73
|
-
<text x={offsetLeft / bpPerPx} y={fontSize} fontSize={fontSize}>
|
|
74
|
-
{refName}
|
|
75
|
-
</text>
|
|
76
|
-
{renderRuler ? (
|
|
77
|
-
<g transform="translate(0 20)" clipPath="url(#clip-ruler)">
|
|
78
|
-
<Ruler
|
|
79
|
-
start={start}
|
|
80
|
-
end={end}
|
|
81
|
-
bpPerPx={bpPerPx}
|
|
82
|
-
reversed={reversed}
|
|
83
|
-
/>
|
|
84
|
-
</g>
|
|
85
|
-
) : (
|
|
86
|
-
<line
|
|
87
|
-
strokeWidth={1}
|
|
88
|
-
stroke="black"
|
|
89
|
-
x1={start / bpPerPx}
|
|
90
|
-
x2={end / bpPerPx}
|
|
91
|
-
y1={20}
|
|
92
|
-
y2={20}
|
|
93
|
-
/>
|
|
94
|
-
)}
|
|
95
|
-
</g>
|
|
96
|
-
)
|
|
97
|
-
})}
|
|
98
|
-
</>
|
|
99
|
-
)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const fontSize = 15
|
|
103
|
-
const rulerHeight = 50
|
|
104
|
-
const textHeight = fontSize + 5
|
|
105
|
-
const paddingHeight = 20
|
|
106
|
-
const headerHeight = textHeight + 20
|
|
107
|
-
const cytobandHeightIfExists = 100
|
|
108
|
-
|
|
109
|
-
interface Display {
|
|
110
|
-
height: number
|
|
111
|
-
}
|
|
112
|
-
interface Track {
|
|
113
|
-
displays: Display[]
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const totalHeight = (tracks: Track[]) => {
|
|
117
|
-
return tracks.reduce((accum, track) => {
|
|
118
|
-
const display = track.displays[0]
|
|
119
|
-
return accum + display.height + paddingHeight + textHeight
|
|
120
|
-
}, 0)
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// SVG component, ruler and assembly name
|
|
124
|
-
const SVGHeader = ({ model }: { model: LGV }) => {
|
|
125
|
-
const { width, assemblyNames, showCytobands, displayedRegions } = model
|
|
126
|
-
const { assemblyManager } = getSession(model)
|
|
127
|
-
const assemblyName = assemblyNames.length > 1 ? '' : assemblyNames[0]
|
|
128
|
-
const assembly = assemblyManager.get(assemblyName)
|
|
129
|
-
|
|
130
|
-
const overview = Base1DView.create({
|
|
131
|
-
displayedRegions: JSON.parse(JSON.stringify(displayedRegions)),
|
|
132
|
-
interRegionPaddingWidth: 0,
|
|
133
|
-
minimumBlockWidth: model.minimumBlockWidth,
|
|
134
|
-
})
|
|
135
|
-
const visibleRegions = model.dynamicBlocks.contentBlocks
|
|
136
|
-
|
|
137
|
-
overview.setVolatileWidth(width)
|
|
138
|
-
overview.showAllRegions()
|
|
139
|
-
const block = overview.dynamicBlocks.contentBlocks[0]
|
|
140
|
-
|
|
141
|
-
const first = visibleRegions[0]
|
|
142
|
-
const firstOverviewPx =
|
|
143
|
-
overview.bpToPx({
|
|
144
|
-
...first,
|
|
145
|
-
coord: first.reversed ? first.end : first.start,
|
|
146
|
-
}) || 0
|
|
147
|
-
|
|
148
|
-
const last = visibleRegions[visibleRegions.length - 1]
|
|
149
|
-
const lastOverviewPx =
|
|
150
|
-
overview.bpToPx({
|
|
151
|
-
...last,
|
|
152
|
-
coord: last.reversed ? last.start : last.end,
|
|
153
|
-
}) || 0
|
|
154
|
-
|
|
155
|
-
const cytobandHeight = showCytobands ? cytobandHeightIfExists : 0
|
|
156
|
-
|
|
157
|
-
return (
|
|
158
|
-
<g id="header">
|
|
159
|
-
<text x={0} y={fontSize} fontSize={fontSize}>
|
|
160
|
-
{assemblyName}
|
|
161
|
-
</text>
|
|
162
|
-
|
|
163
|
-
{showCytobands ? (
|
|
164
|
-
<g transform={`translate(0 ${rulerHeight})`}>
|
|
165
|
-
<Cytobands overview={overview} assembly={assembly} block={block} />
|
|
166
|
-
<rect
|
|
167
|
-
stroke="red"
|
|
168
|
-
fill="rgb(255,0,0,0.1)"
|
|
169
|
-
width={Math.max(lastOverviewPx - firstOverviewPx, 0.5)}
|
|
170
|
-
height={HEADER_OVERVIEW_HEIGHT - 1}
|
|
171
|
-
x={firstOverviewPx}
|
|
172
|
-
y={0.5}
|
|
173
|
-
/>
|
|
174
|
-
<g transform={`translate(0,${HEADER_OVERVIEW_HEIGHT})`}>
|
|
175
|
-
<Polygon overview={overview} model={model} useOffset={false} />
|
|
176
|
-
</g>
|
|
177
|
-
</g>
|
|
178
|
-
) : null}
|
|
179
|
-
|
|
180
|
-
<g transform={`translate(0 ${fontSize + cytobandHeight})`}>
|
|
181
|
-
<Scalebar model={model} fontSize={fontSize} />
|
|
182
|
-
</g>
|
|
183
|
-
<g transform={`translate(0 ${rulerHeight + cytobandHeight})`}>
|
|
184
|
-
<SVGRuler model={model} fontSize={fontSize} width={width} />
|
|
185
|
-
</g>
|
|
186
|
-
</g>
|
|
187
|
-
)
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// SVG component, region separator
|
|
191
|
-
const SVGRegionSeparators = ({
|
|
192
|
-
model,
|
|
193
|
-
height,
|
|
194
|
-
}: {
|
|
195
|
-
height: number
|
|
196
|
-
model: LGV
|
|
197
|
-
}) => {
|
|
198
|
-
const { dynamicBlocks, offsetPx, interRegionPaddingWidth } = model
|
|
199
|
-
return (
|
|
200
|
-
<>
|
|
201
|
-
{dynamicBlocks.contentBlocks.slice(1).map(block => (
|
|
202
|
-
<rect
|
|
203
|
-
key={block.key}
|
|
204
|
-
x={block.offsetPx - offsetPx - interRegionPaddingWidth}
|
|
205
|
-
width={interRegionPaddingWidth}
|
|
206
|
-
y={0}
|
|
207
|
-
height={height}
|
|
208
|
-
stroke="none"
|
|
209
|
-
fill="grey"
|
|
210
|
-
/>
|
|
211
|
-
))}
|
|
212
|
-
</>
|
|
213
|
-
)
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// SVG component, tracks
|
|
217
|
-
function SVGTracks({
|
|
218
|
-
displayResults,
|
|
219
|
-
model,
|
|
220
|
-
offset,
|
|
221
|
-
}: {
|
|
222
|
-
displayResults: {
|
|
223
|
-
track: {
|
|
224
|
-
configuration: AnyConfigurationModel
|
|
225
|
-
displays: { height: number }[]
|
|
226
|
-
}
|
|
227
|
-
result: string
|
|
228
|
-
}[]
|
|
229
|
-
model: LGV
|
|
230
|
-
offset: number
|
|
231
|
-
}) {
|
|
232
|
-
return (
|
|
233
|
-
<>
|
|
234
|
-
{displayResults.map(({ track, result }) => {
|
|
235
|
-
const current = offset
|
|
236
|
-
const trackName =
|
|
237
|
-
getConf(track, 'name') ||
|
|
238
|
-
`Reference sequence (${
|
|
239
|
-
readConfObject(getParent(track.configuration), 'displayName') ||
|
|
240
|
-
readConfObject(getParent(track.configuration), 'name')
|
|
241
|
-
})`
|
|
242
|
-
const display = track.displays[0]
|
|
243
|
-
offset += display.height + paddingHeight + textHeight
|
|
244
|
-
return (
|
|
245
|
-
<g
|
|
246
|
-
key={track.configuration.trackId}
|
|
247
|
-
transform={`translate(0 ${current})`}
|
|
248
|
-
>
|
|
249
|
-
<text fontSize={fontSize} x={Math.max(-model.offsetPx, 0)}>
|
|
250
|
-
{trackName}
|
|
251
|
-
</text>
|
|
252
|
-
<g transform={`translate(0 ${textHeight})`}>
|
|
253
|
-
{result}
|
|
254
|
-
<SVGRegionSeparators model={model} height={display.height} />
|
|
255
|
-
</g>
|
|
256
|
-
</g>
|
|
257
|
-
)
|
|
258
|
-
})}
|
|
259
|
-
</>
|
|
260
|
-
)
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
// render LGV to SVG
|
|
264
|
-
export async function renderToSvg(model: LGV, opts: ExportSvgOptions) {
|
|
265
|
-
await when(() => model.initialized)
|
|
266
|
-
const { Wrapper = ({ children }) => <>{children}</> } = opts
|
|
267
|
-
const { width, tracks, showCytobands } = model
|
|
268
|
-
const shift = 50
|
|
269
|
-
const offset =
|
|
270
|
-
headerHeight +
|
|
271
|
-
rulerHeight +
|
|
272
|
-
(showCytobands ? cytobandHeightIfExists : 0) +
|
|
273
|
-
20
|
|
274
|
-
const height = totalHeight(tracks) + offset
|
|
275
|
-
const displayResults = await Promise.all(
|
|
276
|
-
tracks.map(async track => {
|
|
277
|
-
const display = track.displays[0]
|
|
278
|
-
await when(() => (display.ready !== undefined ? display.ready : true))
|
|
279
|
-
return { track, result: await display.renderSvg(opts) }
|
|
280
|
-
}),
|
|
281
|
-
)
|
|
282
|
-
|
|
283
|
-
// the xlink namespace is used for rendering <image> tag
|
|
284
|
-
return renderToStaticMarkup(
|
|
285
|
-
<Wrapper>
|
|
286
|
-
<svg
|
|
287
|
-
width={width}
|
|
288
|
-
height={height}
|
|
289
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
290
|
-
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
291
|
-
viewBox={[0, 0, width + shift * 2, height].toString()}
|
|
292
|
-
>
|
|
293
|
-
{/* background white */}
|
|
294
|
-
<rect width={width + shift * 2} height={height} fill="white" />
|
|
295
|
-
|
|
296
|
-
<g stroke="none" transform={`translate(${shift} ${fontSize})`}>
|
|
297
|
-
<SVGHeader model={model} />
|
|
298
|
-
<SVGTracks
|
|
299
|
-
model={model}
|
|
300
|
-
displayResults={displayResults}
|
|
301
|
-
offset={offset}
|
|
302
|
-
/>
|
|
303
|
-
</g>
|
|
304
|
-
</svg>
|
|
305
|
-
</Wrapper>,
|
|
306
|
-
)
|
|
307
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { makeStyles } from 'tss-react/mui'
|
|
3
|
-
import { observer } from 'mobx-react'
|
|
4
|
-
import { getTickDisplayStr } from '@jbrowse/core/util'
|
|
5
|
-
|
|
6
|
-
// locals
|
|
7
|
-
import { makeTicks } from '../util'
|
|
8
|
-
|
|
9
|
-
const useStyles = makeStyles()({
|
|
10
|
-
majorTickLabel: {
|
|
11
|
-
fontSize: '11px',
|
|
12
|
-
},
|
|
13
|
-
majorTick: {
|
|
14
|
-
stroke: '#555',
|
|
15
|
-
},
|
|
16
|
-
minorTick: {
|
|
17
|
-
stroke: '#999',
|
|
18
|
-
},
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
function Ruler({
|
|
22
|
-
start,
|
|
23
|
-
end,
|
|
24
|
-
bpPerPx,
|
|
25
|
-
reversed = false,
|
|
26
|
-
major = true,
|
|
27
|
-
minor = true,
|
|
28
|
-
}: {
|
|
29
|
-
start: number
|
|
30
|
-
end: number
|
|
31
|
-
bpPerPx: number
|
|
32
|
-
reversed?: boolean
|
|
33
|
-
major?: boolean
|
|
34
|
-
minor?: boolean
|
|
35
|
-
}) {
|
|
36
|
-
const { classes } = useStyles()
|
|
37
|
-
const ticks = makeTicks(start, end, bpPerPx, major, minor)
|
|
38
|
-
return (
|
|
39
|
-
<>
|
|
40
|
-
{ticks.map(tick => {
|
|
41
|
-
const x = (reversed ? end - tick.base : tick.base - start) / bpPerPx
|
|
42
|
-
return (
|
|
43
|
-
<line
|
|
44
|
-
key={tick.base}
|
|
45
|
-
x1={x}
|
|
46
|
-
x2={x}
|
|
47
|
-
y1={0}
|
|
48
|
-
y2={tick.type === 'major' ? 6 : 4}
|
|
49
|
-
strokeWidth={1}
|
|
50
|
-
stroke={tick.type === 'major' ? '#555' : '#999'}
|
|
51
|
-
className={
|
|
52
|
-
tick.type === 'major' ? classes.majorTick : classes.minorTick
|
|
53
|
-
}
|
|
54
|
-
data-bp={tick.base}
|
|
55
|
-
/>
|
|
56
|
-
)
|
|
57
|
-
})}
|
|
58
|
-
{ticks
|
|
59
|
-
.filter(tick => tick.type === 'major')
|
|
60
|
-
.map(tick => {
|
|
61
|
-
const x = (reversed ? end - tick.base : tick.base - start) / bpPerPx
|
|
62
|
-
return (
|
|
63
|
-
<text
|
|
64
|
-
x={x - 3}
|
|
65
|
-
y={7 + 11}
|
|
66
|
-
key={`label-${tick.base}`}
|
|
67
|
-
style={{ fontSize: '11px' }}
|
|
68
|
-
className={classes.majorTickLabel}
|
|
69
|
-
>
|
|
70
|
-
{getTickDisplayStr(tick.base + 1, bpPerPx)}
|
|
71
|
-
</text>
|
|
72
|
-
)
|
|
73
|
-
})}
|
|
74
|
-
</>
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export default observer(Ruler)
|