@grunwaldlab/heat-tree 0.1.0 → 0.1.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.
- package/README.md +46 -75
- package/dist/heat-tree.es.min.js +7360 -0
- package/dist/heat-tree.es.min.js.map +1 -0
- package/dist/heat-tree.iife.min.js +2 -0
- package/dist/heat-tree.iife.min.js.map +1 -0
- package/dist/heat-tree.umd.min.js +2 -0
- package/dist/heat-tree.umd.min.js.map +1 -0
- package/package.json +6 -5
- package/dist/heat-tree.es.js +0 -5083
- package/dist/heat-tree.es.js.map +0 -1
- package/dist/heat-tree.umd.js +0 -20
- package/dist/heat-tree.umd.js.map +0 -1
package/README.md
CHANGED
|
@@ -26,20 +26,8 @@ npm install heat-tree
|
|
|
26
26
|
|
|
27
27
|
```javascript
|
|
28
28
|
import { heatTree } from 'heat-tree';
|
|
29
|
-
|
|
30
29
|
const newickString = "(A:0.1,B:0.2,(C:0.3,D:0.4):0.5);";
|
|
31
|
-
|
|
32
|
-
heatTree(
|
|
33
|
-
{
|
|
34
|
-
trees: [
|
|
35
|
-
{
|
|
36
|
-
name: 'My Tree',
|
|
37
|
-
newick: newickString
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
},
|
|
41
|
-
'#container'
|
|
42
|
-
);
|
|
30
|
+
heatTree('#container', {name: 'My Tree', newick: newickString});
|
|
43
31
|
```
|
|
44
32
|
|
|
45
33
|
## Usage
|
|
@@ -49,26 +37,23 @@ heatTree(
|
|
|
49
37
|
The `heatTree` function creates an interactive tree visualization in a specified container element.
|
|
50
38
|
|
|
51
39
|
```javascript
|
|
52
|
-
heatTree(
|
|
40
|
+
heatTree(containerSelector, treesInput, options);
|
|
53
41
|
```
|
|
54
42
|
|
|
55
43
|
**Parameters:**
|
|
56
44
|
|
|
57
|
-
- `treesConfig` (Object): Configuration object containing tree data
|
|
58
|
-
- `trees` (Array): Array of tree objects, each with:
|
|
59
|
-
- `newick` (string, required): Newick format tree string
|
|
60
|
-
- `name` (string, optional): Display name for the tree
|
|
61
|
-
- `metadata` (Array|Object, optional): Metadata tables (see Metadata section)
|
|
62
|
-
- `aesthetics` (Object, optional): Initial aesthetic mappings (see Aesthetics section)
|
|
63
|
-
|
|
64
45
|
- `containerSelector` (string): CSS selector for the container element (e.g., `'#my-tree'`)
|
|
65
|
-
|
|
46
|
+
- `treesInput` (Array/Object, optional): Configuration object containing tree data or an array of such objects
|
|
47
|
+
- `newick` (string, required): Newick format tree string
|
|
48
|
+
- `name` (string, optional): Display name for the tree
|
|
49
|
+
- `metadata` (Array|Object, optional): Metadata tables (see Metadata section)
|
|
50
|
+
- `aesthetics` (Object, optional): Initial aesthetic mappings (see Aesthetics section)
|
|
66
51
|
- `options` (Object, optional): Configuration options (see Options section)
|
|
67
52
|
|
|
68
|
-
You can also pass just a container selector to create an empty visualization:
|
|
53
|
+
You can also pass just a container selector to create an empty visualization (trees can be loaded interactively):
|
|
69
54
|
|
|
70
55
|
```javascript
|
|
71
|
-
heatTree('#container'
|
|
56
|
+
heatTree('#container');
|
|
72
57
|
```
|
|
73
58
|
|
|
74
59
|
### Adding Metadata
|
|
@@ -82,21 +67,17 @@ B\t892\tnursery
|
|
|
82
67
|
C\t234\tcity`;
|
|
83
68
|
|
|
84
69
|
heatTree(
|
|
70
|
+
'#container',
|
|
85
71
|
{
|
|
86
|
-
|
|
72
|
+
name: 'My Tree',
|
|
73
|
+
newick: newickString,
|
|
74
|
+
metadata: [
|
|
87
75
|
{
|
|
88
|
-
name: '
|
|
89
|
-
|
|
90
|
-
metadata: [
|
|
91
|
-
{
|
|
92
|
-
name: 'Sample Data',
|
|
93
|
-
data: metadata
|
|
94
|
-
}
|
|
95
|
-
]
|
|
76
|
+
name: 'Sample Data',
|
|
77
|
+
data: metadata
|
|
96
78
|
}
|
|
97
79
|
]
|
|
98
|
-
}
|
|
99
|
-
'#container'
|
|
80
|
+
}
|
|
100
81
|
);
|
|
101
82
|
```
|
|
102
83
|
|
|
@@ -108,21 +89,17 @@ Although the metadata columns used to color/size tree parts can be set interacti
|
|
|
108
89
|
|
|
109
90
|
```javascript
|
|
110
91
|
heatTree(
|
|
92
|
+
'#container',
|
|
111
93
|
{
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
]
|
|
124
|
-
},
|
|
125
|
-
'#container'
|
|
94
|
+
name: 'My Tree',
|
|
95
|
+
newick: newickString,
|
|
96
|
+
metadata: [{ name: 'Data', data: metadata }],
|
|
97
|
+
aesthetics: {
|
|
98
|
+
tipLabelColor: 'source', // Color tips by 'source' column
|
|
99
|
+
tipLabelSize: 'abundance', // Size tips by 'abundance' column
|
|
100
|
+
tipLabelStyle: 'font_style' // Style tips by 'font_style' column
|
|
101
|
+
}
|
|
102
|
+
}
|
|
126
103
|
);
|
|
127
104
|
```
|
|
128
105
|
|
|
@@ -186,19 +163,15 @@ Configure the visualization behavior and appearance:
|
|
|
186
163
|
|
|
187
164
|
```javascript
|
|
188
165
|
heatTree(
|
|
166
|
+
'#container',
|
|
189
167
|
{
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
tipLabelColor: 'source'
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
]
|
|
168
|
+
name: 'My Tree',
|
|
169
|
+
newick: newickString,
|
|
170
|
+
metadata: [{ name: 'Data', data: metadata }],
|
|
171
|
+
aesthetics: {
|
|
172
|
+
tipLabelColor: 'source'
|
|
173
|
+
}
|
|
200
174
|
},
|
|
201
|
-
'#container',
|
|
202
175
|
{
|
|
203
176
|
layout: 'circular',
|
|
204
177
|
branchLengthScale: 1.5,
|
|
@@ -217,21 +190,19 @@ The widget can be initialized with multiple trees:
|
|
|
217
190
|
|
|
218
191
|
```javascript
|
|
219
192
|
heatTree(
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
},
|
|
234
|
-
'#container'
|
|
193
|
+
'#container',
|
|
194
|
+
[
|
|
195
|
+
{
|
|
196
|
+
name: 'Tree 1',
|
|
197
|
+
newick: newickString1,
|
|
198
|
+
metadata: [{ name: 'Data 1', data: metadata1 }]
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: 'Tree 2',
|
|
202
|
+
newick: newickString2,
|
|
203
|
+
metadata: [{ name: 'Data 2', data: metadata2 }]
|
|
204
|
+
}
|
|
205
|
+
]
|
|
235
206
|
);
|
|
236
207
|
```
|
|
237
208
|
|