react-msaview 1.3.2 → 2.1.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 (245) hide show
  1. package/bundle/index.js +285 -97099
  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 +53 -0
  7. package/dist/UniprotTrack.js.map +1 -0
  8. package/dist/colorSchemes.d.ts +5 -11
  9. package/dist/colorSchemes.js +27 -32
  10. package/dist/colorSchemes.js.map +1 -0
  11. package/dist/components/BoxTrack.d.ts +6 -6
  12. package/dist/components/BoxTrack.js +9 -137
  13. package/dist/components/BoxTrack.js.map +1 -0
  14. package/dist/components/BoxTrackBlock.d.ts +8 -0
  15. package/dist/components/BoxTrackBlock.js +136 -0
  16. package/dist/components/BoxTrackBlock.js.map +1 -0
  17. package/dist/components/Header.d.ts +2 -2
  18. package/dist/components/Header.js +55 -48
  19. package/dist/components/Header.js.map +1 -0
  20. package/dist/components/ImportForm.d.ts +2 -2
  21. package/dist/components/ImportForm.js +59 -71
  22. package/dist/components/ImportForm.js.map +1 -0
  23. package/dist/components/MSABlock.d.ts +8 -0
  24. package/dist/components/MSABlock.js +103 -0
  25. package/dist/components/MSABlock.js.map +1 -0
  26. package/dist/components/MSACanvas.d.ts +2 -2
  27. package/dist/components/MSACanvas.js +32 -133
  28. package/dist/components/MSACanvas.js.map +1 -0
  29. package/dist/components/MSAMouseoverCanvas.d.ts +6 -0
  30. package/dist/components/MSAMouseoverCanvas.js +52 -0
  31. package/dist/components/MSAMouseoverCanvas.js.map +1 -0
  32. package/dist/components/MSAView.d.ts +2 -2
  33. package/dist/components/MSAView.js +17 -62
  34. package/dist/components/MSAView.js.map +1 -0
  35. package/dist/components/MultiAlignmentSelector.d.ts +6 -0
  36. package/dist/components/MultiAlignmentSelector.js +13 -0
  37. package/dist/components/MultiAlignmentSelector.js.map +1 -0
  38. package/dist/components/ResizeHandles.d.ts +5 -5
  39. package/dist/components/ResizeHandles.js +31 -32
  40. package/dist/components/ResizeHandles.js.map +1 -0
  41. package/dist/components/Rubberband.d.ts +3 -2
  42. package/dist/components/Rubberband.js +41 -64
  43. package/dist/components/Rubberband.js.map +1 -0
  44. package/dist/components/Ruler.d.ts +2 -16
  45. package/dist/components/Ruler.js +19 -88
  46. package/dist/components/Ruler.js.map +1 -0
  47. package/dist/components/TextTrack.d.ts +5 -5
  48. package/dist/components/TextTrack.js +23 -24
  49. package/dist/components/TextTrack.js.map +1 -0
  50. package/dist/components/Track.d.ts +5 -5
  51. package/dist/components/Track.js +41 -40
  52. package/dist/components/Track.js.map +1 -0
  53. package/dist/components/TreeBranchMenu.d.ts +14 -0
  54. package/dist/components/TreeBranchMenu.js +26 -0
  55. package/dist/components/TreeBranchMenu.js.map +1 -0
  56. package/dist/components/TreeCanvas.d.ts +2 -2
  57. package/dist/components/TreeCanvas.js +24 -356
  58. package/dist/components/TreeCanvas.js.map +1 -0
  59. package/dist/components/TreeCanvasBlock.d.ts +7 -0
  60. package/dist/components/TreeCanvasBlock.js +252 -0
  61. package/dist/components/TreeCanvasBlock.js.map +1 -0
  62. package/dist/components/TreeMenu.d.ts +12 -0
  63. package/dist/components/TreeMenu.js +56 -0
  64. package/dist/components/TreeMenu.js.map +1 -0
  65. package/dist/components/TreeRuler.d.ts +2 -2
  66. package/dist/components/TreeRuler.js +3 -3
  67. package/dist/components/TreeRuler.js.map +1 -0
  68. package/dist/components/VerticalGuide.d.ts +7 -0
  69. package/dist/components/VerticalGuide.js +30 -0
  70. package/dist/components/VerticalGuide.js.map +1 -0
  71. package/dist/components/ZoomControls.d.ts +6 -0
  72. package/dist/components/ZoomControls.js +58 -0
  73. package/dist/components/ZoomControls.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/dist/components/dialogs/AboutDlg.d.ts +4 -0
  78. package/dist/components/dialogs/AboutDlg.js +40 -0
  79. package/dist/components/dialogs/AboutDlg.js.map +1 -0
  80. package/{bundle/components → dist/components/dialogs}/AddTrackDlg.d.ts +3 -3
  81. package/dist/components/dialogs/AddTrackDlg.js +26 -0
  82. package/dist/components/dialogs/AddTrackDlg.js.map +1 -0
  83. package/dist/components/{AnnotationDlg.d.ts → dialogs/AnnotationDlg.d.ts} +3 -3
  84. package/dist/components/dialogs/AnnotationDlg.js +65 -0
  85. package/dist/components/dialogs/AnnotationDlg.js.map +1 -0
  86. package/dist/components/dialogs/DetailsDlg.d.ts +7 -0
  87. package/dist/components/dialogs/DetailsDlg.js +13 -0
  88. package/dist/components/dialogs/DetailsDlg.js.map +1 -0
  89. package/dist/components/dialogs/MoreInfoDlg.d.ts +6 -0
  90. package/dist/components/dialogs/MoreInfoDlg.js +11 -0
  91. package/dist/components/dialogs/MoreInfoDlg.js.map +1 -0
  92. package/dist/components/dialogs/SettingsDlg.d.ts +7 -0
  93. package/dist/components/dialogs/SettingsDlg.js +48 -0
  94. package/dist/components/dialogs/SettingsDlg.js.map +1 -0
  95. package/dist/components/dialogs/TrackInfoDlg.d.ts +9 -0
  96. package/{bundle/components → dist/components/dialogs}/TrackInfoDlg.js +12 -13
  97. package/dist/components/dialogs/TrackInfoDlg.js.map +1 -0
  98. package/dist/components/dialogs/TracklistDlg.d.ts +7 -0
  99. package/dist/components/dialogs/TracklistDlg.js +18 -0
  100. package/dist/components/dialogs/TracklistDlg.js.map +1 -0
  101. package/{bundle/components/Ruler.d.ts → dist/components/util.d.ts} +1 -6
  102. package/dist/components/util.js +68 -0
  103. package/dist/components/util.js.map +1 -0
  104. package/dist/index.d.ts +2 -4
  105. package/dist/index.js +3 -3
  106. package/dist/index.js.map +1 -0
  107. package/dist/layout.js +14 -20
  108. package/dist/layout.js.map +1 -0
  109. package/dist/model.d.ts +114 -97
  110. package/dist/model.js +248 -486
  111. package/dist/model.js.map +1 -0
  112. package/dist/parseNewick.d.ts +1 -5
  113. package/dist/parseNewick.js +11 -8
  114. package/dist/parseNewick.js.map +1 -0
  115. package/dist/parsers/ClustalMSA.d.ts +6 -18
  116. package/dist/parsers/ClustalMSA.js +55 -64
  117. package/dist/parsers/ClustalMSA.js.map +1 -0
  118. package/dist/parsers/FastaMSA.d.ts +5 -12
  119. package/dist/parsers/FastaMSA.js +55 -64
  120. package/dist/parsers/FastaMSA.js.map +1 -0
  121. package/dist/parsers/StockholmMSA.d.ts +10 -17
  122. package/dist/parsers/StockholmMSA.js +81 -110
  123. package/dist/parsers/StockholmMSA.js.map +1 -0
  124. package/dist/util.d.ts +34 -7
  125. package/dist/util.js +76 -24
  126. package/dist/util.js.map +1 -0
  127. package/dist/version.d.ts +1 -0
  128. package/dist/version.js +2 -0
  129. package/dist/version.js.map +1 -0
  130. package/package.json +34 -34
  131. package/src/StructureModel.ts +11 -0
  132. package/src/UniprotTrack.ts +59 -0
  133. package/src/colorSchemes.ts +520 -0
  134. package/src/components/BoxTrack.tsx +33 -0
  135. package/src/components/BoxTrackBlock.tsx +198 -0
  136. package/src/components/Header.tsx +106 -0
  137. package/src/components/ImportForm.tsx +192 -0
  138. package/src/components/MSABlock.tsx +164 -0
  139. package/src/components/MSACanvas.tsx +142 -0
  140. package/src/components/MSAMouseoverCanvas.tsx +87 -0
  141. package/src/components/MSAView.tsx +88 -0
  142. package/src/components/MultiAlignmentSelector.tsx +33 -0
  143. package/src/components/ResizeHandles.tsx +137 -0
  144. package/src/components/Rubberband.tsx +270 -0
  145. package/src/components/Ruler.tsx +123 -0
  146. package/src/components/TextTrack.tsx +120 -0
  147. package/src/components/Track.tsx +153 -0
  148. package/src/components/TreeBranchMenu.tsx +67 -0
  149. package/src/components/TreeCanvas.tsx +128 -0
  150. package/src/components/TreeCanvasBlock.tsx +359 -0
  151. package/src/components/TreeMenu.tsx +105 -0
  152. package/src/components/TreeRuler.tsx +12 -0
  153. package/src/components/VerticalGuide.tsx +50 -0
  154. package/src/components/ZoomControls.tsx +78 -0
  155. package/src/components/data/seq2.ts +35 -0
  156. package/src/components/dialogs/AboutDlg.tsx +58 -0
  157. package/src/components/dialogs/AddTrackDlg.tsx +74 -0
  158. package/src/components/dialogs/AnnotationDlg.tsx +144 -0
  159. package/src/components/dialogs/DetailsDlg.tsx +28 -0
  160. package/src/components/dialogs/MoreInfoDlg.tsx +21 -0
  161. package/src/components/dialogs/SettingsDlg.tsx +154 -0
  162. package/src/components/dialogs/TrackInfoDlg.tsx +59 -0
  163. package/src/components/dialogs/TracklistDlg.tsx +59 -0
  164. package/src/components/util.ts +93 -0
  165. package/src/declare.d.ts +1 -0
  166. package/src/index.ts +2 -0
  167. package/src/layout.ts +83 -0
  168. package/src/model.ts +793 -0
  169. package/{bundle/parseNewick.d.ts → src/parseNewick.ts} +35 -5
  170. package/src/parsers/ClustalMSA.ts +79 -0
  171. package/src/parsers/FastaMSA.ts +82 -0
  172. package/src/parsers/StockholmMSA.ts +137 -0
  173. package/src/util.ts +142 -0
  174. package/src/version.ts +1 -0
  175. package/bundle/colorSchemes.d.ts +0 -16
  176. package/bundle/colorSchemes.js +0 -455
  177. package/bundle/components/AboutDlg.d.ts +0 -5
  178. package/bundle/components/AboutDlg.js +0 -47
  179. package/bundle/components/AddTrackDlg.js +0 -26
  180. package/bundle/components/AnnotationDlg.d.ts +0 -11
  181. package/bundle/components/AnnotationDlg.js +0 -77
  182. package/bundle/components/BoxTrack.d.ts +0 -7
  183. package/bundle/components/BoxTrack.js +0 -143
  184. package/bundle/components/DetailsDlg.d.ts +0 -8
  185. package/bundle/components/DetailsDlg.js +0 -12
  186. package/bundle/components/Header.d.ts +0 -6
  187. package/bundle/components/Header.js +0 -63
  188. package/bundle/components/ImportForm.d.ts +0 -6
  189. package/bundle/components/ImportForm.js +0 -89
  190. package/bundle/components/MSACanvas.d.ts +0 -6
  191. package/bundle/components/MSACanvas.js +0 -210
  192. package/bundle/components/MSAView.d.ts +0 -6
  193. package/bundle/components/MSAView.js +0 -88
  194. package/bundle/components/MoreInfoDlg.d.ts +0 -6
  195. package/bundle/components/MoreInfoDlg.js +0 -11
  196. package/bundle/components/ResizeHandles.d.ts +0 -8
  197. package/bundle/components/ResizeHandles.js +0 -110
  198. package/bundle/components/Rubberband.d.ts +0 -7
  199. package/bundle/components/Rubberband.js +0 -196
  200. package/bundle/components/Ruler.js +0 -121
  201. package/bundle/components/SettingsDlg.d.ts +0 -8
  202. package/bundle/components/SettingsDlg.js +0 -40
  203. package/bundle/components/TextTrack.d.ts +0 -7
  204. package/bundle/components/TextTrack.js +0 -72
  205. package/bundle/components/Track.d.ts +0 -11
  206. package/bundle/components/Track.js +0 -81
  207. package/bundle/components/TrackInfoDlg.d.ts +0 -6
  208. package/bundle/components/TracklistDlg.d.ts +0 -8
  209. package/bundle/components/TracklistDlg.js +0 -18
  210. package/bundle/components/TreeCanvas.d.ts +0 -6
  211. package/bundle/components/TreeCanvas.js +0 -431
  212. package/bundle/components/TreeRuler.d.ts +0 -6
  213. package/bundle/components/TreeRuler.js +0 -8
  214. package/bundle/components/data/seq2.d.ts +0 -3
  215. package/bundle/components/data/seq2.js +0 -3
  216. package/bundle/index.d.ts +0 -4
  217. package/bundle/layout.d.ts +0 -23
  218. package/bundle/layout.js +0 -53
  219. package/bundle/model.d.ts +0 -364
  220. package/bundle/model.js +0 -894
  221. package/bundle/parseNewick.js +0 -94
  222. package/bundle/parsers/ClustalMSA.d.ts +0 -39
  223. package/bundle/parsers/ClustalMSA.js +0 -77
  224. package/bundle/parsers/FastaMSA.d.ts +0 -26
  225. package/bundle/parsers/FastaMSA.js +0 -78
  226. package/bundle/parsers/StockholmMSA.d.ts +0 -75
  227. package/bundle/parsers/StockholmMSA.js +0 -142
  228. package/bundle/util.d.ts +0 -17
  229. package/bundle/util.js +0 -33
  230. package/dist/components/AboutDlg.d.ts +0 -5
  231. package/dist/components/AboutDlg.js +0 -50
  232. package/dist/components/AddTrackDlg.d.ts +0 -8
  233. package/dist/components/AddTrackDlg.js +0 -26
  234. package/dist/components/AnnotationDlg.js +0 -77
  235. package/dist/components/DetailsDlg.d.ts +0 -8
  236. package/dist/components/DetailsDlg.js +0 -12
  237. package/dist/components/MoreInfoDlg.d.ts +0 -6
  238. package/dist/components/MoreInfoDlg.js +0 -11
  239. package/dist/components/SettingsDlg.d.ts +0 -8
  240. package/dist/components/SettingsDlg.js +0 -40
  241. package/dist/components/TrackInfoDlg.d.ts +0 -6
  242. package/dist/components/TrackInfoDlg.js +0 -33
  243. package/dist/components/TracklistDlg.d.ts +0 -8
  244. package/dist/components/TracklistDlg.js +0 -18
  245. package/dist/components/package.json +0 -62
