react-msaview 3.2.1 → 3.2.2

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 (48) hide show
  1. package/bundle/index.js +11 -11
  2. package/dist/components/msa/renderMSABlock.js +30 -26
  3. package/dist/components/msa/renderMSABlock.js.map +1 -1
  4. package/dist/components/tree/dialogs/TreeNodeInfoDialog.js +2 -3
  5. package/dist/components/tree/dialogs/TreeNodeInfoDialog.js.map +1 -1
  6. package/dist/components/tree/renderTreeCanvas.js +5 -5
  7. package/dist/components/tree/renderTreeCanvas.js.map +1 -1
  8. package/dist/model/DialogQueue.d.ts +1 -1
  9. package/dist/model.d.ts +23 -24
  10. package/dist/model.js +37 -13
  11. package/dist/model.js.map +1 -1
  12. package/dist/parseNewick.d.ts +4 -4
  13. package/dist/parseNewick.js +7 -7
  14. package/dist/parseNewick.js.map +1 -1
  15. package/dist/parsers/ClustalMSA.d.ts +4 -4
  16. package/dist/parsers/ClustalMSA.js +2 -2
  17. package/dist/parsers/ClustalMSA.js.map +1 -1
  18. package/dist/parsers/EmfMSA.d.ts +27 -0
  19. package/dist/parsers/EmfMSA.js +53 -0
  20. package/dist/parsers/EmfMSA.js.map +1 -0
  21. package/dist/parsers/EmfTree.d.ts +5 -0
  22. package/dist/parsers/EmfTree.js +8 -0
  23. package/dist/parsers/EmfTree.js.map +1 -0
  24. package/dist/parsers/FastaMSA.js +2 -2
  25. package/dist/parsers/FastaMSA.js.map +1 -1
  26. package/dist/parsers/StockholmMSA.js +2 -2
  27. package/dist/parsers/StockholmMSA.js.map +1 -1
  28. package/dist/reparseTree.js +2 -2
  29. package/dist/reparseTree.js.map +1 -1
  30. package/dist/util.d.ts +3 -3
  31. package/dist/util.js +1 -1
  32. package/dist/util.js.map +1 -1
  33. package/dist/version.d.ts +1 -1
  34. package/dist/version.js +1 -1
  35. package/package.json +4 -3
  36. package/src/components/msa/renderMSABlock.ts +42 -38
  37. package/src/components/tree/dialogs/TreeNodeInfoDialog.tsx +6 -2
  38. package/src/components/tree/renderTreeCanvas.ts +2 -2
  39. package/src/model.ts +38 -19
  40. package/src/parseNewick.ts +7 -7
  41. package/src/parsers/ClustalMSA.ts +2 -2
  42. package/src/parsers/EmfMSA.ts +66 -0
  43. package/src/parsers/EmfTree.ts +9 -0
  44. package/src/parsers/FastaMSA.ts +2 -2
  45. package/src/parsers/StockholmMSA.ts +2 -2
  46. package/src/reparseTree.ts +3 -3
  47. package/src/util.ts +5 -5
  48. package/src/version.ts +1 -1
