react-msaview 5.0.6 → 5.0.13

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.
Files changed (190) hide show
  1. package/bundle/index.js +106 -106
  2. package/bundle/index.js.LICENSE.txt +1 -1
  3. package/bundle/index.js.map +1 -1
  4. package/dist/components/Checkbox2.js +3 -6
  5. package/dist/components/Checkbox2.js.map +1 -1
  6. package/dist/components/MSAViewer.d.ts +14 -0
  7. package/dist/components/MSAViewer.js +34 -0
  8. package/dist/components/MSAViewer.js.map +1 -0
  9. package/dist/components/Track.d.ts +0 -4
  10. package/dist/components/Track.js +6 -26
  11. package/dist/components/Track.js.map +1 -1
  12. package/dist/components/dialogs/DomainDialog.js +2 -5
  13. package/dist/components/dialogs/DomainDialog.js.map +1 -1
  14. package/dist/components/dialogs/InterProScanDialog.js +7 -7
  15. package/dist/components/dialogs/InterProScanDialog.js.map +1 -1
  16. package/dist/components/dialogs/SettingsDialog.js +3 -19
  17. package/dist/components/dialogs/SettingsDialog.js.map +1 -1
  18. package/dist/components/header/ColorSchemeMenu.d.ts +6 -0
  19. package/dist/components/header/ColorSchemeMenu.js +19 -0
  20. package/dist/components/header/ColorSchemeMenu.js.map +1 -0
  21. package/dist/components/header/{ZoomStar.d.ts → FileMenu.d.ts} +2 -2
  22. package/dist/components/header/FileMenu.js +71 -0
  23. package/dist/components/header/FileMenu.js.map +1 -0
  24. package/dist/components/header/Header.js +8 -6
  25. package/dist/components/header/Header.js.map +1 -1
  26. package/dist/components/header/HeaderMenu.js +3 -145
  27. package/dist/components/header/HeaderMenu.js.map +1 -1
  28. package/dist/components/header/MSASettingsMenu.d.ts +6 -0
  29. package/dist/components/header/MSASettingsMenu.js +36 -0
  30. package/dist/components/header/MSASettingsMenu.js.map +1 -0
  31. package/dist/components/header/SettingsMenu.js +1 -21
  32. package/dist/components/header/SettingsMenu.js.map +1 -1
  33. package/dist/components/header/TreeSettingsMenu.d.ts +6 -0
  34. package/dist/components/header/TreeSettingsMenu.js +74 -0
  35. package/dist/components/header/TreeSettingsMenu.js.map +1 -0
  36. package/dist/components/header/ZoomMenu.js +0 -8
  37. package/dist/components/header/ZoomMenu.js.map +1 -1
  38. package/dist/components/header/getDomainsMenu.d.ts +31 -0
  39. package/dist/components/header/getDomainsMenu.js +75 -0
  40. package/dist/components/header/getDomainsMenu.js.map +1 -0
  41. package/dist/components/import/ImportFormExamples.js +21 -19
  42. package/dist/components/import/ImportFormExamples.js.map +1 -1
  43. package/dist/components/msa/MSACanvas.js +13 -89
  44. package/dist/components/msa/MSACanvas.js.map +1 -1
  45. package/dist/components/msa/MSACanvasBlock.js +1 -3
  46. package/dist/components/msa/MSACanvasBlock.js.map +1 -1
  47. package/dist/components/msa/renderMSABlock.js +2 -4
  48. package/dist/components/msa/renderMSABlock.js.map +1 -1
  49. package/dist/components/msa/renderMSAMouseover.js +1 -7
  50. package/dist/components/msa/renderMSAMouseover.js.map +1 -1
  51. package/dist/components/tree/TreeCanvas.js +18 -101
  52. package/dist/components/tree/TreeCanvas.js.map +1 -1
  53. package/dist/components/tree/TreeCanvasBlock.js +33 -1
  54. package/dist/components/tree/TreeCanvasBlock.js.map +1 -1
  55. package/dist/components/tree/TreeNodeMenu.js +5 -16
  56. package/dist/components/tree/TreeNodeMenu.js.map +1 -1
  57. package/dist/components/tree/renderTreeCanvas.js +4 -12
  58. package/dist/components/tree/renderTreeCanvas.js.map +1 -1
  59. package/dist/constants.d.ts +0 -2
  60. package/dist/constants.js +0 -2
  61. package/dist/constants.js.map +1 -1
  62. package/dist/fetchUtils.d.ts +0 -1
  63. package/dist/fetchUtils.js +0 -4
  64. package/dist/fetchUtils.js.map +1 -1
  65. package/dist/flatToTree.d.ts +0 -5
  66. package/dist/flatToTree.js +13 -30
  67. package/dist/flatToTree.js.map +1 -1
  68. package/dist/hierarchy.d.ts +28 -0
  69. package/dist/hierarchy.js +164 -0
  70. package/dist/hierarchy.js.map +1 -0
  71. package/dist/index.d.ts +2 -0
  72. package/dist/index.js +1 -0
  73. package/dist/index.js.map +1 -1
  74. package/dist/launchInterProScan.d.ts +0 -5
  75. package/dist/launchInterProScan.js +5 -3
  76. package/dist/launchInterProScan.js.map +1 -1
  77. package/dist/model/DataModel.d.ts +9 -0
  78. package/dist/model/DataModel.js +12 -1
  79. package/dist/model/DataModel.js.map +1 -1
  80. package/dist/model/msaModel.d.ts +3 -0
  81. package/dist/model/msaModel.js +0 -1
  82. package/dist/model/msaModel.js.map +1 -1
  83. package/dist/model/treeModel.d.ts +3 -6
  84. package/dist/model/treeModel.js +3 -15
  85. package/dist/model/treeModel.js.map +1 -1
  86. package/dist/model.d.ts +34 -77
  87. package/dist/model.js +140 -239
  88. package/dist/model.js.map +1 -1
  89. package/dist/neighborJoining.js +40 -633
  90. package/dist/neighborJoining.js.map +1 -1
  91. package/dist/parseAsn1.d.ts +0 -12
  92. package/dist/parseAsn1.js +125 -332
  93. package/dist/parseAsn1.js.map +1 -1
  94. package/dist/useWheelScroll.d.ts +8 -0
  95. package/dist/useWheelScroll.js +93 -0
  96. package/dist/useWheelScroll.js.map +1 -0
  97. package/dist/util.d.ts +1 -6
  98. package/dist/util.js +5 -34
  99. package/dist/util.js.map +1 -1
  100. package/dist/vendor/copyToClipboard.d.ts +1 -10
  101. package/dist/vendor/copyToClipboard.js +14 -109
  102. package/dist/vendor/copyToClipboard.js.map +1 -1
  103. package/dist/vendor/fileSaver.d.ts +1 -11
  104. package/dist/vendor/fileSaver.js +7 -76
  105. package/dist/vendor/fileSaver.js.map +1 -1
  106. package/dist/version.d.ts +1 -1
  107. package/dist/version.js +1 -1
  108. package/dist/version.js.map +1 -1
  109. package/package.json +14 -14
  110. package/src/collapseLogic.test.ts +115 -0
  111. package/src/components/Checkbox2.tsx +9 -18
  112. package/src/components/MSAViewer.tsx +67 -0
  113. package/src/components/Track.tsx +11 -30
  114. package/src/components/dialogs/DomainDialog.tsx +4 -5
  115. package/src/components/dialogs/InterProScanDialog.tsx +7 -7
  116. package/src/components/dialogs/SettingsDialog.tsx +0 -37
  117. package/src/components/header/ColorSchemeMenu.tsx +35 -0
  118. package/src/components/header/FileMenu.tsx +84 -0
  119. package/src/components/header/Header.tsx +8 -6
  120. package/src/components/header/HeaderMenu.tsx +4 -155
  121. package/src/components/header/MSASettingsMenu.tsx +48 -0
  122. package/src/components/header/SettingsMenu.tsx +0 -23
  123. package/src/components/header/TreeSettingsMenu.tsx +96 -0
  124. package/src/components/header/ZoomMenu.tsx +0 -8
  125. package/src/components/header/getDomainsMenu.ts +83 -0
  126. package/src/components/import/ImportFormExamples.tsx +37 -34
  127. package/src/components/msa/MSACanvas.tsx +21 -97
  128. package/src/components/msa/MSACanvasBlock.tsx +1 -3
  129. package/src/components/msa/renderBoxFeatureCanvasBlock.ts +1 -1
  130. package/src/components/msa/renderMSABlock.ts +2 -5
  131. package/src/components/msa/renderMSAMouseover.ts +0 -6
  132. package/src/components/tree/TreeCanvas.tsx +48 -111
  133. package/src/components/tree/TreeCanvasBlock.tsx +44 -0
  134. package/src/components/tree/TreeNodeMenu.tsx +5 -14
  135. package/src/components/tree/renderTreeCanvas.ts +8 -21
  136. package/src/constants.ts +0 -2
  137. package/src/fetchUtils.ts +0 -5
  138. package/src/flatToTree.ts +20 -38
  139. package/src/hierarchy.test.ts +120 -0
  140. package/src/hierarchy.ts +220 -0
  141. package/src/index.ts +2 -0
  142. package/src/launchInterProScan.ts +4 -3
  143. package/src/model/DataModel.ts +12 -1
  144. package/src/model/msaModel.ts +0 -2
  145. package/src/model/treeModel.ts +2 -18
  146. package/src/model.ts +203 -278
  147. package/src/neighborJoining.test.ts +15 -7
  148. package/src/neighborJoining.ts +40 -632
  149. package/src/parseAsn1.test.ts +5 -2
  150. package/src/parseAsn1.ts +135 -405
  151. package/src/useWheelScroll.ts +109 -0
  152. package/src/util.ts +5 -50
  153. package/src/vendor/copyToClipboard.ts +14 -122
  154. package/src/vendor/fileSaver.ts +8 -105
  155. package/src/version.ts +1 -1
  156. package/dist/components/dialogs/AddTrackDialog.d.ts +0 -8
  157. package/dist/components/dialogs/AddTrackDialog.js +0 -30
  158. package/dist/components/dialogs/AddTrackDialog.js.map +0 -1
  159. package/dist/components/dialogs/TabPanel.d.ts +0 -6
  160. package/dist/components/dialogs/TabPanel.js +0 -6
  161. package/dist/components/dialogs/TabPanel.js.map +0 -1
  162. package/dist/components/header/ZoomStar.js +0 -40
  163. package/dist/components/header/ZoomStar.js.map +0 -1
  164. package/dist/createPaletteMap.test.d.ts +0 -1
  165. package/dist/createPaletteMap.test.js +0 -49
  166. package/dist/createPaletteMap.test.js.map +0 -1
  167. package/dist/layout.d.ts +0 -26
  168. package/dist/layout.js +0 -74
  169. package/dist/layout.js.map +0 -1
  170. package/dist/neighborJoining.test.d.ts +0 -1
  171. package/dist/neighborJoining.test.js +0 -110
  172. package/dist/neighborJoining.test.js.map +0 -1
  173. package/dist/parseAsn1.test.d.ts +0 -1
  174. package/dist/parseAsn1.test.js +0 -8
  175. package/dist/parseAsn1.test.js.map +0 -1
  176. package/dist/reparseTree.d.ts +0 -2
  177. package/dist/reparseTree.js +0 -15
  178. package/dist/reparseTree.js.map +0 -1
  179. package/dist/rowCoordinateCalculations.test.d.ts +0 -1
  180. package/dist/rowCoordinateCalculations.test.js +0 -224
  181. package/dist/rowCoordinateCalculations.test.js.map +0 -1
  182. package/dist/seqPosToGlobalCol.test.d.ts +0 -1
  183. package/dist/seqPosToGlobalCol.test.js +0 -60
  184. package/dist/seqPosToGlobalCol.test.js.map +0 -1
  185. package/src/components/dialogs/AddTrackDialog.tsx +0 -85
  186. package/src/components/dialogs/TabPanel.tsx +0 -19
  187. package/src/components/header/ZoomStar.tsx +0 -74
  188. package/src/createPaletteMap.test.ts +0 -57
  189. package/src/layout.ts +0 -118
  190. package/src/reparseTree.ts +0 -18
