react-msaview 6.0.0 → 6.1.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/bundle/index.js +98 -98
- package/bundle/index.js.map +4 -4
- package/dist/columnCounts.d.ts +7 -0
- package/dist/columnCounts.js +18 -0
- package/dist/columnCounts.js.map +1 -1
- package/dist/components/DragHandle.d.ts +25 -0
- package/dist/components/DragHandle.js +49 -0
- package/dist/components/DragHandle.js.map +1 -0
- package/dist/components/ResizeHandles.d.ts +4 -2
- package/dist/components/ResizeHandles.js +29 -32
- package/dist/components/ResizeHandles.js.map +1 -1
- package/dist/components/VerticalScrollbar.js +2 -2
- package/dist/components/VerticalScrollbar.js.map +1 -1
- package/dist/components/dialogs/InterProScanDialog.js +52 -129
- package/dist/components/dialogs/InterProScanDialog.js.map +1 -1
- package/dist/components/header/settingsMenuItems.js +16 -1
- package/dist/components/header/settingsMenuItems.js.map +1 -1
- package/dist/components/minimap/Minimap.js +32 -4
- package/dist/components/minimap/Minimap.js.map +1 -1
- package/dist/components/msa/MSACanvas.js +8 -2
- package/dist/components/msa/MSACanvas.js.map +1 -1
- package/dist/components/msa/MSACanvasBlock.js +12 -3
- package/dist/components/msa/MSACanvasBlock.js.map +1 -1
- package/dist/components/msa/msaRaster.d.ts +63 -0
- package/dist/components/msa/msaRaster.js +252 -0
- package/dist/components/msa/msaRaster.js.map +1 -0
- package/dist/components/msa/renderMSABlock.d.ts +2 -1
- package/dist/components/msa/renderMSABlock.js +13 -21
- package/dist/components/msa/renderMSABlock.js.map +1 -1
- package/dist/components/msa/tileColor.d.ts +6 -0
- package/dist/components/msa/tileColor.js +35 -0
- package/dist/components/msa/tileColor.js.map +1 -0
- package/dist/components/renderCtx.d.ts +1 -1
- package/dist/components/tracks/TrackBlocks.d.ts +14 -0
- package/dist/components/tracks/TrackBlocks.js +65 -0
- package/dist/components/tracks/TrackBlocks.js.map +1 -0
- package/dist/components/tracks/{renderTracksSvg.d.ts → drawTracks.d.ts} +22 -10
- package/dist/components/tracks/drawTracks.js +193 -0
- package/dist/components/tracks/drawTracks.js.map +1 -0
- package/dist/components/tree/TreeCanvas.js +8 -2
- package/dist/components/tree/TreeCanvas.js.map +1 -1
- package/dist/components/tree/TreeCanvasBlock.js +7 -4
- package/dist/components/tree/TreeCanvasBlock.js.map +1 -1
- package/dist/components/tree/renderTreeCanvas.js +27 -21
- package/dist/components/tree/renderTreeCanvas.js.map +1 -1
- package/dist/constants.d.ts +3 -0
- package/dist/constants.js +8 -0
- package/dist/constants.js.map +1 -1
- package/dist/model/DataModel.d.ts +1 -4
- package/dist/model/DataModel.js +8 -10
- package/dist/model/DataModel.js.map +1 -1
- package/dist/model/treeModel.d.ts +1 -1
- package/dist/model/treeModel.js +1 -1
- package/dist/model.d.ts +36 -7
- package/dist/model.js +113 -58
- package/dist/model.js.map +1 -1
- package/dist/neighborJoining.js +34 -18
- package/dist/neighborJoining.js.map +1 -1
- package/dist/renderTestEnv.d.ts +43 -0
- package/dist/renderTestEnv.js +88 -0
- package/dist/renderTestEnv.js.map +1 -0
- package/dist/renderToSvg.js +1 -1
- package/dist/renderToSvg.js.map +1 -1
- package/dist/sequenceLogo.d.ts +28 -0
- package/dist/sequenceLogo.js +47 -0
- package/dist/sequenceLogo.js.map +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
- package/src/columnCounts.test.ts +15 -0
- package/src/columnCounts.ts +19 -0
- package/src/components/DragHandle.tsx +81 -0
- package/src/components/ResizeHandles.tsx +46 -54
- package/src/components/VerticalScrollbar.tsx +3 -2
- package/src/components/dialogs/InterProScanDialog.tsx +54 -131
- package/src/components/header/settingsMenuItems.ts +19 -1
- package/src/components/minimap/Minimap.tsx +47 -4
- package/src/components/msa/MSACanvas.tsx +30 -10
- package/src/components/msa/MSACanvasBlock.tsx +13 -3
- package/src/components/msa/msaRaster.test.ts +145 -0
- package/src/components/msa/msaRaster.ts +350 -0
- package/src/components/msa/renderMSABlock.ts +15 -20
- package/src/components/msa/tileColor.ts +37 -0
- package/src/components/renderCtx.ts +2 -0
- package/src/components/tracks/TrackBlocks.tsx +111 -0
- package/src/components/tracks/drawTracks.ts +323 -0
- package/src/components/tree/TreeCanvas.tsx +16 -4
- package/src/components/tree/TreeCanvasBlock.tsx +18 -11
- package/src/components/tree/renderTreeCanvas.test.ts +55 -0
- package/src/components/tree/renderTreeCanvas.ts +28 -19
- package/src/constants.ts +10 -0
- package/src/impgRender.test.tsx +2 -57
- package/src/largeTree.test.ts +16 -2
- package/src/model/DataModel.ts +11 -11
- package/src/model/treeModel.ts +1 -1
- package/src/model.ts +128 -60
- package/src/neighborJoining.ts +36 -18
- package/src/renderDomainsSvg.test.tsx +2 -57
- package/src/renderMinimapSvg.test.tsx +2 -56
- package/src/renderSequenceLogoSvg.test.tsx +176 -0
- package/src/renderTestEnv.ts +96 -0
- package/src/renderToSvg.tsx +1 -1
- package/src/sequenceLogo.test.ts +88 -0
- package/src/sequenceLogo.ts +63 -0
- package/src/types.ts +7 -1
- package/src/version.ts +1 -1
- package/dist/components/ConservationTrack.d.ts +0 -8
- package/dist/components/ConservationTrack.js +0 -49
- package/dist/components/ConservationTrack.js.map +0 -1
- package/dist/components/ScrollbarThumb.d.ts +0 -14
- package/dist/components/ScrollbarThumb.js +0 -28
- package/dist/components/ScrollbarThumb.js.map +0 -1
- package/dist/components/TextTrack.d.ts +0 -8
- package/dist/components/TextTrack.js +0 -58
- package/dist/components/TextTrack.js.map +0 -1
- package/dist/components/tracks/renderTracksSvg.js +0 -126
- package/dist/components/tracks/renderTracksSvg.js.map +0 -1
- package/src/components/ConservationTrack.tsx +0 -99
- package/src/components/ScrollbarThumb.tsx +0 -48
- package/src/components/TextTrack.tsx +0 -103
- package/src/components/tracks/renderTracksSvg.ts +0 -247
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import { setFontSize } from '../../setFontSize.ts'
|
|
2
|
-
import { visibleColRange } from '../msa/visibleColRange.ts'
|
|
3
|
-
|
|
4
|
-
import type { MsaViewModel } from '../../model.ts'
|
|
5
|
-
import type { BasicTrack } from '../../types.ts'
|
|
6
|
-
import type { RenderCtx } from '../renderCtx.ts'
|
|
7
|
-
import type { Theme } from '@mui/material'
|
|
8
|
-
|
|
9
|
-
export function drawConservationBars({
|
|
10
|
-
ctx,
|
|
11
|
-
values,
|
|
12
|
-
color,
|
|
13
|
-
colWidth,
|
|
14
|
-
trackHeight,
|
|
15
|
-
offsetX,
|
|
16
|
-
blockSize,
|
|
17
|
-
}: {
|
|
18
|
-
ctx: RenderCtx
|
|
19
|
-
values: number[]
|
|
20
|
-
color: string
|
|
21
|
-
colWidth: number
|
|
22
|
-
trackHeight: number
|
|
23
|
-
offsetX: number
|
|
24
|
-
blockSize: number
|
|
25
|
-
}) {
|
|
26
|
-
const { xStart, xEnd } = visibleColRange({
|
|
27
|
-
offsetX,
|
|
28
|
-
blockWidth: blockSize,
|
|
29
|
-
colWidth,
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
ctx.fillStyle = color
|
|
33
|
-
for (let i = xStart; i < xEnd && i < values.length; i++) {
|
|
34
|
-
const value = values[i]!
|
|
35
|
-
const barHeight = value * trackHeight
|
|
36
|
-
const x = i * colWidth
|
|
37
|
-
ctx.fillRect(x, trackHeight - barHeight, colWidth, barHeight)
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// the bar-track values live on model getters (kept off the plain track object so
|
|
42
|
-
// the live canvas autorun stays reactive); select the right one by track id
|
|
43
|
-
export function barTrackValues(model: MsaViewModel, trackId: string) {
|
|
44
|
-
return trackId === 'property-conservation'
|
|
45
|
-
? model.propertyConservation
|
|
46
|
-
: model.conservation
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function drawTextTrackContent({
|
|
50
|
-
ctx,
|
|
51
|
-
data,
|
|
52
|
-
colorScheme,
|
|
53
|
-
contrastScheme,
|
|
54
|
-
bgColor,
|
|
55
|
-
textColor,
|
|
56
|
-
colWidth,
|
|
57
|
-
rowHeight,
|
|
58
|
-
offsetX,
|
|
59
|
-
blockSize,
|
|
60
|
-
}: {
|
|
61
|
-
ctx: RenderCtx
|
|
62
|
-
data: string | undefined
|
|
63
|
-
colorScheme: Record<string, string>
|
|
64
|
-
contrastScheme: Record<string, string>
|
|
65
|
-
bgColor: boolean
|
|
66
|
-
textColor: string
|
|
67
|
-
colWidth: number
|
|
68
|
-
rowHeight: number
|
|
69
|
-
offsetX: number
|
|
70
|
-
blockSize: number
|
|
71
|
-
}) {
|
|
72
|
-
const { xStart, xEnd } = visibleColRange({
|
|
73
|
-
offsetX,
|
|
74
|
-
blockWidth: blockSize,
|
|
75
|
-
colWidth,
|
|
76
|
-
})
|
|
77
|
-
const str = data?.slice(xStart, xEnd)
|
|
78
|
-
const drawLetters = rowHeight >= 10 && colWidth >= rowHeight / 2
|
|
79
|
-
|
|
80
|
-
for (let i = 0; str && i < str.length; i++) {
|
|
81
|
-
const letter = str[i]!
|
|
82
|
-
const upper = letter.toUpperCase()
|
|
83
|
-
const color = colorScheme[upper]
|
|
84
|
-
const x = (xStart + i) * colWidth
|
|
85
|
-
const filled = bgColor && !!color
|
|
86
|
-
if (filled) {
|
|
87
|
-
ctx.fillStyle = color!
|
|
88
|
-
ctx.fillRect(x, 0, colWidth, rowHeight)
|
|
89
|
-
}
|
|
90
|
-
if (drawLetters) {
|
|
91
|
-
// a letter on a colored tile needs the tile's contrast color; otherwise it
|
|
92
|
-
// sits on the plain background and takes the theme's text color
|
|
93
|
-
ctx.fillStyle = filled ? (contrastScheme[upper] ?? 'black') : textColor
|
|
94
|
-
ctx.fillText(letter, x + colWidth / 2, rowHeight / 2 + 1)
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export function renderConservationTrack({
|
|
100
|
-
model,
|
|
101
|
-
ctx,
|
|
102
|
-
track,
|
|
103
|
-
offsetX,
|
|
104
|
-
offsetY,
|
|
105
|
-
trackHeight,
|
|
106
|
-
blockSizeXOverride,
|
|
107
|
-
highResScaleFactorOverride,
|
|
108
|
-
}: {
|
|
109
|
-
model: MsaViewModel
|
|
110
|
-
ctx: RenderCtx
|
|
111
|
-
track: BasicTrack
|
|
112
|
-
offsetX: number
|
|
113
|
-
offsetY: number
|
|
114
|
-
trackHeight: number
|
|
115
|
-
blockSizeXOverride?: number
|
|
116
|
-
highResScaleFactorOverride?: number
|
|
117
|
-
}) {
|
|
118
|
-
const { blockSize, colWidth, highResScaleFactor } = model
|
|
119
|
-
const bx = blockSizeXOverride ?? blockSize
|
|
120
|
-
const k = highResScaleFactorOverride ?? highResScaleFactor
|
|
121
|
-
|
|
122
|
-
ctx.resetTransform()
|
|
123
|
-
ctx.scale(k, k)
|
|
124
|
-
ctx.translate(-offsetX, offsetY)
|
|
125
|
-
|
|
126
|
-
drawConservationBars({
|
|
127
|
-
ctx,
|
|
128
|
-
values: barTrackValues(model, track.model.id),
|
|
129
|
-
color: track.model.barColor ?? 'gray',
|
|
130
|
-
colWidth,
|
|
131
|
-
trackHeight,
|
|
132
|
-
offsetX,
|
|
133
|
-
blockSize: bx,
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
ctx.resetTransform()
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export function renderTextTrack({
|
|
140
|
-
model,
|
|
141
|
-
ctx,
|
|
142
|
-
track,
|
|
143
|
-
offsetX,
|
|
144
|
-
offsetY,
|
|
145
|
-
contrastScheme,
|
|
146
|
-
theme,
|
|
147
|
-
blockSizeXOverride,
|
|
148
|
-
highResScaleFactorOverride,
|
|
149
|
-
}: {
|
|
150
|
-
model: MsaViewModel
|
|
151
|
-
ctx: RenderCtx
|
|
152
|
-
track: BasicTrack
|
|
153
|
-
offsetX: number
|
|
154
|
-
offsetY: number
|
|
155
|
-
contrastScheme: Record<string, string>
|
|
156
|
-
theme: Theme
|
|
157
|
-
blockSizeXOverride?: number
|
|
158
|
-
highResScaleFactorOverride?: number
|
|
159
|
-
}) {
|
|
160
|
-
const {
|
|
161
|
-
blockSize,
|
|
162
|
-
bgColor,
|
|
163
|
-
colorScheme: modelColorScheme,
|
|
164
|
-
colWidth,
|
|
165
|
-
fontSize,
|
|
166
|
-
rowHeight,
|
|
167
|
-
highResScaleFactor,
|
|
168
|
-
} = model
|
|
169
|
-
|
|
170
|
-
const { customColorScheme, data } = track.model
|
|
171
|
-
const colorScheme = customColorScheme ?? modelColorScheme
|
|
172
|
-
const bx = blockSizeXOverride ?? blockSize
|
|
173
|
-
const k = highResScaleFactorOverride ?? highResScaleFactor
|
|
174
|
-
|
|
175
|
-
ctx.resetTransform()
|
|
176
|
-
ctx.scale(k, k)
|
|
177
|
-
ctx.translate(-offsetX, offsetY)
|
|
178
|
-
ctx.textAlign = 'center'
|
|
179
|
-
setFontSize(ctx, fontSize)
|
|
180
|
-
|
|
181
|
-
drawTextTrackContent({
|
|
182
|
-
ctx,
|
|
183
|
-
data,
|
|
184
|
-
colorScheme,
|
|
185
|
-
contrastScheme,
|
|
186
|
-
bgColor,
|
|
187
|
-
textColor: theme.palette.text.primary,
|
|
188
|
-
colWidth,
|
|
189
|
-
rowHeight,
|
|
190
|
-
offsetX,
|
|
191
|
-
blockSize: bx,
|
|
192
|
-
})
|
|
193
|
-
|
|
194
|
-
ctx.resetTransform()
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export function renderAllTracks({
|
|
198
|
-
model,
|
|
199
|
-
ctx,
|
|
200
|
-
offsetX,
|
|
201
|
-
contrastScheme,
|
|
202
|
-
theme,
|
|
203
|
-
blockSizeXOverride,
|
|
204
|
-
highResScaleFactorOverride,
|
|
205
|
-
}: {
|
|
206
|
-
model: MsaViewModel
|
|
207
|
-
ctx: RenderCtx
|
|
208
|
-
offsetX: number
|
|
209
|
-
contrastScheme: Record<string, string>
|
|
210
|
-
theme: Theme
|
|
211
|
-
blockSizeXOverride?: number
|
|
212
|
-
highResScaleFactorOverride?: number
|
|
213
|
-
}) {
|
|
214
|
-
const { turnedOnTracks } = model
|
|
215
|
-
let currentY = 0
|
|
216
|
-
|
|
217
|
-
for (const track of turnedOnTracks) {
|
|
218
|
-
const trackHeight = track.model.height
|
|
219
|
-
|
|
220
|
-
if (track.model.barColor !== undefined) {
|
|
221
|
-
renderConservationTrack({
|
|
222
|
-
model,
|
|
223
|
-
ctx,
|
|
224
|
-
track,
|
|
225
|
-
offsetX,
|
|
226
|
-
offsetY: currentY,
|
|
227
|
-
trackHeight,
|
|
228
|
-
blockSizeXOverride,
|
|
229
|
-
highResScaleFactorOverride,
|
|
230
|
-
})
|
|
231
|
-
} else {
|
|
232
|
-
renderTextTrack({
|
|
233
|
-
model,
|
|
234
|
-
ctx,
|
|
235
|
-
track,
|
|
236
|
-
offsetX,
|
|
237
|
-
offsetY: currentY,
|
|
238
|
-
contrastScheme,
|
|
239
|
-
theme,
|
|
240
|
-
blockSizeXOverride,
|
|
241
|
-
highResScaleFactorOverride,
|
|
242
|
-
})
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
currentY += trackHeight
|
|
246
|
-
}
|
|
247
|
-
}
|