react-msaview 1.3.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/bundle/index.js +283 -97265
  2. package/dist/StructureModel.d.ts +9 -0
  3. package/dist/StructureModel.js +11 -0
  4. package/dist/StructureModel.js.map +1 -0
  5. package/dist/UniprotTrack.d.ts +27 -0
  6. package/dist/UniprotTrack.js +52 -0
  7. package/dist/UniprotTrack.js.map +1 -0
  8. package/dist/colorSchemes.d.ts +2 -2
  9. package/dist/colorSchemes.js +24 -29
  10. package/dist/colorSchemes.js.map +1 -0
  11. package/dist/components/AboutDlg.d.ts +0 -1
  12. package/dist/components/AboutDlg.js +38 -48
  13. package/dist/components/AboutDlg.js.map +1 -0
  14. package/dist/components/AddTrackDlg.d.ts +0 -1
  15. package/dist/components/AddTrackDlg.js +13 -13
  16. package/dist/components/AddTrackDlg.js.map +1 -0
  17. package/dist/components/AnnotationDlg.d.ts +0 -1
  18. package/dist/components/AnnotationDlg.js +36 -48
  19. package/dist/components/AnnotationDlg.js.map +1 -0
  20. package/dist/components/BoxTrack.d.ts +3 -4
  21. package/dist/components/BoxTrack.js +51 -48
  22. package/dist/components/BoxTrack.js.map +1 -0
  23. package/dist/components/DetailsDlg.d.ts +0 -1
  24. package/dist/components/DetailsDlg.js +7 -7
  25. package/dist/components/DetailsDlg.js.map +1 -0
  26. package/dist/components/Header.d.ts +0 -1
  27. package/dist/components/Header.js +39 -34
  28. package/dist/components/Header.js.map +1 -0
  29. package/dist/components/ImportForm.d.ts +0 -1
  30. package/dist/components/ImportForm.js +59 -71
  31. package/dist/components/ImportForm.js.map +1 -0
  32. package/dist/components/MSACanvas.d.ts +0 -1
  33. package/dist/components/MSACanvas.js +71 -74
  34. package/dist/components/MSACanvas.js.map +1 -0
  35. package/dist/components/MSAView.d.ts +0 -1
  36. package/dist/components/MSAView.js +19 -38
  37. package/dist/components/MSAView.js.map +1 -0
  38. package/dist/components/MoreInfoDlg.d.ts +2 -3
  39. package/dist/components/MoreInfoDlg.js +5 -5
  40. package/dist/components/MoreInfoDlg.js.map +1 -0
  41. package/dist/components/ResizeHandles.d.ts +2 -3
  42. package/dist/components/ResizeHandles.js +31 -32
  43. package/dist/components/ResizeHandles.js.map +1 -0
  44. package/dist/components/Rubberband.d.ts +2 -1
  45. package/dist/components/Rubberband.js +42 -64
  46. package/dist/components/Rubberband.js.map +1 -0
  47. package/dist/components/Ruler.d.ts +0 -15
  48. package/dist/components/Ruler.js +18 -87
  49. package/dist/components/Ruler.js.map +1 -0
  50. package/dist/components/SettingsDlg.d.ts +0 -1
  51. package/dist/components/SettingsDlg.js +29 -22
  52. package/dist/components/SettingsDlg.js.map +1 -0
  53. package/dist/components/TextTrack.d.ts +3 -4
  54. package/dist/components/TextTrack.js +23 -24
  55. package/dist/components/TextTrack.js.map +1 -0
  56. package/dist/components/Track.d.ts +2 -3
  57. package/dist/components/Track.js +38 -38
  58. package/dist/components/Track.js.map +1 -0
  59. package/dist/components/TrackInfoDlg.d.ts +5 -3
  60. package/dist/components/TrackInfoDlg.js +12 -13
  61. package/dist/components/TrackInfoDlg.js.map +1 -0
  62. package/dist/components/TracklistDlg.d.ts +0 -1
  63. package/dist/components/TracklistDlg.js +9 -9
  64. package/dist/components/TracklistDlg.js.map +1 -0
  65. package/dist/components/TreeCanvas.d.ts +0 -1
  66. package/dist/components/TreeCanvas.js +135 -148
  67. package/dist/components/TreeCanvas.js.map +1 -0
  68. package/dist/components/TreeRuler.d.ts +0 -1
  69. package/dist/components/TreeRuler.js +3 -3
  70. package/dist/components/TreeRuler.js.map +1 -0
  71. package/dist/components/VerticalGuide.d.ts +6 -0
  72. package/dist/components/VerticalGuide.js +30 -0
  73. package/dist/components/VerticalGuide.js.map +1 -0
  74. package/dist/components/data/seq2.d.ts +3 -3
  75. package/dist/components/data/seq2.js +33 -3
  76. package/dist/components/data/seq2.js.map +1 -0
  77. package/{bundle/components/Ruler.d.ts → dist/components/util.d.ts} +1 -6
  78. package/dist/components/util.js +69 -0
  79. package/dist/components/util.js.map +1 -0
  80. package/dist/index.d.ts +2 -4
  81. package/dist/index.js +3 -3
  82. package/dist/index.js.map +1 -0
  83. package/dist/layout.js +14 -20
  84. package/dist/layout.js.map +1 -0
  85. package/dist/model.d.ts +94 -74
  86. package/dist/model.js +232 -473
  87. package/dist/model.js.map +1 -0
  88. package/dist/parseNewick.d.ts +1 -5
  89. package/dist/parseNewick.js +10 -7
  90. package/dist/parseNewick.js.map +1 -0
  91. package/dist/parsers/ClustalMSA.d.ts +6 -18
  92. package/dist/parsers/ClustalMSA.js +55 -64
  93. package/dist/parsers/ClustalMSA.js.map +1 -0
  94. package/dist/parsers/FastaMSA.d.ts +4 -9
  95. package/dist/parsers/FastaMSA.js +55 -64
  96. package/dist/parsers/FastaMSA.js.map +1 -0
  97. package/dist/parsers/StockholmMSA.d.ts +8 -13
  98. package/dist/parsers/StockholmMSA.js +78 -107
  99. package/dist/parsers/StockholmMSA.js.map +1 -0
  100. package/dist/util.d.ts +33 -4
  101. package/dist/util.js +76 -24
  102. package/dist/util.js.map +1 -0
  103. package/dist/version.d.ts +1 -0
  104. package/dist/version.js +2 -0
  105. package/dist/version.js.map +1 -0
  106. package/package.json +30 -30
  107. package/src/StructureModel.ts +11 -0
  108. package/src/UniprotTrack.ts +60 -0
  109. package/src/colorSchemes.ts +520 -0
  110. package/src/components/AboutDlg.tsx +64 -0
  111. package/src/components/AddTrackDlg.tsx +74 -0
  112. package/src/components/AnnotationDlg.tsx +144 -0
  113. package/src/components/BoxTrack.tsx +225 -0
  114. package/src/components/DetailsDlg.tsx +28 -0
  115. package/src/components/Header.tsx +117 -0
  116. package/src/components/ImportForm.tsx +192 -0
  117. package/src/components/MSACanvas.tsx +297 -0
  118. package/src/components/MSAView.tsx +132 -0
  119. package/src/components/MoreInfoDlg.tsx +21 -0
  120. package/src/components/ResizeHandles.tsx +137 -0
  121. package/src/components/Rubberband.tsx +271 -0
  122. package/src/components/Ruler.tsx +122 -0
  123. package/src/components/SettingsDlg.tsx +154 -0
  124. package/src/components/TextTrack.tsx +120 -0
  125. package/src/components/Track.tsx +150 -0
  126. package/src/components/TrackInfoDlg.tsx +59 -0
  127. package/src/components/TracklistDlg.tsx +61 -0
  128. package/src/components/TreeCanvas.tsx +633 -0
  129. package/src/components/TreeRuler.tsx +12 -0
  130. package/src/components/VerticalGuide.tsx +50 -0
  131. package/src/components/data/seq2.ts +35 -0
  132. package/src/components/util.ts +94 -0
  133. package/src/declare.d.ts +2 -0
  134. package/src/index.ts +2 -0
  135. package/src/layout.ts +83 -0
  136. package/src/model.ts +790 -0
  137. package/{bundle/parseNewick.d.ts → src/parseNewick.ts} +36 -5
  138. package/src/parsers/ClustalMSA.ts +79 -0
  139. package/src/parsers/FastaMSA.ts +82 -0
  140. package/src/parsers/StockholmMSA.ts +137 -0
  141. package/src/util.ts +142 -0
  142. package/src/version.ts +1 -0
  143. package/bundle/colorSchemes.d.ts +0 -16
  144. package/bundle/colorSchemes.js +0 -455
  145. package/bundle/components/AboutDlg.d.ts +0 -5
  146. package/bundle/components/AboutDlg.js +0 -47
  147. package/bundle/components/AddTrackDlg.d.ts +0 -8
  148. package/bundle/components/AddTrackDlg.js +0 -26
  149. package/bundle/components/AnnotationDlg.d.ts +0 -11
  150. package/bundle/components/AnnotationDlg.js +0 -77
  151. package/bundle/components/BoxTrack.d.ts +0 -7
  152. package/bundle/components/BoxTrack.js +0 -143
  153. package/bundle/components/DetailsDlg.d.ts +0 -8
  154. package/bundle/components/DetailsDlg.js +0 -12
  155. package/bundle/components/Header.d.ts +0 -6
  156. package/bundle/components/Header.js +0 -63
  157. package/bundle/components/ImportForm.d.ts +0 -6
  158. package/bundle/components/ImportForm.js +0 -89
  159. package/bundle/components/MSACanvas.d.ts +0 -6
  160. package/bundle/components/MSACanvas.js +0 -210
  161. package/bundle/components/MSAView.d.ts +0 -6
  162. package/bundle/components/MSAView.js +0 -88
  163. package/bundle/components/MoreInfoDlg.d.ts +0 -6
  164. package/bundle/components/MoreInfoDlg.js +0 -11
  165. package/bundle/components/ResizeHandles.d.ts +0 -8
  166. package/bundle/components/ResizeHandles.js +0 -110
  167. package/bundle/components/Rubberband.d.ts +0 -7
  168. package/bundle/components/Rubberband.js +0 -196
  169. package/bundle/components/Ruler.js +0 -121
  170. package/bundle/components/SettingsDlg.d.ts +0 -8
  171. package/bundle/components/SettingsDlg.js +0 -40
  172. package/bundle/components/TextTrack.d.ts +0 -7
  173. package/bundle/components/TextTrack.js +0 -72
  174. package/bundle/components/Track.d.ts +0 -11
  175. package/bundle/components/Track.js +0 -81
  176. package/bundle/components/TrackInfoDlg.d.ts +0 -6
  177. package/bundle/components/TrackInfoDlg.js +0 -33
  178. package/bundle/components/TracklistDlg.d.ts +0 -8
  179. package/bundle/components/TracklistDlg.js +0 -18
  180. package/bundle/components/TreeCanvas.d.ts +0 -6
  181. package/bundle/components/TreeCanvas.js +0 -431
  182. package/bundle/components/TreeRuler.d.ts +0 -6
  183. package/bundle/components/TreeRuler.js +0 -8
  184. package/bundle/components/data/seq2.d.ts +0 -3
  185. package/bundle/components/data/seq2.js +0 -3
  186. package/bundle/index.d.ts +0 -4
  187. package/bundle/layout.d.ts +0 -23
  188. package/bundle/layout.js +0 -53
  189. package/bundle/model.d.ts +0 -364
  190. package/bundle/model.js +0 -894
  191. package/bundle/parseNewick.js +0 -94
  192. package/bundle/parsers/ClustalMSA.d.ts +0 -39
  193. package/bundle/parsers/ClustalMSA.js +0 -77
  194. package/bundle/parsers/FastaMSA.d.ts +0 -26
  195. package/bundle/parsers/FastaMSA.js +0 -78
  196. package/bundle/parsers/StockholmMSA.d.ts +0 -75
  197. package/bundle/parsers/StockholmMSA.js +0 -142
  198. package/bundle/util.d.ts +0 -17
  199. package/bundle/util.js +0 -33
  200. package/dist/components/package.json +0 -62