@@ -1,75 +1,17 @@
1
- import React, { lazy } from 'react'
1
+ import React from 'react'
2
2
 
3
3
  import CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton'
4
- import AccountTree from '@mui/icons-material/AccountTree'
5
- import Assignment from '@mui/icons-material/Assignment'
6
- import FilterAlt from '@mui/icons-material/FilterAlt'
7
- import FolderOpen from '@mui/icons-material/FolderOpen'
8
4
  import MoreVert from '@mui/icons-material/Menu'
9
- import PhotoCamera from '@mui/icons-material/PhotoCamera'
10
- import Search from '@mui/icons-material/Search'
11
- import Sort from '@mui/icons-material/Sort'
12
5
  import Visibility from '@mui/icons-material/Visibility'
13
6
  import { observer } from 'mobx-react'
14
7
 
15
8
  import type { MsaViewModel } from '../../model.ts'
16
9
 
17
- // lazies
18
- const MetadataDialog = lazy(() => import('../dialogs/MetadataDialog.tsx'))
19
- const ExportSVGDialog = lazy(() => import('../dialogs/ExportSVGDialog.tsx'))
20
- const FeatureFilterDialog = lazy(() => import('../dialogs/FeatureDialog.tsx'))
21
- const SettingsDialog = lazy(() => import('../dialogs/SettingsDialog.tsx'))
22
- const UserProvidedDomainsDialog = lazy(
23
- () => import('../dialogs/UserProvidedDomainsDialog.tsx'),
24
- )
25
- const InterProScanDialog = lazy(
26
- () => import('../dialogs/InterProScanDialog.tsx'),
27
- )
28
-
29
10
  const HeaderMenu = observer(({ model }: { model: MsaViewModel }) => {
30
- const {
31
- showDomains,
32
- actuallyShowDomains,
33
- subFeatureRows,
34
- noDomains,
35
- tracks,
36
- turnedOffTracks,
37
- } = model
11
+ const { tracks, turnedOffTracks } = model
38
12
  return (
39
13
  <CascadingMenuButton
40
14
  menuItems={[
41
- {
42
- label: 'Return to import form',
43
- icon: FolderOpen,
44
- onClick: () => {
45
- model.reset()
46
- },
47
- },
48
- {
49
- label: 'Metadata',
50
- icon: Assignment,
51
- onClick: () => {
52
- model.queueDialog(onClose => [
53
- MetadataDialog,
54
- {
55
- model,
56
- onClose,
57
- },
58
- ])
59
- },
60
- },
61
- {
62
- label: 'More settings',
63
- onClick: () => {
64
- model.queueDialog(onClose => [
65
- SettingsDialog,
66
- {
67
- model,
68
- onClose,
69
- },
70
- ])
71
- },
72
- },
73
15
  {
74
16
  label: 'Tracks',
75
17
  icon: Visibility,
@@ -83,103 +25,10 @@ const HeaderMenu = observer(({ model }: { model: MsaViewModel }) => {
83
25
  },
84
26
  })),
85
27
  },
86
- {
87
- label: 'Export SVG',
88
- icon: PhotoCamera,
89
- onClick: () => {
90
- model.queueDialog(onClose => [
91
- ExportSVGDialog,
92
- {
93
- onClose,
94
- model,
95
- },
96
- ])
97
- },
98
- },
99
- ...(model.rows.length >= 2
100
- ? [
101
- {
102
- label: 'Calculate neighbor joining tree (BLOSUM62)',
103
- icon: AccountTree,
104
- onClick: () => {
105
- try {
106
- model.calculateNeighborJoiningTreeFromMSA()
107
- } catch (e) {
108
- console.error('Failed to calculate NJ tree:', e)
109
- model.setError(e)
110
- }
111
- },
112
- },
113
- ]
114
- : []),
115
- {
116
- label: 'Features/protein domains',
117
- type: 'subMenu',
118
- subMenu: [
119
- {
120
- label: 'Open domains...',
121
- icon: FolderOpen,
122
- onClick: () => {
123
- model.queueDialog(handleClose => [
124
- UserProvidedDomainsDialog,
125
- {
126
- handleClose,
127
- model,
128
- },
129
- ])
130
- },
131
- },
132
- {
133
- label: 'Query InterProScan for domains...',
134
- icon: Search,
135
- onClick: () => {
136
- model.queueDialog(handleClose => [
137
- InterProScanDialog,
138
- {
139
- handleClose,
140
- model,
141
- },
142
- ])
143
- },
144
- },
145
- {
146
- label: `Show domains${noDomains ? ' (no domains loaded)' : ''}`,
147
- disabled: noDomains,
148
- icon: Visibility,
149
- checked: actuallyShowDomains ? showDomains : false,
150
- type: 'checkbox',
151
- onClick: () => {
152
- model.setShowDomains(!showDomains)
153
- },
154
- },
155
- {
156
- label: `Use sub-row layout${noDomains ? ' (no domains loaded)' : ''}`,
157
- disabled: noDomains,
158
- checked: actuallyShowDomains ? subFeatureRows : false,
159
- icon: Sort,
160
- type: 'checkbox',
161
- onClick: () => {
162
- model.setSubFeatureRows(!subFeatureRows)
163
- },
164
- },
165
- {
166
- label: `Filter domains${noDomains ? ' (no domains loaded)' : ''}`,
167
- icon: FilterAlt,
168
- disabled: noDomains,
169
- onClick: () => {
170
- model.queueDialog(onClose => [
171
- FeatureFilterDialog,
172
- {
173
- onClose,
174
- model,
175
- },
176
- ])
177
- },
178
- },
179
- ],
180
- },
181
28
  ...model.extraViewMenuItems(),
182
29
  ]}
30
+ anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }}
31
+ transformOrigin={{ vertical: 'top', horizontal: 'left' }}
183
32
  >