@@ -44,10 +44,10 @@ export default class ClustalMSA {
44
44
  id: 'root',
45
45
  name: 'root',
46
46
  noTree: true,
47
- branchset: this.getNames().map(name => ({
47
+ children: this.getNames().map(name => ({
48
48
  id: name,
49
49
  name,
50
- branchset: [],
50
+ children: [],
51
51
  })),
52
52
  }
53
53
  }
@@ -0,0 +1,66 @@
1
+ import { parseEmfAln } from 'emf-js'
2
+ import type { NodeWithIds } from '../util'
3
+
4
+ export default class EmfMSA {
5
+ private MSA: ReturnType<typeof parseEmfAln>
6
+
7
+ constructor(text: string) {
8
+ this.MSA = parseEmfAln(text)
9
+ }
10
+
11
+ getMSA() {
12
+ return this.MSA
13
+ }
14
+
15
+ getRow(name: string): string {
16
+ return this.MSA.find(aln => aln.protein === name)?.seq || ''
17
+ }
18
+
19
+ getWidth() {
20
+ return this.MSA[0]!.seq.length
21
+ }
22
+
23
+ getRowData() {
24
+ return undefined
25
+ }
26
+
27
+ getHeader() {
28
+ return ''
29
+ }
30
+
31
+ getNames() {
32
+ return this.MSA.map(aln => aln.protein)
33
+ }
34
+
35
+ getStructures() {
36
+ return {}
37
+ }
38
+
39
+ get alignmentNames() {
40
+ return []
41
+ }
42
+
43
+ getTree(): NodeWithIds {
44
+ return {
45
+ id: 'root',
46
+ name: 'root',
47
+ noTree: true,
48
+ children: this.getNames().map(name => ({
49
+ id: name,
50
+ name,
51
+ children: [],
52
+ })),
53
+ }
54
+ }
55
+
56
+ get seqConsensus() {
57
+ return undefined
58
+ }
59
+ get secondaryStructureConsensus() {
60
+ return undefined
61
+ }
62
+
63
+ get tracks() {
64
+ return []
65
+ }
66
+ }
@@ -0,0 +1,9 @@
1
+ import { parseEmfTree } from 'emf-js'
2
+
3
+ export default class EmfTree {
4
+ data: ReturnType<typeof parseEmfTree>
5
+
6
+ constructor(text: string) {
7
+ this.data = parseEmfTree(text)
8
+ }
9
+ }
@@ -61,9 +61,9 @@ export default class FastaMSA {
61
61
  id: 'root',
62
62
  name: 'root',
63
63
  noTree: true,
64
- branchset: this.getNames().map(name => ({
64
+ children: this.getNames().map(name => ({
65
65
  id: name,
66
- branchset: [],
66
+ children: [],
67
67
  name,
68
68
  })),
69
69
  }
@@ -100,9 +100,9 @@ export default class StockholmMSA {
100
100
  id: 'root',
101
101
  name: 'root',
102
102
  noTree: true,
103
- branchset: this.getNames().map(name => ({
103
+ children: this.getNames().map(name => ({
104
104
  id: name,
105
- branchset: [],
105
+ children: [],
106
106
  name,
107
107
  })),
108
108
  }
@@ -3,11 +3,11 @@ import type { NodeWithIds } from './util'
3
3
  export function reparseTree(tree: NodeWithIds): NodeWithIds {
4
4
  return {
5
5
  ...tree,
6
- branchset: tree.branchset.map(r =>
7
- r.branchset.length
6
+ children: tree.children.map(r =>
7
+ r.children.length
8
8
  ? reparseTree(r)
9
9
  : {
10
- branchset: [r],
10
+ children: [r],
11
11
  id: `${r.id}-leafnode`,
12
12
  name: `${r.name}-hidden`,
13
13
  },
package/src/util.ts CHANGED
@@ -14,7 +14,7 @@ export function transform<T>(
14
14
  }
15
15
 
16
16
  interface Node {
17
- branchset?: Node[]
17
+ children?: Node[]
18
18
  name?: string
19
19
  [key: string]: unknown
20
20
  }
@@ -22,7 +22,7 @@ interface Node {
22
22
  export interface NodeWithIds {
23
23
  id: string
24
24
  name: string
25
- branchset: NodeWithIds[]
25
+ children: NodeWithIds[]
26
26
  length?: number
27
27
  noTree?: boolean
28
28
  }
@@ -30,7 +30,7 @@ export interface NodeWithIds {
30
30
  export interface NodeWithIdsAndLength {
31
31
  id: string
32
32
  name: string
33
- branchset: NodeWithIdsAndLength[]
33
+ children: NodeWithIdsAndLength[]
34
34
  noTree?: boolean
35
35
  length: number
36
36
  }
@@ -46,8 +46,8 @@ export function generateNodeIds(
46
46
  ...tree,
47
47
  id,
48
48
  name: tree.name || id,
49
- branchset:
50
- tree.branchset?.map((b, i) =>
49
+ children:
50
+ tree.children?.map((b, i) =>
51
51
  generateNodeIds(b, `${id}-${i}`, depth + 1),
52
52
  ) || [],
53
53
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '3.2.1'
1
+ export const version = '3.2.2'