react-msaview 3.1.12 → 3.2.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 +32 -31
- package/dist/colorSchemes.d.ts +2 -2
- package/dist/colorSchemes.js +5 -6
- package/dist/colorSchemes.js.map +1 -1
- package/dist/components/Loading.d.ts +1 -1
- package/dist/components/Loading.js +7 -5
- package/dist/components/Loading.js.map +1 -1
- package/dist/components/MSAView.d.ts +1 -1
- package/dist/components/MSAView.js +13 -9
- package/dist/components/MSAView.js.map +1 -1
- package/dist/components/ResizeHandles.d.ts +1 -1
- package/dist/components/ResizeHandles.js +8 -4
- package/dist/components/ResizeHandles.js.map +1 -1
- package/dist/components/SequenceTextArea.js +9 -3
- package/dist/components/SequenceTextArea.js.map +1 -1
- package/dist/components/TextTrack.d.ts +1 -1
- package/dist/components/TextTrack.js +1 -1
- package/dist/components/TextTrack.js.map +1 -1
- package/dist/components/Track.d.ts +1 -1
- package/dist/components/Track.js +6 -2
- package/dist/components/Track.js.map +1 -1
- package/dist/components/VerticalScrollbar.d.ts +6 -0
- package/dist/components/VerticalScrollbar.js +69 -0
- package/dist/components/VerticalScrollbar.js.map +1 -0
- package/dist/components/dialogs/AboutDialog.js +3 -1
- package/dist/components/dialogs/AboutDialog.js.map +1 -1
- package/dist/components/dialogs/AddTrackDialog.d.ts +3 -3
- package/dist/components/dialogs/AddTrackDialog.js +8 -3
- package/dist/components/dialogs/AddTrackDialog.js.map +1 -1
- package/dist/components/dialogs/DomainDialog.d.ts +1 -1
- package/dist/components/dialogs/DomainDialog.js +8 -4
- package/dist/components/dialogs/DomainDialog.js.map +1 -1
- package/dist/components/dialogs/ExportSVGDialog.d.ts +1 -1
- package/dist/components/dialogs/ExportSVGDialog.js +29 -17
- package/dist/components/dialogs/ExportSVGDialog.js.map +1 -1
- package/dist/components/dialogs/FeatureDialog.d.ts +1 -1
- package/dist/components/dialogs/FeatureDialog.js +8 -4
- package/dist/components/dialogs/FeatureDialog.js.map +1 -1
- package/dist/components/dialogs/{InterProScanPanel.d.ts → InterProScanDialog.d.ts} +1 -1
- package/dist/components/dialogs/{InterProScanPanel.js → InterProScanDialog.js} +26 -11
- package/dist/components/dialogs/InterProScanDialog.js.map +1 -0
- package/dist/components/dialogs/MetadataDialog.d.ts +1 -1
- package/dist/components/dialogs/MetadataDialog.js +3 -1
- package/dist/components/dialogs/MetadataDialog.js.map +1 -1
- package/dist/components/dialogs/SettingsDialog.d.ts +1 -1
- package/dist/components/dialogs/SettingsDialog.js +62 -15
- package/dist/components/dialogs/SettingsDialog.js.map +1 -1
- package/dist/components/dialogs/TracklistDialog.d.ts +3 -3
- package/dist/components/dialogs/TracklistDialog.js +8 -3
- package/dist/components/dialogs/TracklistDialog.js.map +1 -1
- package/dist/components/dialogs/UserProvidedDomainsDialog.d.ts +7 -0
- package/dist/components/dialogs/UserProvidedDomainsDialog.js +64 -0
- package/dist/components/dialogs/UserProvidedDomainsDialog.js.map +1 -0
- package/dist/components/header/Header.d.ts +1 -1
- package/dist/components/header/Header.js +11 -4
- package/dist/components/header/Header.js.map +1 -1
- package/dist/components/header/HeaderInfoArea.d.ts +1 -1
- package/dist/components/header/HeaderInfoArea.js +5 -2
- package/dist/components/header/HeaderInfoArea.js.map +1 -1
- package/dist/components/header/HeaderMenu.d.ts +1 -1
- package/dist/components/header/HeaderMenu.js +12 -4
- package/dist/components/header/HeaderMenu.js.map +1 -1
- package/dist/components/header/HeaderMenuExtra.d.ts +1 -1
- package/dist/components/header/HeaderMenuExtra.js +55 -35
- package/dist/components/header/HeaderMenuExtra.js.map +1 -1
- package/dist/components/header/HeaderStatusArea.d.ts +2 -2
- package/dist/components/header/HeaderStatusArea.js +1 -1
- package/dist/components/header/HeaderStatusArea.js.map +1 -1
- package/dist/components/header/MultiAlignmentSelector.d.ts +1 -1
- package/dist/components/header/ZoomControls.js +45 -3
- package/dist/components/header/ZoomControls.js.map +1 -1
- package/dist/components/import/ImportForm.d.ts +3 -3
- package/dist/components/import/ImportForm.js +15 -2
- package/dist/components/import/ImportForm.js.map +1 -1
- package/dist/components/import/ImportFormExamples.d.ts +1 -1
- package/dist/components/import/ImportFormExamples.js +53 -38
- package/dist/components/import/ImportFormExamples.js.map +1 -1
- package/dist/components/import/util.d.ts +2 -2
- package/dist/components/minimap/Minimap.d.ts +1 -1
- package/dist/components/minimap/Minimap.js +24 -17
- package/dist/components/minimap/Minimap.js.map +1 -1
- package/dist/components/minimap/MinimapSVG.d.ts +1 -1
- package/dist/components/minimap/MinimapSVG.js +1 -1
- package/dist/components/minimap/MinimapSVG.js.map +1 -1
- package/dist/components/msa/MSACanvas.d.ts +1 -1
- package/dist/components/msa/MSACanvas.js +3 -3
- package/dist/components/msa/MSACanvas.js.map +1 -1
- package/dist/components/msa/MSACanvasBlock.d.ts +3 -3
- package/dist/components/msa/MSACanvasBlock.js +9 -6
- package/dist/components/msa/MSACanvasBlock.js.map +1 -1
- package/dist/components/msa/MSAMouseoverCanvas.d.ts +1 -1
- package/dist/components/msa/MSAPanel.d.ts +1 -1
- package/dist/components/msa/renderBoxFeatureCanvasBlock.d.ts +1 -1
- package/dist/components/msa/renderBoxFeatureCanvasBlock.js +3 -4
- package/dist/components/msa/renderBoxFeatureCanvasBlock.js.map +1 -1
- package/dist/components/msa/renderMSABlock.d.ts +2 -2
- package/dist/components/msa/renderMSABlock.js +16 -16
- package/dist/components/msa/renderMSABlock.js.map +1 -1
- package/dist/components/msa/renderMSAMouseover.d.ts +1 -1
- package/dist/components/msa/renderMSAMouseover.js +3 -3
- package/dist/components/msa/renderMSAMouseover.js.map +1 -1
- package/dist/components/tree/TreeBranchMenu.d.ts +1 -1
- package/dist/components/tree/TreeBranchMenu.js +6 -3
- package/dist/components/tree/TreeBranchMenu.js.map +1 -1
- package/dist/components/tree/TreeCanvas.d.ts +1 -1
- package/dist/components/tree/TreeCanvas.js +13 -12
- package/dist/components/tree/TreeCanvas.js.map +1 -1
- package/dist/components/tree/TreeCanvasBlock.d.ts +1 -1
- package/dist/components/tree/TreeCanvasBlock.js +13 -5
- package/dist/components/tree/TreeCanvasBlock.js.map +1 -1
- package/dist/components/tree/TreeNodeMenu.d.ts +1 -1
- package/dist/components/tree/TreeNodeMenu.js +3 -3
- package/dist/components/tree/TreeNodeMenu.js.map +1 -1
- package/dist/components/tree/TreePanel.d.ts +1 -1
- package/dist/components/tree/TreeRuler.d.ts +1 -1
- package/dist/components/tree/dialogs/TreeNodeInfoDialog.d.ts +3 -3
- package/dist/components/tree/dialogs/TreeNodeInfoDialog.js +5 -2
- package/dist/components/tree/dialogs/TreeNodeInfoDialog.js.map +1 -1
- package/dist/components/tree/renderTreeCanvas.d.ts +3 -3
- package/dist/components/tree/renderTreeCanvas.js +25 -9
- package/dist/components/tree/renderTreeCanvas.js.map +1 -1
- package/dist/components/util.js +1 -4
- package/dist/components/util.js.map +1 -1
- package/dist/ggplotPalettes.js.map +1 -1
- package/dist/launchInterProScan.d.ts +1 -1
- package/dist/launchInterProScan.js +11 -13
- package/dist/launchInterProScan.js.map +1 -1
- package/dist/model/DataModel.d.ts +5 -1
- package/dist/model/DataModel.js +10 -1
- package/dist/model/DataModel.js.map +1 -1
- package/dist/model/DialogQueue.d.ts +1 -1
- package/dist/model/DialogQueue.js +0 -1
- package/dist/model/DialogQueue.js.map +1 -1
- package/dist/model.d.ts +187 -35
- package/dist/model.js +317 -94
- package/dist/model.js.map +1 -1
- package/dist/parseGFF.js +8 -6
- package/dist/parseGFF.js.map +1 -1
- package/dist/parseNewick.js +1 -2
- package/dist/parseNewick.js.map +1 -1
- package/dist/parsers/ClustalMSA.d.ts +2 -2
- package/dist/parsers/ClustalMSA.js.map +1 -1
- package/dist/parsers/FastaMSA.d.ts +1 -1
- package/dist/parsers/FastaMSA.js +3 -3
- package/dist/parsers/FastaMSA.js.map +1 -1
- package/dist/parsers/StockholmMSA.d.ts +7 -7
- package/dist/parsers/StockholmMSA.js +4 -4
- package/dist/parsers/StockholmMSA.js.map +1 -1
- package/dist/renderToSvg.d.ts +2 -2
- package/dist/renderToSvg.js +6 -11
- package/dist/renderToSvg.js.map +1 -1
- package/dist/reparseTree.d.ts +1 -1
- package/dist/rowCoordinateCalculations.d.ts +2 -0
- package/dist/rowCoordinateCalculations.js +26 -0
- package/dist/rowCoordinateCalculations.js.map +1 -0
- package/dist/rowCoordinateCalculations.test.d.ts +1 -0
- package/dist/rowCoordinateCalculations.test.js +18 -0
- package/dist/rowCoordinateCalculations.test.js.map +1 -0
- package/dist/util.d.ts +2 -2
- package/dist/util.js +0 -2
- package/dist/util.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +10 -3
- package/src/colorSchemes.ts +7 -6
- package/src/components/Checkbox2.tsx +1 -1
- package/src/components/Loading.tsx +18 -6
- package/src/components/MSAView.tsx +27 -18
- package/src/components/ResizeHandles.tsx +9 -5
- package/src/components/SequenceTextArea.tsx +10 -4
- package/src/components/TextTrack.tsx +3 -3
- package/src/components/Track.tsx +9 -5
- package/src/components/VerticalScrollbar.tsx +89 -0
- package/src/components/dialogs/AboutDialog.tsx +7 -1
- package/src/components/dialogs/AddTrackDialog.tsx +15 -5
- package/src/components/dialogs/DomainDialog.tsx +12 -5
- package/src/components/dialogs/ExportSVGDialog.tsx +37 -18
- package/src/components/dialogs/FeatureDialog.tsx +10 -8
- package/src/components/dialogs/{InterProScanPanel.tsx → InterProScanDialog.tsx} +30 -13
- package/src/components/dialogs/MetadataDialog.tsx +9 -2
- package/src/components/dialogs/SettingsDialog.tsx +98 -19
- package/src/components/dialogs/TracklistDialog.tsx +18 -4
- package/src/components/dialogs/UserProvidedDomainsDialog.tsx +139 -0
- package/src/components/header/Header.tsx +12 -5
- package/src/components/header/HeaderInfoArea.tsx +4 -3
- package/src/components/header/HeaderMenu.tsx +13 -8
- package/src/components/header/HeaderMenuExtra.tsx +59 -43
- package/src/components/header/HeaderStatusArea.tsx +2 -6
- package/src/components/header/MultiAlignmentSelector.tsx +1 -1
- package/src/components/header/ZoomControls.tsx +52 -2
- package/src/components/import/ImportForm.tsx +16 -4
- package/src/components/import/ImportFormExamples.tsx +77 -64
- package/src/components/import/util.ts +2 -2
- package/src/components/minimap/Minimap.tsx +34 -29
- package/src/components/minimap/MinimapSVG.tsx +2 -2
- package/src/components/msa/MSACanvas.tsx +11 -4
- package/src/components/msa/MSACanvasBlock.tsx +10 -7
- package/src/components/msa/MSAMouseoverCanvas.tsx +1 -1
- package/src/components/msa/MSAPanel.tsx +1 -1
- package/src/components/msa/renderBoxFeatureCanvasBlock.ts +8 -9
- package/src/components/msa/renderMSABlock.ts +44 -24
- package/src/components/msa/renderMSAMouseover.ts +4 -4
- package/src/components/tree/TreeBranchMenu.tsx +6 -4
- package/src/components/tree/TreeCanvas.tsx +15 -16
- package/src/components/tree/TreeCanvasBlock.tsx +14 -6
- package/src/components/tree/TreeNodeMenu.tsx +4 -4
- package/src/components/tree/TreePanel.tsx +1 -1
- package/src/components/tree/TreeRuler.tsx +1 -1
- package/src/components/tree/dialogs/TreeNodeInfoDialog.tsx +12 -3
- package/src/components/tree/renderTreeCanvas.ts +32 -12
- package/src/components/util.ts +2 -5
- package/src/ggplotPalettes.ts +1 -1
- package/src/launchInterProScan.ts +13 -15
- package/src/model/DataModel.ts +10 -0
- package/src/model/DialogQueue.ts +1 -2
- package/src/model.ts +355 -112
- package/src/parseGFF.ts +13 -11
- package/src/parseNewick.ts +4 -4
- package/src/parsers/ClustalMSA.ts +3 -3
- package/src/parsers/FastaMSA.ts +5 -5
- package/src/parsers/StockholmMSA.ts +11 -11
- package/src/renderToSvg.tsx +7 -8
- package/src/reparseTree.ts +1 -1
- package/src/rowCoordinateCalculations.test.ts +19 -0
- package/src/rowCoordinateCalculations.ts +26 -0
- package/src/util.ts +2 -4
- package/src/version.ts +1 -1
- package/dist/components/dialogs/InterProScanPanel.js.map +0 -1
- package/dist/components/dialogs/UserProvidedResultPanel.d.ts +0 -7
- package/dist/components/dialogs/UserProvidedResultPanel.js +0 -56
- package/dist/components/dialogs/UserProvidedResultPanel.js.map +0 -1
- package/src/components/dialogs/UserProvidedResultPanel.tsx +0 -119
package/src/model.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
+
import type { Buffer } from 'buffer'
|
|
2
3
|
import { autorun, transaction } from 'mobx'
|
|
3
|
-
import { Instance, cast, types, addDisposer } from 'mobx-state-tree'
|
|
4
|
-
import { hierarchy, cluster, HierarchyNode } from 'd3-hierarchy'
|
|
4
|
+
import { type Instance, cast, types, addDisposer } from 'mobx-state-tree'
|
|
5
|
+
import { hierarchy, cluster, type HierarchyNode } from 'd3-hierarchy'
|
|
5
6
|
import { ascending } from 'd3-array'
|
|
6
7
|
import Stockholm from 'stockholm-js'
|
|
7
8
|
import { saveAs } from 'file-saver'
|
|
8
|
-
import { Theme } from '@mui/material'
|
|
9
|
+
import type { Theme } from '@mui/material'
|
|
10
|
+
import { ungzip } from 'pako'
|
|
9
11
|
|
|
10
12
|
// jbrowse
|
|
11
13
|
import { FileLocation, ElementId } from '@jbrowse/core/util/types/mst'
|
|
12
|
-
import { FileLocation as FileLocationType } from '@jbrowse/core/util/types'
|
|
14
|
+
import type { FileLocation as FileLocationType } from '@jbrowse/core/util/types'
|
|
13
15
|
import { openLocation } from '@jbrowse/core/util/io'
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
sum,
|
|
20
|
-
} from '@jbrowse/core/util'
|
|
16
|
+
import { groupBy, notEmpty, sum } from '@jbrowse/core/util'
|
|
17
|
+
|
|
18
|
+
export function isGzip(buf: Buffer) {
|
|
19
|
+
return buf[0] === 31 && buf[1] === 139 && buf[2] === 8
|
|
20
|
+
}
|
|
21
21
|
|
|
22
22
|
// locals
|
|
23
23
|
import {
|
|
@@ -27,8 +27,8 @@ import {
|
|
|
27
27
|
maxLength,
|
|
28
28
|
setBrLength,
|
|
29
29
|
skipBlanks,
|
|
30
|
-
NodeWithIds,
|
|
31
|
-
NodeWithIdsAndLength,
|
|
30
|
+
type NodeWithIds,
|
|
31
|
+
type NodeWithIdsAndLength,
|
|
32
32
|
len,
|
|
33
33
|
} from './util'
|
|
34
34
|
import { colord } from 'colord'
|
|
@@ -52,7 +52,11 @@ import { DataModelF } from './model/DataModel'
|
|
|
52
52
|
import { DialogQueueSessionMixin } from './model/DialogQueue'
|
|
53
53
|
import { TreeF } from './model/treeModel'
|
|
54
54
|
import { MSAModelF } from './model/msaModel'
|
|
55
|
-
import { InterProScanResults } from './launchInterProScan'
|
|
55
|
+
import type { InterProScanResults } from './launchInterProScan'
|
|
56
|
+
import {
|
|
57
|
+
mouseOverCoordToGlobalCoord,
|
|
58
|
+
globalCoordToRowSpecificCoord,
|
|
59
|
+
} from './rowCoordinateCalculations'
|
|
56
60
|
|
|
57
61
|
export interface Accession {
|
|
58
62
|
accession: string
|
|
@@ -72,7 +76,6 @@ export interface TextTrackModel extends BasicTrackModel {
|
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
export interface ITextTrack {
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
79
|
ReactComponent: React.FC<any>
|
|
77
80
|
model: TextTrackModel
|
|
78
81
|
}
|
|
@@ -98,10 +101,20 @@ function stateModelFactory() {
|
|
|
98
101
|
* id of view, randomly generated if not provided
|
|
99
102
|
*/
|
|
100
103
|
id: ElementId,
|
|
104
|
+
|
|
101
105
|
/**
|
|
102
106
|
* #property
|
|
103
107
|
*/
|
|
104
108
|
showDomains: false,
|
|
109
|
+
/**
|
|
110
|
+
* #property
|
|
111
|
+
*/
|
|
112
|
+
allowedGappyness: 100,
|
|
113
|
+
/**
|
|
114
|
+
* #property
|
|
115
|
+
*/
|
|
116
|
+
contrastLettering: true,
|
|
117
|
+
|
|
105
118
|
/**
|
|
106
119
|
* #property
|
|
107
120
|
*/
|
|
@@ -113,6 +126,20 @@ function stateModelFactory() {
|
|
|
113
126
|
*/
|
|
114
127
|
type: types.literal('MsaView'),
|
|
115
128
|
|
|
129
|
+
/**
|
|
130
|
+
* #property
|
|
131
|
+
*/
|
|
132
|
+
drawMsaLetters: true,
|
|
133
|
+
/**
|
|
134
|
+
* #property
|
|
135
|
+
*/
|
|
136
|
+
hideGaps: true,
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* #property
|
|
140
|
+
*/
|
|
141
|
+
drawTreeText: true,
|
|
142
|
+
|
|
116
143
|
/**
|
|
117
144
|
* #property
|
|
118
145
|
* height of the div containing the view, px
|
|
@@ -170,15 +197,17 @@ function stateModelFactory() {
|
|
|
170
197
|
|
|
171
198
|
/**
|
|
172
199
|
* #property
|
|
173
|
-
* array of tree parent nodes that are 'collapsed'
|
|
200
|
+
* array of tree parent nodes that are 'collapsed' (all children are
|
|
201
|
+
* hidden)
|
|
174
202
|
*/
|
|
175
203
|
collapsed: types.array(types.string),
|
|
176
204
|
|
|
177
205
|
/**
|
|
178
206
|
* #property
|
|
179
|
-
* array of tree leaf nodes that are 'collapsed'
|
|
207
|
+
* array of tree leaf nodes that are 'collapsed' (just that leaf node
|
|
208
|
+
* is hidden)
|
|
180
209
|
*/
|
|
181
|
-
|
|
210
|
+
collapsedLeaves: types.array(types.string),
|
|
182
211
|
/**
|
|
183
212
|
* #property
|
|
184
213
|
* focus on particular subtree
|
|
@@ -196,6 +225,7 @@ function stateModelFactory() {
|
|
|
196
225
|
* autorun
|
|
197
226
|
*/
|
|
198
227
|
data: types.optional(DataModelF(), { tree: '', msa: '' }),
|
|
228
|
+
|
|
199
229
|
/**
|
|
200
230
|
* #property
|
|
201
231
|
*/
|
|
@@ -203,6 +233,13 @@ function stateModelFactory() {
|
|
|
203
233
|
}),
|
|
204
234
|
)
|
|
205
235
|
.volatile(() => ({
|
|
236
|
+
/**
|
|
237
|
+
* #volatile
|
|
238
|
+
*/
|
|
239
|
+
headerHeight: 0,
|
|
240
|
+
/**
|
|
241
|
+
* #volatile
|
|
242
|
+
*/
|
|
206
243
|
status: undefined as { msg: string; url?: string } | undefined,
|
|
207
244
|
/**
|
|
208
245
|
* #volatile
|
|
@@ -221,7 +258,7 @@ function stateModelFactory() {
|
|
|
221
258
|
/**
|
|
222
259
|
* #volatile
|
|
223
260
|
*/
|
|
224
|
-
|
|
261
|
+
volatileWidth: undefined as number | undefined,
|
|
225
262
|
/**
|
|
226
263
|
* #volatile
|
|
227
264
|
* resize handle width between tree and msa area, px
|
|
@@ -232,7 +269,7 @@ function stateModelFactory() {
|
|
|
232
269
|
* #volatile
|
|
233
270
|
* size of blocks of content to be drawn, px
|
|
234
271
|
*/
|
|
235
|
-
blockSize:
|
|
272
|
+
blockSize: 500,
|
|
236
273
|
|
|
237
274
|
/**
|
|
238
275
|
* #volatile
|
|
@@ -289,11 +326,29 @@ function stateModelFactory() {
|
|
|
289
326
|
* #volatile
|
|
290
327
|
*
|
|
291
328
|
*/
|
|
292
|
-
|
|
329
|
+
interProAnnotations: undefined as
|
|
293
330
|
| undefined
|
|
294
331
|
| Record<string, InterProScanResults>,
|
|
295
332
|
}))
|
|
296
333
|
.actions(self => ({
|
|
334
|
+
/**
|
|
335
|
+
* #action
|
|
336
|
+
*/
|
|
337
|
+
setHideGaps(arg: boolean) {
|
|
338
|
+
self.hideGaps = arg
|
|
339
|
+
},
|
|
340
|
+
/**
|
|
341
|
+
* #action
|
|
342
|
+
*/
|
|
343
|
+
setAllowedGappyness(arg: number) {
|
|
344
|
+
self.allowedGappyness = arg
|
|
345
|
+
},
|
|
346
|
+
/**
|
|
347
|
+
* #action
|
|
348
|
+
*/
|
|
349
|
+
setContrastLettering(arg: boolean) {
|
|
350
|
+
self.contrastLettering = arg
|
|
351
|
+
},
|
|
297
352
|
/**
|
|
298
353
|
* #action
|
|
299
354
|
*/
|
|
@@ -310,7 +365,7 @@ function stateModelFactory() {
|
|
|
310
365
|
* #action
|
|
311
366
|
*/
|
|
312
367
|
setWidth(arg: number) {
|
|
313
|
-
self.
|
|
368
|
+
self.volatileWidth = arg
|
|
314
369
|
},
|
|
315
370
|
/**
|
|
316
371
|
* #action
|
|
@@ -405,10 +460,10 @@ function stateModelFactory() {
|
|
|
405
460
|
* #action
|
|
406
461
|
*/
|
|
407
462
|
toggleCollapsed2(node: string) {
|
|
408
|
-
if (self.
|
|
409
|
-
self.
|
|
463
|
+
if (self.collapsedLeaves.includes(node)) {
|
|
464
|
+
self.collapsedLeaves.remove(node)
|
|
410
465
|
} else {
|
|
411
|
-
self.
|
|
466
|
+
self.collapsedLeaves.push(node)
|
|
412
467
|
}
|
|
413
468
|
},
|
|
414
469
|
/**
|
|
@@ -461,6 +516,35 @@ function stateModelFactory() {
|
|
|
461
516
|
},
|
|
462
517
|
}))
|
|
463
518
|
|
|
519
|
+
.views(self => ({
|
|
520
|
+
/**
|
|
521
|
+
* #getter
|
|
522
|
+
*/
|
|
523
|
+
get realAllowedGappyness() {
|
|
524
|
+
return self.hideGaps ? self.allowedGappyness : 100
|
|
525
|
+
},
|
|
526
|
+
/**
|
|
527
|
+
* #getter
|
|
528
|
+
*/
|
|
529
|
+
get actuallyShowDomains() {
|
|
530
|
+
return self.showDomains && !!self.interProAnnotations
|
|
531
|
+
},
|
|
532
|
+
/**
|
|
533
|
+
* #getter
|
|
534
|
+
*/
|
|
535
|
+
get viewInitialized() {
|
|
536
|
+
return self.volatileWidth !== undefined
|
|
537
|
+
},
|
|
538
|
+
/**
|
|
539
|
+
* #getter
|
|
540
|
+
*/
|
|
541
|
+
get width() {
|
|
542
|
+
if (self.volatileWidth === undefined) {
|
|
543
|
+
throw new Error('not initialized')
|
|
544
|
+
}
|
|
545
|
+
return self.volatileWidth
|
|
546
|
+
},
|
|
547
|
+
}))
|
|
464
548
|
.views(self => ({
|
|
465
549
|
/**
|
|
466
550
|
* #method
|
|
@@ -473,7 +557,7 @@ function stateModelFactory() {
|
|
|
473
557
|
* #getter
|
|
474
558
|
*/
|
|
475
559
|
get colorScheme() {
|
|
476
|
-
return colorSchemes[self.colorSchemeName]
|
|
560
|
+
return colorSchemes[self.colorSchemeName]!
|
|
477
561
|
},
|
|
478
562
|
|
|
479
563
|
/**
|
|
@@ -502,18 +586,18 @@ function stateModelFactory() {
|
|
|
502
586
|
* #getter
|
|
503
587
|
*/
|
|
504
588
|
get noTree() {
|
|
505
|
-
return !!this.
|
|
589
|
+
return !!this.tree.noTree
|
|
506
590
|
},
|
|
507
591
|
/**
|
|
508
592
|
* #getter
|
|
509
593
|
*/
|
|
510
|
-
get
|
|
511
|
-
return !self.
|
|
594
|
+
get noDomains() {
|
|
595
|
+
return !self.interProAnnotations
|
|
512
596
|
},
|
|
513
597
|
/**
|
|
514
598
|
* #getter
|
|
515
599
|
*/
|
|
516
|
-
|
|
600
|
+
menuItems() {
|
|
517
601
|
return []
|
|
518
602
|
},
|
|
519
603
|
/**
|
|
@@ -530,11 +614,11 @@ function stateModelFactory() {
|
|
|
530
614
|
if (text) {
|
|
531
615
|
if (Stockholm.sniff(text)) {
|
|
532
616
|
return new StockholmMSA(text, self.currentAlignment)
|
|
533
|
-
}
|
|
617
|
+
}
|
|
618
|
+
if (text.startsWith('>')) {
|
|
534
619
|
return new FastaMSA(text)
|
|
535
|
-
} else {
|
|
536
|
-
return new ClustalMSA(text)
|
|
537
620
|
}
|
|
621
|
+
return new ClustalMSA(text)
|
|
538
622
|
}
|
|
539
623
|
return null
|
|
540
624
|
},
|
|
@@ -548,7 +632,7 @@ function stateModelFactory() {
|
|
|
548
632
|
/**
|
|
549
633
|
* #getter
|
|
550
634
|
*/
|
|
551
|
-
get
|
|
635
|
+
get tree(): NodeWithIds {
|
|
552
636
|
const ret = self.data.tree
|
|
553
637
|
? generateNodeIds(parseNewick(self.data.tree))
|
|
554
638
|
: this.MSA?.getTree() || {
|
|
@@ -563,7 +647,7 @@ function stateModelFactory() {
|
|
|
563
647
|
* #getter
|
|
564
648
|
*/
|
|
565
649
|
get rowNames(): string[] {
|
|
566
|
-
return this.
|
|
650
|
+
return this.leaves.map(n => n.data.name)
|
|
567
651
|
},
|
|
568
652
|
/**
|
|
569
653
|
* #getter
|
|
@@ -577,7 +661,9 @@ function stateModelFactory() {
|
|
|
577
661
|
* #getter
|
|
578
662
|
*/
|
|
579
663
|
get root() {
|
|
580
|
-
let hier = hierarchy(this.
|
|
664
|
+
let hier = hierarchy(this.tree, d => d.branchset)
|
|
665
|
+
// todo: investigate whether needed, typescript says branchset always true
|
|
666
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
581
667
|
.sum(d => (d.branchset ? 0 : 1))
|
|
582
668
|
.sort((a, b) => ascending(a.data.length || 1, b.data.length || 1))
|
|
583
669
|
|
|
@@ -588,10 +674,12 @@ function stateModelFactory() {
|
|
|
588
674
|
}
|
|
589
675
|
}
|
|
590
676
|
|
|
591
|
-
;[...self.collapsed, ...self.
|
|
677
|
+
;[...self.collapsed, ...self.collapsedLeaves]
|
|
592
678
|
.map(collapsedId => hier.find(node => node.data.id === collapsedId))
|
|
593
679
|
.filter(notEmpty)
|
|
594
|
-
.map(node =>
|
|
680
|
+
.map(node => {
|
|
681
|
+
collapse(node)
|
|
682
|
+
})
|
|
595
683
|
|
|
596
684
|
return hier
|
|
597
685
|
},
|
|
@@ -614,42 +702,57 @@ function stateModelFactory() {
|
|
|
614
702
|
* #getter
|
|
615
703
|
*/
|
|
616
704
|
get blanks() {
|
|
705
|
+
const { hideGaps, realAllowedGappyness } = self
|
|
617
706
|
const blanks = []
|
|
618
|
-
|
|
619
|
-
.leaves
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
707
|
+
if (hideGaps) {
|
|
708
|
+
const strs = this.leaves
|
|
709
|
+
.map(leaf => this.MSA?.getRow(leaf.data.name))
|
|
710
|
+
.filter((item): item is string => !!item)
|
|
711
|
+
if (strs.length) {
|
|
712
|
+
for (let i = 0; i < strs[0]!.length; i++) {
|
|
713
|
+
let counter = 0
|
|
714
|
+
for (const str of strs) {
|
|
715
|
+
if (str[i] === '-') {
|
|
716
|
+
counter++
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
if (counter / strs.length >= realAllowedGappyness / 100) {
|
|
720
|
+
blanks.push(i)
|
|
721
|
+
}
|
|
628
722
|
}
|
|
629
723
|
}
|
|
630
|
-
if (counter === strs.length) {
|
|
631
|
-
blanks.push(i)
|
|
632
|
-
}
|
|
633
724
|
}
|
|
634
725
|
return blanks
|
|
635
726
|
},
|
|
727
|
+
/**
|
|
728
|
+
* #getter
|
|
729
|
+
*/
|
|
730
|
+
get blanksSet() {
|
|
731
|
+
return new Set(this.blanks)
|
|
732
|
+
},
|
|
636
733
|
/**
|
|
637
734
|
* #getter
|
|
638
735
|
*/
|
|
639
736
|
get rows() {
|
|
640
737
|
const MSA = this.MSA
|
|
641
|
-
return this.
|
|
642
|
-
.leaves()
|
|
738
|
+
return this.leaves
|
|
643
739
|
.map(leaf => [leaf.data.name, MSA?.getRow(leaf.data.name)] as const)
|
|
644
740
|
.filter((f): f is [string, string] => !!f[1])
|
|
645
741
|
},
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* #getter
|
|
745
|
+
*/
|
|
746
|
+
get rowMap() {
|
|
747
|
+
return new Map(this.rows)
|
|
748
|
+
},
|
|
646
749
|
/**
|
|
647
750
|
* #getter
|
|
648
751
|
*/
|
|
649
752
|
get columns() {
|
|
650
753
|
return Object.fromEntries(
|
|
651
754
|
this.rows.map(
|
|
652
|
-
(row, index) => [row[0], this.columns2d[index]] as const,
|
|
755
|
+
(row, index) => [row[0], this.columns2d[index]!] as const,
|
|
653
756
|
),
|
|
654
757
|
)
|
|
655
758
|
},
|
|
@@ -674,15 +777,27 @@ function stateModelFactory() {
|
|
|
674
777
|
for (const column of columns) {
|
|
675
778
|
for (let j = 0; j < column.length; j++) {
|
|
676
779
|
const l = r[j] || {}
|
|
677
|
-
|
|
678
|
-
|
|
780
|
+
const cj = column[j]!
|
|
781
|
+
if (!l[cj]) {
|
|
782
|
+
l[cj] = 0
|
|
679
783
|
}
|
|
680
|
-
l[
|
|
784
|
+
l[cj]++
|
|
681
785
|
r[j] = l
|
|
682
786
|
}
|
|
683
787
|
}
|
|
684
788
|
return r
|
|
685
789
|
},
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* #getter
|
|
793
|
+
*/
|
|
794
|
+
get colStatsSums() {
|
|
795
|
+
return Object.fromEntries(
|
|
796
|
+
Object.entries(this.colStats).map(([key, val]) => {
|
|
797
|
+
return [key, sum(Object.values(val))]
|
|
798
|
+
}),
|
|
799
|
+
)
|
|
800
|
+
},
|
|
686
801
|
/**
|
|
687
802
|
* #getter
|
|
688
803
|
* generates a new tree that is clustered with x,y positions
|
|
@@ -703,6 +818,13 @@ function stateModelFactory() {
|
|
|
703
818
|
get totalHeight() {
|
|
704
819
|
return this.root.leaves().length * self.rowHeight
|
|
705
820
|
},
|
|
821
|
+
|
|
822
|
+
/**
|
|
823
|
+
* #getter
|
|
824
|
+
*/
|
|
825
|
+
get leaves() {
|
|
826
|
+
return this.hierarchy.leaves()
|
|
827
|
+
},
|
|
706
828
|
}))
|
|
707
829
|
.views(self => ({
|
|
708
830
|
/**
|
|
@@ -717,7 +839,7 @@ function stateModelFactory() {
|
|
|
717
839
|
/**
|
|
718
840
|
* #getter
|
|
719
841
|
*/
|
|
720
|
-
get
|
|
842
|
+
get dataInitialized() {
|
|
721
843
|
return (self.data.msa || self.data.tree) && !self.error
|
|
722
844
|
},
|
|
723
845
|
/**
|
|
@@ -751,7 +873,7 @@ function stateModelFactory() {
|
|
|
751
873
|
const ret = []
|
|
752
874
|
for (const by of self.blocksY) {
|
|
753
875
|
for (const bx of self.blocksX) {
|
|
754
|
-
ret.push([bx, by])
|
|
876
|
+
ret.push([bx, by] as const)
|
|
755
877
|
}
|
|
756
878
|
}
|
|
757
879
|
return ret
|
|
@@ -769,29 +891,78 @@ function stateModelFactory() {
|
|
|
769
891
|
get maxScrollX() {
|
|
770
892
|
return -self.totalWidth + (self.msaAreaWidth - 100)
|
|
771
893
|
},
|
|
894
|
+
/**
|
|
895
|
+
* #getter
|
|
896
|
+
*/
|
|
897
|
+
get showMsaLetters() {
|
|
898
|
+
return self.drawMsaLetters && self.rowHeight >= 5
|
|
899
|
+
},
|
|
900
|
+
/**
|
|
901
|
+
* #getter
|
|
902
|
+
*/
|
|
903
|
+
get showTreeText() {
|
|
904
|
+
return self.drawLabels && self.rowHeight >= 5
|
|
905
|
+
},
|
|
772
906
|
}))
|
|
773
907
|
.actions(self => ({
|
|
774
908
|
/**
|
|
775
909
|
* #action
|
|
776
910
|
*/
|
|
777
|
-
|
|
911
|
+
setDrawMsaLetters(arg: boolean) {
|
|
912
|
+
self.drawMsaLetters = arg
|
|
913
|
+
},
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* #action
|
|
917
|
+
*/
|
|
918
|
+
zoomOutHorizontal() {
|
|
919
|
+
self.colWidth = Math.max(1, Math.floor(self.colWidth * 0.75))
|
|
920
|
+
self.scrollX = clamp(self.maxScrollX, self.scrollX, 0)
|
|
921
|
+
},
|
|
922
|
+
/**
|
|
923
|
+
* #action
|
|
924
|
+
*/
|
|
925
|
+
zoomInHorizontal() {
|
|
778
926
|
self.colWidth = Math.ceil(self.colWidth * 1.5)
|
|
779
|
-
self.rowHeight = Math.ceil(self.rowHeight * 1.5)
|
|
780
927
|
self.scrollX = clamp(self.maxScrollX, self.scrollX, 0)
|
|
781
928
|
},
|
|
782
929
|
/**
|
|
783
930
|
* #action
|
|
784
931
|
*/
|
|
785
|
-
|
|
786
|
-
self.
|
|
932
|
+
zoomInVertical() {
|
|
933
|
+
self.rowHeight = Math.ceil(self.rowHeight * 1.5)
|
|
934
|
+
},
|
|
935
|
+
/**
|
|
936
|
+
* #action
|
|
937
|
+
*/
|
|
938
|
+
zoomOutVertical() {
|
|
787
939
|
self.rowHeight = Math.max(1.5, Math.floor(self.rowHeight * 0.75))
|
|
788
|
-
self.scrollX = clamp(self.maxScrollX, self.scrollX, 0)
|
|
789
940
|
},
|
|
790
941
|
/**
|
|
791
942
|
* #action
|
|
792
943
|
*/
|
|
793
|
-
|
|
794
|
-
|
|
944
|
+
zoomIn() {
|
|
945
|
+
transaction(() => {
|
|
946
|
+
self.colWidth = Math.ceil(self.colWidth * 1.5)
|
|
947
|
+
self.rowHeight = Math.ceil(self.rowHeight * 1.5)
|
|
948
|
+
self.scrollX = clamp(self.maxScrollX, self.scrollX, 0)
|
|
949
|
+
})
|
|
950
|
+
},
|
|
951
|
+
/**
|
|
952
|
+
* #action
|
|
953
|
+
*/
|
|
954
|
+
zoomOut() {
|
|
955
|
+
transaction(() => {
|
|
956
|
+
self.colWidth = Math.max(1, Math.floor(self.colWidth * 0.75))
|
|
957
|
+
self.rowHeight = Math.max(1.5, Math.floor(self.rowHeight * 0.75))
|
|
958
|
+
self.scrollX = clamp(self.maxScrollX, self.scrollX, 0)
|
|
959
|
+
})
|
|
960
|
+
},
|
|
961
|
+
/**
|
|
962
|
+
* #action
|
|
963
|
+
*/
|
|
964
|
+
setInterProAnnotations(data: Record<string, InterProScanResults>) {
|
|
965
|
+
self.interProAnnotations = data
|
|
795
966
|
},
|
|
796
967
|
|
|
797
968
|
/**
|
|
@@ -838,9 +1009,9 @@ function stateModelFactory() {
|
|
|
838
1009
|
*/
|
|
839
1010
|
get labelsWidth() {
|
|
840
1011
|
let x = 0
|
|
841
|
-
const { rowHeight,
|
|
1012
|
+
const { rowHeight, leaves, treeMetadata, fontSize } = self
|
|
842
1013
|
if (rowHeight > 5) {
|
|
843
|
-
for (const node of
|
|
1014
|
+
for (const node of leaves) {
|
|
844
1015
|
x = Math.max(
|
|
845
1016
|
measureTextCanvas(
|
|
846
1017
|
treeMetadata[node.data.name]?.genome || node.data.name,
|
|
@@ -872,7 +1043,7 @@ function stateModelFactory() {
|
|
|
872
1043
|
*/
|
|
873
1044
|
get conservation() {
|
|
874
1045
|
if (self.columns2d.length) {
|
|
875
|
-
for (let i = 0; i < self.columns2d[0]
|
|
1046
|
+
for (let i = 0; i < self.columns2d[0]!.length; i++) {
|
|
876
1047
|
const col = []
|
|
877
1048
|
for (const column of self.columns2d) {
|
|
878
1049
|
col.push(column[i])
|
|
@@ -912,28 +1083,46 @@ function stateModelFactory() {
|
|
|
912
1083
|
return this.tracks.filter(f => !self.turnedOffTracks.has(f.model.id))
|
|
913
1084
|
},
|
|
914
1085
|
|
|
1086
|
+
/**
|
|
1087
|
+
* #getter
|
|
1088
|
+
*/
|
|
1089
|
+
get showHorizontalScrollbar() {
|
|
1090
|
+
return self.msaAreaWidth < self.totalWidth
|
|
1091
|
+
},
|
|
1092
|
+
|
|
1093
|
+
/**
|
|
1094
|
+
* #getter
|
|
1095
|
+
*/
|
|
1096
|
+
get rowNamesSet() {
|
|
1097
|
+
return new Map(self.rowNames.map((r, idx) => [r, idx]))
|
|
1098
|
+
},
|
|
1099
|
+
|
|
915
1100
|
/**
|
|
916
1101
|
* #method
|
|
917
|
-
* return a row-specific
|
|
918
|
-
* coordinate
|
|
1102
|
+
* return a row-specific letter, or undefined if gap
|
|
919
1103
|
*/
|
|
920
|
-
|
|
921
|
-
const {
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
1104
|
+
mouseOverCoordToRowLetter(rowName: string, position: number) {
|
|
1105
|
+
const { rowMap, blanks } = self
|
|
1106
|
+
return rowMap.get(rowName)?.[
|
|
1107
|
+
mouseOverCoordToGlobalCoord(blanks, position)
|
|
1108
|
+
]
|
|
1109
|
+
},
|
|
925
1110
|
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
1111
|
+
/**
|
|
1112
|
+
* #method
|
|
1113
|
+
* return a row-specific sequence coordinate, skipping gaps, given a
|
|
1114
|
+
* global coordinate
|
|
1115
|
+
*/
|
|
1116
|
+
mouseOverCoordToGapRemovedRowCoord(rowName: string, position: number) {
|
|
1117
|
+
const { rowMap, blanks } = self
|
|
1118
|
+
const seq = rowMap.get(rowName)
|
|
1119
|
+
if (seq !== undefined) {
|
|
1120
|
+
const pos2 = mouseOverCoordToGlobalCoord(blanks, position)
|
|
1121
|
+
const pos1 = globalCoordToRowSpecificCoord(seq, pos2)
|
|
1122
|
+
return seq[pos1] === '-' || !seq[pos1] ? undefined : pos1
|
|
1123
|
+
} else {
|
|
1124
|
+
return undefined
|
|
935
1125
|
}
|
|
936
|
-
return 0
|
|
937
1126
|
},
|
|
938
1127
|
|
|
939
1128
|
/**
|
|
@@ -963,6 +1152,17 @@ function stateModelFactory() {
|
|
|
963
1152
|
}))
|
|
964
1153
|
|
|
965
1154
|
.views(self => ({
|
|
1155
|
+
/**
|
|
1156
|
+
* #getter
|
|
1157
|
+
* widget width minus the tree area gives the space for the MSA
|
|
1158
|
+
*/
|
|
1159
|
+
get msaAreaHeight() {
|
|
1160
|
+
return (
|
|
1161
|
+
self.height -
|
|
1162
|
+
(self.showHorizontalScrollbar ? self.minimapHeight : 0) -
|
|
1163
|
+
self.headerHeight
|
|
1164
|
+
)
|
|
1165
|
+
},
|
|
966
1166
|
/**
|
|
967
1167
|
* #getter
|
|
968
1168
|
* total height of track area (px)
|
|
@@ -973,20 +1173,21 @@ function stateModelFactory() {
|
|
|
973
1173
|
/**
|
|
974
1174
|
* #getter
|
|
975
1175
|
*/
|
|
976
|
-
get
|
|
1176
|
+
get tidyInterProAnnotationTypes() {
|
|
977
1177
|
const types = new Map<string, Accession>()
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
types.set(accession, { name, accession, description })
|
|
981
|
-
}
|
|
1178
|
+
for (const annot of this.tidyInterProAnnotations) {
|
|
1179
|
+
types.set(annot.accession, annot)
|
|
982
1180
|
}
|
|
983
1181
|
return types
|
|
984
1182
|
},
|
|
985
|
-
|
|
1183
|
+
/**
|
|
1184
|
+
* #getter
|
|
1185
|
+
*/
|
|
1186
|
+
get tidyInterProAnnotations() {
|
|
986
1187
|
const ret = []
|
|
987
|
-
const {
|
|
988
|
-
if (
|
|
989
|
-
for (const [id, val] of Object.entries(
|
|
1188
|
+
const { interProAnnotations } = self
|
|
1189
|
+
if (interProAnnotations) {
|
|
1190
|
+
for (const [id, val] of Object.entries(interProAnnotations)) {
|
|
990
1191
|
for (const { signature, locations } of val.matches) {
|
|
991
1192
|
const { entry } = signature
|
|
992
1193
|
if (entry) {
|
|
@@ -1010,30 +1211,50 @@ function stateModelFactory() {
|
|
|
1010
1211
|
/**
|
|
1011
1212
|
* #getter
|
|
1012
1213
|
*/
|
|
1013
|
-
get
|
|
1014
|
-
return this.
|
|
1214
|
+
get tidyFilteredInterProAnnotations() {
|
|
1215
|
+
return this.tidyInterProAnnotations.filter(r =>
|
|
1015
1216
|
self.featureFilters.get(r.accession),
|
|
1016
1217
|
)
|
|
1017
1218
|
},
|
|
1018
1219
|
/**
|
|
1019
1220
|
* #getter
|
|
1020
1221
|
*/
|
|
1021
|
-
get
|
|
1022
|
-
return groupBy(this.
|
|
1222
|
+
get tidyFilteredGatheredInterProAnnotations() {
|
|
1223
|
+
return groupBy(this.tidyFilteredInterProAnnotations, r => r.id)
|
|
1023
1224
|
},
|
|
1024
1225
|
}))
|
|
1025
1226
|
.views(self => ({
|
|
1227
|
+
/**
|
|
1228
|
+
* #getter
|
|
1229
|
+
*/
|
|
1230
|
+
get showVerticalScrollbar() {
|
|
1231
|
+
return self.msaAreaHeight < self.totalHeight
|
|
1232
|
+
},
|
|
1233
|
+
}))
|
|
1234
|
+
.views(self => ({
|
|
1235
|
+
/**
|
|
1236
|
+
* #getter
|
|
1237
|
+
*/
|
|
1238
|
+
get verticalScrollbarWidth() {
|
|
1239
|
+
return self.showVerticalScrollbar ? 20 : 0
|
|
1240
|
+
},
|
|
1241
|
+
/**
|
|
1242
|
+
* #getter
|
|
1243
|
+
*/
|
|
1026
1244
|
get fillPalette() {
|
|
1027
|
-
const arr = [...self.
|
|
1245
|
+
const arr = [...self.tidyInterProAnnotationTypes.keys()]
|
|
1028
1246
|
let i = 0
|
|
1029
1247
|
const map = {} as Record<string, string>
|
|
1030
1248
|
for (const key of arr) {
|
|
1031
1249
|
const k = Math.min(arr.length - 1, palettes.length - 1)
|
|
1032
|
-
map[key] = palettes[k][i]
|
|
1250
|
+
map[key] = palettes[k]![i]!
|
|
1033
1251
|
i++
|
|
1034
1252
|
}
|
|
1035
1253
|
return map
|
|
1036
1254
|
},
|
|
1255
|
+
/**
|
|
1256
|
+
* #getter
|
|
1257
|
+
*/
|
|
1037
1258
|
get strokePalette() {
|
|
1038
1259
|
return Object.fromEntries(
|
|
1039
1260
|
Object.entries(this.fillPalette).map(([key, val]) => [
|
|
@@ -1044,18 +1265,23 @@ function stateModelFactory() {
|
|
|
1044
1265
|
},
|
|
1045
1266
|
}))
|
|
1046
1267
|
.actions(self => ({
|
|
1268
|
+
/**
|
|
1269
|
+
* #action
|
|
1270
|
+
*/
|
|
1271
|
+
setHeaderHeight(arg: number) {
|
|
1272
|
+
self.headerHeight = arg
|
|
1273
|
+
},
|
|
1047
1274
|
/**
|
|
1048
1275
|
* #action
|
|
1049
1276
|
*/
|
|
1050
1277
|
reset() {
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
})
|
|
1278
|
+
self.setData({ tree: '', msa: '' })
|
|
1279
|
+
self.setError(undefined)
|
|
1280
|
+
self.setScrollY(0)
|
|
1281
|
+
self.setScrollX(0)
|
|
1282
|
+
self.setCurrentAlignment(0)
|
|
1283
|
+
self.setTreeFilehandle(undefined)
|
|
1284
|
+
self.setMSAFilehandle(undefined)
|
|
1059
1285
|
},
|
|
1060
1286
|
/**
|
|
1061
1287
|
* #action
|
|
@@ -1098,7 +1324,7 @@ function stateModelFactory() {
|
|
|
1098
1324
|
addDisposer(
|
|
1099
1325
|
self,
|
|
1100
1326
|
autorun(() => {
|
|
1101
|
-
for (const key of self.
|
|
1327
|
+
for (const key of self.tidyInterProAnnotationTypes.keys()) {
|
|
1102
1328
|
this.initFilter(key)
|
|
1103
1329
|
}
|
|
1104
1330
|
}),
|
|
@@ -1154,9 +1380,11 @@ function stateModelFactory() {
|
|
|
1154
1380
|
if (msaFilehandle) {
|
|
1155
1381
|
try {
|
|
1156
1382
|
self.setLoadingMSA(true)
|
|
1157
|
-
const res = await openLocation(msaFilehandle).readFile(
|
|
1383
|
+
const res = await openLocation(msaFilehandle).readFile()
|
|
1384
|
+
const buf = isGzip(res) ? ungzip(res) : res
|
|
1385
|
+
const txt = new TextDecoder('utf8').decode(buf)
|
|
1158
1386
|
transaction(() => {
|
|
1159
|
-
self.setMSA(
|
|
1387
|
+
self.setMSA(txt)
|
|
1160
1388
|
if (msaFilehandle.locationType === 'BlobLocation') {
|
|
1161
1389
|
// clear filehandle after loading if from a local file
|
|
1162
1390
|
self.setMSAFilehandle(undefined)
|
|
@@ -1172,6 +1400,21 @@ function stateModelFactory() {
|
|
|
1172
1400
|
}),
|
|
1173
1401
|
)
|
|
1174
1402
|
|
|
1403
|
+
// force colStats not to go stale
|
|
1404
|
+
// xref solution https://github.com/mobxjs/mobx/issues/266#issuecomment-222007278
|
|
1405
|
+
// xref problem https://github.com/GMOD/react-msaview/issues/75
|
|
1406
|
+
addDisposer(
|
|
1407
|
+
self,
|
|
1408
|
+
autorun(() => {
|
|
1409
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
1410
|
+
self.colStats
|
|
1411
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
1412
|
+
self.colStatsSums
|
|
1413
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
1414
|
+
self.columns
|
|
1415
|
+
}),
|
|
1416
|
+
)
|
|
1417
|
+
|
|
1175
1418
|
// autorun synchronizes treeWidth with treeAreaWidth
|
|
1176
1419
|
addDisposer(
|
|
1177
1420
|
self,
|