184
33
  <MoreVert />
185
34
  </CascadingMenuButton>
@@ -0,0 +1,48 @@
1
+ import React from 'react'
2
+
3
+ import CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton'
4
+ import Tune from '@mui/icons-material/Tune'
5
+ import { observer } from 'mobx-react'
6
+
7
+ import type { MsaViewModel } from '../../model.ts'
8
+
9
+ const MSASettingsMenu = observer(function ({ model }: { model: MsaViewModel }) {
10
+ const { drawMsaLetters, hideGaps, bgColor } = model
11
+ return (
12
+ <CascadingMenuButton
13
+ closeAfterItemClick={false}
14
+ anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }}
15
+ transformOrigin={{ vertical: 'top', horizontal: 'left' }}
16
+ menuItems={[
17
+ {
18
+ label: 'Draw letters',
19
+ type: 'checkbox',
20
+ checked: drawMsaLetters,
21
+ onClick: () => {
22
+ model.setDrawMsaLetters(!drawMsaLetters)
23
+ },
24
+ },
25
+ {
26
+ label: 'Color letters instead of background of tiles',
27
+ type: 'checkbox',
28
+ checked: !bgColor,
29
+ onClick: () => {
30
+ model.setBgColor(!bgColor)
31
+ },
32
+ },
33
+ {
34
+ label: 'Enable hiding gappy columns?',
35
+ type: 'checkbox',
36
+ checked: hideGaps,
37
+ onClick: () => {
38
+ model.setHideGaps(!hideGaps)
39
+ },
40
+ },
41
+ ]}
42
+ >
43
+ <Tune />
44
+ </CascadingMenuButton>
45
+ )
46
+ })
47
+
48
+ export default MSASettingsMenu
@@ -14,7 +14,6 @@ const SettingsMenu = observer(function ({ model }: { model: MsaViewModel }) {
14
14
  const {
15
15
  colorSchemeName,
16
16
  drawMsaLetters,
17
- contrastLettering,
18
17
  hideGaps,
19
18
  bgColor,
20
19
  drawTree,
@@ -22,8 +21,6 @@ const SettingsMenu = observer(function ({ model }: { model: MsaViewModel }) {
22
21
  labelsAlignRight,
23
22
  drawNodeBubbles,
24
23
  drawLabels,
25
- treeWidthMatchesArea,
26
- noTree,
27
24
  } = model
28
25
  return (
29
26
  <CascadingMenuButton
@@ -65,14 +62,6 @@ const SettingsMenu = observer(function ({ model }: { model: MsaViewModel }) {
65
62
  model.setBgColor(!bgColor)
66
63
  },
67
64
  },
68
- {
69
- label: 'Use contrast lettering',
70
- type: 'checkbox',
71
- checked: contrastLettering,
72
- onClick: () => {
73
- model.setContrastLettering(!contrastLettering)
74
- },
75
- },
76
65
  {
77
66
  label: 'Enable hiding gappy columns?',
78
67
  type: 'checkbox',
@@ -128,18 +117,6 @@ const SettingsMenu = observer(function ({ model }: { model: MsaViewModel }) {
128
117
  model.setDrawLabels(!drawLabels)
129
118
  },
130
119
  },
131
- ...(noTree
132
- ? []
133
- : [
134
- {
135
- label: 'Make tree width fit to tree area',
136
- type: 'checkbox' as const,
137
- checked: treeWidthMatchesArea,
138
- onClick: () => {
139
- model.setTreeWidthMatchesArea(!treeWidthMatchesArea)
140
- },
141
- },
142
- ]),
143
120
  ],
144
121
  },
145
122
  ]}
@@ -0,0 +1,96 @@
1
+ import React from 'react'
2
+
3
+ import CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton'
4
+ import AccountTree from '@mui/icons-material/AccountTree'
5
+ import { observer } from 'mobx-react'
6
+
7
+ import type { MsaViewModel } from '../../model.ts'
8
+
9
+ const TreeSettingsMenu = observer(function ({
10
+ model,
11
+ }: {
12
+ model: MsaViewModel
13
+ }) {
14
+ const {
15
+ drawTree,
16
+ showBranchLen,
17
+ labelsAlignRight,
18
+ drawNodeBubbles,
19
+ drawLabels,
20
+ rows,
21
+ } = model
22
+ return (
23
+ <CascadingMenuButton
24
+ closeAfterItemClick={false}
25
+ anchorOrigin={{ vertical: 'bottom', horizontal: 'left' }}
26
+ transformOrigin={{ vertical: 'top', horizontal: 'left' }}
27
+ menuItems={[
28
+ {
29
+ label: 'Show branch length',
30
+ type: 'checkbox',
31
+ checked: showBranchLen,
32
+ onClick: () => {
33
+ model.setShowBranchLen(!showBranchLen)
34
+ },
35
+ },
36
+ {
37
+ label: 'Show tree',
38
+ type: 'checkbox',
39
+ checked: drawTree,
40
+ onClick: () => {
41
+ model.setDrawTree(!drawTree)
42
+ },
43
+ },
44
+ {
45
+ label: 'Draw clickable bubbles on tree branches',
46
+ type: 'checkbox',
47
+ checked: drawNodeBubbles,
48
+ onClick: () => {
49
+ model.setDrawNodeBubbles(!drawNodeBubbles)
50
+ },
51
+ },
52
+ {
53
+ label: 'Tree labels align right',
54
+ type: 'checkbox',
55
+ checked: labelsAlignRight,
56
+ onClick: () => {
57
+ model.setLabelsAlignRight(!labelsAlignRight)
58
+ },
59
+ },
60
+ {
61
+ label: 'Draw labels',
62
+ type: 'checkbox',
63
+ checked: drawLabels,
64
+ onClick: () => {
65
+ model.setDrawLabels(!drawLabels)
66
+ },
67
+ },
68
+ ...(rows.length >= 2
69
+ ? [
70
+ {
71
+ label: 'Advanced',
72
+ type: 'subMenu' as const,
73
+ subMenu: [
74
+ {
75
+ label: 'Calculate neighbor joining tree (BLOSUM62)',
76
+ onClick: () => {
77
+ try {
78
+ model.calculateNeighborJoiningTreeFromMSA()
79
+ } catch (e) {
80
+ console.error('Failed to calculate NJ tree:', e)
81
+ model.setError(e)
82
+ }
83
+ },
84
+ },
85
+ ],
86
+ },
87
+ ]
88
+ : []),
89
+ ]}
90
+ >
91
+ <AccountTree />
92
+ </CascadingMenuButton>
93
+ )
94
+ })
95
+
96
+ export default TreeSettingsMenu
@@ -37,14 +37,6 @@ const ZoomMenu = observer(function ({ model }: { model: MsaViewModel }) {
37
37
  model.resetZoom()
38
38
  },
39
39
  },
40
- {
41
- label: 'Show extra zoom options',
42
- checked: model.showZoomStar,
43
- type: 'checkbox',
44
- onClick: () => {
45
- model.setShowZoomStar(!model.showZoomStar)
46
- },
47
- },
48
40
  ]}
