archaeopteryx 3.3.0 → 3.4.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.
- package/README.md +143 -11
- package/archaeopteryx.d.ts +100 -10
- package/archaeopteryx.js +2059 -277
- package/forester.js +288 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -202,6 +202,42 @@ panel: **rectangular** (root at left), **circular**, and **unrooted** — the
|
|
|
202
202
|
desktop's equal-angle fan, where each subtree opens a wedge proportional to
|
|
203
203
|
how many tips it holds.
|
|
204
204
|
|
|
205
|
+
In the rectangular layouts a rooted tree shows a short **stub** branch into
|
|
206
|
+
its root; a tree that declares itself unrooted (phyloXML `rooted="false"`, a
|
|
207
|
+
Nexus `[&U]` tree) shows none, and the circular layout never draws one. A
|
|
208
|
+
subtree view always shows the stub, since a clade has a definite root,
|
|
209
|
+
whatever the branch above it was. When the whole tree is a phylogram and the
|
|
210
|
+
file gives the root a branch length, that branch is drawn to scale instead
|
|
211
|
+
of the stub — except in the **unrooted** display, which draws no root branch
|
|
212
|
+
of any kind, real or stub: there the root is a point of the fan, not the end
|
|
213
|
+
of a branch from nowhere. The root itself wears a circle only for the reasons
|
|
214
|
+
any node does — an event, a search hit, a selection, a visualization.
|
|
215
|
+
|
|
216
|
+
**Collapsing a clade.** The node menu's **Collapse/Uncollapse** folds an
|
|
217
|
+
internal node's whole clade into a wedge and opens it again; **Uncollapse
|
|
218
|
+
Subtree** opens everything below a node; the tool row's uncollapse-all button
|
|
219
|
+
(the desktop's glyph, lit only while something is collapsed) opens the whole
|
|
220
|
+
tree, and so does **Esc**. The wedge is the desktop's triangle: its apex at
|
|
221
|
+
the node, its vertical base at the clade's average tip distance (one depth
|
|
222
|
+
step in a cladogram), so its depth stays readable; it is filled in the colour most of its tips wear under the current
|
|
223
|
+
Color-by, grows gently taller with its tip count, and is named — the node's
|
|
224
|
+
own name if it has one; else the one Color-by value nearly all its tips share,
|
|
225
|
+
so a clade reads "Bovine · 12 tips" while you look at hosts; else the tips'
|
|
226
|
+
common name prefix; always with the tip count, and with `[found/total]` while
|
|
227
|
+
a search hits inside it. Legends, alignment rows and domain tracks describe
|
|
228
|
+
the tips on screen, so a collapsed clade's tips leave them. Collapsing is
|
|
229
|
+
display state only: nothing is removed, exports and downloads carry every
|
|
230
|
+
tip, and the unrooted layout, which has no rows to fold, shows every clade
|
|
231
|
+
open. The controls are the desktop's; the drawing and naming are this
|
|
232
|
+
program's.
|
|
233
|
+
|
|
234
|
+
A phylogram carries a **scale bar** at the bottom left: a round number of
|
|
235
|
+
branch-length units (1, 2 or 5 × 10ᵏ, whichever makes the bar about 100 px)
|
|
236
|
+
with its length written above it. It is drawn with the tree, so it zooms and
|
|
237
|
+
exports with it and its label always holds. A cladogram has nothing to
|
|
238
|
+
measure and shows none, and a tree under a time axis leaves the measuring to
|
|
239
|
+
the axis.
|
|
240
|
+
|
|
205
241
|
In the two radial layouts the zoom row changes meaning, exactly as on the
|
|
206
242
|
desktop: **Y+ / Y− become the plain + / − zoom** (a circle has one diameter;
|
|
207
243
|
the mouse wheel zooms too, and never rotates), **X− / X+ become rotate** (a
|
|
@@ -212,6 +248,36 @@ also resets rotation and label direction. Unrooted
|
|
|
212
248
|
additionally greys out the aligned-phylogram option and Auto-hide Labels
|
|
213
249
|
(there is no common label edge, and no even row spacing to hide against).
|
|
214
250
|
|
|
251
|
+
## Metadata tables
|
|
252
|
+
|
|
253
|
+
A tree file rarely carries everything known about its tips. A **metadata
|
|
254
|
+
table** beside it does: TSV or CSV, a header row, the first column naming the
|
|
255
|
+
tip and every other column a piece of data. On the [open page](https://cmzmasek.github.io/archaeopteryx-js/open.html)
|
|
256
|
+
drop, choose or paste the table before or after the tree — a table pasted
|
|
257
|
+
first waits for the tree; one added while a tree is showing joins it and the
|
|
258
|
+
view relaunches — and the toolbar says how many columns joined how many tips,
|
|
259
|
+
with the rows that matched no tip and the tips without a row a hover away.
|
|
260
|
+
|
|
261
|
+
Each column becomes a node property (`meta:` plus the header, so "Collection
|
|
262
|
+
Date" comes back as `Collection Date` in every menu; a header that already
|
|
263
|
+
reads as `namespace:name` is kept as it is). From there nothing is special:
|
|
264
|
+
the columns are offered for **Color-by** and **Shape** by the same rules as
|
|
265
|
+
any property, with the same legends; they are **search** fields, typed
|
|
266
|
+
numeric when every filled cell is a number; they appear in the **node data**;
|
|
267
|
+
and they are written into a phyloXML export, so a saved tree keeps them.
|
|
268
|
+
Tip names are matched exactly, then case-insensitively; empty cells add
|
|
269
|
+
nothing; a column the tree already carries under the same ref is replaced by
|
|
270
|
+
the table's values. Quoted cells, `#` comment lines and Windows line ends are
|
|
271
|
+
fine.
|
|
272
|
+
|
|
273
|
+
Embedders do the same in two lines, before `launch()`:
|
|
274
|
+
|
|
275
|
+
```js
|
|
276
|
+
const tree = archaeopteryx.parseTree(name, treeText);
|
|
277
|
+
const report = forester.joinMetadataTable(tree, tableText); // {columns, tips, matchedTips, unmatchedTips, unmatchedRows, properties}
|
|
278
|
+
archaeopteryx.launch('#tree', tree, config);
|
|
279
|
+
```
|
|
280
|
+
|
|
215
281
|
## Searching
|
|
216
282
|
|
|
217
283
|
Two search boxes (A and B), each with its own **field** menu (built from what
|
|
@@ -232,12 +298,62 @@ press centres the previous / next hit in the viewport, wrapping around.
|
|
|
232
298
|
|
|
233
299
|
## Keyboard
|
|
234
300
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
the
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
301
|
+
The same actions on every platform; only the modifier differs: **⌘** on
|
|
302
|
+
macOS, **Ctrl** on Windows and Linux. **⌘/** (Ctrl+/) shows this list in
|
|
303
|
+
the viewer, drawn for the platform you are on; the About box links to it
|
|
304
|
+
too.
|
|
305
|
+
|
|
306
|
+
| macOS | Windows / Linux | Does |
|
|
307
|
+
|---|---|---|
|
|
308
|
+
| ⌘0 | Ctrl+0 | Fit the tree to the window |
|
|
309
|
+
| ⌘+ / ⌘− | Ctrl++ / Ctrl+− | Zoom in / out |
|
|
310
|
+
| ⌘⇧↑ / ⌘⇧↓ | Ctrl+Shift+↑ / ↓ | Zoom in / out vertically |
|
|
311
|
+
| ⌘⇧→ / ⌘⇧← | Ctrl+Shift+→ / ← | Zoom in / out horizontally (circular: rotate) |
|
|
312
|
+
| ⌘⇧E | Ctrl+Shift+E | Expand vertically until the labels fit |
|
|
313
|
+
| ⌘⇧L | Ctrl+Shift+L | Next layout: rectangular, circular, unrooted |
|
|
314
|
+
| ⌘⇧D | Ctrl+Shift+D | Next display type: phylogram, aligned, cladogram |
|
|
315
|
+
| ⌘⇧X | Ctrl+Shift+X | Time axis on / off |
|
|
316
|
+
| ⌘⇧O | Ctrl+Shift+O | Ladderize |
|
|
317
|
+
| ⌘⇧U | Ctrl+Shift+U | Uncollapse every clade |
|
|
318
|
+
| ⌘F | Ctrl+F | Go to the search box |
|
|
319
|
+
| ⌘G / ⌘⇧G | Ctrl+G / Ctrl+Shift+G | Next / previous search hit |
|
|
320
|
+
| ⌘⇧< / ⌘⇧> | Ctrl+Shift+< / > | Previous / next tree of a multi-tree file |
|
|
321
|
+
| ⌘/ | Ctrl+/ | The shortcut list |
|
|
322
|
+
| Esc or Home | Esc or Home | Back to the whole tree, the launch view |
|
|
323
|
+
| O | O | Move the overview to the next corner |
|
|
324
|
+
| Page Up / Page Down | PageUp / PageDown | Larger / smaller font |
|
|
325
|
+
|
|
326
|
+
Mouse wheel, also the same everywhere: plain zooms both axes, **Shift**
|
|
327
|
+
vertical only, **Shift+Alt** (macOS: Shift+Option) horizontal only,
|
|
328
|
+
**Ctrl+Shift** the font size. Inside a text box only the combos that cannot
|
|
329
|
+
interfere with typing fire (fit, zoom, search, the list); the plain keys
|
|
330
|
+
never do. The letters follow the desktop Archaeopteryx where it has the
|
|
331
|
+
action (its Alt+O, Alt+U, Alt+E and ⌘0, ⌘G). There is no key for
|
|
332
|
+
re-rooting, by decision. On Linux, Ctrl+Shift+U inside a text field is the
|
|
333
|
+
desktop's Unicode entry: it stays with the text field there, as it should.
|
|
334
|
+
|
|
335
|
+
## Sharing a view
|
|
336
|
+
|
|
337
|
+
A view is what you made of a tree with the panel: the layout and display
|
|
338
|
+
type, which labels show, the colour and shape fields, both searches, the
|
|
339
|
+
clade you switched to, the clades you collapsed, the font, node and branch
|
|
340
|
+
sizes, the rotation, the tracks. On the demo pages it rides in the URL's
|
|
341
|
+
`#` hash and follows every change, so the address bar is always a link to
|
|
342
|
+
what is on screen: copy it (**Copy link to this view** in the toolbar) and
|
|
343
|
+
the recipient opens the same tree in the same view. Opening your own file
|
|
344
|
+
keeps the view in the hash too, so the same file reopened at that address
|
|
345
|
+
comes back as you left it. Zoom, pan, the legend's position and the node
|
|
346
|
+
selection are not part of a view; a shared view opens fitted.
|
|
347
|
+
|
|
348
|
+
Embedders get the same four pieces: the handle's `getViewState()` and
|
|
349
|
+
`applyViewState(state)`, the config's `view` (open straight into one) and
|
|
350
|
+
`onViewChange(state, encoded)` (called when it changes), and
|
|
351
|
+
`archaeopteryx.encodeViewState()` / `decodeViewState()` for the hash form,
|
|
352
|
+
which reads like
|
|
353
|
+
`layout=circular&colorBy=tax:common_name&show=name,external&font=9&collapsed=12,44&a=HUMAN&af=Any+Text&am=contains`.
|
|
354
|
+
Nodes are named by their launch-time preorder index, so a view belongs to
|
|
355
|
+
the tree it was made on; a key a view leaves out keeps its current value,
|
|
356
|
+
and anything that does not fit the tree is skipped.
|
|
241
357
|
|
|
242
358
|
## Protein domain architectures
|
|
243
359
|
|
|
@@ -400,6 +516,13 @@ const viewer = archaeopteryx.launchArchaeopteryx(container, fileName, data, conf
|
|
|
400
516
|
const tree = archaeopteryx.parseTree(fileName, data);
|
|
401
517
|
const viewer = archaeopteryx.launch(container, tree, config);
|
|
402
518
|
|
|
519
|
+
// every tree the file holds (a Nexus TREES block, a multi-tree Newick,
|
|
520
|
+
// several phylogenies): launch() takes the list, shows the first, and
|
|
521
|
+
// the panel gets a picker for the rest
|
|
522
|
+
const trees = archaeopteryx.parseTrees(fileName, data);
|
|
523
|
+
const viewer = archaeopteryx.launch(container, trees, config);
|
|
524
|
+
viewer.showTree(1); // also viewer.getTreeIndex(), viewer.getTreeCount()
|
|
525
|
+
|
|
403
526
|
// later, e.g. when an SPA removes the view:
|
|
404
527
|
viewer.destroy();
|
|
405
528
|
```
|
|
@@ -489,9 +612,13 @@ The parser is picked from the data and the `location`: content starting with
|
|
|
489
612
|
`#NEXUS` (or a name ending in `.nex`/`.nexus`) is read as Nexus, JSON content
|
|
490
613
|
(or a name ending in `.json`) as an **Auspice/Nextstrain v2** `dataset.json`,
|
|
491
614
|
a name ending in `xml` as phyloXML, anything else as New Hampshire (Newick).
|
|
492
|
-
A
|
|
493
|
-
|
|
494
|
-
|
|
615
|
+
A file holding **several trees** — a Nexus TREES block, a Newick file with one
|
|
616
|
+
tree per `;`, a phyloXML with several phylogenies — opens on the first, and a
|
|
617
|
+
picker with previous / next buttons at the top of the control panel moves
|
|
618
|
+
between them; each tree opens fresh under the same config, the way a new tab
|
|
619
|
+
does on the desktop. A protein/DNA/RNA characters matrix in a Nexus file
|
|
620
|
+
(sequential or interleaved) lands on the tips as an aligned `mol_seq`, so the
|
|
621
|
+
alignment track appears just as it does for phyloXML.
|
|
495
622
|
|
|
496
623
|
An Auspice dataset opens on the **time view** (branch lengths from `num_date`
|
|
497
624
|
differences; a divergence-only build falls back to `div` differences): the
|
|
@@ -531,6 +658,7 @@ a popup any more, and nothing fails silently.
|
|
|
531
658
|
| **Auspice / Nextstrain** `dataset.json` (v2) | in | Phylodynamic builds: sampling dates and their confidence, cumulative divergence, and discrete traits (country, clade, host, ...) with their posterior distributions. | [5] |
|
|
532
659
|
| **BEAST** / BEAST 2 / TreeAnnotator annotations | in (embedded in Newick/Nexus) | `[&posterior=...,height_95%_HPD={lo,hi},rate=...]`-style blobs: posterior clade support, node-age confidence intervals, per-branch rates and other traits. FigTree's `!color` is read the same way. | [6, 7] |
|
|
533
660
|
| **MrBayes** annotations | in (embedded in Newick/Nexus) | `prob=`/`prob.stddev=` blobs: posterior-probability clade support. | [8] |
|
|
661
|
+
| **Metadata table** (`.tsv`, `.csv`) | in (beside a tree) | A header row and one row per tip, the first column naming the tip: every other column is joined onto the tips as a property, so it is offered for Color-by and Shape, searched, shown in the node data and written into phyloXML exports. See [Metadata tables](#metadata-tables). | — |
|
|
534
662
|
| **FASTA** | out | The molecular sequence(s) of the selected tip(s), or every sequence the tree carries. Offered in the Download menu only when the tree actually carries molecular sequences (aligned or not). | [9] |
|
|
535
663
|
| SVG · PNG · vector PDF | out | A snapshot of the drawn tree for publication or further editing — vector (SVG, PDF) or raster (PNG). General-purpose graphics formats, not phylogenetic data, so no literature reference applies. | — |
|
|
536
664
|
|
|
@@ -623,7 +751,7 @@ shorter than the dot itself stays clean.
|
|
|
623
751
|
One object, passed as the third argument. It is optional, and the best
|
|
624
752
|
configuration is usually an empty one — almost everything that used to be
|
|
625
753
|
configured is now read off the tree (see **Intelligent pre-sets** above). The
|
|
626
|
-
|
|
754
|
+
thirty keys below are the ones no tree can answer for you.
|
|
627
755
|
|
|
628
756
|
There used to be two objects, `options` and `settings`, split by whether the
|
|
629
757
|
user could also change the value from the control panel. That was a fact about
|
|
@@ -659,6 +787,8 @@ copy-pastable JSON.
|
|
|
659
787
|
| `showSupportDots` | `false` | Open with the Support Dots marks on (the checkbox appears whenever the tree has confidences). |
|
|
660
788
|
| `supportDotMinimum` | `95` | Support Dots threshold, as a percentage. On a tree whose confidences top out at 1 (posterior probabilities) it is read on the 0–1 scale, so the default means ≥ 0.95 there and ≥ 95 on a bootstrap tree. |
|
|
661
789
|
| `searchAinitialValue` | `null` | Prefill search box A. |
|
|
790
|
+
| `view` | `null` | Open straight into a saved view — the object `getViewState()` returns, or `decodeViewState()` reads from a URL hash: layout, display type, labels, colours, searches, the clade and the collapsed clades, sizes. See **Sharing a view**. |
|
|
791
|
+
| `onViewChange` | `null` | `function (state, encoded)`, called once per settled redraw when the view changed: `state` as `getViewState()` returns it, `encoded` its hash-ready string. The demo pages write it into the URL. |
|
|
662
792
|
| `searchBinitialValue` | `null` | Prefill search box B. |
|
|
663
793
|
| `enableVisualizations` | `true` | Offer the Color / Shape visualizations (which fields they cover is decided from the tree). |
|
|
664
794
|
| `initialVisualization` | `null` | The visualization to open with, by its Color-menu name (e.g. `'Host'`; case-insensitive). A name the tree cannot honour logs a console warning and falls back to the automatic choice, so a site-wide value is safe on trees without that field. Default: Archaeopteryx.js picks the most informative field itself. |
|
|
@@ -1241,7 +1371,9 @@ labels shown AND, in a radial layout, radial rather than upright labels.
|
|
|
1241
1371
|
Scale: one factor for the tree, `f = W_eff / Lmax × 0.9` px per residue.
|
|
1242
1372
|
`W` (the track width) starts at `0.25 × viewport width`; `d+` / `d−` scale it
|
|
1243
1373
|
by 1.2 / 0.8 and stop at 2000 / 20. `W_eff = W` in the rectangular layout,
|
|
1244
|
-
`min(W, 0.2 × radius)`
|
|
1374
|
+
a width of the radial layouts' own, which starts at `min(W, 0.2 × radius)`
|
|
1375
|
+
and is then stepped by the same buttons (the desktop caps the drawn width at
|
|
1376
|
+
that fifth of the radius instead). `Lmax` is the longest architecture
|
|
1245
1377
|
in the displayed tree, counting every domain whatever its E-value, so the
|
|
1246
1378
|
threshold never rescales. The rectangular layout reserves `20 + W + 10` px
|
|
1247
1379
|
from `_w` past the label reservation (`_domainReserve`, counted wherever `_w`
|
package/archaeopteryx.d.ts
CHANGED
|
@@ -73,6 +73,9 @@ export interface ArchaeopteryxConfig {
|
|
|
73
73
|
nhConfidenceValuesInBrackets?: boolean;
|
|
74
74
|
nhExportWriteConfidences?: boolean;
|
|
75
75
|
nodeLabels?: Record<string, NodeLabelSpec> | null;
|
|
76
|
+
/** Called once per settled redraw when the view changed: the state as
|
|
77
|
+
* getViewState() returns it, and its hash-ready string. */
|
|
78
|
+
onViewChange?: ((state: ViewState, encoded: string) => void) | null;
|
|
76
79
|
pngExportScale?: number;
|
|
77
80
|
rootOffset?: number;
|
|
78
81
|
searchAinitialValue?: string | null;
|
|
@@ -82,27 +85,103 @@ export interface ArchaeopteryxConfig {
|
|
|
82
85
|
showTimeAxis?: boolean;
|
|
83
86
|
supportDotMinimum?: number;
|
|
84
87
|
timeAxisGrid?: boolean;
|
|
88
|
+
/** Open straight into a view (getViewState / decodeViewState). */
|
|
89
|
+
view?: ViewState | null;
|
|
85
90
|
visualizationsLegendXpos?: number;
|
|
86
91
|
visualizationsLegendYpos?: number;
|
|
87
92
|
zoomToFitUponWindowResize?: boolean;
|
|
88
93
|
}
|
|
89
94
|
|
|
95
|
+
/** One search box in a view: the field by its menu label, the mode, the
|
|
96
|
+
* value (and the range's second value). */
|
|
97
|
+
export interface ViewSearch {
|
|
98
|
+
field?: string;
|
|
99
|
+
mode?: string;
|
|
100
|
+
value: string;
|
|
101
|
+
value2?: string;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** A view of a tree as the control panel left it: what getViewState()
|
|
105
|
+
* returns, what the config's view key and applyViewState() take, and what
|
|
106
|
+
* encodeViewState() / decodeViewState() turn into a URL-hash string and
|
|
107
|
+
* back. Every key is optional; a key left out keeps its current value,
|
|
108
|
+
* except searchA / searchB, which an absent key clears. Nodes (subtree,
|
|
109
|
+
* collapsed) are named by their launch-time preorder index. */
|
|
110
|
+
export interface ViewState {
|
|
111
|
+
/** Which tree of a multi-tree launch (0-based). */
|
|
112
|
+
tree?: number;
|
|
113
|
+
layout?: Layout;
|
|
114
|
+
display?: 'phylogram' | 'aligned' | 'cladogram';
|
|
115
|
+
/** The ladderize direction applied. */
|
|
116
|
+
order?: 'asc' | 'desc';
|
|
117
|
+
/** Midpoint re-rooted. */
|
|
118
|
+
root?: 'midpoint';
|
|
119
|
+
subtree?: number;
|
|
120
|
+
collapsed?: number[];
|
|
121
|
+
/** A visualization id (as the Color-by menu values them), or 'none'. */
|
|
122
|
+
colorBy?: string;
|
|
123
|
+
shapeBy?: string;
|
|
124
|
+
/** The panel's checked boxes: name, taxonomy, sequence, confidence,
|
|
125
|
+
* branchLength, external, internal, nodeEvents, branchEvents,
|
|
126
|
+
* supportDots, shortNames, autoHide, visualizations, visualStyles, and
|
|
127
|
+
* custom:<key> for a nodeLabels checkbox. */
|
|
128
|
+
show?: string[];
|
|
129
|
+
font?: number;
|
|
130
|
+
node?: number;
|
|
131
|
+
branch?: number;
|
|
132
|
+
/** Radial rotation in button presses (pi/32 each). */
|
|
133
|
+
rotation?: number;
|
|
134
|
+
horizontalLabels?: boolean;
|
|
135
|
+
msa?: boolean;
|
|
136
|
+
domains?: boolean;
|
|
137
|
+
domainLabels?: 'none' | 'domains' | 'legend';
|
|
138
|
+
domainGlow?: boolean;
|
|
139
|
+
domainEvalue?: number;
|
|
140
|
+
timeAxis?: boolean;
|
|
141
|
+
timeGrid?: boolean;
|
|
142
|
+
searchA?: ViewSearch;
|
|
143
|
+
searchB?: ViewSearch;
|
|
144
|
+
combine?: 'and' | 'or';
|
|
145
|
+
matchCase?: boolean;
|
|
146
|
+
inverse?: boolean;
|
|
147
|
+
}
|
|
148
|
+
|
|
90
149
|
/** What launch() returns: the per-viewer surface an embedder needs after
|
|
91
150
|
* launching. */
|
|
92
151
|
export interface ViewerHandle {
|
|
93
152
|
/** The nodes the user has selected via the node menu (when
|
|
94
153
|
* enableManualNodeSelection is on). */
|
|
95
154
|
getSelectedNodes(): PhylogenyNode[];
|
|
155
|
+
/** How many trees the launch holds: one, or every tree the file held
|
|
156
|
+
* (launch() with the array parseTrees returns). */
|
|
157
|
+
getTreeCount(): number;
|
|
158
|
+
/** Which of them is shown (0-based). */
|
|
159
|
+
getTreeIndex(): number;
|
|
160
|
+
/** Shows another tree of the launch in the same container under the
|
|
161
|
+
* same config; it opens fresh. Returns the handle for the new viewer. */
|
|
162
|
+
showTree(index: number): ViewerHandle;
|
|
163
|
+
/** The view as the panel left it (see ViewState). */
|
|
164
|
+
getViewState(): ViewState;
|
|
165
|
+
/** Opens a view on the running viewer; a view of another tree of the
|
|
166
|
+
* launch relaunches into that tree. */
|
|
167
|
+
applyViewState(state: ViewState): void;
|
|
96
168
|
/** Unmounts the viewer completely: the DOM inside the container, the
|
|
97
169
|
* body-level pieces, the window resize listener and every page-level
|
|
98
170
|
* key/wheel handler. A later launch() works normally. */
|
|
99
171
|
destroy(): void;
|
|
100
172
|
}
|
|
101
173
|
|
|
174
|
+
/** How bare numeric internal labels of a Newick / Nexus tree are read:
|
|
175
|
+
* 'auto' decides per tree, 'confidence' takes every one as a support
|
|
176
|
+
* value, 'label' keeps them as names. */
|
|
177
|
+
export type InternalNumericLabels = 'auto' | 'confidence' | 'label';
|
|
178
|
+
|
|
102
179
|
export interface Archaeopteryx {
|
|
103
180
|
/** Launch the viewer into a container (a CSS selector or the element
|
|
104
|
-
* itself; an unresolvable container throws). Exactly three arguments.
|
|
105
|
-
|
|
181
|
+
* itself; an unresolvable container throws). Exactly three arguments.
|
|
182
|
+
* A tree, or every tree of a file (parseTrees): the first is shown and
|
|
183
|
+
* the control panel gets a picker for the others. */
|
|
184
|
+
launch(container: string | Element, tree: Phylogeny | Phylogeny[], config?: ArchaeopteryxConfig): ViewerHandle;
|
|
106
185
|
|
|
107
186
|
/** Parse-and-launch in one step. Fetch the file content yourself; the
|
|
108
187
|
* fileName picks the parser (extension; content is sniffed too).
|
|
@@ -112,23 +191,34 @@ export interface Archaeopteryx {
|
|
|
112
191
|
|
|
113
192
|
/** Parse tree data, auto-detecting the format from content and fileName:
|
|
114
193
|
* Nexus (#NEXUS / .nex / .nexus), Auspice/Nextstrain v2 JSON ({ / .json),
|
|
115
|
-
* phyloXML (*xml), otherwise New Hampshire (Newick).
|
|
194
|
+
* phyloXML (*xml), otherwise New Hampshire (Newick). The FIRST tree the
|
|
195
|
+
* data holds; parseTrees returns them all. */
|
|
116
196
|
parseTree(fileName: string, data: string,
|
|
117
|
-
|
|
118
|
-
|
|
197
|
+
internalNumericLabels?: InternalNumericLabels): Phylogeny;
|
|
198
|
+
/** Every tree the data holds, in file order: a Nexus TREES block, a
|
|
199
|
+
* Newick text with one tree per ';', a phyloXML with several
|
|
200
|
+
* phylogenies (an Auspice dataset is one tree). Hand the array to
|
|
201
|
+
* launch(). */
|
|
202
|
+
parseTrees(fileName: string, data: string,
|
|
203
|
+
internalNumericLabels?: InternalNumericLabels): Phylogeny[];
|
|
119
204
|
|
|
120
205
|
parsePhyloXML(data: string): Phylogeny;
|
|
121
206
|
parseNewHampshire(data: string,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
207
|
+
internalNumericLabels?: InternalNumericLabels): Phylogeny;
|
|
208
|
+
/** A Nexus file can hold several trees; the FIRST is returned
|
|
209
|
+
* (parseTrees returns them all). */
|
|
125
210
|
parseNexus(data: string,
|
|
126
|
-
|
|
127
|
-
confidenceValuesAsInternalNames?: boolean): Phylogeny;
|
|
211
|
+
internalNumericLabels?: InternalNumericLabels): Phylogeny;
|
|
128
212
|
parseAuspiceJson(data: string | object): Phylogeny;
|
|
129
213
|
|
|
130
214
|
/** Module-level twin of the handle's getSelectedNodes. */
|
|
131
215
|
getSelectedNodes(): PhylogenyNode[];
|
|
216
|
+
|
|
217
|
+
/** A view as a "key=value&..." string for a URL hash, and back. decode
|
|
218
|
+
* accepts a leading '#', ignores what it does not know, and returns
|
|
219
|
+
* null for nothing. */
|
|
220
|
+
encodeViewState(state: ViewState): string;
|
|
221
|
+
decodeViewState(text: string | null | undefined): ViewState | null;
|
|
132
222
|
}
|
|
133
223
|
|
|
134
224
|
export const archaeopteryx: Archaeopteryx;
|