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
@@ -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,62 +0,0 @@
1
- {
2
- "version": "1.3.0",
3
- "license": "MIT",
4
- "main": "dist/index.js",
5
- "typings": "dist/index.d.ts",
6
- "files": [
7
- "dist",
8
- "bundle"
9
- ],
10
- "engines": {
11
- "node": ">=10"
12
- },
13
- "scripts": {
14
- "lint": "eslint src",
15
- "clean": "rimraf dist",
16
- "prestart": "npm run clean",
17
- "prebuild": "npm run clean",
18
- "start": "yarn tsc --watch",
19
- "build": "yarn tsc && rollup -c",
20
- "preversion": "npm run build",
21
- "postversion": "git push --follow-tags"
22
- },
23
- "peerDependencies": {
24
- "@jbrowse/core": ">=1.5.1",
25
- "@material-ui/core": ">=4.12.2",
26
- "react": ">=16.8.0",
27
- "react-dom": ">=16.8.0"
28
- },
29
- "name": "react-msaview",
30
- "author": "Colin",
31
- "devDependencies": {
32
- "@rollup/plugin-commonjs": "^21.0.1",
33
- "@rollup/plugin-json": "^4.1.0",
34
- "@rollup/plugin-node-resolve": "^13.0.6",
35
- "@rollup/plugin-typescript": "^8.3.0",
36
- "@types/color": "^3.0.1",
37
- "@types/d3": "^6.7.0",
38
- "@types/lodash": "^4.14.170",
39
- "@types/react": "^17.0.3",
40
- "@types/react-dom": "^17.0.2",
41
- "concurrently": "^6.2.0",
42
- "eslint-config-react-app": "^6.0.0",
43
- "react": "^17.0.1",
44
- "react-dom": "^17.0.1",
45
- "rollup": "^2.60.2",
46
- "rollup-plugin-node-builtins": "^2.1.2",
47
- "rollup-plugin-node-polyfills": "^0.2.1",
48
- "rollup-plugin-polyfill-node": "^0.7.0",
49
- "tslib": "^2.1.0",
50
- "typescript": "^4.2.3"
51
- },
52
- "dependencies": {
53
- "clustal-js": "^1.0.3",
54
- "color": "^3.1.3",
55
- "copy-to-clipboard": "^3.3.1",
56
- "d3-array": "^2.12.0",
57
- "d3-hierarchy": "^2.0.0",
58
- "normalize-wheel": "^1.0.1",
59
- "rbush": "^3.0.1",
60
- "stockholm-js": "^1.0.10"
61
- }
62
- }