49
41
  >
50
42
  <MoreVert />
@@ -0,0 +1,83 @@
1
+ import { lazy } from 'react'
2
+
3
+ import FilterAlt from '@mui/icons-material/FilterAlt'
4
+ import FolderOpen from '@mui/icons-material/FolderOpen'
5
+ import Search from '@mui/icons-material/Search'
6
+ import Sort from '@mui/icons-material/Sort'
7
+ import Visibility from '@mui/icons-material/Visibility'
8
+
9
+ import type { MsaViewModel } from '../../model.ts'
10
+
11
+ const FeatureFilterDialog = lazy(() => import('../dialogs/FeatureDialog.tsx'))
12
+ const UserProvidedDomainsDialog = lazy(
13
+ () => import('../dialogs/UserProvidedDomainsDialog.tsx'),
14
+ )
15
+ const InterProScanDialog = lazy(
16
+ () => import('../dialogs/InterProScanDialog.tsx'),
17
+ )
18
+
19
+ export function getDomainMenu({ model }: { model: MsaViewModel }) {
20
+ const { showDomains, actuallyShowDomains, subFeatureRows, noDomains } = model
21
+ return [
22
+ {
23
+ label: 'Open domains...',
24
+ icon: FolderOpen,
25
+ onClick: () => {
26
+ model.queueDialog(handleClose => [
27
+ UserProvidedDomainsDialog,
28
+ {
29
+ handleClose,
30
+ model,
31
+ },
32
+ ])
33
+ },
34
+ },
35
+ {
36
+ label: 'Query InterProScan for domains...',
37
+ icon: Search,
38
+ onClick: () => {
39
+ model.queueDialog(handleClose => [
40
+ InterProScanDialog,
41
+ {
42
+ handleClose,
43
+ model,
44
+ },
45
+ ])
46
+ },
47
+ },
48
+ {
49
+ label: `Show domains${noDomains ? ' (no domains loaded)' : ''}`,
50
+ disabled: noDomains,
51
+ icon: Visibility,
52
+ checked: actuallyShowDomains ? showDomains : false,
53
+ type: 'checkbox' as const,
54
+ onClick: () => {
55
+ model.setShowDomains(!showDomains)
56
+ },
57
+ },
58
+ {
59
+ label: `Use sub-row layout${noDomains ? ' (no domains loaded)' : ''}`,
60
+ disabled: noDomains,
61
+ checked: actuallyShowDomains ? subFeatureRows : false,
62
+ icon: Sort,
63
+ type: 'checkbox' as const,
64
+ onClick: () => {
65
+ model.setSubFeatureRows(!subFeatureRows)
66
+ },
67
+ },
68
+ {
69
+ label: `Filter domains${noDomains ? ' (no domains loaded)' : ''}`,
70
+ icon: FilterAlt,
71
+ disabled: noDomains,
72
+ onClick: () => {
73
+ model.queueDialog(onClose => [
74
+ FeatureFilterDialog,
75
+ {
76
+ onClose,
77
+ model,
78
+ },
79
+ ])
80
+ },
81
+ },
82
+ ]
83
+ }
@@ -33,29 +33,30 @@ function ListItem({
33
33
  )
34
34
  }
