@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
|
@@ -7,7 +7,6 @@ import { observer } from 'mobx-react'
|
|
|
7
7
|
import Base1DView, { Base1DViewModel } from '@jbrowse/core/util/Base1DViewModel'
|
|
8
8
|
import { getSession, getTickDisplayStr } from '@jbrowse/core/util'
|
|
9
9
|
import { ContentBlock } from '@jbrowse/core/util/blockTypes'
|
|
10
|
-
import { Assembly } from '@jbrowse/core/assemblyManager/assembly'
|
|
11
10
|
|
|
12
11
|
// locals
|
|
13
12
|
import {
|
|
@@ -17,6 +16,8 @@ import {
|
|
|
17
16
|
} from '..'
|
|
18
17
|
import { chooseGridPitch } from '../util'
|
|
19
18
|
import OverviewRubberband from './OverviewRubberband'
|
|
19
|
+
import Cytobands from './Cytobands'
|
|
20
|
+
import { getCytobands } from './util'
|
|
20
21
|
|
|
21
22
|
const wholeSeqSpacer = 2
|
|
22
23
|
|
|
@@ -32,13 +33,14 @@ const useStyles = makeStyles()(theme => ({
|
|
|
32
33
|
position: 'absolute',
|
|
33
34
|
top: 0,
|
|
34
35
|
height: HEADER_OVERVIEW_HEIGHT,
|
|
36
|
+
overflow: 'hidden',
|
|
35
37
|
},
|
|
36
38
|
scalebarContigForward: {
|
|
37
|
-
backgroundImage: `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 9'%3E%3Cpath d='M-.1 0L6 4.5L-.1 9' fill='none' stroke='
|
|
39
|
+
backgroundImage: `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 9'%3E%3Cpath d='M-.1 0L6 4.5L-.1 9' fill='none' stroke='${theme.palette.divider}'/%3E%3C/svg%3E")`,
|
|
38
40
|
backgroundRepeat: 'repeat',
|
|
39
41
|
},
|
|
40
42
|
scalebarContigReverse: {
|
|
41
|
-
backgroundImage: `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 9'%3E%3Cpath d='M6 0L0 4.5L6 9' fill='none' stroke='
|
|
43
|
+
backgroundImage: `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 9'%3E%3Cpath d='M6 0L0 4.5L6 9' fill='none' stroke='${theme.palette.divider}'/%3E%3C/svg%3E")`,
|
|
42
44
|
backgroundRepeat: 'repeat',
|
|
43
45
|
},
|
|
44
46
|
|
|
@@ -72,393 +74,228 @@ const useStyles = makeStyles()(theme => ({
|
|
|
72
74
|
},
|
|
73
75
|
}))
|
|
74
76
|
|
|
75
|
-
const Polygon = observer(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
-
return (
|
|
126
|
-
<polygon
|
|
127
|
-
points={points.toString()}
|
|
128
|
-
fill={alpha(polygonColor, 0.3)}
|
|
129
|
-
stroke={alpha(polygonColor, 0.8)}
|
|
130
|
-
/>
|
|
131
|
-
)
|
|
132
|
-
},
|
|
133
|
-
)
|
|
134
|
-
|
|
135
|
-
type LGV = LinearGenomeViewModel
|
|
136
|
-
|
|
137
|
-
// rounded rect from https://stackoverflow.com/a/45889603/2129219
|
|
138
|
-
// prettier-ignore
|
|
139
|
-
function rightRoundedRect(x: number, y: number, width: number, height: number, radius: number) {
|
|
140
|
-
return "M" + x + "," + y
|
|
141
|
-
+ "h" + (width - radius)
|
|
142
|
-
+ "a" + radius + "," + radius + " 0 0 1 " + radius + "," + radius
|
|
143
|
-
+ "v" + (height - 2 * radius)
|
|
144
|
-
+ "a" + radius + "," + radius + " 0 0 1 " + -radius + "," + radius
|
|
145
|
-
+ "h" + (radius - width)
|
|
146
|
-
+ "z";
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// prettier-ignore
|
|
150
|
-
function leftRoundedRect(x: number, y: number, width: number, height: number, radius: number ) {
|
|
151
|
-
return "M" + (x + radius) + "," + y
|
|
152
|
-
+ "h" + (width - radius)
|
|
153
|
-
+ "v" + height
|
|
154
|
-
+ "h" + (radius - width)
|
|
155
|
-
+ "a" + radius + "," + radius + " 0 0 1 " + (-radius) + "," + (-radius)
|
|
156
|
-
+ "v" + (2 * radius - height)
|
|
157
|
-
+ "a" + radius + "," + radius + " 0 0 1 " + radius + "," + (-radius)
|
|
158
|
-
+ "z";
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
const colorMap: { [key: string]: string | undefined } = {
|
|
162
|
-
gneg: 'rgb(227,227,227)',
|
|
163
|
-
gpos25: 'rgb(142,142,142)',
|
|
164
|
-
gpos50: 'rgb(85,85,85)',
|
|
165
|
-
gpos100: 'rgb(0,0,0)',
|
|
166
|
-
gpos75: 'rgb(57,57,57)',
|
|
167
|
-
gvar: 'rgb(0,0,0)',
|
|
168
|
-
stalk: 'rgb(127,127,127)',
|
|
169
|
-
acen: '#800',
|
|
170
|
-
}
|
|
77
|
+
const Polygon = observer(function ({
|
|
78
|
+
model,
|
|
79
|
+
overview,
|
|
80
|
+
useOffset = true,
|
|
81
|
+
}: {
|
|
82
|
+
model: LGV
|
|
83
|
+
overview: Base1DViewModel
|
|
84
|
+
useOffset?: boolean
|
|
85
|
+
}) {
|
|
86
|
+
const theme = useTheme()
|
|
87
|
+
const multiplier = Number(useOffset)
|
|
88
|
+
const { interRegionPaddingWidth, offsetPx, dynamicBlocks, cytobandOffset } =
|
|
89
|
+
model
|
|
90
|
+
const { contentBlocks, totalWidthPxWithoutBorders } = dynamicBlocks
|
|
91
|
+
|
|
92
|
+
const { tertiary, primary } = theme.palette
|
|
93
|
+
const polygonColor = tertiary ? tertiary.light : primary.light
|
|
94
|
+
|
|
95
|
+
if (!contentBlocks.length) {
|
|
96
|
+
return null
|
|
97
|
+
}
|
|
98
|
+
const first = contentBlocks[0]
|
|
99
|
+
const last = contentBlocks[contentBlocks.length - 1]
|
|
100
|
+
const topLeft =
|
|
101
|
+
(overview.bpToPx({
|
|
102
|
+
...first,
|
|
103
|
+
coord: first.reversed ? first.end : first.start,
|
|
104
|
+
}) || 0) +
|
|
105
|
+
cytobandOffset * multiplier
|
|
106
|
+
const topRight =
|
|
107
|
+
(overview.bpToPx({
|
|
108
|
+
...last,
|
|
109
|
+
coord: last.reversed ? last.start : last.end,
|
|
110
|
+
}) || 0) +
|
|
111
|
+
cytobandOffset * multiplier
|
|
112
|
+
|
|
113
|
+
const startPx = Math.max(0, -offsetPx)
|
|
114
|
+
const endPx =
|
|
115
|
+
startPx +
|
|
116
|
+
totalWidthPxWithoutBorders +
|
|
117
|
+
(contentBlocks.length * interRegionPaddingWidth) / 2
|
|
118
|
+
|
|
119
|
+
const points = [
|
|
120
|
+
[startPx, HEADER_BAR_HEIGHT],
|
|
121
|
+
[endPx, HEADER_BAR_HEIGHT],
|
|
122
|
+
[topRight, 0],
|
|
123
|
+
[topLeft, 0],
|
|
124
|
+
]
|
|
171
125
|
|
|
172
|
-
function getCytobands(assembly: Assembly | undefined, refName: string) {
|
|
173
126
|
return (
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
type: f.get('type'),
|
|
180
|
-
}))
|
|
181
|
-
.filter(f => f.refName === refName) || []
|
|
127
|
+
<polygon
|
|
128
|
+
points={points.toString()}
|
|
129
|
+
fill={alpha(polygonColor, 0.3)}
|
|
130
|
+
stroke={alpha(polygonColor, 0.8)}
|
|
131
|
+
/>
|
|
182
132
|
)
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const Cytobands = observer(
|
|
186
|
-
({
|
|
187
|
-
overview,
|
|
188
|
-
block,
|
|
189
|
-
assembly,
|
|
190
|
-
}: {
|
|
191
|
-
overview: Base1DViewModel
|
|
192
|
-
assembly?: Assembly
|
|
193
|
-
block: ContentBlock
|
|
194
|
-
}) => {
|
|
195
|
-
const { offsetPx, reversed } = block
|
|
196
|
-
const cytobands = getCytobands(assembly, block.refName)
|
|
197
|
-
const coords = cytobands.map(f => {
|
|
198
|
-
const { refName, start, end, type } = f
|
|
199
|
-
return [
|
|
200
|
-
overview.bpToPx({
|
|
201
|
-
refName,
|
|
202
|
-
coord: start,
|
|
203
|
-
}),
|
|
204
|
-
overview.bpToPx({
|
|
205
|
-
refName,
|
|
206
|
-
coord: end,
|
|
207
|
-
}),
|
|
208
|
-
type,
|
|
209
|
-
]
|
|
210
|
-
})
|
|
211
|
-
|
|
212
|
-
const arr = cytobands || []
|
|
213
|
-
const lcap = reversed ? arr.length - 1 : 0
|
|
214
|
-
const rcap = reversed ? 0 : arr.length - 1
|
|
215
|
-
|
|
216
|
-
let firstCent = true
|
|
217
|
-
return (
|
|
218
|
-
<g transform={`translate(-${offsetPx})`}>
|
|
219
|
-
{coords.map(([start, end, type], index) => {
|
|
220
|
-
const key = `${start}-${end}-${type}`
|
|
221
|
-
if (type === 'acen' && firstCent) {
|
|
222
|
-
firstCent = false
|
|
223
|
-
return (
|
|
224
|
-
<polygon
|
|
225
|
-
key={key}
|
|
226
|
-
points={[
|
|
227
|
-
[start, 0],
|
|
228
|
-
[end, HEADER_OVERVIEW_HEIGHT / 2],
|
|
229
|
-
[start, HEADER_OVERVIEW_HEIGHT],
|
|
230
|
-
].toString()}
|
|
231
|
-
fill={colorMap[type]}
|
|
232
|
-
/>
|
|
233
|
-
)
|
|
234
|
-
}
|
|
235
|
-
if (type === 'acen' && !firstCent) {
|
|
236
|
-
return (
|
|
237
|
-
<polygon
|
|
238
|
-
key={key}
|
|
239
|
-
points={[
|
|
240
|
-
[start, HEADER_OVERVIEW_HEIGHT / 2],
|
|
241
|
-
[end, 0],
|
|
242
|
-
[end, HEADER_OVERVIEW_HEIGHT],
|
|
243
|
-
].toString()}
|
|
244
|
-
fill={colorMap[type]}
|
|
245
|
-
/>
|
|
246
|
-
)
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
if (lcap === index) {
|
|
250
|
-
return (
|
|
251
|
-
<path
|
|
252
|
-
key={key}
|
|
253
|
-
d={leftRoundedRect(
|
|
254
|
-
Math.min(start, end),
|
|
255
|
-
0,
|
|
256
|
-
Math.abs(end - start),
|
|
257
|
-
HEADER_OVERVIEW_HEIGHT,
|
|
258
|
-
8,
|
|
259
|
-
)}
|
|
260
|
-
fill={colorMap[type]}
|
|
261
|
-
/>
|
|
262
|
-
)
|
|
263
|
-
} else if (rcap === index) {
|
|
264
|
-
return (
|
|
265
|
-
<path
|
|
266
|
-
key={key}
|
|
267
|
-
d={rightRoundedRect(
|
|
268
|
-
Math.min(start, end),
|
|
269
|
-
0,
|
|
270
|
-
Math.abs(end - start) - 2,
|
|
271
|
-
HEADER_OVERVIEW_HEIGHT,
|
|
272
|
-
8,
|
|
273
|
-
)}
|
|
274
|
-
fill={colorMap[type]}
|
|
275
|
-
/>
|
|
276
|
-
)
|
|
277
|
-
} else {
|
|
278
|
-
return (
|
|
279
|
-
<rect
|
|
280
|
-
key={key}
|
|
281
|
-
x={Math.min(start, end)}
|
|
282
|
-
y={0}
|
|
283
|
-
width={Math.abs(end - start)}
|
|
284
|
-
height={HEADER_OVERVIEW_HEIGHT}
|
|
285
|
-
fill={colorMap[type]}
|
|
286
|
-
/>
|
|
287
|
-
)
|
|
288
|
-
}
|
|
289
|
-
})}
|
|
290
|
-
</g>
|
|
291
|
-
)
|
|
292
|
-
},
|
|
293
|
-
)
|
|
294
|
-
|
|
295
|
-
const OverviewBox = observer(
|
|
296
|
-
({
|
|
297
|
-
scale,
|
|
298
|
-
model,
|
|
299
|
-
block,
|
|
300
|
-
overview,
|
|
301
|
-
}: {
|
|
302
|
-
scale: number
|
|
303
|
-
model: LGV
|
|
304
|
-
block: ContentBlock
|
|
305
|
-
overview: Base1DViewModel
|
|
306
|
-
}) => {
|
|
307
|
-
const { classes, cx } = useStyles()
|
|
308
|
-
const { cytobandOffset, showCytobands } = model
|
|
309
|
-
const { start, end, reversed, refName, assemblyName } = block
|
|
310
|
-
const { majorPitch } = chooseGridPitch(scale, 120, 15)
|
|
311
|
-
const { assemblyManager } = getSession(model)
|
|
312
|
-
const assembly = assemblyManager.get(assemblyName)
|
|
313
|
-
const refNameColor = assembly?.getRefNameColor(refName)
|
|
133
|
+
})
|
|
314
134
|
|
|
315
|
-
|
|
316
|
-
for (let i = 0; i < Math.floor((end - start) / majorPitch); i++) {
|
|
317
|
-
const offsetLabel = (i + 1) * majorPitch
|
|
318
|
-
tickLabels.push(reversed ? end - offsetLabel : start + offsetLabel)
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
const canDisplayCytobands =
|
|
322
|
-
showCytobands && getCytobands(assembly, block.refName).length
|
|
135
|
+
type LGV = LinearGenomeViewModel
|
|
323
136
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
{!canDisplayCytobands
|
|
353
|
-
? tickLabels.map((tickLabel, labelIdx) => (
|
|
354
|
-
<Typography
|
|
355
|
-
key={`${JSON.stringify(block)}-${tickLabel}-${labelIdx}`}
|
|
356
|
-
className={classes.scalebarLabel}
|
|
357
|
-
variant="body2"
|
|
358
|
-
style={{
|
|
359
|
-
left: ((labelIdx + 1) * majorPitch) / scale,
|
|
360
|
-
pointerEvents: 'none',
|
|
361
|
-
color: refNameColor,
|
|
362
|
-
}}
|
|
363
|
-
>
|
|
364
|
-
{getTickDisplayStr(tickLabel, overview.bpPerPx)}
|
|
365
|
-
</Typography>
|
|
366
|
-
))
|
|
367
|
-
: null}
|
|
137
|
+
const OverviewBox = observer(function ({
|
|
138
|
+
scale,
|
|
139
|
+
model,
|
|
140
|
+
block,
|
|
141
|
+
overview,
|
|
142
|
+
}: {
|
|
143
|
+
scale: number
|
|
144
|
+
model: LGV
|
|
145
|
+
block: ContentBlock
|
|
146
|
+
overview: Base1DViewModel
|
|
147
|
+
}) {
|
|
148
|
+
const { classes, cx } = useStyles()
|
|
149
|
+
const theme = useTheme()
|
|
150
|
+
const { cytobandOffset, showCytobands } = model
|
|
151
|
+
const { start, end, reversed, refName, assemblyName } = block
|
|
152
|
+
const { majorPitch } = chooseGridPitch(scale, 120, 15)
|
|
153
|
+
const { assemblyManager } = getSession(model)
|
|
154
|
+
const assembly = assemblyManager.get(assemblyName)
|
|
155
|
+
const refNameColor = assembly?.getRefNameColor(refName)
|
|
156
|
+
|
|
157
|
+
const tickLabels = []
|
|
158
|
+
for (let i = 0; i < Math.floor((end - start) / majorPitch); i++) {
|
|
159
|
+
const offsetLabel = (i + 1) * majorPitch
|
|
160
|
+
tickLabels.push(reversed ? end - offsetLabel : start + offsetLabel)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const canDisplayCytobands =
|
|
164
|
+
showCytobands && getCytobands(assembly, block.refName).length
|
|
368
165
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
166
|
+
return (
|
|
167
|
+
<div>
|
|
168
|
+
{/* name of sequence */}
|
|
169
|
+
<Typography
|
|
170
|
+
style={{
|
|
171
|
+
left: block.offsetPx + 3,
|
|
172
|
+
color: canDisplayCytobands
|
|
173
|
+
? theme.palette.primary.contrastText
|
|
174
|
+
: refNameColor,
|
|
175
|
+
}}
|
|
176
|
+
className={classes.scalebarRefName}
|
|
177
|
+
>
|
|
178
|
+
{refName}
|
|
179
|
+
</Typography>
|
|
180
|
+
<div
|
|
181
|
+
className={cx(
|
|
182
|
+
classes.scalebarContig,
|
|
183
|
+
canDisplayCytobands
|
|
184
|
+
? undefined
|
|
185
|
+
: reversed
|
|
186
|
+
? classes.scalebarContigReverse
|
|
187
|
+
: classes.scalebarContigForward,
|
|
188
|
+
!canDisplayCytobands ? classes.scalebarBorder : undefined,
|
|
189
|
+
)}
|
|
190
|
+
style={{
|
|
191
|
+
left: block.offsetPx + cytobandOffset,
|
|
192
|
+
width: block.widthPx,
|
|
193
|
+
borderColor: refNameColor,
|
|
194
|
+
}}
|
|
195
|
+
>
|
|
196
|
+
{!canDisplayCytobands
|
|
197
|
+
? tickLabels.map((tickLabel, labelIdx) => (
|
|
198
|
+
<Typography
|
|
199
|
+
key={`${JSON.stringify(block)}-${tickLabel}-${labelIdx}`}
|
|
200
|
+
className={classes.scalebarLabel}
|
|
201
|
+
variant="body2"
|
|
202
|
+
style={{
|
|
203
|
+
left: ((labelIdx + 1) * majorPitch) / scale,
|
|
204
|
+
pointerEvents: 'none',
|
|
205
|
+
color: refNameColor,
|
|
206
|
+
}}
|
|
207
|
+
>
|
|
208
|
+
{getTickDisplayStr(tickLabel, overview.bpPerPx)}
|
|
209
|
+
</Typography>
|
|
210
|
+
))
|
|
211
|
+
: null}
|
|
212
|
+
|
|
213
|
+
{canDisplayCytobands ? (
|
|
214
|
+
<svg style={{ width: '100%' }}>
|
|
215
|
+
<Cytobands overview={overview} assembly={assembly} block={block} />
|
|
216
|
+
</svg>
|
|
217
|
+
) : null}
|
|
379
218
|
</div>
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
)
|
|
383
|
-
|
|
384
|
-
const Scalebar = observer(
|
|
385
|
-
({
|
|
386
|
-
model,
|
|
387
|
-
scale,
|
|
388
|
-
overview,
|
|
389
|
-
}: {
|
|
390
|
-
model: LGV
|
|
391
|
-
overview: Base1DViewModel
|
|
392
|
-
scale: number
|
|
393
|
-
}) => {
|
|
394
|
-
const { classes } = useStyles()
|
|
395
|
-
const theme = useTheme()
|
|
396
|
-
const { dynamicBlocks, showCytobands, cytobandOffset } = model
|
|
397
|
-
const visibleRegions = dynamicBlocks.contentBlocks
|
|
398
|
-
const overviewVisibleRegions = overview.dynamicBlocks
|
|
399
|
-
|
|
400
|
-
const { tertiary, primary } = theme.palette
|
|
401
|
-
const scalebarColor = tertiary ? tertiary.light : primary.light
|
|
402
|
-
|
|
403
|
-
if (!visibleRegions.length) {
|
|
404
|
-
return null
|
|
405
|
-
}
|
|
406
|
-
const first = visibleRegions[0]
|
|
407
|
-
const firstOverviewPx =
|
|
408
|
-
overview.bpToPx({
|
|
409
|
-
...first,
|
|
410
|
-
coord: first.reversed ? first.end : first.start,
|
|
411
|
-
}) || 0
|
|
412
|
-
|
|
413
|
-
const last = visibleRegions[visibleRegions.length - 1]
|
|
414
|
-
const lastOverviewPx =
|
|
415
|
-
overview.bpToPx({
|
|
416
|
-
...last,
|
|
417
|
-
coord: last.reversed ? last.start : last.end,
|
|
418
|
-
}) || 0
|
|
219
|
+
</div>
|
|
220
|
+
)
|
|
221
|
+
})
|
|
419
222
|
|
|
420
|
-
|
|
421
|
-
|
|
223
|
+
const Scalebar = observer(function ({
|
|
224
|
+
model,
|
|
225
|
+
scale,
|
|
226
|
+
overview,
|
|
227
|
+
}: {
|
|
228
|
+
model: LGV
|
|
229
|
+
overview: Base1DViewModel
|
|
230
|
+
scale: number
|
|
231
|
+
}) {
|
|
232
|
+
const { classes } = useStyles()
|
|
233
|
+
const theme = useTheme()
|
|
234
|
+
const { dynamicBlocks, showCytobands, cytobandOffset } = model
|
|
235
|
+
const visibleRegions = dynamicBlocks.contentBlocks
|
|
236
|
+
const overviewVisibleRegions = overview.dynamicBlocks
|
|
237
|
+
|
|
238
|
+
const { tertiary, primary } = theme.palette
|
|
239
|
+
const scalebarColor = tertiary ? tertiary.light : primary.light
|
|
240
|
+
|
|
241
|
+
if (!visibleRegions.length) {
|
|
242
|
+
return null
|
|
243
|
+
}
|
|
244
|
+
const first = visibleRegions[0]
|
|
245
|
+
const firstOverviewPx =
|
|
246
|
+
overview.bpToPx({
|
|
247
|
+
...first,
|
|
248
|
+
coord: first.reversed ? first.end : first.start,
|
|
249
|
+
}) || 0
|
|
250
|
+
|
|
251
|
+
const last = visibleRegions[visibleRegions.length - 1]
|
|
252
|
+
const lastOverviewPx =
|
|
253
|
+
overview.bpToPx({
|
|
254
|
+
...last,
|
|
255
|
+
coord: last.reversed ? last.start : last.end,
|
|
256
|
+
}) || 0
|
|
257
|
+
|
|
258
|
+
const color = showCytobands ? '#f00' : scalebarColor
|
|
259
|
+
const transparency = showCytobands ? 0.1 : 0.3
|
|
422
260
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
)
|
|
261
|
+
return (
|
|
262
|
+
<div className={classes.scalebar}>
|
|
263
|
+
<div
|
|
264
|
+
className={classes.scalebarVisibleRegion}
|
|
265
|
+
style={{
|
|
266
|
+
width: lastOverviewPx - firstOverviewPx,
|
|
267
|
+
left: firstOverviewPx + cytobandOffset,
|
|
268
|
+
background: alpha(color, transparency),
|
|
269
|
+
borderColor: color,
|
|
270
|
+
}}
|
|
271
|
+
/>
|
|
272
|
+
{/* this is the entire scale bar */}
|
|
273
|
+
{overviewVisibleRegions.map((block, idx) => {
|
|
274
|
+
return !(block instanceof ContentBlock) ? (
|
|
275
|
+
<div
|
|
276
|
+
key={`${JSON.stringify(block)}-${idx}`}
|
|
277
|
+
className={classes.scalebarContig}
|
|
278
|
+
style={{
|
|
279
|
+
width: block.widthPx,
|
|
280
|
+
left: block.offsetPx,
|
|
281
|
+
backgroundColor: '#999',
|
|
282
|
+
backgroundImage:
|
|
283
|
+
'repeating-linear-gradient(90deg, transparent, transparent 1px, rgba(255,255,255,.5) 1px, rgba(255,255,255,.5) 3px)',
|
|
284
|
+
}}
|
|
285
|
+
/>
|
|
286
|
+
) : (
|
|
287
|
+
<OverviewBox
|
|
288
|
+
scale={scale}
|
|
289
|
+
block={block}
|
|
290
|
+
model={model}
|
|
291
|
+
overview={overview}
|
|
292
|
+
key={`${JSON.stringify(block)}-${idx}`}
|
|
293
|
+
/>
|
|
294
|
+
)
|
|
295
|
+
})}
|
|
296
|
+
</div>
|
|
297
|
+
)
|
|
298
|
+
})
|
|
462
299
|
|
|
463
300
|
function OverviewScalebar({
|
|
464
301
|
model,
|
|
@@ -7,8 +7,8 @@ import { stringify, toLocale } from '@jbrowse/core/util'
|
|
|
7
7
|
const useStyles = makeStyles()(theme => {
|
|
8
8
|
const { primary, tertiary } = theme.palette
|
|
9
9
|
const background = tertiary
|
|
10
|
-
? alpha(tertiary.
|
|
11
|
-
: alpha(primary.
|
|
10
|
+
? alpha(tertiary.light, 0.7)
|
|
11
|
+
: alpha(primary.light, 0.7)
|
|
12
12
|
return {
|
|
13
13
|
rubberband: {
|
|
14
14
|
height: '100%',
|