react-msaview 3.1.7 → 3.1.8
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 -32
- package/dist/components/Checkbox2.d.ts +7 -0
- package/dist/components/Checkbox2.js +10 -0
- package/dist/components/Checkbox2.js.map +1 -0
- package/dist/components/Loading.js +12 -4
- package/dist/components/Loading.js.map +1 -1
- package/dist/components/MSAView.js +5 -8
- package/dist/components/MSAView.js.map +1 -1
- package/dist/components/SequenceTextArea.d.ts +4 -0
- package/dist/components/SequenceTextArea.js +38 -0
- package/dist/components/SequenceTextArea.js.map +1 -0
- package/dist/components/Track.js +9 -8
- package/dist/components/Track.js.map +1 -1
- package/dist/components/dialogs/AddTrackDialog.js +0 -1
- package/dist/components/dialogs/AddTrackDialog.js.map +1 -1
- package/dist/components/{ExportSVGDialog.d.ts → dialogs/ExportSVGDialog.d.ts} +1 -1
- package/dist/components/{ExportSVGDialog.js → dialogs/ExportSVGDialog.js} +3 -4
- package/dist/components/dialogs/ExportSVGDialog.js.map +1 -0
- package/dist/components/dialogs/FeatureDialog.d.ts +7 -0
- package/dist/components/dialogs/FeatureDialog.js +52 -0
- package/dist/components/dialogs/FeatureDialog.js.map +1 -0
- package/dist/components/dialogs/InterProScanDialog.d.ts +7 -0
- package/dist/components/dialogs/InterProScanDialog.js +163 -0
- package/dist/components/dialogs/InterProScanDialog.js.map +1 -0
- package/dist/components/dialogs/MetadataDialog.js +6 -3
- package/dist/components/dialogs/MetadataDialog.js.map +1 -1
- package/dist/components/dialogs/SettingsDialog.js +6 -11
- package/dist/components/dialogs/SettingsDialog.js.map +1 -1
- package/dist/components/{Header.d.ts → header/Header.d.ts} +1 -1
- package/dist/components/header/Header.js +30 -0
- package/dist/components/header/Header.js.map +1 -0
- package/dist/components/{HeaderInfoArea.d.ts → header/HeaderInfoArea.d.ts} +2 -2
- package/dist/components/header/HeaderInfoArea.js +20 -0
- package/dist/components/header/HeaderInfoArea.js.map +1 -0
- package/dist/components/header/HeaderMenu.d.ts +6 -0
- package/dist/components/header/HeaderMenu.js +40 -0
- package/dist/components/header/HeaderMenu.js.map +1 -0
- package/dist/components/header/HeaderMenuExtra.d.ts +6 -0
- package/dist/components/header/HeaderMenuExtra.js +92 -0
- package/dist/components/header/HeaderMenuExtra.js.map +1 -0
- package/dist/components/header/HeaderStatusArea.d.ts +6 -0
- package/dist/components/header/HeaderStatusArea.js +20 -0
- package/dist/components/header/HeaderStatusArea.js.map +1 -0
- package/dist/components/{MultiAlignmentSelector.d.ts → header/MultiAlignmentSelector.d.ts} +1 -1
- package/dist/components/header/MultiAlignmentSelector.js.map +1 -0
- package/dist/components/{ZoomControls.d.ts → header/ZoomControls.d.ts} +1 -1
- package/dist/components/header/ZoomControls.js +15 -0
- package/dist/components/header/ZoomControls.js.map +1 -0
- package/dist/components/{ImportForm/index.js → import/ImportForm.js} +1 -1
- package/dist/components/import/ImportForm.js.map +1 -0
- package/dist/components/{ImportForm → import}/ImportFormExamples.js +6 -2
- package/dist/components/import/ImportFormExamples.js.map +1 -0
- package/dist/components/import/data/seq2.js.map +1 -0
- package/dist/components/import/util.js +10 -0
- package/dist/components/import/util.js.map +1 -0
- package/dist/components/{Minimap.d.ts → minimap/Minimap.d.ts} +1 -1
- package/dist/components/minimap/Minimap.js.map +1 -0
- package/dist/components/{MinimapSVG.d.ts → minimap/MinimapSVG.d.ts} +1 -1
- package/dist/components/minimap/MinimapSVG.js.map +1 -0
- package/dist/components/msa/Loading.js.map +1 -0
- package/dist/components/{MSAPanel → msa}/MSACanvas.js +3 -2
- package/dist/components/msa/MSACanvas.js.map +1 -0
- package/dist/components/{MSAPanel/MSABlock.js → msa/MSACanvasBlock.js} +21 -9
- package/dist/components/msa/MSACanvasBlock.js.map +1 -0
- package/dist/components/msa/MSAMouseoverCanvas.js.map +1 -0
- package/dist/components/msa/MSAPanel.d.ts +6 -0
- package/dist/components/{MSAPanel/index.js → msa/MSAPanel.js} +6 -3
- package/dist/components/msa/MSAPanel.js.map +1 -0
- package/dist/components/msa/renderBoxFeatureCanvasBlock.d.ts +9 -0
- package/dist/components/msa/renderBoxFeatureCanvasBlock.js +44 -0
- package/dist/components/msa/renderBoxFeatureCanvasBlock.js.map +1 -0
- package/dist/components/{MSAPanel → msa}/renderMSABlock.js +24 -20
- package/dist/components/msa/renderMSABlock.js.map +1 -0
- package/dist/components/msa/renderMSAMouseover.js.map +1 -0
- package/dist/components/tree/TreeBranchMenu.js.map +1 -0
- package/dist/components/{TreePanel → tree}/TreeCanvas.js +1 -1
- package/dist/components/tree/TreeCanvas.js.map +1 -0
- package/dist/components/{TreePanel → tree}/TreeCanvasBlock.js +1 -1
- package/dist/components/tree/TreeCanvasBlock.js.map +1 -0
- package/dist/components/{TreePanel → tree}/TreeNodeMenu.js +2 -33
- package/dist/components/tree/TreeNodeMenu.js.map +1 -0
- package/dist/components/{TreePanel/index.js → tree/TreePanel.js} +2 -2
- package/dist/components/tree/TreePanel.js.map +1 -0
- package/dist/components/tree/TreeRuler.js.map +1 -0
- package/dist/components/{TreePanel → tree}/dialogs/TreeNodeInfoDialog.js +6 -2
- package/dist/components/tree/dialogs/TreeNodeInfoDialog.js.map +1 -0
- package/dist/components/{TreePanel → tree}/renderTreeCanvas.js +23 -37
- package/dist/components/tree/renderTreeCanvas.js.map +1 -0
- package/dist/fetchUtils.d.ts +5 -0
- package/dist/fetchUtils.js +23 -0
- package/dist/fetchUtils.js.map +1 -0
- package/dist/ggplotPalettes.d.ts +3 -0
- package/dist/ggplotPalettes.js +24 -0
- package/dist/ggplotPalettes.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/launchInterProScan.d.ts +32 -0
- package/dist/launchInterProScan.js +47 -0
- package/dist/launchInterProScan.js.map +1 -0
- package/dist/model/DataModel.js.map +1 -0
- package/dist/model/DialogQueue.js.map +1 -0
- package/dist/model/msaModel.d.ts +14 -0
- package/dist/model/msaModel.js +36 -0
- package/dist/model/msaModel.js.map +1 -0
- package/dist/model/treeModel.d.ts +46 -0
- package/dist/model/treeModel.js +105 -0
- package/dist/model/treeModel.js.map +1 -0
- package/dist/model.d.ts +261 -273
- package/dist/model.js +1043 -1029
- package/dist/model.js.map +1 -1
- package/dist/parseGFF.d.ts +10 -0
- package/dist/parseGFF.js +29 -0
- package/dist/parseGFF.js.map +1 -0
- package/dist/renderToSvg.js +23 -9
- package/dist/renderToSvg.js.map +1 -1
- package/dist/reparseTree.d.ts +2 -0
- package/dist/reparseTree.js +13 -0
- package/dist/reparseTree.js.map +1 -0
- package/dist/util.d.ts +4 -10
- package/dist/util.js +3 -28
- package/dist/util.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +12 -2
- package/src/components/Checkbox2.tsx +34 -0
- package/src/components/Loading.tsx +27 -11
- package/src/components/MSAView.tsx +6 -10
- package/src/components/SequenceTextArea.tsx +63 -0
- package/src/components/Track.tsx +8 -13
- package/src/components/dialogs/AddTrackDialog.tsx +0 -1
- package/src/components/{ExportSVGDialog.tsx → dialogs/ExportSVGDialog.tsx} +9 -16
- package/src/components/dialogs/FeatureDialog.tsx +109 -0
- package/src/components/dialogs/InterProScanDialog.tsx +230 -0
- package/src/components/dialogs/MetadataDialog.tsx +9 -2
- package/src/components/dialogs/SettingsDialog.tsx +10 -30
- package/src/components/header/Header.tsx +44 -0
- package/src/components/header/HeaderInfoArea.tsx +27 -0
- package/src/components/header/HeaderMenu.tsx +54 -0
- package/src/components/header/HeaderMenuExtra.tsx +108 -0
- package/src/components/header/HeaderStatusArea.tsx +31 -0
- package/src/components/{MultiAlignmentSelector.tsx → header/MultiAlignmentSelector.tsx} +1 -1
- package/src/components/header/ZoomControls.tsx +28 -0
- package/src/components/{ImportForm → import}/ImportFormExamples.tsx +12 -1
- package/src/components/{ImportForm → import}/util.ts +5 -10
- package/src/components/{Minimap.tsx → minimap/Minimap.tsx} +1 -1
- package/src/components/{MinimapSVG.tsx → minimap/MinimapSVG.tsx} +1 -1
- package/src/components/{MSAPanel → msa}/MSACanvas.tsx +3 -2
- package/src/components/{MSAPanel/MSABlock.tsx → msa/MSACanvasBlock.tsx} +25 -12
- package/src/components/{MSAPanel/index.tsx → msa/MSAPanel.tsx} +8 -2
- package/src/components/msa/renderBoxFeatureCanvasBlock.ts +88 -0
- package/src/components/{MSAPanel → msa}/renderMSABlock.ts +26 -20
- package/src/components/{TreePanel → tree}/TreeCanvas.tsx +1 -1
- package/src/components/{TreePanel → tree}/TreeCanvasBlock.tsx +1 -1
- package/src/components/{TreePanel → tree}/TreeNodeMenu.tsx +1 -53
- package/src/components/{TreePanel/index.tsx → tree/TreePanel.tsx} +1 -1
- package/src/components/{TreePanel → tree}/dialogs/TreeNodeInfoDialog.tsx +9 -2
- package/src/components/{TreePanel → tree}/renderTreeCanvas.ts +25 -41
- package/src/fetchUtils.ts +30 -0
- package/src/ggplotPalettes.ts +25 -0
- package/src/index.ts +1 -1
- package/src/launchInterProScan.ts +98 -0
- package/src/model/msaModel.ts +39 -0
- package/src/model/treeModel.ts +116 -0
- package/src/model.ts +1124 -1126
- package/src/parseGFF.ts +32 -0
- package/src/renderToSvg.tsx +27 -8
- package/src/reparseTree.ts +16 -0
- package/src/util.ts +4 -33
- package/src/version.ts +1 -1
- package/dist/DataModel.js.map +0 -1
- package/dist/DialogQueue.js.map +0 -1
- package/dist/SelectedStructuresMixin.d.ts +0 -46
- package/dist/SelectedStructuresMixin.js +0 -52
- package/dist/SelectedStructuresMixin.js.map +0 -1
- package/dist/StructureModel.d.ts +0 -9
- package/dist/StructureModel.js +0 -11
- package/dist/StructureModel.js.map +0 -1
- package/dist/UniprotTrack.d.ts +0 -27
- package/dist/UniprotTrack.js +0 -53
- package/dist/UniprotTrack.js.map +0 -1
- package/dist/components/BoxTrack.d.ts +0 -7
- package/dist/components/BoxTrack.js +0 -15
- package/dist/components/BoxTrack.js.map +0 -1
- package/dist/components/BoxTrackBlock.d.ts +0 -8
- package/dist/components/BoxTrackBlock.js +0 -136
- package/dist/components/BoxTrackBlock.js.map +0 -1
- package/dist/components/ExportSVGDialog.js.map +0 -1
- package/dist/components/Header.js +0 -62
- package/dist/components/Header.js.map +0 -1
- package/dist/components/HeaderInfoArea.js +0 -12
- package/dist/components/HeaderInfoArea.js.map +0 -1
- package/dist/components/ImportForm/ImportFormExamples.js.map +0 -1
- package/dist/components/ImportForm/data/seq2.js.map +0 -1
- package/dist/components/ImportForm/index.js.map +0 -1
- package/dist/components/ImportForm/util.js +0 -16
- package/dist/components/ImportForm/util.js.map +0 -1
- package/dist/components/MSAPanel/Loading.js.map +0 -1
- package/dist/components/MSAPanel/MSABlock.js.map +0 -1
- package/dist/components/MSAPanel/MSACanvas.js.map +0 -1
- package/dist/components/MSAPanel/MSAMouseoverCanvas.js.map +0 -1
- package/dist/components/MSAPanel/index.d.ts +0 -5
- package/dist/components/MSAPanel/index.js.map +0 -1
- package/dist/components/MSAPanel/renderMSABlock.js.map +0 -1
- package/dist/components/MSAPanel/renderMSAMouseover.js.map +0 -1
- package/dist/components/Minimap.js.map +0 -1
- package/dist/components/MinimapSVG.js.map +0 -1
- package/dist/components/MultiAlignmentSelector.js.map +0 -1
- package/dist/components/TreePanel/TreeBranchMenu.js.map +0 -1
- package/dist/components/TreePanel/TreeCanvas.js.map +0 -1
- package/dist/components/TreePanel/TreeCanvasBlock.js.map +0 -1
- package/dist/components/TreePanel/TreeNodeMenu.js.map +0 -1
- package/dist/components/TreePanel/TreeRuler.js.map +0 -1
- package/dist/components/TreePanel/dialogs/TreeNodeInfoDialog.js.map +0 -1
- package/dist/components/TreePanel/index.js.map +0 -1
- package/dist/components/TreePanel/renderTreeCanvas.js.map +0 -1
- package/dist/components/VerticalGuide.d.ts +0 -7
- package/dist/components/VerticalGuide.js +0 -30
- package/dist/components/VerticalGuide.js.map +0 -1
- package/dist/components/ZoomControls.js +0 -59
- package/dist/components/ZoomControls.js.map +0 -1
- package/src/SelectedStructuresMixin.ts +0 -59
- package/src/StructureModel.ts +0 -11
- package/src/UniprotTrack.ts +0 -59
- package/src/components/BoxTrack.tsx +0 -33
- package/src/components/BoxTrackBlock.tsx +0 -200
- package/src/components/Header.tsx +0 -99
- package/src/components/HeaderInfoArea.tsx +0 -21
- package/src/components/VerticalGuide.tsx +0 -50
- package/src/components/ZoomControls.tsx +0 -86
- package/dist/components/{MultiAlignmentSelector.js → header/MultiAlignmentSelector.js} +0 -0
- package/dist/components/{ImportForm/index.d.ts → import/ImportForm.d.ts} +0 -0
- package/dist/components/{ImportForm → import}/ImportFormExamples.d.ts +0 -0
- package/dist/components/{ImportForm → import}/data/seq2.d.ts +0 -0
- package/dist/components/{ImportForm → import}/data/seq2.js +0 -0
- package/dist/components/{ImportForm → import}/util.d.ts +0 -0
- package/dist/components/{Minimap.js → minimap/Minimap.js} +0 -0
- package/dist/components/{MinimapSVG.js → minimap/MinimapSVG.js} +0 -0
- package/dist/components/{MSAPanel → msa}/Loading.d.ts +0 -0
- package/dist/components/{MSAPanel → msa}/Loading.js +0 -0
- package/dist/components/{MSAPanel → msa}/MSACanvas.d.ts +0 -0
- package/dist/components/{MSAPanel/MSABlock.d.ts → msa/MSACanvasBlock.d.ts} +0 -0
- package/dist/components/{MSAPanel → msa}/MSAMouseoverCanvas.d.ts +0 -0
- package/dist/components/{MSAPanel → msa}/MSAMouseoverCanvas.js +0 -0
- package/dist/components/{MSAPanel → msa}/renderMSABlock.d.ts +1 -1
- /package/dist/components/{MSAPanel → msa}/renderMSAMouseover.d.ts +0 -0
- /package/dist/components/{MSAPanel → msa}/renderMSAMouseover.js +0 -0
- /package/dist/components/{TreePanel → tree}/TreeBranchMenu.d.ts +0 -0
- /package/dist/components/{TreePanel → tree}/TreeBranchMenu.js +0 -0
- /package/dist/components/{TreePanel → tree}/TreeCanvas.d.ts +0 -0
- /package/dist/components/{TreePanel → tree}/TreeCanvasBlock.d.ts +0 -0
- /package/dist/components/{TreePanel → tree}/TreeNodeMenu.d.ts +0 -0
- /package/dist/components/{TreePanel/index.d.ts → tree/TreePanel.d.ts} +0 -0
- /package/dist/components/{TreePanel → tree}/TreeRuler.d.ts +0 -0
- /package/dist/components/{TreePanel → tree}/TreeRuler.js +0 -0
- /package/dist/components/{TreePanel → tree}/dialogs/TreeNodeInfoDialog.d.ts +0 -0
- /package/dist/components/{TreePanel → tree}/renderTreeCanvas.d.ts +0 -0
- /package/dist/{DataModel.d.ts → model/DataModel.d.ts} +0 -0
- /package/dist/{DataModel.js → model/DataModel.js} +0 -0
- /package/dist/{DialogQueue.d.ts → model/DialogQueue.d.ts} +0 -0
- /package/dist/{DialogQueue.js → model/DialogQueue.js} +0 -0
- /package/src/components/{ImportForm/index.tsx → import/ImportForm.tsx} +0 -0
- /package/src/components/{ImportForm → import}/data/seq2.ts +0 -0
- /package/src/components/{MSAPanel → msa}/Loading.tsx +0 -0
- /package/src/components/{MSAPanel → msa}/MSAMouseoverCanvas.tsx +0 -0
- /package/src/components/{MSAPanel → msa}/renderMSAMouseover.ts +0 -0
- /package/src/components/{TreePanel → tree}/TreeBranchMenu.tsx +0 -0
- /package/src/components/{TreePanel → tree}/TreeRuler.tsx +0 -0
- /package/src/{DataModel.ts → model/DataModel.ts} +0 -0
- /package/src/{DialogQueue.ts → model/DialogQueue.ts} +0 -0
package/dist/model.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { autorun } from 'mobx';
|
|
1
|
+
import { autorun, transaction } from 'mobx';
|
|
2
2
|
import { cast, types, addDisposer } from 'mobx-state-tree';
|
|
3
3
|
import { hierarchy, cluster } from 'd3-hierarchy';
|
|
4
4
|
import { ascending } from 'd3-array';
|
|
@@ -7,15 +7,16 @@ import { saveAs } from 'file-saver';
|
|
|
7
7
|
// jbrowse
|
|
8
8
|
import { FileLocation, ElementId } from '@jbrowse/core/util/types/mst';
|
|
9
9
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
10
|
-
import { notEmpty, sum } from '@jbrowse/core/util';
|
|
11
|
-
import BaseViewModel from '@jbrowse/core/pluggableElementTypes/models/BaseViewModel';
|
|
10
|
+
import { groupBy, localStorageGetItem, localStorageSetItem, notEmpty, sum, } from '@jbrowse/core/util';
|
|
12
11
|
// locals
|
|
13
|
-
import { clamp, collapse, generateNodeIds, maxLength, setBrLength, skipBlanks, } from './util';
|
|
12
|
+
import { clamp, collapse, generateNodeIds, maxLength, setBrLength, skipBlanks, len, } from './util';
|
|
13
|
+
import { colord } from 'colord';
|
|
14
|
+
import { reparseTree } from './reparseTree';
|
|
14
15
|
import { blocksX, blocksY } from './calculateBlocks';
|
|
15
16
|
import { measureTextCanvas } from './measureTextCanvas';
|
|
17
|
+
import palettes from './ggplotPalettes';
|
|
16
18
|
// components
|
|
17
19
|
import TextTrack from './components/TextTrack';
|
|
18
|
-
import BoxTrack from './components/BoxTrack';
|
|
19
20
|
// parsers
|
|
20
21
|
import ClustalMSA from './parsers/ClustalMSA';
|
|
21
22
|
import StockholmMSA from './parsers/StockholmMSA';
|
|
@@ -23,1069 +24,1082 @@ import FastaMSA from './parsers/FastaMSA';
|
|
|
23
24
|
import parseNewick from './parseNewick';
|
|
24
25
|
import colorSchemes from './colorSchemes';
|
|
25
26
|
// models
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
27
|
+
import { DataModelF } from './model/DataModel';
|
|
28
|
+
import { DialogQueueSessionMixin } from './model/DialogQueue';
|
|
29
|
+
import { TreeF } from './model/treeModel';
|
|
30
|
+
import { MSAModelF } from './model/msaModel';
|
|
31
|
+
import { launchInterProScan, loadInterProScanResults, } from './launchInterProScan';
|
|
30
32
|
/**
|
|
31
33
|
* #stateModel MsaView
|
|
32
34
|
* extends
|
|
33
|
-
* - BaseViewModel
|
|
34
35
|
* - DialogQueueSessionMixin
|
|
35
|
-
* -
|
|
36
|
+
* - MSAModel
|
|
37
|
+
* - Tree
|
|
36
38
|
*/
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
self.treeAreaWidth = n;
|
|
316
|
-
},
|
|
317
|
-
/**
|
|
318
|
-
* #action
|
|
319
|
-
* set tree width (px)
|
|
320
|
-
*/
|
|
321
|
-
setTreeWidth(n) {
|
|
322
|
-
self.treeWidth = n;
|
|
323
|
-
},
|
|
324
|
-
/**
|
|
325
|
-
* #action
|
|
326
|
-
*
|
|
327
|
-
*/
|
|
328
|
-
setCurrentAlignment(n) {
|
|
329
|
-
self.currentAlignment = n;
|
|
330
|
-
},
|
|
331
|
-
/**
|
|
332
|
-
* #action
|
|
333
|
-
*/
|
|
334
|
-
setLabelsAlignRight(arg) {
|
|
335
|
-
self.labelsAlignRight = arg;
|
|
336
|
-
},
|
|
337
|
-
/**
|
|
338
|
-
* #action
|
|
339
|
-
*/
|
|
340
|
-
setDrawTree(arg) {
|
|
341
|
-
self.drawTree = arg;
|
|
342
|
-
},
|
|
343
|
-
/**
|
|
344
|
-
* #action
|
|
345
|
-
*/
|
|
346
|
-
toggleCollapsed(node) {
|
|
347
|
-
if (self.collapsed.includes(node)) {
|
|
348
|
-
self.collapsed.remove(node);
|
|
349
|
-
}
|
|
350
|
-
else {
|
|
351
|
-
self.collapsed.push(node);
|
|
352
|
-
}
|
|
353
|
-
},
|
|
354
|
-
/**
|
|
355
|
-
* #action
|
|
356
|
-
*/
|
|
357
|
-
toggleCollapsed2(node) {
|
|
358
|
-
if (self.collapsed2.includes(node)) {
|
|
359
|
-
self.collapsed2.remove(node);
|
|
360
|
-
}
|
|
361
|
-
else {
|
|
362
|
-
self.collapsed2.push(node);
|
|
363
|
-
}
|
|
364
|
-
},
|
|
365
|
-
/**
|
|
366
|
-
* #action
|
|
367
|
-
*/
|
|
368
|
-
setShowOnly(node) {
|
|
369
|
-
self.showOnly = node;
|
|
370
|
-
},
|
|
371
|
-
/**
|
|
372
|
-
* #action
|
|
373
|
-
*/
|
|
374
|
-
setShowBranchLen(arg) {
|
|
375
|
-
self.showBranchLen = arg;
|
|
376
|
-
},
|
|
377
|
-
/**
|
|
378
|
-
* #action
|
|
379
|
-
*/
|
|
380
|
-
setBgColor(arg) {
|
|
381
|
-
self.bgColor = arg;
|
|
382
|
-
},
|
|
383
|
-
/**
|
|
384
|
-
* #action
|
|
385
|
-
*/
|
|
386
|
-
setDrawNodeBubbles(arg) {
|
|
387
|
-
self.drawNodeBubbles = arg;
|
|
388
|
-
},
|
|
389
|
-
/**
|
|
390
|
-
* #action
|
|
391
|
-
*/
|
|
392
|
-
setData(data) {
|
|
393
|
-
self.data = cast(data);
|
|
394
|
-
},
|
|
395
|
-
/**
|
|
396
|
-
* #action
|
|
397
|
-
*/
|
|
398
|
-
async setMSAFilehandle(msaFilehandle) {
|
|
399
|
-
self.msaFilehandle = msaFilehandle;
|
|
400
|
-
},
|
|
401
|
-
/**
|
|
402
|
-
* #action
|
|
403
|
-
*/
|
|
404
|
-
async setTreeFilehandle(treeFilehandle) {
|
|
405
|
-
if (treeFilehandle && 'blobId' in treeFilehandle) {
|
|
406
|
-
const r = await openLocation(treeFilehandle).readFile('utf8');
|
|
407
|
-
this.setTree(r);
|
|
408
|
-
}
|
|
409
|
-
else {
|
|
410
|
-
self.treeFilehandle = treeFilehandle;
|
|
411
|
-
}
|
|
412
|
-
},
|
|
413
|
-
/**
|
|
414
|
-
* #action
|
|
415
|
-
*/
|
|
416
|
-
setMSA(result) {
|
|
417
|
-
self.data.setMSA(result);
|
|
418
|
-
},
|
|
419
|
-
/**
|
|
420
|
-
* #action
|
|
421
|
-
*/
|
|
422
|
-
setTree(result) {
|
|
423
|
-
self.data.setTree(result);
|
|
424
|
-
},
|
|
425
|
-
/**
|
|
426
|
-
* #action
|
|
427
|
-
*/
|
|
428
|
-
setTreeMetadata(result) {
|
|
429
|
-
self.data.setTreeMetadata(result);
|
|
430
|
-
},
|
|
431
|
-
}))
|
|
432
|
-
.views(self => ({
|
|
433
|
-
/**
|
|
434
|
-
* #getter
|
|
435
|
-
*/
|
|
436
|
-
get colorScheme() {
|
|
437
|
-
return colorSchemes[self.colorSchemeName];
|
|
438
|
-
},
|
|
439
|
-
/**
|
|
440
|
-
* #getter
|
|
441
|
-
*/
|
|
442
|
-
get header() {
|
|
443
|
-
return this.MSA?.getHeader() || {};
|
|
444
|
-
},
|
|
445
|
-
/**
|
|
446
|
-
* #method
|
|
447
|
-
*/
|
|
448
|
-
getRowData(name) {
|
|
449
|
-
const matches = name.match(/\S+\/(\d+)-(\d+)/);
|
|
450
|
-
return {
|
|
451
|
-
data: this.MSA?.getRowData(name) || {},
|
|
452
|
-
...(matches && {
|
|
453
|
-
range: {
|
|
454
|
-
start: +matches[1],
|
|
455
|
-
end: +matches[2],
|
|
456
|
-
},
|
|
457
|
-
}),
|
|
458
|
-
};
|
|
459
|
-
},
|
|
460
|
-
/**
|
|
461
|
-
* #getter
|
|
462
|
-
*/
|
|
463
|
-
get currentAlignmentName() {
|
|
464
|
-
return this.alignmentNames[self.currentAlignment];
|
|
465
|
-
},
|
|
466
|
-
/**
|
|
467
|
-
* #getter
|
|
468
|
-
*/
|
|
469
|
-
get alignmentNames() {
|
|
470
|
-
return this.MSA?.alignmentNames || [];
|
|
471
|
-
},
|
|
472
|
-
/**
|
|
473
|
-
* #getter
|
|
474
|
-
*/
|
|
475
|
-
get noTree() {
|
|
476
|
-
return !!this._tree.noTree;
|
|
477
|
-
},
|
|
478
|
-
/**
|
|
479
|
-
* #getter
|
|
480
|
-
*/
|
|
481
|
-
get menuItems() {
|
|
482
|
-
return [];
|
|
483
|
-
},
|
|
484
|
-
/**
|
|
485
|
-
* #getter
|
|
486
|
-
*/
|
|
487
|
-
get treeMetadata() {
|
|
488
|
-
return self.data.treeMetadata ? JSON.parse(self.data.treeMetadata) : {};
|
|
489
|
-
},
|
|
490
|
-
/**
|
|
491
|
-
* #getter
|
|
492
|
-
*/
|
|
493
|
-
get MSA() {
|
|
494
|
-
const text = self.data.msa;
|
|
495
|
-
if (text) {
|
|
496
|
-
if (Stockholm.sniff(text)) {
|
|
497
|
-
return new StockholmMSA(text, self.currentAlignment);
|
|
39
|
+
function stateModelFactory() {
|
|
40
|
+
return types
|
|
41
|
+
.compose(DialogQueueSessionMixin(), TreeF(), MSAModelF(), types.model('MsaView', {
|
|
42
|
+
/**
|
|
43
|
+
* #property
|
|
44
|
+
* id of view, randomly generated if not provided
|
|
45
|
+
*/
|
|
46
|
+
id: ElementId,
|
|
47
|
+
/**
|
|
48
|
+
* #property
|
|
49
|
+
*/
|
|
50
|
+
featureMode: false,
|
|
51
|
+
/**
|
|
52
|
+
* #property
|
|
53
|
+
*/
|
|
54
|
+
subFeatureRows: false,
|
|
55
|
+
/**
|
|
56
|
+
* #property
|
|
57
|
+
* hardcoded view type
|
|
58
|
+
*/
|
|
59
|
+
type: types.literal('MsaView'),
|
|
60
|
+
/**
|
|
61
|
+
* #property
|
|
62
|
+
* height of the div containing the view, px
|
|
63
|
+
*/
|
|
64
|
+
height: types.optional(types.number, 550),
|
|
65
|
+
/**
|
|
66
|
+
* #property
|
|
67
|
+
* height of each row, px
|
|
68
|
+
*/
|
|
69
|
+
rowHeight: 20,
|
|
70
|
+
/**
|
|
71
|
+
* #property
|
|
72
|
+
* scroll position, Y-offset, px
|
|
73
|
+
*/
|
|
74
|
+
scrollY: 0,
|
|
75
|
+
/**
|
|
76
|
+
* #property
|
|
77
|
+
* scroll position, X-offset, px
|
|
78
|
+
*/
|
|
79
|
+
scrollX: 0,
|
|
80
|
+
/**
|
|
81
|
+
* #property
|
|
82
|
+
* width of columns, px
|
|
83
|
+
*/
|
|
84
|
+
colWidth: 16,
|
|
85
|
+
/**
|
|
86
|
+
* #property
|
|
87
|
+
* filehandle object for the tree
|
|
88
|
+
*/
|
|
89
|
+
treeFilehandle: types.maybe(FileLocation),
|
|
90
|
+
/**
|
|
91
|
+
* #property
|
|
92
|
+
* filehandle object for the MSA (which could contain a tree e.g. with
|
|
93
|
+
* stockholm files)
|
|
94
|
+
*/
|
|
95
|
+
msaFilehandle: types.maybe(FileLocation),
|
|
96
|
+
/**
|
|
97
|
+
* #property
|
|
98
|
+
* filehandle object for tree metadata
|
|
99
|
+
*/
|
|
100
|
+
treeMetadataFilehandle: types.maybe(FileLocation),
|
|
101
|
+
/**
|
|
102
|
+
* #property
|
|
103
|
+
*
|
|
104
|
+
*/
|
|
105
|
+
currentAlignment: 0,
|
|
106
|
+
/**
|
|
107
|
+
* #property
|
|
108
|
+
* array of tree parent nodes that are 'collapsed'
|
|
109
|
+
*/
|
|
110
|
+
collapsed: types.array(types.string),
|
|
111
|
+
/**
|
|
112
|
+
* #property
|
|
113
|
+
* array of tree leaf nodes that are 'collapsed'
|
|
114
|
+
*/
|
|
115
|
+
collapsed2: types.array(types.string),
|
|
116
|
+
/**
|
|
117
|
+
* #property
|
|
118
|
+
* focus on particular subtree
|
|
119
|
+
*/
|
|
120
|
+
showOnly: types.maybe(types.string),
|
|
121
|
+
/**
|
|
122
|
+
* #property
|
|
123
|
+
* turned off tracks
|
|
124
|
+
*/
|
|
125
|
+
turnedOffTracks: types.map(types.boolean),
|
|
126
|
+
/**
|
|
127
|
+
* #property
|
|
128
|
+
* data from the loaded tree/msa/treeMetadata, generally loaded by
|
|
129
|
+
* autorun
|
|
130
|
+
*/
|
|
131
|
+
data: types.optional(DataModelF(), { tree: '', msa: '' }),
|
|
132
|
+
/**
|
|
133
|
+
* #property
|
|
134
|
+
*/
|
|
135
|
+
featureFilters: types.map(types.boolean),
|
|
136
|
+
}))
|
|
137
|
+
.volatile(() => ({
|
|
138
|
+
status: undefined,
|
|
139
|
+
/**
|
|
140
|
+
* #volatile
|
|
141
|
+
* high resolution scale factor, helps make canvas look better on hi-dpi
|
|
142
|
+
* screens
|
|
143
|
+
*/
|
|
144
|
+
highResScaleFactor: 1,
|
|
145
|
+
/**
|
|
146
|
+
* #volatile
|
|
147
|
+
*/
|
|
148
|
+
loadingMSA: false,
|
|
149
|
+
/**
|
|
150
|
+
* #volatile
|
|
151
|
+
*/
|
|
152
|
+
loadingTree: false,
|
|
153
|
+
/**
|
|
154
|
+
* #volatile
|
|
155
|
+
*/
|
|
156
|
+
width: 800,
|
|
157
|
+
/**
|
|
158
|
+
* #volatile
|
|
159
|
+
* resize handle width between tree and msa area, px
|
|
160
|
+
*/
|
|
161
|
+
resizeHandleWidth: 5,
|
|
162
|
+
/**
|
|
163
|
+
* #volatile
|
|
164
|
+
* size of blocks of content to be drawn, px
|
|
165
|
+
*/
|
|
166
|
+
blockSize: 1000,
|
|
167
|
+
/**
|
|
168
|
+
* #volatile
|
|
169
|
+
* the currently mouse-hovered row
|
|
170
|
+
*/
|
|
171
|
+
mouseRow: undefined,
|
|
172
|
+
/**
|
|
173
|
+
* #volatile
|
|
174
|
+
* the currently mouse-hovered column
|
|
175
|
+
*/
|
|
176
|
+
mouseCol: undefined,
|
|
177
|
+
/**
|
|
178
|
+
* #volatile
|
|
179
|
+
* the currently mouse-click row
|
|
180
|
+
*/
|
|
181
|
+
mouseClickRow: undefined,
|
|
182
|
+
/**
|
|
183
|
+
* #volatile
|
|
184
|
+
* the currently mouse-click column
|
|
185
|
+
*/
|
|
186
|
+
mouseClickCol: undefined,
|
|
187
|
+
/**
|
|
188
|
+
* #volatile
|
|
189
|
+
* a dummy variable that is incremented when ref changes so autorun for
|
|
190
|
+
* drawing canvas commands will run
|
|
191
|
+
*/
|
|
192
|
+
nref: 0,
|
|
193
|
+
/**
|
|
194
|
+
* #volatile
|
|
195
|
+
*/
|
|
196
|
+
minimapHeight: 56,
|
|
197
|
+
/**
|
|
198
|
+
* #volatile
|
|
199
|
+
*/
|
|
200
|
+
marginLeft: 20,
|
|
201
|
+
/**
|
|
202
|
+
* #volatile
|
|
203
|
+
*/
|
|
204
|
+
error: undefined,
|
|
205
|
+
/**
|
|
206
|
+
* #volatile
|
|
207
|
+
*/
|
|
208
|
+
annotPos: undefined,
|
|
209
|
+
/**
|
|
210
|
+
* #volatile
|
|
211
|
+
*
|
|
212
|
+
*/
|
|
213
|
+
loadedInterProAnnotations: undefined,
|
|
214
|
+
/**
|
|
215
|
+
* #volatile
|
|
216
|
+
*/
|
|
217
|
+
interProScanJobIds: JSON.parse(localStorageGetItem('msaview-interproscanqueries') || '[]'),
|
|
218
|
+
}))
|
|
219
|
+
.actions(self => ({
|
|
220
|
+
/**
|
|
221
|
+
* #action
|
|
222
|
+
*/
|
|
223
|
+
setLoadingMSA(arg) {
|
|
224
|
+
self.loadingMSA = arg;
|
|
225
|
+
},
|
|
226
|
+
/**
|
|
227
|
+
* #action
|
|
228
|
+
*/
|
|
229
|
+
setLoadingTree(arg) {
|
|
230
|
+
self.loadingTree = arg;
|
|
231
|
+
},
|
|
232
|
+
/**
|
|
233
|
+
* #action
|
|
234
|
+
*/
|
|
235
|
+
setWidth(arg) {
|
|
236
|
+
self.width = arg;
|
|
237
|
+
},
|
|
238
|
+
/**
|
|
239
|
+
* #action
|
|
240
|
+
* set the height of the view in px
|
|
241
|
+
*/
|
|
242
|
+
setHeight(height) {
|
|
243
|
+
self.height = height;
|
|
244
|
+
},
|
|
245
|
+
/**
|
|
246
|
+
* #action
|
|
247
|
+
* set error state
|
|
248
|
+
*/
|
|
249
|
+
setError(error) {
|
|
250
|
+
self.error = error;
|
|
251
|
+
},
|
|
252
|
+
/**
|
|
253
|
+
* #action
|
|
254
|
+
* set mouse position (row, column) in the MSA
|
|
255
|
+
*/
|
|
256
|
+
setMousePos(col, row) {
|
|
257
|
+
self.mouseCol = col;
|
|
258
|
+
self.mouseRow = row;
|
|
259
|
+
},
|
|
260
|
+
/**
|
|
261
|
+
* #action
|
|
262
|
+
*/
|
|
263
|
+
setFeatureMode(arg) {
|
|
264
|
+
self.featureMode = arg;
|
|
265
|
+
},
|
|
266
|
+
/**
|
|
267
|
+
* #action
|
|
268
|
+
*/
|
|
269
|
+
setSubFeatureRows(arg) {
|
|
270
|
+
self.subFeatureRows = arg;
|
|
271
|
+
},
|
|
272
|
+
/**
|
|
273
|
+
* #action
|
|
274
|
+
* set mouse click position (row, column) in the MSA
|
|
275
|
+
*/
|
|
276
|
+
setMouseClickPos(col, row) {
|
|
277
|
+
self.mouseClickCol = col;
|
|
278
|
+
self.mouseClickRow = row;
|
|
279
|
+
},
|
|
280
|
+
/**
|
|
281
|
+
* #action
|
|
282
|
+
* set row height (px)
|
|
283
|
+
*/
|
|
284
|
+
setRowHeight(n) {
|
|
285
|
+
self.rowHeight = n;
|
|
286
|
+
},
|
|
287
|
+
/**
|
|
288
|
+
* #action
|
|
289
|
+
* set col width (px)
|
|
290
|
+
*/
|
|
291
|
+
setColWidth(n) {
|
|
292
|
+
self.colWidth = n;
|
|
293
|
+
},
|
|
294
|
+
/**
|
|
295
|
+
* #action
|
|
296
|
+
* set scroll Y-offset (px)
|
|
297
|
+
*/
|
|
298
|
+
setScrollY(n) {
|
|
299
|
+
self.scrollY = n;
|
|
300
|
+
},
|
|
301
|
+
/**
|
|
302
|
+
* #action
|
|
303
|
+
*
|
|
304
|
+
*/
|
|
305
|
+
setCurrentAlignment(n) {
|
|
306
|
+
self.currentAlignment = n;
|
|
307
|
+
},
|
|
308
|
+
/**
|
|
309
|
+
* #action
|
|
310
|
+
*/
|
|
311
|
+
toggleCollapsed(node) {
|
|
312
|
+
if (self.collapsed.includes(node)) {
|
|
313
|
+
self.collapsed.remove(node);
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
self.collapsed.push(node);
|
|
498
317
|
}
|
|
499
|
-
|
|
500
|
-
|
|
318
|
+
},
|
|
319
|
+
/**
|
|
320
|
+
* #action
|
|
321
|
+
*/
|
|
322
|
+
toggleCollapsed2(node) {
|
|
323
|
+
if (self.collapsed2.includes(node)) {
|
|
324
|
+
self.collapsed2.remove(node);
|
|
501
325
|
}
|
|
502
326
|
else {
|
|
503
|
-
|
|
327
|
+
self.collapsed2.push(node);
|
|
504
328
|
}
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
329
|
+
},
|
|
330
|
+
/**
|
|
331
|
+
* #action
|
|
332
|
+
*/
|
|
333
|
+
setShowOnly(node) {
|
|
334
|
+
self.showOnly = node;
|
|
335
|
+
},
|
|
336
|
+
/**
|
|
337
|
+
* #action
|
|
338
|
+
*/
|
|
339
|
+
setData(data) {
|
|
340
|
+
self.data = cast(data);
|
|
341
|
+
},
|
|
342
|
+
/**
|
|
343
|
+
* #action
|
|
344
|
+
*/
|
|
345
|
+
setMSAFilehandle(msaFilehandle) {
|
|
346
|
+
self.msaFilehandle = msaFilehandle;
|
|
347
|
+
},
|
|
348
|
+
/**
|
|
349
|
+
* #action
|
|
350
|
+
*/
|
|
351
|
+
setTreeFilehandle(treeFilehandle) {
|
|
352
|
+
self.treeFilehandle = treeFilehandle;
|
|
353
|
+
},
|
|
354
|
+
/**
|
|
355
|
+
* #action
|
|
356
|
+
*/
|
|
357
|
+
setMSA(result) {
|
|
358
|
+
self.data.setMSA(result);
|
|
359
|
+
},
|
|
360
|
+
/**
|
|
361
|
+
* #action
|
|
362
|
+
*/
|
|
363
|
+
setTree(result) {
|
|
364
|
+
self.data.setTree(result);
|
|
365
|
+
},
|
|
366
|
+
/**
|
|
367
|
+
* #action
|
|
368
|
+
*/
|
|
369
|
+
setTreeMetadata(result) {
|
|
370
|
+
self.data.setTreeMetadata(result);
|
|
371
|
+
},
|
|
372
|
+
}))
|
|
373
|
+
.views(self => ({
|
|
374
|
+
/**
|
|
375
|
+
* #method
|
|
376
|
+
* unused here, but can be used by derived classes to add extra items
|
|
377
|
+
*/
|
|
378
|
+
extraViewMenuItems() {
|
|
379
|
+
return [];
|
|
380
|
+
},
|
|
381
|
+
/**
|
|
382
|
+
* #getter
|
|
383
|
+
*/
|
|
384
|
+
get colorScheme() {
|
|
385
|
+
return colorSchemes[self.colorSchemeName];
|
|
386
|
+
},
|
|
387
|
+
/**
|
|
388
|
+
* #getter
|
|
389
|
+
*/
|
|
390
|
+
get header() {
|
|
391
|
+
return this.MSA?.getHeader() || {};
|
|
392
|
+
},
|
|
393
|
+
/**
|
|
394
|
+
* #method
|
|
395
|
+
*/
|
|
396
|
+
getRowData(name) {
|
|
397
|
+
return {
|
|
398
|
+
data: this.MSA?.getRowData(name),
|
|
525
399
|
};
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
400
|
+
},
|
|
401
|
+
/**
|
|
402
|
+
* #getter
|
|
403
|
+
*/
|
|
404
|
+
get alignmentNames() {
|
|
405
|
+
return this.MSA?.alignmentNames || [];
|
|
406
|
+
},
|
|
407
|
+
/**
|
|
408
|
+
* #getter
|
|
409
|
+
*/
|
|
410
|
+
get noTree() {
|
|
411
|
+
return !!this._tree.noTree;
|
|
412
|
+
},
|
|
413
|
+
/**
|
|
414
|
+
* #getter
|
|
415
|
+
*/
|
|
416
|
+
get noAnnotations() {
|
|
417
|
+
return !self.loadedInterProAnnotations;
|
|
418
|
+
},
|
|
419
|
+
/**
|
|
420
|
+
* #getter
|
|
421
|
+
*/
|
|
422
|
+
get menuItems() {
|
|
423
|
+
return [];
|
|
424
|
+
},
|
|
425
|
+
/**
|
|
426
|
+
* #getter
|
|
427
|
+
*/
|
|
428
|
+
get treeMetadata() {
|
|
429
|
+
return self.data.treeMetadata ? JSON.parse(self.data.treeMetadata) : {};
|
|
430
|
+
},
|
|
431
|
+
/**
|
|
432
|
+
* #getter
|
|
433
|
+
*/
|
|
434
|
+
get MSA() {
|
|
435
|
+
const text = self.data.msa;
|
|
436
|
+
if (text) {
|
|
437
|
+
if (Stockholm.sniff(text)) {
|
|
438
|
+
return new StockholmMSA(text, self.currentAlignment);
|
|
439
|
+
}
|
|
440
|
+
else if (text.startsWith('>')) {
|
|
441
|
+
return new FastaMSA(text);
|
|
442
|
+
}
|
|
443
|
+
else {
|
|
444
|
+
return new ClustalMSA(text);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
return null;
|
|
448
|
+
},
|
|
449
|
+
/**
|
|
450
|
+
* #getter
|
|
451
|
+
*/
|
|
452
|
+
get numColumns() {
|
|
453
|
+
return (this.MSA?.getWidth() || 0) - this.blanks.length;
|
|
454
|
+
},
|
|
455
|
+
/**
|
|
456
|
+
* #getter
|
|
457
|
+
*/
|
|
458
|
+
get _tree() {
|
|
459
|
+
const ret = self.data.tree
|
|
460
|
+
? generateNodeIds(parseNewick(self.data.tree))
|
|
461
|
+
: this.MSA?.getTree() || {
|
|
462
|
+
noTree: true,
|
|
463
|
+
branchset: [],
|
|
464
|
+
id: 'empty',
|
|
465
|
+
name: 'empty',
|
|
466
|
+
};
|
|
467
|
+
return reparseTree(ret);
|
|
468
|
+
},
|
|
469
|
+
/**
|
|
470
|
+
* #getter
|
|
471
|
+
*/
|
|
472
|
+
get rowNames() {
|
|
473
|
+
return this.hierarchy.leaves().map(n => n.data.name);
|
|
474
|
+
},
|
|
475
|
+
/**
|
|
476
|
+
* #getter
|
|
477
|
+
*/
|
|
478
|
+
get mouseOverRowName() {
|
|
479
|
+
const { mouseRow } = self;
|
|
480
|
+
return mouseRow !== undefined ? this.rowNames[mouseRow] : undefined;
|
|
481
|
+
},
|
|
482
|
+
/**
|
|
483
|
+
* #getter
|
|
484
|
+
*/
|
|
485
|
+
get root() {
|
|
486
|
+
let hier = hierarchy(this._tree, d => d.branchset)
|
|
487
|
+
.sum(d => (d.branchset ? 0 : 1))
|
|
488
|
+
.sort((a, b) => ascending(a.data.length || 1, b.data.length || 1));
|
|
489
|
+
if (self.showOnly) {
|
|
490
|
+
const res = hier.find(n => n.data.id === self.showOnly);
|
|
491
|
+
if (res) {
|
|
492
|
+
hier = res;
|
|
493
|
+
}
|
|
559
494
|
}
|
|
560
|
-
}
|
|
561
|
-
if (self.collapsed.length || self.collapsed2.length) {
|
|
562
495
|
;
|
|
563
496
|
[...self.collapsed, ...self.collapsed2]
|
|
564
497
|
.map(collapsedId => hier.find(node => node.data.id === collapsedId))
|
|
565
498
|
.filter(notEmpty)
|
|
566
499
|
.map(node => collapse(node));
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
const strs = this.hierarchy
|
|
601
|
-
.leaves()
|
|
602
|
-
.map(leaf => this.MSA?.getRow(leaf.data.name))
|
|
603
|
-
.filter((item) => !!item);
|
|
604
|
-
for (let i = 0; i < strs[0]?.length; i++) {
|
|
605
|
-
let counter = 0;
|
|
606
|
-
for (const str of strs) {
|
|
607
|
-
if (str[i] === '-') {
|
|
608
|
-
counter++;
|
|
500
|
+
return hier;
|
|
501
|
+
},
|
|
502
|
+
/**
|
|
503
|
+
* #getter
|
|
504
|
+
* widget width minus the tree area gives the space for the MSA
|
|
505
|
+
*/
|
|
506
|
+
get msaAreaWidth() {
|
|
507
|
+
return self.width - self.treeAreaWidth;
|
|
508
|
+
},
|
|
509
|
+
/**
|
|
510
|
+
* #getter
|
|
511
|
+
*/
|
|
512
|
+
get treeAreaWidthMinusMargin() {
|
|
513
|
+
return self.treeAreaWidth - self.marginLeft;
|
|
514
|
+
},
|
|
515
|
+
/**
|
|
516
|
+
* #getter
|
|
517
|
+
*/
|
|
518
|
+
get blanks() {
|
|
519
|
+
const blanks = [];
|
|
520
|
+
const strs = this.hierarchy
|
|
521
|
+
.leaves()
|
|
522
|
+
.map(leaf => this.MSA?.getRow(leaf.data.name))
|
|
523
|
+
.filter((item) => !!item);
|
|
524
|
+
for (let i = 0; i < strs[0]?.length; i++) {
|
|
525
|
+
let counter = 0;
|
|
526
|
+
for (const str of strs) {
|
|
527
|
+
if (str[i] === '-') {
|
|
528
|
+
counter++;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
if (counter === strs.length) {
|
|
532
|
+
blanks.push(i);
|
|
609
533
|
}
|
|
610
534
|
}
|
|
611
|
-
|
|
612
|
-
|
|
535
|
+
return blanks;
|
|
536
|
+
},
|
|
537
|
+
/**
|
|
538
|
+
* #getter
|
|
539
|
+
*/
|
|
540
|
+
get rows() {
|
|
541
|
+
const MSA = this.MSA;
|
|
542
|
+
return this.hierarchy
|
|
543
|
+
.leaves()
|
|
544
|
+
.map(leaf => [leaf.data.name, MSA?.getRow(leaf.data.name)])
|
|
545
|
+
.filter((f) => !!f[1]);
|
|
546
|
+
},
|
|
547
|
+
/**
|
|
548
|
+
* #getter
|
|
549
|
+
*/
|
|
550
|
+
get columns() {
|
|
551
|
+
return Object.fromEntries(this.rows.map((row, index) => [row[0], this.columns2d[index]]));
|
|
552
|
+
},
|
|
553
|
+
/**
|
|
554
|
+
* #getter
|
|
555
|
+
*/
|
|
556
|
+
get columns2d() {
|
|
557
|
+
return this.rows.map(r => r[1]).map(str => skipBlanks(this.blanks, str));
|
|
558
|
+
},
|
|
559
|
+
/**
|
|
560
|
+
* #getter
|
|
561
|
+
*/
|
|
562
|
+
get fontSize() {
|
|
563
|
+
return Math.min(Math.max(6, self.rowHeight - 8), 18);
|
|
564
|
+
},
|
|
565
|
+
/**
|
|
566
|
+
* #getter
|
|
567
|
+
*/
|
|
568
|
+
get colStats() {
|
|
569
|
+
const r = [];
|
|
570
|
+
const columns = this.columns2d;
|
|
571
|
+
for (const column of columns) {
|
|
572
|
+
for (let j = 0; j < column.length; j++) {
|
|
573
|
+
const l = r[j] || {};
|
|
574
|
+
if (!l[column[j]]) {
|
|
575
|
+
l[column[j]] = 0;
|
|
576
|
+
}
|
|
577
|
+
l[column[j]]++;
|
|
578
|
+
r[j] = l;
|
|
579
|
+
}
|
|
613
580
|
}
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
581
|
+
return r;
|
|
582
|
+
},
|
|
583
|
+
/**
|
|
584
|
+
* #getter
|
|
585
|
+
* generates a new tree that is clustered with x,y positions
|
|
586
|
+
*/
|
|
587
|
+
get hierarchy() {
|
|
588
|
+
const r = this.root;
|
|
589
|
+
const clust = cluster()
|
|
590
|
+
.size([this.totalHeight, self.treeWidth])
|
|
591
|
+
.separation(() => 1);
|
|
592
|
+
clust(r);
|
|
593
|
+
setBrLength(r, (r.data.length = 0), self.treeWidth / maxLength(r));
|
|
594
|
+
return r;
|
|
595
|
+
},
|
|
596
|
+
/**
|
|
597
|
+
* #getter
|
|
598
|
+
*/
|
|
599
|
+
get totalHeight() {
|
|
600
|
+
return this.root.leaves().length * self.rowHeight;
|
|
601
|
+
},
|
|
602
|
+
}))
|
|
603
|
+
.views(self => ({
|
|
604
|
+
/**
|
|
605
|
+
* #getter
|
|
606
|
+
*/
|
|
607
|
+
get totalWidth() {
|
|
608
|
+
return self.numColumns * self.colWidth;
|
|
609
|
+
},
|
|
610
|
+
}))
|
|
611
|
+
.views(self => ({
|
|
612
|
+
/**
|
|
613
|
+
* #getter
|
|
614
|
+
*/
|
|
615
|
+
get initialized() {
|
|
616
|
+
return (self.data.msa || self.data.tree) && !self.error;
|
|
617
|
+
},
|
|
618
|
+
/**
|
|
619
|
+
* #getter
|
|
620
|
+
*/
|
|
621
|
+
get blocksX() {
|
|
622
|
+
return blocksX({
|
|
623
|
+
viewportWidth: self.msaAreaWidth,
|
|
624
|
+
viewportX: -self.scrollX,
|
|
625
|
+
blockSize: self.blockSize,
|
|
626
|
+
mapWidth: self.totalWidth,
|
|
627
|
+
});
|
|
628
|
+
},
|
|
629
|
+
/**
|
|
630
|
+
* #getter
|
|
631
|
+
*/
|
|
632
|
+
get blocksY() {
|
|
633
|
+
return blocksY({
|
|
634
|
+
viewportHeight: self.height,
|
|
635
|
+
viewportY: -self.scrollY,
|
|
636
|
+
blockSize: self.blockSize,
|
|
637
|
+
mapHeight: self.totalHeight,
|
|
638
|
+
});
|
|
639
|
+
},
|
|
640
|
+
}))
|
|
641
|
+
.views(self => ({
|
|
642
|
+
/**
|
|
643
|
+
* #getter
|
|
644
|
+
*/
|
|
645
|
+
get blocks2d() {
|
|
646
|
+
const ret = [];
|
|
647
|
+
for (const by of self.blocksY) {
|
|
648
|
+
for (const bx of self.blocksX) {
|
|
649
|
+
ret.push([bx, by]);
|
|
656
650
|
}
|
|
657
|
-
l[column[j]]++;
|
|
658
|
-
r[j] = l;
|
|
659
651
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
});
|
|
723
|
-
},
|
|
724
|
-
}))
|
|
725
|
-
.views(self => ({
|
|
726
|
-
/**
|
|
727
|
-
* #getter
|
|
728
|
-
*/
|
|
729
|
-
get blocks2d() {
|
|
730
|
-
const ret = [];
|
|
731
|
-
for (const by of self.blocksY) {
|
|
732
|
-
for (const bx of self.blocksX) {
|
|
733
|
-
ret.push([bx, by]);
|
|
652
|
+
return ret;
|
|
653
|
+
},
|
|
654
|
+
/**
|
|
655
|
+
* #getter
|
|
656
|
+
*/
|
|
657
|
+
get isLoading() {
|
|
658
|
+
return self.loadingMSA || self.loadingTree;
|
|
659
|
+
},
|
|
660
|
+
/**
|
|
661
|
+
* #getter
|
|
662
|
+
*/
|
|
663
|
+
get maxScrollX() {
|
|
664
|
+
return -self.totalWidth + (self.msaAreaWidth - 100);
|
|
665
|
+
},
|
|
666
|
+
}))
|
|
667
|
+
.actions(self => ({
|
|
668
|
+
/**
|
|
669
|
+
* #action
|
|
670
|
+
*/
|
|
671
|
+
zoomIn() {
|
|
672
|
+
self.colWidth = Math.ceil(self.colWidth * 1.5);
|
|
673
|
+
self.rowHeight = Math.ceil(self.rowHeight * 1.5);
|
|
674
|
+
self.scrollX = clamp(self.maxScrollX, self.scrollX, 0);
|
|
675
|
+
},
|
|
676
|
+
/**
|
|
677
|
+
* #action
|
|
678
|
+
*/
|
|
679
|
+
zoomOut() {
|
|
680
|
+
self.colWidth = Math.max(1, Math.floor(self.colWidth * 0.75));
|
|
681
|
+
self.rowHeight = Math.max(1.5, Math.floor(self.rowHeight * 0.75));
|
|
682
|
+
self.scrollX = clamp(self.maxScrollX, self.scrollX, 0);
|
|
683
|
+
},
|
|
684
|
+
/**
|
|
685
|
+
* #action
|
|
686
|
+
*/
|
|
687
|
+
setLoadedInterProAnnotations(data) {
|
|
688
|
+
self.loadedInterProAnnotations = data;
|
|
689
|
+
},
|
|
690
|
+
/**
|
|
691
|
+
* #action
|
|
692
|
+
*/
|
|
693
|
+
doScrollY(deltaY) {
|
|
694
|
+
self.scrollY = clamp(-self.totalHeight + 10, self.scrollY + deltaY, 0);
|
|
695
|
+
},
|
|
696
|
+
/**
|
|
697
|
+
* #action
|
|
698
|
+
*/
|
|
699
|
+
doScrollX(deltaX) {
|
|
700
|
+
self.scrollX = clamp(self.maxScrollX, self.scrollX + deltaX, 0);
|
|
701
|
+
},
|
|
702
|
+
/**
|
|
703
|
+
* #action
|
|
704
|
+
*/
|
|
705
|
+
setScrollX(n) {
|
|
706
|
+
self.scrollX = clamp(self.maxScrollX, n, 0);
|
|
707
|
+
},
|
|
708
|
+
/**
|
|
709
|
+
* #action
|
|
710
|
+
*/
|
|
711
|
+
toggleTrack(id) {
|
|
712
|
+
if (self.turnedOffTracks.has(id)) {
|
|
713
|
+
self.turnedOffTracks.delete(id);
|
|
734
714
|
}
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
},
|
|
738
|
-
/**
|
|
739
|
-
* #getter
|
|
740
|
-
*/
|
|
741
|
-
get done() {
|
|
742
|
-
return self.initialized && (self.data.msa || self.data.tree);
|
|
743
|
-
},
|
|
744
|
-
/**
|
|
745
|
-
* #getter
|
|
746
|
-
*/
|
|
747
|
-
get maxScrollX() {
|
|
748
|
-
return -self.totalWidth + (self.msaAreaWidth - 100);
|
|
749
|
-
},
|
|
750
|
-
}))
|
|
751
|
-
.actions(self => ({
|
|
752
|
-
/**
|
|
753
|
-
* #action
|
|
754
|
-
*/
|
|
755
|
-
addUniprotTrack(node) {
|
|
756
|
-
if (self.boxTracks.some(t => t.name === node.name)) {
|
|
757
|
-
if (self.turnedOffTracks.has(node.name)) {
|
|
758
|
-
this.toggleTrack(node.name);
|
|
715
|
+
else {
|
|
716
|
+
self.turnedOffTracks.set(id, true);
|
|
759
717
|
}
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
/**
|
|
788
|
-
* #action
|
|
789
|
-
*/
|
|
790
|
-
setMouseoveredColumn(n, chain, file) {
|
|
791
|
-
let j = 0;
|
|
792
|
-
let i = 0;
|
|
793
|
-
const { id } = self.inverseStructures[file.slice(0, -4)] || {};
|
|
794
|
-
const row = self.MSA?.getRow(id);
|
|
795
|
-
if (row) {
|
|
796
|
-
for (i = 0; i < row.length && j < n; i++) {
|
|
797
|
-
if (row[i] !== '-') {
|
|
798
|
-
j++;
|
|
718
|
+
},
|
|
719
|
+
/**
|
|
720
|
+
* #action
|
|
721
|
+
*/
|
|
722
|
+
addInterProScanJobId(arg) {
|
|
723
|
+
self.interProScanJobIds = [
|
|
724
|
+
...self.interProScanJobIds,
|
|
725
|
+
{ jobId: arg, date: +Date.now() },
|
|
726
|
+
];
|
|
727
|
+
},
|
|
728
|
+
/**
|
|
729
|
+
* #action
|
|
730
|
+
*/
|
|
731
|
+
setStatus(status) {
|
|
732
|
+
self.status = status;
|
|
733
|
+
},
|
|
734
|
+
}))
|
|
735
|
+
.views(self => ({
|
|
736
|
+
/**
|
|
737
|
+
* #getter
|
|
738
|
+
*/
|
|
739
|
+
get labelsWidth() {
|
|
740
|
+
let x = 0;
|
|
741
|
+
const { rowHeight, hierarchy, treeMetadata, fontSize } = self;
|
|
742
|
+
if (rowHeight > 5) {
|
|
743
|
+
for (const node of hierarchy.leaves()) {
|
|
744
|
+
x = Math.max(measureTextCanvas(treeMetadata[node.data.name]?.genome || node.data.name, fontSize), x);
|
|
799
745
|
}
|
|
800
746
|
}
|
|
801
|
-
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
if (rowHeight > 5) {
|
|
827
|
-
for (const node of hierarchy.leaves()) {
|
|
828
|
-
x = Math.max(measureTextCanvas(treeMetadata[node.data.name]?.genome || node.data.name, fontSize), x);
|
|
747
|
+
return x;
|
|
748
|
+
},
|
|
749
|
+
/**
|
|
750
|
+
* #getter
|
|
751
|
+
*/
|
|
752
|
+
get secondaryStructureConsensus() {
|
|
753
|
+
return self.MSA?.secondaryStructureConsensus;
|
|
754
|
+
},
|
|
755
|
+
/**
|
|
756
|
+
* #getter
|
|
757
|
+
*/
|
|
758
|
+
get seqConsensus() {
|
|
759
|
+
return self.MSA?.seqConsensus;
|
|
760
|
+
},
|
|
761
|
+
/**
|
|
762
|
+
* #getter
|
|
763
|
+
*/
|
|
764
|
+
get conservation() {
|
|
765
|
+
if (self.columns2d.length) {
|
|
766
|
+
for (let i = 0; i < self.columns2d[0].length; i++) {
|
|
767
|
+
const col = [];
|
|
768
|
+
for (const column of self.columns2d) {
|
|
769
|
+
col.push(column[i]);
|
|
770
|
+
}
|
|
771
|
+
}
|
|
829
772
|
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
773
|
+
return ['a'];
|
|
774
|
+
},
|
|
775
|
+
/**
|
|
776
|
+
* #getter
|
|
777
|
+
*/
|
|
778
|
+
get adapterTrackModels() {
|
|
779
|
+
return (self.MSA?.tracks.map(t => ({
|
|
780
|
+
model: {
|
|
781
|
+
...t,
|
|
782
|
+
data: t.data ? skipBlanks(self.blanks, t.data) : undefined,
|
|
783
|
+
height: self.rowHeight,
|
|
784
|
+
},
|
|
785
|
+
ReactComponent: TextTrack,
|
|
786
|
+
})) || []);
|
|
787
|
+
},
|
|
788
|
+
/**
|
|
789
|
+
* #getter
|
|
790
|
+
*/
|
|
791
|
+
get tracks() {
|
|
792
|
+
return this.adapterTrackModels;
|
|
793
|
+
},
|
|
794
|
+
/**
|
|
795
|
+
* #getter
|
|
796
|
+
*/
|
|
797
|
+
get turnedOnTracks() {
|
|
798
|
+
return this.tracks.filter(f => !self.turnedOffTracks.has(f.model.id));
|
|
799
|
+
},
|
|
800
|
+
/**
|
|
801
|
+
* #method
|
|
802
|
+
* return a row-specific sequence coordinate, skipping gaps, given a global
|
|
803
|
+
* coordinate
|
|
804
|
+
*/
|
|
805
|
+
globalCoordToRowSpecificSeqCoord(rowName, position) {
|
|
806
|
+
const { rowNames, rows } = self;
|
|
807
|
+
const index = rowNames.indexOf(rowName);
|
|
808
|
+
if (index !== -1 && rows[index]) {
|
|
809
|
+
const row = rows[index][1];
|
|
810
|
+
let k = 0;
|
|
811
|
+
for (let i = 0; i < position; i++) {
|
|
812
|
+
if (row[i] !== '-') {
|
|
813
|
+
k++;
|
|
814
|
+
}
|
|
815
|
+
else if (k >= position) {
|
|
816
|
+
break;
|
|
817
|
+
}
|
|
854
818
|
}
|
|
819
|
+
return k;
|
|
855
820
|
}
|
|
856
|
-
}
|
|
857
|
-
return ['a'];
|
|
858
|
-
},
|
|
859
|
-
/**
|
|
860
|
-
* #getter
|
|
861
|
-
*/
|
|
862
|
-
get adapterTrackModels() {
|
|
863
|
-
return (self.MSA?.tracks.map(t => ({
|
|
864
|
-
model: {
|
|
865
|
-
...t,
|
|
866
|
-
data: t.data ? skipBlanks(self.blanks, t.data) : undefined,
|
|
867
|
-
height: self.rowHeight,
|
|
868
|
-
},
|
|
869
|
-
ReactComponent: TextTrack,
|
|
870
|
-
})) || []);
|
|
871
|
-
},
|
|
872
|
-
/**
|
|
873
|
-
* #getter
|
|
874
|
-
*/
|
|
875
|
-
get boxTrackModels() {
|
|
876
|
-
return self.boxTracks
|
|
877
|
-
.filter(track => self.rows.some(row => row[0] === track.name))
|
|
878
|
-
.map(track => ({
|
|
879
|
-
model: track,
|
|
880
|
-
ReactComponent: BoxTrack,
|
|
881
|
-
}));
|
|
882
|
-
},
|
|
883
|
-
/**
|
|
884
|
-
* #getter
|
|
885
|
-
*/
|
|
886
|
-
get tracks() {
|
|
887
|
-
return [...this.adapterTrackModels, ...this.boxTrackModels];
|
|
888
|
-
},
|
|
889
|
-
/**
|
|
890
|
-
* #getter
|
|
891
|
-
*/
|
|
892
|
-
get turnedOnTracks() {
|
|
893
|
-
return this.tracks.filter(f => !self.turnedOffTracks.has(f.model.id));
|
|
894
|
-
},
|
|
895
|
-
/**
|
|
896
|
-
* #method
|
|
897
|
-
* returns coordinate in the current relative coordinate scheme
|
|
898
|
-
*/
|
|
899
|
-
pxToBp(coord) {
|
|
900
|
-
return Math.floor((coord - self.scrollX) / self.colWidth);
|
|
901
|
-
},
|
|
902
|
-
/**
|
|
903
|
-
* #method
|
|
904
|
-
*/
|
|
905
|
-
rowSpecificBpToPx(rowName, position) {
|
|
906
|
-
const { rowNames, rows } = self;
|
|
907
|
-
const index = rowNames.indexOf(rowName);
|
|
908
|
-
const row = rows[index][1];
|
|
909
|
-
const details = self.getRowData(rowName);
|
|
910
|
-
const offset = details.range?.start || 0;
|
|
911
|
-
const current = position - offset;
|
|
912
|
-
const s = new Set(self.blanks);
|
|
913
|
-
if (current < 0) {
|
|
914
821
|
return 0;
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
for (let k = 0; k < self.rows[0]?.[1].length; k++) {
|
|
938
|
-
if (s.has(k) && k < position + 1) {
|
|
939
|
-
count++;
|
|
822
|
+
},
|
|
823
|
+
/**
|
|
824
|
+
* #method
|
|
825
|
+
* return a global coordinate given a row-specific sequence coordinate
|
|
826
|
+
* which does not not include gaps
|
|
827
|
+
*/
|
|
828
|
+
seqCoordToRowSpecificGlobalCoord(rowName, position) {
|
|
829
|
+
const { rowNames, rows } = self;
|
|
830
|
+
const index = rowNames.indexOf(rowName);
|
|
831
|
+
if (index !== -1 && rows[index]) {
|
|
832
|
+
const row = rows[index][1];
|
|
833
|
+
let k = 0;
|
|
834
|
+
let i = 0;
|
|
835
|
+
for (; k < position; i++) {
|
|
836
|
+
if (row[i] !== '-') {
|
|
837
|
+
k++;
|
|
838
|
+
}
|
|
839
|
+
else if (k >= position) {
|
|
840
|
+
break;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
return i;
|
|
940
844
|
}
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
}
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
845
|
+
return 0;
|
|
846
|
+
},
|
|
847
|
+
}))
|
|
848
|
+
.views(self => ({
|
|
849
|
+
/**
|
|
850
|
+
* #getter
|
|
851
|
+
* total height of track area (px)
|
|
852
|
+
*/
|
|
853
|
+
get totalTrackAreaHeight() {
|
|
854
|
+
return sum(self.turnedOnTracks.map(r => r.model.height));
|
|
855
|
+
},
|
|
856
|
+
/**
|
|
857
|
+
* #getter
|
|
858
|
+
*/
|
|
859
|
+
get tidyTypes() {
|
|
860
|
+
const types = new Map();
|
|
861
|
+
if (this.tidyAnnotations) {
|
|
862
|
+
for (const { name, accession, description } of this.tidyAnnotations) {
|
|
863
|
+
types.set(accession, { name, accession, description });
|
|
956
864
|
}
|
|
957
|
-
|
|
958
|
-
|
|
865
|
+
}
|
|
866
|
+
return types;
|
|
867
|
+
},
|
|
868
|
+
get tidyAnnotations() {
|
|
869
|
+
const ret = [];
|
|
870
|
+
const { loadedInterProAnnotations } = self;
|
|
871
|
+
if (loadedInterProAnnotations) {
|
|
872
|
+
for (const [id, val] of Object.entries(loadedInterProAnnotations)) {
|
|
873
|
+
for (const { signature, locations } of val.matches) {
|
|
874
|
+
const { entry } = signature;
|
|
875
|
+
if (entry) {
|
|
876
|
+
const { name, accession, description } = entry;
|
|
877
|
+
for (const { start, end } of locations) {
|
|
878
|
+
ret.push({
|
|
879
|
+
id,
|
|
880
|
+
name,
|
|
881
|
+
accession,
|
|
882
|
+
description,
|
|
883
|
+
start,
|
|
884
|
+
end,
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
959
889
|
}
|
|
960
890
|
}
|
|
961
|
-
return
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
891
|
+
return ret.sort((a, b) => len(b) - len(a));
|
|
892
|
+
},
|
|
893
|
+
/**
|
|
894
|
+
* #getter
|
|
895
|
+
*/
|
|
896
|
+
get tidyFilteredAnnotations() {
|
|
897
|
+
return this.tidyAnnotations.filter(r => self.featureFilters.get(r.accession));
|
|
898
|
+
},
|
|
899
|
+
/**
|
|
900
|
+
* #getter
|
|
901
|
+
*/
|
|
902
|
+
get tidyFilteredGatheredAnnotations() {
|
|
903
|
+
return groupBy(this.tidyFilteredAnnotations, r => r.id);
|
|
904
|
+
},
|
|
905
|
+
}))
|
|
906
|
+
.views(self => ({
|
|
907
|
+
get fillPalette() {
|
|
908
|
+
const arr = [...self.tidyTypes.keys()];
|
|
974
909
|
let i = 0;
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
break;
|
|
981
|
-
}
|
|
910
|
+
const map = {};
|
|
911
|
+
for (const key of arr) {
|
|
912
|
+
const k = Math.min(arr.length - 1, palettes.length - 1);
|
|
913
|
+
map[key] = palettes[k][i];
|
|
914
|
+
i++;
|
|
982
915
|
}
|
|
983
|
-
return
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
916
|
+
return map;
|
|
917
|
+
},
|
|
918
|
+
get strokePalette() {
|
|
919
|
+
return Object.fromEntries(Object.entries(this.fillPalette).map(([key, val]) => [
|
|
920
|
+
key,
|
|
921
|
+
colord(val).darken(0.1).toHex(),
|
|
922
|
+
]));
|
|
923
|
+
},
|
|
924
|
+
}))
|
|
925
|
+
.actions(self => ({
|
|
926
|
+
/**
|
|
927
|
+
* #action
|
|
928
|
+
*/
|
|
929
|
+
async loadInterProScanResults(jobId) {
|
|
930
|
+
self.setStatus({ msg: 'Loading ' + jobId });
|
|
931
|
+
const ret = await loadInterProScanResults(jobId);
|
|
932
|
+
self.setStatus();
|
|
933
|
+
self.setLoadedInterProAnnotations(Object.fromEntries(ret.results.map(r => [r.xref[0].id, r])));
|
|
934
|
+
},
|
|
935
|
+
/**
|
|
936
|
+
* #action
|
|
937
|
+
*/
|
|
938
|
+
async queryInterProScan(programs) {
|
|
939
|
+
const { rows } = self;
|
|
940
|
+
if (rows.length > 140) {
|
|
941
|
+
throw new Error('Too many sequences, please run InterProScan offline');
|
|
996
942
|
}
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
943
|
+
const ret = await launchInterProScan({
|
|
944
|
+
algorithm: 'interproscan',
|
|
945
|
+
programs: programs,
|
|
946
|
+
seq: rows
|
|
947
|
+
.map(row => `>${row[0]}\n${row[1].replaceAll('-', '')}`)
|
|
948
|
+
.join('\n'),
|
|
949
|
+
onProgress: arg => self.setStatus(arg),
|
|
950
|
+
onJobId: jobId => self.addInterProScanJobId(jobId),
|
|
951
|
+
});
|
|
952
|
+
self.setLoadedInterProAnnotations(Object.fromEntries(ret.results.map(r => [r.xref[0].id, r])));
|
|
953
|
+
},
|
|
954
|
+
/**
|
|
955
|
+
* #action
|
|
956
|
+
*/
|
|
957
|
+
reset() {
|
|
958
|
+
transaction(() => {
|
|
959
|
+
self.setData({ tree: '', msa: '' });
|
|
960
|
+
self.setScrollY(0);
|
|
961
|
+
self.setScrollX(0);
|
|
962
|
+
self.setCurrentAlignment(0);
|
|
963
|
+
self.setTreeFilehandle(undefined);
|
|
964
|
+
self.setMSAFilehandle(undefined);
|
|
965
|
+
});
|
|
966
|
+
},
|
|
967
|
+
/**
|
|
968
|
+
* #action
|
|
969
|
+
*/
|
|
970
|
+
async exportSVG(opts) {
|
|
971
|
+
const { renderToSvg } = await import('./renderToSvg');
|
|
972
|
+
const html = await renderToSvg(self, opts);
|
|
973
|
+
const blob = new Blob([html], { type: 'image/svg+xml' });
|
|
974
|
+
saveAs(blob, 'image.svg');
|
|
975
|
+
},
|
|
976
|
+
/**
|
|
977
|
+
* #action
|
|
978
|
+
* internal, used for drawing to canvas
|
|
979
|
+
*/
|
|
980
|
+
incrementRef() {
|
|
981
|
+
self.nref++;
|
|
982
|
+
},
|
|
983
|
+
/**
|
|
984
|
+
* #action
|
|
985
|
+
*/
|
|
986
|
+
initFilter(arg) {
|
|
987
|
+
const ret = self.featureFilters.get(arg);
|
|
988
|
+
if (ret === undefined) {
|
|
989
|
+
self.featureFilters.set(arg, true);
|
|
1039
990
|
}
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
991
|
+
},
|
|
992
|
+
/**
|
|
993
|
+
* #action
|
|
994
|
+
*/
|
|
995
|
+
setFilter(arg, flag) {
|
|
996
|
+
self.featureFilters.set(arg, flag);
|
|
997
|
+
},
|
|
998
|
+
afterCreate() {
|
|
999
|
+
addDisposer(self, autorun(() => {
|
|
1000
|
+
for (const key of self.tidyTypes.keys()) {
|
|
1001
|
+
this.initFilter(key);
|
|
1047
1002
|
}
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1003
|
+
}));
|
|
1004
|
+
addDisposer(self, autorun(async () => {
|
|
1005
|
+
// const res = Object.fromEntries(
|
|
1006
|
+
// await Promise.all(
|
|
1007
|
+
// self.annotationTracks.map(async f => {
|
|
1008
|
+
// const d = await jsonfetch(
|
|
1009
|
+
// `https://jbrowse.org/demos/interproscan/json/${encodeURIComponent(f)}`,
|
|
1010
|
+
// )
|
|
1011
|
+
// return [
|
|
1012
|
+
// decodeURIComponent(f).replace('.json', ''),
|
|
1013
|
+
// d.result.results[0],
|
|
1014
|
+
// ] as const
|
|
1015
|
+
// }),
|
|
1016
|
+
// ),
|
|
1017
|
+
// )
|
|
1018
|
+
// self.setLoadedInterProAnnotations(res)
|
|
1019
|
+
}));
|
|
1020
|
+
// autorun opens treeFilehandle
|
|
1021
|
+
addDisposer(self, autorun(async () => {
|
|
1022
|
+
const { treeFilehandle } = self;
|
|
1023
|
+
if (treeFilehandle) {
|
|
1024
|
+
try {
|
|
1025
|
+
self.setLoadingTree(true);
|
|
1026
|
+
self.setTree(await openLocation(treeFilehandle).readFile('utf8'));
|
|
1027
|
+
if (treeFilehandle.locationType === 'BlobLocation') {
|
|
1028
|
+
// clear filehandle after loading if from a local file
|
|
1029
|
+
self.setTreeFilehandle(undefined);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
catch (e) {
|
|
1033
|
+
console.error(e);
|
|
1034
|
+
self.setError(e);
|
|
1035
|
+
}
|
|
1036
|
+
finally {
|
|
1037
|
+
self.setLoadingTree(false);
|
|
1038
|
+
}
|
|
1051
1039
|
}
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1040
|
+
}));
|
|
1041
|
+
// autorun opens treeMetadataFilehandle
|
|
1042
|
+
addDisposer(self, autorun(async () => {
|
|
1043
|
+
const { treeMetadataFilehandle } = self;
|
|
1044
|
+
if (treeMetadataFilehandle) {
|
|
1045
|
+
try {
|
|
1046
|
+
self.setTreeMetadata(await openLocation(treeMetadataFilehandle).readFile('utf8'));
|
|
1047
|
+
}
|
|
1048
|
+
catch (e) {
|
|
1049
|
+
console.error(e);
|
|
1050
|
+
self.setError(e);
|
|
1051
|
+
}
|
|
1060
1052
|
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1053
|
+
}));
|
|
1054
|
+
// autorun opens msaFilehandle
|
|
1055
|
+
addDisposer(self, autorun(async () => {
|
|
1056
|
+
const { msaFilehandle } = self;
|
|
1057
|
+
if (msaFilehandle) {
|
|
1058
|
+
try {
|
|
1059
|
+
self.setLoadingMSA(true);
|
|
1060
|
+
const res = await openLocation(msaFilehandle).readFile('utf8');
|
|
1061
|
+
transaction(() => {
|
|
1062
|
+
self.setMSA(res);
|
|
1063
|
+
if (msaFilehandle.locationType === 'BlobLocation') {
|
|
1064
|
+
// clear filehandle after loading if from a local file
|
|
1065
|
+
self.setMSAFilehandle(undefined);
|
|
1066
|
+
}
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
catch (e) {
|
|
1070
|
+
console.error(e);
|
|
1071
|
+
self.setError(e);
|
|
1072
|
+
}
|
|
1073
|
+
finally {
|
|
1074
|
+
self.setLoadingMSA(false);
|
|
1075
|
+
}
|
|
1064
1076
|
}
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
}))
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1077
|
+
}));
|
|
1078
|
+
// autorun synchronizes treeWidth with treeAreaWidth
|
|
1079
|
+
addDisposer(self, autorun(async () => {
|
|
1080
|
+
if (self.treeWidthMatchesArea) {
|
|
1081
|
+
self.setTreeWidth(Math.max(50, self.treeAreaWidth - self.labelsWidth - 10 - self.marginLeft));
|
|
1082
|
+
}
|
|
1083
|
+
}));
|
|
1084
|
+
addDisposer(self, autorun(() => {
|
|
1085
|
+
localStorageSetItem('msaview-interproscanqueries', JSON.stringify(self.interProScanJobIds));
|
|
1086
|
+
}));
|
|
1087
|
+
},
|
|
1088
|
+
}))
|
|
1089
|
+
.postProcessSnapshot(result => {
|
|
1090
|
+
const snap = result;
|
|
1091
|
+
const { data: { tree, msa, treeMetadata }, ...rest } = snap;
|
|
1092
|
+
// remove the MSA/tree data from the tree if the filehandle available in
|
|
1093
|
+
// which case it can be reloaded on refresh
|
|
1094
|
+
return {
|
|
1095
|
+
data: {
|
|
1096
|
+
...(result.treeFilehandle ? {} : { tree }),
|
|
1097
|
+
...(result.msaFilehandle ? {} : { msa }),
|
|
1098
|
+
...(result.treeMetadataFilehandle ? {} : { treeMetadata }),
|
|
1099
|
+
},
|
|
1100
|
+
...rest,
|
|
1101
|
+
};
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
export default stateModelFactory;
|
|
1091
1105
|
//# sourceMappingURL=model.js.map
|