35
35
 
36
+ const BASE = 'https://jbrowse.org/genomes/multiple_sequence_alignments'
37
+
36
38
  const ImportFormExamples = observer(function ({
37
39
  model,
38
40
  }: {
39
41
  model: MsaViewModel
40
42
  }) {
41
- function l2(uri1?: string, uri2?: string) {
43
+ function loadUris({
44
+ msa,
45
+ tree,
46
+ gff,
47
+ }: {
48
+ msa?: string
49
+ tree?: string
50
+ gff?: string
51
+ }) {
42
52
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
43
53
  ;(async () => {
44
54
  try {
45
55
  await load(
46
56
  model,
47
- uri1
48
- ? {
49
- uri: uri1,
50
- locationType: 'UriLocation',
51
- }
52
- : undefined,
53
- uri2
54
- ? {
55
- uri: uri2,
56
- locationType: 'UriLocation',
57
- }
58
- : undefined,
57
+ msa ? { uri: msa, locationType: 'UriLocation' } : undefined,
58
+ tree ? { uri: tree, locationType: 'UriLocation' } : undefined,
59
+ gff ? { uri: gff, locationType: 'UriLocation' } : undefined,
59
60
  )
60
61
  } catch (e) {
61
62
  console.error(e)
@@ -68,10 +69,9 @@ const ImportFormExamples = observer(function ({
68
69
  <ListItem
69
70
  model={model}
70
71
  onClick={() => {
71
- l2(
72
- undefined,
73
- 'https://jbrowse.org/genomes/newicktrees/sarscov2phylo.pub.ft.nh',
74
- )
72
+ loadUris({
73
+ tree: 'https://jbrowse.org/genomes/newicktrees/sarscov2phylo.pub.ft.nh',
74
+ })
75
75
  }}
76
76
  >
77
77
  230k COVID-19 samples (tree only)
@@ -95,9 +95,7 @@ const ImportFormExamples = observer(function ({
95
95
  <ListItem
96
96
  model={model}
97
97
  onClick={() => {
98
- l2(
99
- 'https://jbrowse.org/genomes/multiple_sequence_alignments/pfam-cov2.stock',
100
- )
98
+ loadUris({ msa: `${BASE}/pfam-cov2.stock` })
101
99
  }}
102
100
  >
103
101
  PFAM SARS-CoV2 multi-stockholm
@@ -105,9 +103,18 @@ const ImportFormExamples = observer(function ({
105
103
  <ListItem
106
104
  model={model}
107
105
  onClick={() => {
108
- l2(
109
- 'https://jbrowse.org/genomes/multiple_sequence_alignments/Lysine.stock',
110
- )
106
+ loadUris({
107
+ msa: `${BASE}/pfam-cov2.stock`,
108
+ gff: `${BASE}/pfam-cov2-domains.gff`,
109
+ })
110
+ }}
111
+ >
112
+ PFAM SARS-CoV2 multi-stockholm w/ domains loaded
113
+ </ListItem>
114
+ <ListItem
115
+ model={model}
116
+ onClick={() => {
117
+ loadUris({ msa: `${BASE}/Lysine.stock` })
111
118
  }}
112
119
  >
113
120
  Lysine stockholm file
@@ -115,9 +122,7 @@ const ImportFormExamples = observer(function ({
115
122
  <ListItem
116
123
  model={model}
117
124
  onClick={() => {
118
- l2(
119
- 'https://jbrowse.org/genomes/multiple_sequence_alignments/PF01601_full.txt',
120
- )
125
+ loadUris({ msa: `${BASE}/PF01601_full.txt` })
121
126
  }}
122
127
  >
123
128
  PF01601 stockholm file (SARS-CoV2 spike protein)
@@ -125,9 +130,7 @@ const ImportFormExamples = observer(function ({
125
130
  <ListItem
126
131
  model={model}
127
132
  onClick={() => {
128
- l2(
129
- 'https://jbrowse.org/genomes/multiple_sequence_alignments/europe_covid.fa',
130
- )
133
+ loadUris({ msa: `${BASE}/europe_covid.fa` })
131
134
  }}
132
135
  >
133
136
  Europe COVID full genomes (LR883044.1 and 199 other sequences)
@@ -135,10 +138,10 @@ const ImportFormExamples = observer(function ({
135
138
  <ListItem
136
139
  model={model}
137
140
  onClick={() => {
138
- l2(
139
- 'https://jbrowse.org/genomes/multiple_sequence_alignments/rhv_test-only.aligned_with_mafft_auto.fa',
140
- 'https://jbrowse.org/genomes/multiple_sequence_alignments/rhv_test-only.aligned_with_mafft_auto.nh',
141
- )
141
+ loadUris({
142
+ msa: `${BASE}/rhv_test-only.aligned_with_mafft_auto.fa`,
143
+ tree: `${BASE}/rhv_test-only.aligned_with_mafft_auto.nh`,
144
+ })
142
145
  }}
143
146
  >
144
147
  MAFFT+VeryFastTree(17.9k samples)
@@ -146,7 +149,7 @@ const ImportFormExamples = observer(function ({
146
149
  <ListItem
147
150
  model={model}
148
151
  onClick={() => {
149
- l2('https://jbrowse.org/demos/ttc39a.mfa')
152
+ loadUris({ msa: 'https://jbrowse.org/demos/ttc39a.mfa' })
150
153
  }}
151
154
  >
152
155
  Human BLAST results mfa