@@ -1,94 +0,0 @@
1
- /**
2
- * Newick format parser in JavaScript.
3
- *
4
- * Copyright (c) Jason Davies 2010.
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in
14
- * all copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- * THE SOFTWARE.
23
- *
24
- * Example tree (from http://en.wikipedia.org/wiki/Newick_format):
25
- *
26
- * +--0.1--A
27
- * F-----0.2-----B +-------0.3----C
28
- * +------------------0.5-----E
29
- * +---------0.4------D
30
- *
31
- * Newick format:
32
- * (A:0.1,B:0.2,(C:0.3,D:0.4)E:0.5)F;
33
- *
34
- * Converted to JSON:
35
- * {
36
- * name: "F",
37
- * branchset: [
38
- * {name: "A", length: 0.1},
39
- * {name: "B", length: 0.2},
40
- * {
41
- * name: "E",
42
- * length: 0.5,
43
- * branchset: [
44
- * {name: "C", length: 0.3},
45
- * {name: "D", length: 0.4}
46
- * ]
47
- * }
48
- * ]
49
- * }
50
- *
51
- * Converted to JSON, but with no names or lengths:
52
- * {
53
- * branchset: [
54
- * {}, {}, {
55
- * branchset: [{}, {}]
56
- * }
57
- * ]
58
- * }
59
- */
60
- export default function parse(s) {
61
- var ancestors = [];
62
- var tree = {};
63
- var tokens = s.split(/\s*(;|\(|\)|,|:)\s*/);
64
- for (var i = 0; i < tokens.length; i++) {
65
- var token = tokens[i];
66
- var subtree = {};
67
- switch (token) {
68
- case '(': // new branchset
69
- tree.branchset = [subtree];
70
- ancestors.push(tree);
71
- tree = subtree;
72
- break;
73
- case ',': // another branch
74
- ancestors[ancestors.length - 1].branchset.push(subtree);
75
- tree = subtree;
76
- break;
77
- case ')': // optional name next
78
- tree = ancestors.pop();
79
- break;
80
- case ':': // optional length next
81
- break;
82
- default: {
83
- var x = tokens[i - 1];
84
- if (x === ')' || x === '(' || x === ',') {
85
- tree.name = token;
86
- }
87
- else if (x === ':') {
88
- tree.length = parseFloat(token);
89
- }
90
- }
91
- }
92
- }
93
- return tree;
94
- }
@@ -1,39 +0,0 @@
1
- export default class ClustalMSA {
2
- private MSA;
3
- constructor(text: string);
4
- getMSA(): {
5
- header: Record<string, any>;
6
- consensus?: string | undefined;
7
- alns: {
8
- id: string;
9
- seq: string;
10
- }[];
11
- };
12
- getRow(name: string): string[] | undefined;
13
- getWidth(): number;
14
- getDetails(): Record<string, any>;
15
- getNames(): string[];
16
- getStructures(): {};
17
- get alignmentNames(): never[];
18
- getTree(): {
19
- id: string;
20
- noTree: boolean;
21
- branchset: {
22
- id: string;
23
- name: string;
24
- }[];
25
- };
26
- get seqConsensus(): string | undefined;
27
- get secondaryStructureConsensus(): undefined;
28
- get tracks(): {
29
- id: string;
30
- name: string;
31
- data: string;
32
- customColorScheme: {
33
- '*': string;
34
- ':': string;
35
- '.': string;
36
- ' ': string;
37
- };
38
- }[];
39
- }
@@ -1,77 +0,0 @@
1
- import { parse } from 'clustal-js';
2
- var ClustalMSA = /** @class */ (function () {
3
- function ClustalMSA(text) {
4
- this.MSA = parse(text);
5
- }
6
- ClustalMSA.prototype.getMSA = function () {
7
- return this.MSA;
8
- };
9
- ClustalMSA.prototype.getRow = function (name) {
10
- var _a;
11
- return (_a = this.MSA.alns.find(function (aln) { return aln.id === name; })) === null || _a === void 0 ? void 0 : _a.seq.split('');
12
- };
13
- ClustalMSA.prototype.getWidth = function () {
14
- return this.MSA.alns[0].seq.length;
15
- };
16
- ClustalMSA.prototype.getDetails = function () {
17
- return this.MSA.header;
18
- };
19
- ClustalMSA.prototype.getNames = function () {
20
- return this.MSA.alns.map(function (aln) { return aln.id; });
21
- };
22
- ClustalMSA.prototype.getStructures = function () {
23
- return {};
24
- };
25
- Object.defineProperty(ClustalMSA.prototype, "alignmentNames", {
26
- get: function () {
27
- return [];
28
- },
29
- enumerable: false,
30
- configurable: true
31
- });
32
- ClustalMSA.prototype.getTree = function () {
33
- return {
34
- id: 'root',
35
- noTree: true,
36
- branchset: this.getNames().map(function (name) { return ({ id: name, name: name }); }),
37
- };
38
- };
39
- Object.defineProperty(ClustalMSA.prototype, "seqConsensus", {
40
- get: function () {
41
- return this.MSA.consensus;
42
- },
43
- enumerable: false,
44
- configurable: true
45
- });
46
- Object.defineProperty(ClustalMSA.prototype, "secondaryStructureConsensus", {
47
- get: function () {
48
- return undefined;
49
- },
50
- enumerable: false,
51
- configurable: true
52
- });
53
- Object.defineProperty(ClustalMSA.prototype, "tracks", {
54
- get: function () {
55
- var _a;
56
- return ((_a = this.seqConsensus) === null || _a === void 0 ? void 0 : _a.trim())
57
- ? [
58
- {
59
- id: 'seqConsensus',
60
- name: 'Sequence consensus',
61
- data: this.seqConsensus,
62
- customColorScheme: {
63
- '*': 'white',
64
- ':': 'grey',
65
- '.': 'darkgrey',
66
- ' ': 'black',
67
- },
68
- },
69
- ]
70
- : [];
71
- },
72
- enumerable: false,
73
- configurable: true
74
- });
75
- return ClustalMSA;
76
- }());
77
- export default ClustalMSA;
@@ -1,26 +0,0 @@
1
- export default class FastaMSA {
2
- private MSA;
3
- constructor(text: string);
4
- getMSA(): {
5
- seqdata: {
6
- [key: string]: string;
7
- };
8
- };
9
- getNames(): string[];
10
- getRow(name: string): string[];
11
- getWidth(): number;
12
- getStructures(): {};
13
- get alignmentNames(): never[];
14
- getDetails(): {};
15
- getTree(): {
16
- id: string;
17
- noTree: boolean;
18
- branchset: {
19
- id: string;
20
- name: string;
21
- }[];
22
- };
23
- get seqConsensus(): undefined;
24
- get secondaryStructureConsensus(): undefined;
25
- get tracks(): never[];
26
- }
@@ -1,78 +0,0 @@
1
- var FastaMSA = /** @class */ (function () {
2
- function FastaMSA(text) {
3
- var seq = {};
4
- var name = '';
5
- var re = /^>(\S+)/;
6
- text.split('\n').forEach(function (line) {
7
- var match = re.exec(line);
8
- if (match) {
9
- seq[(name = match[1])] = '';
10
- }
11
- else if (name) {
12
- seq[name] = seq[name] + line.replace(/[ \t]/g, '');
13
- }
14
- });
15
- this.MSA = { seqdata: seq };
16
- }
17
- FastaMSA.prototype.getMSA = function () {
18
- return this.MSA;
19
- };
20
- FastaMSA.prototype.getNames = function () {
21
- return Object.keys(this.MSA.seqdata);
22
- };
23
- FastaMSA.prototype.getRow = function (name) {
24
- var _a, _b;
25
- return (_b = (_a = this.MSA) === null || _a === void 0 ? void 0 : _a.seqdata[name]) === null || _b === void 0 ? void 0 : _b.split('');
26
- };
27
- FastaMSA.prototype.getWidth = function () {
28
- var _a;
29
- var name = Object.keys((_a = this.MSA) === null || _a === void 0 ? void 0 : _a.seqdata)[0];
30
- return this.getRow(name).length;
31
- };
32
- FastaMSA.prototype.getStructures = function () {
33
- return {};
34
- };
35
- Object.defineProperty(FastaMSA.prototype, "alignmentNames", {
36
- get: function () {
37
- return [];
38
- },
39
- enumerable: false,
40
- configurable: true
41
- });
42
- FastaMSA.prototype.getDetails = function () {
43
- return {};
44
- };
45
- FastaMSA.prototype.getTree = function () {
46
- return {
47
- id: 'root',
48
- noTree: true,
49
- branchset: this.getNames().map(function (name) { return ({
50
- id: name,
51
- name: name,
52
- }); }),
53
- };
54
- };
55
- Object.defineProperty(FastaMSA.prototype, "seqConsensus", {
56
- get: function () {
57
- return undefined;
58
- },
59
- enumerable: false,
60
- configurable: true
61
- });
62
- Object.defineProperty(FastaMSA.prototype, "secondaryStructureConsensus", {
63
- get: function () {
64
- return undefined;
65
- },
66
- enumerable: false,
67
- configurable: true
68
- });
69
- Object.defineProperty(FastaMSA.prototype, "tracks", {
70
- get: function () {
71
- return [];
72
- },
73
- enumerable: false,
74
- configurable: true
75
- });
76
- return FastaMSA;
77
- }());
78
- export default FastaMSA;
@@ -1,75 +0,0 @@
1
- declare type StockholmEntry = {
2
- gf: {
3
- DE?: string[];
4
- NH?: string[];
5
- };
6
- gs: {
7
- AC: Record<string, string>;
8
- DR: Record<string, string>;
9
- };
10
- gc?: {
11
- SS_cons?: string;
12
- seq_cons?: string;
13
- };
14
- seqdata: {
15
- [key: string]: string;
16
- };
17
- };
18
- export default class StockholmMSA {
19
- private data;
20
- private MSA;
21
- constructor(text: string, currentAlignment: number);
22
- getMSA(): StockholmEntry;
23
- getRow(name: string): string[];
24
- getWidth(): number;
25
- get alignmentNames(): string[];
26
- getDetails(): {
27
- General: {
28
- DE?: string[] | undefined;
29
- NH?: string[] | undefined;
30
- };
31
- Accessions: Record<string, string>;
32
- Dbxref: Record<string, string>;
33
- };
34
- getRowDetails(rowName: string): {
35
- name: string;
36
- accession: string;
37
- dbxref: string;
38
- };
39
- getNames(): string[];
40
- getSeqCoords(): void;
41
- getStructures(): Record<string, {
42
- pdb: string;
43
- chain: string;
44
- startPos: number;
45
- endPos: number;
46
- }[]>;
47
- getTree(): import("../util").NodeWithIds | {
48
- id: string;
49
- noTree: boolean;
50
- branchset: {
51
- id: string;
52
- name: string;
53
- }[];
54
- };
55
- get seqConsensus(): string | undefined;
56
- get secondaryStructureConsensus(): string | undefined;
57
- get tracks(): ({
58
- id: string;
59
- name: string;
60
- data: string | undefined;
61
- customColorScheme: {
62
- '>'?: undefined;
63
- '<'?: undefined;
64
- };
65
- } | {
66
- id: string;
67
- name: string;
68
- data: string | undefined;
69
- customColorScheme: {
70
- '>': string;
71
- '<': string;
72
- };
73
- })[];
74
- }
75
- export {};
@@ -1,142 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import Stockholm from 'stockholm-js';
13
- import parseNewick from '../parseNewick';
14
- import { generateNodeIds } from '../util';
15
- var StockholmMSA = /** @class */ (function () {
16
- function StockholmMSA(text, currentAlignment) {
17
- var res = Stockholm.parseAll(text);
18
- this.data = res;
19
- this.MSA = res[currentAlignment];
20
- }
21
- StockholmMSA.prototype.getMSA = function () {
22
- return this.MSA;
23
- };
24
- StockholmMSA.prototype.getRow = function (name) {
25
- var _a, _b;
26
- return (_b = (_a = this.MSA) === null || _a === void 0 ? void 0 : _a.seqdata[name]) === null || _b === void 0 ? void 0 : _b.split('');
27
- };
28
- StockholmMSA.prototype.getWidth = function () {
29
- var _a;
30
- var name = Object.keys((_a = this.MSA) === null || _a === void 0 ? void 0 : _a.seqdata)[0];
31
- return this.getRow(name).length;
32
- };
33
- Object.defineProperty(StockholmMSA.prototype, "alignmentNames", {
34
- get: function () {
35
- return this.data.map(function (aln, index) { var _a; return ((_a = aln.gf.DE) === null || _a === void 0 ? void 0 : _a[0]) || "Alignment " + (index + 1); });
36
- },
37
- enumerable: false,
38
- configurable: true
39
- });
40
- StockholmMSA.prototype.getDetails = function () {
41
- var _a, _b;
42
- return {
43
- General: this.MSA.gf,
44
- Accessions: (_a = this.MSA.gs) === null || _a === void 0 ? void 0 : _a.AC,
45
- Dbxref: (_b = this.MSA.gs) === null || _b === void 0 ? void 0 : _b.DR,
46
- };
47
- };
48
- StockholmMSA.prototype.getRowDetails = function (rowName) {
49
- var _a, _b;
50
- return {
51
- name: rowName,
52
- accession: (_a = this.MSA.gs) === null || _a === void 0 ? void 0 : _a.AC[rowName],
53
- dbxref: (_b = this.MSA.gs) === null || _b === void 0 ? void 0 : _b.DR[rowName],
54
- };
55
- };
56
- StockholmMSA.prototype.getNames = function () {
57
- return Object.keys(this.MSA.seqdata);
58
- };
59
- StockholmMSA.prototype.getSeqCoords = function () { };
60
- StockholmMSA.prototype.getStructures = function () {
61
- var _a;
62
- var pdbRegex = /PDB; +(\S+) +(\S); ([0-9]+)-([0-9]+)/;
63
- var ent = this.MSA;
64
- return Object.entries(((_a = ent.gs) === null || _a === void 0 ? void 0 : _a.DR) || {})
65
- .map(function (_a) {
66
- var id = _a[0], dr = _a[1];
67
- return [id, pdbRegex.exec(dr)];
68
- })
69
- .filter(function (item) { return !!item[1]; })
70
- .map(function (_a) {
71
- var id = _a[0], match = _a[1];
72
- var pdb = match[1].toLowerCase();
73
- var chain = match[2];
74
- var startPos = +match[3];
75
- var endPos = +match[4];
76
- return { id: id, pdb: pdb, chain: chain, startPos: startPos, endPos: endPos };
77
- })
78
- .reduce(function (a, b) {
79
- var id = b.id, rest = __rest(b, ["id"]);
80
- if (!a[id]) {
81
- a[id] = [];
82
- }
83
- a[id].push(rest);
84
- return a;
85
- }, {});
86
- };
87
- StockholmMSA.prototype.getTree = function () {
88
- var _a, _b, _c;
89
- var tree = (_c = (_b = (_a = this.MSA) === null || _a === void 0 ? void 0 : _a.gf) === null || _b === void 0 ? void 0 : _b.NH) === null || _c === void 0 ? void 0 : _c[0];
90
- return tree
91
- ? generateNodeIds(parseNewick(tree))
92
- : {
93
- id: 'root',
94
- noTree: true,
95
- branchset: this.getNames().map(function (name) { return ({
96
- id: name,
97
- name: name,
98
- }); }),
99
- };
100
- };
101
- Object.defineProperty(StockholmMSA.prototype, "seqConsensus", {
102
- get: function () {
103
- var _a;
104
- return (_a = this.MSA.gc) === null || _a === void 0 ? void 0 : _a.seq_cons;
105
- },
106
- enumerable: false,
107
- configurable: true
108
- });
109
- Object.defineProperty(StockholmMSA.prototype, "secondaryStructureConsensus", {
110
- get: function () {
111
- var _a;
112
- return (_a = this.MSA.gc) === null || _a === void 0 ? void 0 : _a.SS_cons;
113
- },
114
- enumerable: false,
115
- configurable: true
116
- });
117
- Object.defineProperty(StockholmMSA.prototype, "tracks", {
118
- get: function () {
119
- return [
120
- {
121
- id: 'seqConsensus',
122
- name: 'Sequence consensus',
123
- data: this.seqConsensus,
124
- customColorScheme: {},
125
- },
126
- {
127
- id: 'secondaryStruct',
128
- name: 'Secondary-structure',
129
- data: this.secondaryStructureConsensus,
130
- customColorScheme: {
131
- '>': 'pink',
132
- '<': 'lightblue',
133
- },
134
- },
135
- ];
136
- },
137
- enumerable: false,
138
- configurable: true
139
- });
140
- return StockholmMSA;
141
- }());
142
- export default StockholmMSA;
package/bundle/util.d.ts DELETED
@@ -1,17 +0,0 @@
1
- export declare function transform<T>(obj: Record<string, T>, cb: (arg0: [string, T]) => [string, T]): {
2
- [k: string]: T;
3
- };
4
- export declare type Node = {
5
- branchset?: Node[];
6
- };
7
- export declare type NodeWithIds = {
8
- id: string;
9
- branchset: NodeWithIds[];
10
- noTree?: boolean;
11
- };
12
- export declare function generateNodeIds(tree: Node, parent?: string, depth?: number): NodeWithIds;
13
- export declare function colorContrast(colorScheme: {
14
- [key: string]: string;
15
- }, theme: any): {
16
- [k: string]: string;
17
- };
package/bundle/util.js DELETED
@@ -1,33 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import Color from 'color';
13
- export function transform(obj, cb) {
14
- return Object.fromEntries(Object.entries(obj).map(cb));
15
- }
16
- export function generateNodeIds(tree, parent, depth) {
17
- var _a;
18
- if (parent === void 0) { parent = 'node'; }
19
- if (depth === void 0) { depth = 0; }
20
- var id = parent + "-" + depth;
21
- return __assign(__assign({}, tree), { id: id, branchset: ((_a = tree.branchset) === null || _a === void 0 ? void 0 : _a.map(function (b, i) {
22
- return generateNodeIds(b, id + "-" + i, depth + 1);
23
- })) || [] });
24
- }
25
- export function colorContrast(colorScheme, theme) {
26
- return transform(colorScheme, function (_a) {
27
- var letter = _a[0], color = _a[1];
28
- return [
29
- letter,
30
- theme.palette.getContrastText(Color(color).hex()),
31
- ];
32
- });
33
- }
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- export default function AboutDialog({ onClose, open, }: {
3
- onClose: () => void;
4
- open: boolean;
5
- }): JSX.Element;
@@ -1,50 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { Dialog, DialogTitle, DialogContent, Typography, Link, } from '@material-ui/core';
3
- import { version } from './package.json';
4
- function LicenseDialog(_a) {
5
- var onClose = _a.onClose, open = _a.open;
6
- return (React.createElement(Dialog, { onClose: function () { return onClose(); }, open: open },
7
- React.createElement(DialogTitle, null, "Biotite License"),
8
- React.createElement(DialogContent, null,
9
- React.createElement("pre", { style: { height: 100, overflow: 'auto' } }, "\nCopyright 2017 - 2020, The Biotite contributors\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\nlist of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\nthis list of conditions and the following disclaimer in the documentation and/or\nother materials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its contributors\nmay be used to endorse or promote products derived from this software without\nspecific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n "))));
10
- }
11
- export default function AboutDialog(_a) {
12
- var onClose = _a.onClose, open = _a.open;
13
- var _b = useState(false), dlgOpen = _b[0], setDlgOpen = _b[1];
14
- return (React.createElement(React.Fragment, null,
15
- React.createElement(LicenseDialog, { onClose: function () { return setDlgOpen(false); }, open: dlgOpen }),
16
- React.createElement(Dialog, { onClose: function () { return onClose(); }, open: open },
17
- React.createElement(DialogTitle, null, "About this plugin"),
18
- React.createElement(DialogContent, null,
19
- React.createElement(Typography, null,
20
- "MSAView ",
21
- version,
22
- " (",
23
- React.createElement(Link, { href: "https://github.com/gmod/jbrowse-plugin-msaview" }, "Github"),
24
- ")"),
25
- React.createElement("ul", null,
26
- React.createElement("li", null,
27
- React.createElement(Typography, null,
28
- "We use some color schemes from the",
29
- ' ',
30
- React.createElement(Link, { href: "https://github.com/biotite-dev/biotite" }, "biotite"),
31
- ' ',
32
- "project, and their license is reproduced",
33
- ' ',
34
- React.createElement(Link, { onClick: function () { return setDlgOpen(true); } }, "here"))),
35
- React.createElement("li", null,
36
- React.createElement(Typography, null,
37
- "See this page for some information on jalview colorings",
38
- ' ',
39
- React.createElement(Link, { href: "https://www.jalview.org/help/html/colourSchemes/" }, "here"))),
40
- React.createElement("li", null,
41
- React.createElement(Typography, null,
42
- "See this page for some info on the clustal, cinema, maeditor, and lesk color schemes",
43
- ' ',
44
- React.createElement(Link, { href: "http://www.bioinformatics.nl/~berndb/aacolour.html" }, "here"))),
45
- React.createElement("li", null,
46
- React.createElement(Typography, null,
47
- "See this paper about the flower color scheme",
48
- ' ',
49
- React.createElement(Link, { href: "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7245768/" }, "here"))))))));
50
- }
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- import { MsaViewModel } from '../model';
3
- declare const _default: ({ model, onClose, open, }: {
4
- model: MsaViewModel;
5
- onClose: () => void;
6
- open: boolean;
7
- }) => JSX.Element;
8
- export default _default;
@@ -1,26 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { Dialog, DialogTitle, DialogContent, DialogActions, Button, TextField, MenuItem, Typography, } from '@material-ui/core';
3
- import { FileSelector } from '@jbrowse/core/ui';
4
- import { observer } from 'mobx-react';
5
- export default observer(function (_a) {
6
- var model = _a.model, onClose = _a.onClose, open = _a.open;
7
- var options = model.rows.map(function (r) { return r[0]; });
8
- var _b = useState(), trackFile = _b[0], setTrackFile = _b[1];
9
- var _c = useState(''), currentOption = _c[0], setCurrentOption = _c[1];
10
- return (React.createElement(Dialog, { onClose: function () { return onClose(); }, open: open },
11
- React.createElement(DialogTitle, null, "Add track"),
12
- React.createElement(DialogContent, null,
13
- React.createElement(Typography, null, "Open relevant per-alignment tracks e.g. protein domains"),
14
- React.createElement(TextField, { select: true, helperText: "Which row does this track apply to?", value: currentOption, onChange: function (event) {
15
- setCurrentOption(event.target.value);
16
- } }, options.map(function (option, index) { return (React.createElement(MenuItem, { key: "".concat(option, "-").concat(index), value: option }, option)); })),
17
- React.createElement(FileSelector, { location: trackFile, setLocation: setTrackFile }),
18
- React.createElement(DialogActions, null,
19
- React.createElement(Button, { onClick: function () {
20
- model.setError(undefined);
21
- if (trackFile) {
22
- model.setMSAFilehandle(trackFile);
23
- }
24
- }, variant: "contained", color: "primary" }, "Open"),
25
- React.createElement(Button, { color: "secondary", variant: "contained", onClick: function () { return onClose(); } }, "Cancel")))));
26
- });