@@ -0,0 +1,520 @@
1
+ import Color from 'color'
2
+ import { transform } from './util'
3
+
4
+ const colorSchemes = {
5
+ clustal: {
6
+ G: 'orange',
7
+ P: 'orange',
8
+ S: 'orange',
9
+ T: 'orange',
10
+ H: 'red',
11
+ K: 'red',
12
+ R: 'red',
13
+ F: 'blue',
14
+ W: 'blue',
15
+ Y: 'blue',
16
+ I: 'green',
17
+ L: 'green',
18
+ M: 'green',
19
+ V: 'green',
20
+ },
21
+ lesk: {
22
+ G: 'orange',
23
+ A: 'orange',
24
+ S: 'orange',
25
+ T: 'orange',
26
+ C: 'green',
27
+ V: 'green',
28
+ I: 'green',
29
+ L: 'green',
30
+ P: 'green',
31
+ F: 'green',
32
+ Y: 'green',
33
+ M: 'green',
34
+ W: 'green',
35
+ N: 'magenta',
36
+ Q: 'magenta',
37
+ H: 'magenta',
38
+ D: 'red',
39
+ E: 'red',
40
+ K: 'blue',
41
+ R: 'blue',
42
+ },
43
+ maeditor: {
44
+ A: 'lightgreen',
45
+ G: 'lightgreen',
46
+ C: 'green',
47
+ D: 'darkgreen',
48
+ E: 'darkgreen',
49
+ N: 'darkgreen',
50
+ Q: 'darkgreen',
51
+ I: 'blue',
52
+ L: 'blue',
53
+ M: 'blue',
54
+ V: 'blue',
55
+ F: '#c8a2c8',
56
+ W: '#c8a2c8',
57
+ Y: '#c8a2c8',
58
+ H: 'darkblue',
59
+ K: 'orange',
60
+ R: 'orange',
61
+ P: 'pink',
62
+ S: 'red',
63
+ T: 'red',
64
+ },
65
+
66
+ percent_identity_dynamic: {},
67
+ // https://github.com/biotite-dev/biotite/blob/8c460972f8ab904312f130dfb80f3efc8c9bd7c5/src/biotite/sequence/graphics/color_schemes/flower.json
68
+ flower: {
69
+ A: '#b18a51',
70
+ C: '#ff5701',
71
+ D: '#01a578',
72
+ E: '#2da0a1',
73
+ F: '#fa559d',
74
+ G: '#b1c23c',
75
+ H: '#0194f9',
76
+ I: '#f27663',
77
+ K: '#7fc3d7',
78
+ L: '#df6e75',
79
+ M: '#fe9daf',
80
+ N: '#0bcec6',
81
+ P: '#4fa32a',
82
+ Q: '#7295ae',
83
+ R: '#83bff1',
84
+ S: '#b4bd9b',
85
+ T: '#d2b576',
86
+ V: '#fd997b',
87
+ W: '#ff2ded',
88
+ Y: '#c96ecf',
89
+ },
90
+ rainbow_dna: {
91
+ A: '#3737f5',
92
+ C: '#37f537',
93
+ G: '#f5f537',
94
+ T: '#f53737',
95
+ U: '#f53737',
96
+ },
97
+
98
+ // https://github.com/biotite-dev/biotite/blob/8c460972f8ab904312f130dfb80f3efc8c9bd7c5/src/biotite/sequence/graphics/color_schemes/clustalx_protein.json
99
+ clustalx_protein: {
100
+ A: '#197fe5',
101
+ C: '#e57f7f',
102
+ D: '#cc4ccc',
103
+ E: '#cc4ccc',
104
+ F: '#197fe5',
105
+ G: '#e5994c',
106
+ H: '#19b2b2',
107
+ I: '#197fe5',
108
+ K: '#e53319',
109
+ L: '#197fe5',
110
+ M: '#197fe5',
111
+ N: '#19cc19',
112
+ P: '#cccc00',
113
+ Q: '#19cc19',
114
+ R: '#e53319',
115
+ S: '#19cc19',
116
+ T: '#19cc19',
117
+ V: '#197fe5',
118
+ W: '#197fe5',
119
+ Y: '#19b2b2',
120
+ },
121
+
122
+ // this has special handling
123
+ clustalx_protein_dynamic: {},
124
+
125
+ clustalx_dna: {
126
+ A: '#e53319',
127
+ C: '#197fe5',
128
+ G: '#e5994c',
129
+ T: '#19cc19',
130
+ U: '#19cc19',
131
+ },
132
+ jalview_buried: {
133
+ A: '#00a35c',
134
+ R: '#00fc03',
135
+ N: '#00eb14',
136
+ D: '#00eb14',
137
+ C: '#0000ff',
138
+ Q: '#00f10e',
139
+ E: '#00f10e',
140
+ G: '#009d62',
141
+ H: '#00d52a',
142
+ I: '#0054ab',
143
+ L: '#007b84',
144
+ K: '#00ff00',
145
+ M: '#009768',
146
+ F: '#008778',
147
+ P: '#00e01f',
148
+ S: '#00d52a',
149
+ T: '#00db24',
150
+ W: '#00a857',
151
+ Y: '#00e619',
152
+ V: '#005fa0',
153
+ B: '#00eb14',
154
+ X: '#00b649',
155
+ Z: '#00f10e',
156
+ },
157
+
158
+ jalview_hydrophobicity: {
159
+ A: '#ad0052',
160
+ R: '#0000ff',
161
+ N: '#0c00f3',
162
+ D: '#0c00f3',
163
+ C: '#c2003d',
164
+ Q: '#0c00f3',
165
+ E: '#0c00f3',
166
+ G: '#6a0095',
167
+ H: '#1500ea',
168
+ I: '#ff0000',
169
+ L: '#ea0015',
170
+ K: '#0000ff',
171
+ M: '#b0004f',
172
+ F: '#cb0034',
173
+ P: '#4600b9',
174
+ S: '#5e00a1',
175
+ T: '#61009e',
176
+ W: '#5b00a4',
177
+ Y: '#4f00b0',
178
+ V: '#f60009',
179
+ B: '#0c00f3',
180
+ X: '#680097',
181
+ Z: '#0c00f3',
182
+ },
183
+
184
+ jalview_prophelix: {
185
+ A: '#e718e7',
186
+ R: '#6f906f',
187
+ N: '#1be41b',
188
+ D: '#778877',
189
+ C: '#23dc23',
190
+ Q: '#926d92',
191
+ E: '#ff00ff',
192
+ G: '#00ff00',
193
+ H: '#758a75',
194
+ I: '#8a758a',
195
+ L: '#ae51ae',
196
+ K: '#a05fa0',
197
+ M: '#ef10ef',
198
+ F: '#986798',
199
+ P: '#00ff00',
200
+ S: '#36c936',
201
+ T: '#47b847',
202
+ W: '#8a758a',
203
+ Y: '#21de21',
204
+ V: '#857a85',
205
+ B: '#49b649',
206
+ X: '#758a75',
207
+ Z: '#c936c9',
208
+ },
209
+
210
+ jalview_propstrand: {
211
+ A: '#5858a7',
212
+ R: '#6b6b94',
213
+ N: '#64649b',
214
+ D: '#2121de',
215
+ C: '#9d9d62',
216
+ Q: '#8c8c73',
217
+ E: '#0000ff',
218
+ G: '#4949b6',
219
+ H: '#60609f',
220
+ I: '#ecec13',
221
+ L: '#b2b24d',
222
+ K: '#4747b8',
223
+ M: '#82827d',
224
+ F: '#c2c23d',
225
+ P: '#2323dc',
226
+ S: '#4949b6',
227
+ T: '#9d9d62',
228
+ W: '#c0c03f',
229
+ Y: '#d3d32c',
230
+ V: '#ffff00',
231
+ B: '#4343bc',
232
+ X: '#797986',
233
+ Z: '#4747b8',
234
+ },
235
+
236
+ jalview_propturn: {
237
+ A: '#2cd3d3',
238
+ R: '#708f8f',
239
+ N: '#ff0000',
240
+ D: '#e81717',
241
+ C: '#a85757',
242
+ Q: '#3fc0c0',
243
+ E: '#778888',
244
+ G: '#ff0000',
245
+ H: '#708f8f',
246
+ I: '#00ffff',
247
+ L: '#1ce3e3',
248
+ K: '#7e8181',
249
+ M: '#1ee1e1',
250
+ F: '#1ee1e1',
251
+ P: '#f60909',
252
+ S: '#e11e1e',
253
+ T: '#738c8c',
254
+ W: '#738c8c',
255
+ Y: '#9d6262',
256
+ V: '#07f8f8',
257
+ B: '#f30c0c',
258
+ X: '#7c8383',
259
+ Z: '#5ba4a4',
260
+ },
261
+
262
+ jalview_taylor: {
263
+ A: '#ccff00',
264
+ R: '#0000ff',
265
+ N: '#cc00ff',
266
+ D: '#ff0000',
267
+ C: '#ffff00',
268
+ Q: '#ff00cc',
269
+ E: '#ff0066',
270
+ G: '#ff9900',
271
+ H: '#0066ff',
272
+ I: '#66ff00',
273
+ L: '#33ff00',
274
+ K: '#6600ff',
275
+ M: '#00ff00',
276
+ F: '#00ff66',
277
+ P: '#ffcc00',
278
+ S: '#ff3300',
279
+ T: '#ff6600',
280
+ W: '#00ccff',
281
+ Y: '#00ffcc',
282
+ V: '#99ff00',
283
+ },
284
+
285
+ jalview_zappo: {
286
+ A: '#ffafaf',
287
+ R: '#6464ff',
288
+ N: '#00ff00',
289
+ D: '#ff0000',
290
+ C: '#ffff00',
291
+ Q: '#00ff00',
292
+ E: '#ff0000',
293
+ G: '#ff00ff',
294
+ H: '#6464ff',
295
+ I: '#ffafaf',
296
+ L: '#ffafaf',
297
+ K: '#6464ff',
298
+ M: '#ffafaf',
299
+ F: '#ffc800',
300
+ P: '#ff00ff',
301
+ S: '#00ff00',
302
+ T: '#00ff00',
303
+ W: '#ffc800',
304
+ Y: '#ffc800',
305
+ V: '#ffafaf',
306
+ },
307
+
308
+ cinema: {
309
+ H: 'blue',
310
+ K: 'blue',
311
+ R: 'blue',
312
+ D: 'red',
313
+ E: 'red',
314
+ S: 'green',
315
+ T: 'green',
316
+ N: 'green',
317
+ Q: 'green',
318
+ A: 'white',
319
+ V: 'white',
320
+ L: 'white',
321
+ I: 'white',
322
+ M: 'white',
323
+ F: 'magenta',
324
+ W: 'magenta',
325
+ Y: 'magenta',
326
+ P: 'brown',
327
+ G: 'brown',
328
+ C: 'yellow',
329
+ B: 'gray',
330
+ Z: 'gray',
331
+ X: 'gray',
332
+ '-': 'gray',
333
+ '.': 'gray',
334
+ },
335
+ } as { [key: string]: { [key: string]: string } }
336
+
337
+ // turn all supplied colors to hex colors which getContrastText from mui
338
+ // requires
339
+ export default transform(colorSchemes, ([key, val]) => [
340
+ key,
341
+ transform(val, ([letter, color]) => [letter, Color(color).hex()]),
342
+ ])
343
+
344
+ // info http://www.jalview.org/help/html/colourSchemes/clustal.html
345
+ // modifications:
346
+ // reference to clustalX source code scheme modifies what the jalview.org
347
+ // scheme says there the jalview.org colorscheme says WLVIMAFCHP but it
348
+ // should be WLVIMAFCHPY, colprot.xml says e.g. %#ACFHILMVWYPp" which has Y
349
+ export function getClustalXColor(
350
+ stats: { [key: string]: number },
351
+ model: { columns: Record<string, string> },
352
+ row: string,
353
+ col: number,
354
+ ) {
355
+ const total = Object.values(stats).reduce((a, b) => a + b, 0)
356
+ const l = model.columns[row][col]
357
+ const {
358
+ W = 0,
359
+ L = 0,
360
+ V = 0,
361
+ I = 0,
362
+ M = 0,
363
+ A = 0,
364
+ F = 0,
365
+ C = 0,
366
+ H = 0,
367
+ P = 0,
368
+ R = 0,
369
+ K = 0,
370
+ Q = 0,
371
+ E = 0,
372
+ D = 0,
373
+ T = 0,
374
+ S = 0,
375
+ G = 0,
376
+ Y = 0,
377
+ N = 0,
378
+ } = stats
379
+
380
+ const WLVIMAFCHP = W + L + V + I + M + A + F + C + H + P + Y
381
+
382
+ const KR = K + R
383
+ const QE = Q + E
384
+ const ED = E + D
385
+ const TS = T + S
386
+
387
+ if (WLVIMAFCHP / total > 0.6) {
388
+ if (
389
+ l === 'W' ||
390
+ l === 'L' ||
391
+ l === 'V' ||
392
+ l === 'A' ||
393
+ l === 'I' ||
394
+ l === 'M' ||
395
+ l === 'F' ||
396
+ l === 'C'
397
+ ) {
398
+ // blue from jalview.org docs
399
+ return 'rgb(128,179,230)'
400
+ }
401
+ }
402
+
403
+ if (
404
+ (l === 'K' || l === 'R') &&
405
+ (KR / total > 0.6 || K / total > 0.8 || R / total > 0.8 || Q / total > 0.8)
406
+ ) {
407
+ return '#d88'
408
+ }
409
+
410
+ if (
411
+ l === 'E' &&
412
+ (KR / total > 0.6 ||
413
+ QE / total > 0.5 ||
414
+ E / total > 0.8 ||
415
+ Q / total > 0.8 ||
416
+ D / total > 0.8)
417
+ ) {
418
+ return 'rgb(192, 72, 192)'
419
+ }
420
+
421
+ if (
422
+ l === 'D' &&
423
+ (KR / total > 0.6 ||
424
+ ED / total > 0.5 ||
425
+ K / total > 0.8 ||
426
+ R / total > 0.8 ||
427
+ Q / total > 0.8)
428
+ ) {
429
+ return 'rgb(204, 77, 204)'
430
+ }
431
+
432
+ if (l === 'N' && (N / total > 0.5 || Y / total > 0.85)) {
433
+ return '#8f8'
434
+ }
435
+ if (
436
+ l === 'Q' &&
437
+ (KR / total > 0.6 ||
438
+ QE / total > 0.6 ||
439
+ Q / total > 0.85 ||
440
+ E / total > 0.85 ||
441
+ K / total > 0.85 ||
442
+ R / total > 0.85)
443
+ ) {
444
+ return '#8f8'
445
+ }
446
+
447
+ if (
448
+ (l === 'S' || l === 'T') &&
449
+ // WLVIMAFCHP modified from 0.6 to 0.55 on page to match what i see in jalview
450
+ (WLVIMAFCHP / total > 0.6 ||
451
+ TS / total > 0.5 ||
452
+ S / total > 0.85 ||
453
+ T / total > 0.85)
454
+ ) {
455
+ return 'rgb(26,204,26)'
456
+ }
457
+
458
+ if (l === 'C' && C / total > 0.85) {
459
+ return 'rgb(240, 128, 128)'
460
+ }
461
+
462
+ if (l === 'G' && G / total > 0) {
463
+ return 'rgb(240, 144, 72)'
464
+ }
465
+ if (l === 'P' && P / total > 0) {
466
+ return 'rgb(204, 204, 0)'
467
+ }
468
+
469
+ if (
470
+ (l === 'H' || l === 'Y') &&
471
+ (WLVIMAFCHP / total > 0.6 ||
472
+ W > 0.85 ||
473
+ Y > 0.85 ||
474
+ A > 0.85 ||
475
+ C > 0.85 ||
476
+ P > 0.85 ||
477
+ Q > 0.85 ||
478
+ F > 0.85 ||
479
+ H > 0.85 ||
480
+ I > 0.85 ||
481
+ L > 0.85 ||
482
+ M > 0.85 ||
483
+ V > 0.85)
484
+ ) {
485
+ // cyan from jalview.org docs
486
+ return 'rgb(26, 179, 179)'
487
+ }
488
+ return undefined
489
+ }
490
+
491
+ // info http://www.jalview.org/help/html/colourSchemes/clustal.html
492
+ // modifications:
493
+ // reference to clustalX source code scheme modifies what the jalview.org
494
+ // scheme says there the jalview.org colorscheme says WLVIMAFCHP but it
495
+ // should be WLVIMAFCHPY, colprot.xml says e.g. %#ACFHILMVWYPp" which has Y
496
+ export function getPercentIdentityColor(
497
+ stats: { [key: string]: number },
498
+ model: { columns: Record<string, string> },
499
+ row: string,
500
+ col: number,
501
+ ) {
502
+ const total = Object.values(stats).reduce((a, b) => a + b, 0)
503
+ const l = model.columns[row][col]
504
+ const entries = Object.entries(stats)
505
+ let ent = 0
506
+ let letter = ''
507
+ for (let i = 0; i < entries.length; i++) {
508
+ if (entries[i][1] > ent && entries[i][0] !== '-') {
509
+ letter = entries[i][0]
510
+ ent = entries[i][1]
511
+ }
512
+ }
513
+ const proportion = ent / total
514
+ const thresh = `hsl(240, 30%, ${100 * Math.max(1 - ent / total / 3, 0.3)}%)`
515
+ if (proportion > 0.4) {
516
+ if (l === letter) {
517
+ return thresh
518
+ }
519
+ }
520
+ }
@@ -0,0 +1,64 @@
1
+ import React from 'react'
2
+ import { Dialog } from '@jbrowse/core/ui'
3
+ import { DialogContent, Typography, Link } from '@mui/material'
4
+ import { version } from '../version'
5
+
6
+ export default function AboutDialog({
7
+ onClose,
8
+ open,
9
+ }: {
10
+ onClose: () => void
11
+ open: boolean
12
+ }) {
13
+ return (
14
+ <Dialog onClose={() => onClose()} open={open} title="About this plugin">
15
+ <DialogContent>
16
+ <Typography>
17
+ MSAView {version} (
18
+ <Link href="https://github.com/gmod/jbrowse-plugin-msaview">
19
+ Github
20
+ </Link>
21
+ )
22
+ </Typography>
23
+
24
+ <ul>
25
+ <li>
26
+ <Typography>
27
+ We use some color schemes from the{' '}
28
+ <Link href="https://github.com/biotite-dev/biotite">biotite</Link>{' '}
29
+ project, and their license is reproduced{' '}
30
+ <Link href="https://github.com/biotite-dev/biotite/blob/master/LICENSE.rst">
31
+ here
32
+ </Link>
33
+ </Typography>
34
+ </li>
35
+ <li>
36
+ <Typography>
37
+ See this page for some information on jalview colorings{' '}
38
+ <Link href="https://www.jalview.org/help/html/colourSchemes/">
39
+ here
40
+ </Link>
41
+ </Typography>
42
+ </li>
43
+ <li>
44
+ <Typography>
45
+ See this page for some info on the clustal, cinema, maeditor, and
46
+ lesk color schemes{' '}
47
+ <Link href="http://www.bioinformatics.nl/~berndb/aacolour.html">
48
+ here
49
+ </Link>
50
+ </Typography>
51
+ </li>
52
+ <li>
53
+ <Typography>
54
+ See this paper about the flower color scheme{' '}
55
+ <Link href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7245768/">
56
+ here
57
+ </Link>
58
+ </Typography>
59
+ </li>
60
+ </ul>
61
+ </DialogContent>
62
+ </Dialog>
63
+ )
64
+ }
@@ -0,0 +1,74 @@
1
+ import React, { useState } from 'react'
2
+ import {
3
+ DialogContent,
4
+ DialogActions,
5
+ Button,
6
+ TextField,
7
+ MenuItem,
8
+ Typography,
9
+ } from '@mui/material'
10
+ import { Dialog, FileSelector } from '@jbrowse/core/ui'
11
+ import { FileLocation } from '@jbrowse/core/util/types'
12
+ import { observer } from 'mobx-react'
13
+ import { MsaViewModel } from '../model'
14
+
15
+ export default observer(function ({
16
+ model,
17
+ onClose,
18
+ open,
19
+ }: {
20
+ model: MsaViewModel
21
+ onClose: () => void
22
+ open: boolean
23
+ }) {
24
+ const options = model.rows.map(r => r[0])
25
+ const [trackFile, setTrackFile] = useState<FileLocation>()
26
+ const [currentOption, setCurrentOption] = useState('')
27
+
28
+ return (
29
+ <Dialog onClose={() => onClose()} open={open} title="Add track">
30
+ <DialogContent>
31
+ <Typography>
32
+ Open relevant per-alignment tracks e.g. protein domains
33
+ </Typography>
34
+ <TextField
35
+ select
36
+ helperText="Which row does this track apply to?"
37
+ value={currentOption}
38
+ onChange={event => {
39
+ setCurrentOption(event.target.value)
40
+ }}
41
+ >
42
+ {options.map((option, index) => (
43
+ <MenuItem key={`${option}-${index}`} value={option}>
44
+ {option}
45
+ </MenuItem>
46
+ ))}
47
+ </TextField>
48
+ <FileSelector location={trackFile} setLocation={setTrackFile} />
49
+ <DialogActions>
50
+ <Button
51
+ onClick={() => {
52
+ model.setError(undefined)
53
+ if (trackFile) {
54
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
55
+ model.setMSAFilehandle(trackFile)
56
+ }
57
+ }}
58
+ variant="contained"
59
+ color="primary"
60
+ >
61
+ Open
62
+ </Button>
63
+ <Button
64
+ color="secondary"
65
+ variant="contained"
66
+ onClick={() => onClose()}
67
+ >
68
+ Cancel
69
+ </Button>
70
+ </DialogActions>
71
+ </DialogContent>
72
+ </Dialog>
73
+ )
74
+ })