archaeopteryx 3.3.0 → 3.4.1
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 +166 -14
- package/archaeopteryx.d.ts +100 -10
- package/archaeopteryx.js +2220 -397
- package/forester.js +387 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -202,6 +202,51 @@ 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 has its apex at the node, one edge
|
|
221
|
+
reaching the clade's nearest tip and the other its farthest, so the shape
|
|
222
|
+
shows how uneven the clade's branch lengths are, as iTOL draws it (one depth
|
|
223
|
+
step in a cladogram). Its label stands where a tip's would: on the label
|
|
224
|
+
column in the aligned phylogram and on the outer ring in circular, with the
|
|
225
|
+
same guide line; it is filled in the colour most of its tips wear under the current
|
|
226
|
+
Color-by (the colour
|
|
227
|
+
they wore, even when no tip on screen shares their value), grows gently taller with its tip count, and is named — the node's
|
|
228
|
+
own name if it has one; else the one Color-by value nearly all its tips share,
|
|
229
|
+
so a clade reads "Bovine · 12 tips" while you look at hosts; else the tips'
|
|
230
|
+
common name prefix; always with the tip count, and with `[found/total]` while
|
|
231
|
+
a search hits inside it. Legends, alignment rows and domain tracks describe
|
|
232
|
+
the tips on screen, so a collapsed clade's tips leave them,
|
|
233
|
+
and the counts follow every clade you fold or open. A clade holding search
|
|
234
|
+
hits is one dot in the overview and one stop for the hit navigator; one
|
|
235
|
+
holding selected tips is outlined in the selection colour, and filled when
|
|
236
|
+
all its tips are selected. Re-rooting opens any collapsed clade whose tips it
|
|
237
|
+
would change, such as one the new midpoint falls inside. Collapsing is
|
|
238
|
+
display state only: nothing is removed, exports and downloads carry every
|
|
239
|
+
tip, and the unrooted layout, which has no rows to fold, shows every clade
|
|
240
|
+
open. The controls are the desktop's; the drawing and naming are this
|
|
241
|
+
program's.
|
|
242
|
+
|
|
243
|
+
A phylogram carries a **scale bar** at the bottom left: a round number of
|
|
244
|
+
branch-length units (1, 2 or 5 × 10ᵏ, whichever makes the bar about 100 px)
|
|
245
|
+
with its length written above it. It is drawn with the tree, so it zooms and
|
|
246
|
+
exports with it and its label always holds. A cladogram has nothing to
|
|
247
|
+
measure and shows none, and a tree under a time axis leaves the measuring to
|
|
248
|
+
the axis.
|
|
249
|
+
|
|
205
250
|
In the two radial layouts the zoom row changes meaning, exactly as on the
|
|
206
251
|
desktop: **Y+ / Y− become the plain + / − zoom** (a circle has one diameter;
|
|
207
252
|
the mouse wheel zooms too, and never rotates), **X− / X+ become rotate** (a
|
|
@@ -212,6 +257,43 @@ also resets rotation and label direction. Unrooted
|
|
|
212
257
|
additionally greys out the aligned-phylogram option and Auto-hide Labels
|
|
213
258
|
(there is no common label edge, and no even row spacing to hide against).
|
|
214
259
|
|
|
260
|
+
## Metadata tables
|
|
261
|
+
|
|
262
|
+
A tree file rarely carries everything known about its tips. A **metadata
|
|
263
|
+
table** beside it does: TSV or CSV, a header row, the first column naming the
|
|
264
|
+
tip and every other column a piece of data. On the [open page](https://cmzmasek.github.io/archaeopteryx-js/open.html)
|
|
265
|
+
drop, choose or paste the table before or after the tree — a table pasted
|
|
266
|
+
first waits for the tree; one added while a tree is showing joins it and the
|
|
267
|
+
view relaunches — and the toolbar says how many columns joined how many tips,
|
|
268
|
+
with the rows that matched no tip and the tips without a row a hover away.
|
|
269
|
+
|
|
270
|
+
Each column becomes a node property (`meta:` plus the header, so "Collection
|
|
271
|
+
Date" comes back as `Collection Date` in every menu; a header that already
|
|
272
|
+
reads as `namespace:name` is kept as it is). From there nothing is special:
|
|
273
|
+
the columns are offered for **Color-by** and **Shape** by the same rules as
|
|
274
|
+
any property, with the same legends; they are **search** fields, typed
|
|
275
|
+
numeric when every filled cell is a number; they appear in the **node data**;
|
|
276
|
+
and they are written into a phyloXML export, so a saved tree keeps them.
|
|
277
|
+
Tip names are matched exactly, then case-insensitively; empty cells add
|
|
278
|
+
nothing; a column the tree already carries under the same ref is replaced by
|
|
279
|
+
the table's values. Quoted cells, `#` comment lines and Windows line ends are
|
|
280
|
+
fine.
|
|
281
|
+
|
|
282
|
+
The node menu's **Download Ext. Node Data** writes the other direction: the
|
|
283
|
+
tips under a node as a tab-separated table, header first, with the desktop
|
|
284
|
+
Archaeopteryx's column names (`name`, `taxonomy_scientific_name`, …,
|
|
285
|
+
`branch_length`, then one column per property ref). A column no tip fills
|
|
286
|
+
is left out, and a `node_id` column comes first when tip names are blank or
|
|
287
|
+
repeated. Such a file opens again as a metadata table.
|
|
288
|
+
|
|
289
|
+
Embedders do the same in two lines, before `launch()`:
|
|
290
|
+
|
|
291
|
+
```js
|
|
292
|
+
const tree = archaeopteryx.parseTree(name, treeText);
|
|
293
|
+
const report = forester.joinMetadataTable(tree, tableText); // {columns, tips, matchedTips, unmatchedTips, unmatchedRows, properties}
|
|
294
|
+
archaeopteryx.launch('#tree', tree, config);
|
|
295
|
+
```
|
|
296
|
+
|
|
215
297
|
## Searching
|
|
216
298
|
|
|
217
299
|
Two search boxes (A and B), each with its own **field** menu (built from what
|
|
@@ -225,19 +307,71 @@ and **Inverse** apply to both.
|
|
|
225
307
|
Hits are hard to miss: their labels take the search colour **in bold**, a
|
|
226
308
|
translucent **pulsing halo** breathes behind each hit, and everything that is
|
|
227
309
|
*not* a hit fades — the desktop's "dim non-matches", engaged only while at
|
|
228
|
-
least one hit is
|
|
229
|
-
|
|
310
|
+
least one hit is on screen, so a fruitless search never washes the tree out.
|
|
311
|
+
A collapsed clade holding a hit counts as on screen: it stays bright, its
|
|
312
|
+
wedge outlined in the search colour and its label counting the hits, and
|
|
313
|
+
the rest fades even when every hit is inside collapsed clades. The **overview** miniature marks every hit as a dot in the same
|
|
230
314
|
colour, and a **◀ k / N ▶** navigator appears under the search boxes: each
|
|
231
|
-
press centres the previous / next hit in the viewport, wrapping around.
|
|
315
|
+
press centres the previous / next hit in the viewport, wrapping around. A collapsed clade holding hits is one dot and one stop.
|
|
232
316
|
|
|
233
317
|
## Keyboard
|
|
234
318
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
the
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
319
|
+
The same actions on every platform; only the modifier differs: **⌘** on
|
|
320
|
+
macOS, **Ctrl** on Windows and Linux. **⌘/** (Ctrl+/) shows this list in
|
|
321
|
+
the viewer, drawn for the platform you are on; the About box links to it
|
|
322
|
+
too.
|
|
323
|
+
|
|
324
|
+
| macOS | Windows / Linux | Does |
|
|
325
|
+
|---|---|---|
|
|
326
|
+
| ⌘0 | Ctrl+0 | Fit the tree to the window |
|
|
327
|
+
| ⌘+ / ⌘− | Ctrl++ / Ctrl+− | Zoom in / out |
|
|
328
|
+
| ⌘⇧↑ / ⌘⇧↓ | Ctrl+Shift+↑ / ↓ | Zoom in / out vertically |
|
|
329
|
+
| ⌘⇧→ / ⌘⇧← | Ctrl+Shift+→ / ← | Zoom in / out horizontally (circular: rotate) |
|
|
330
|
+
| ⌘⇧E | Ctrl+Shift+E | Expand vertically until the labels fit |
|
|
331
|
+
| ⌘⇧L | Ctrl+Shift+L | Next layout: rectangular, circular, unrooted |
|
|
332
|
+
| ⌘⇧D | Ctrl+Shift+D | Next display type: phylogram, aligned, cladogram |
|
|
333
|
+
| ⌘⇧X | Ctrl+Shift+X | Time axis on / off |
|
|
334
|
+
| ⌘⇧O | Ctrl+Shift+O | Ladderize |
|
|
335
|
+
| ⌘⇧U | Ctrl+Shift+U | Uncollapse every clade |
|
|
336
|
+
| ⌘F | Ctrl+F | Go to the search box |
|
|
337
|
+
| ⌘G / ⌘⇧G | Ctrl+G / Ctrl+Shift+G | Next / previous search hit |
|
|
338
|
+
| ⌘⇧< / ⌘⇧> | Ctrl+Shift+< / > | Previous / next tree of a multi-tree file |
|
|
339
|
+
| ⌘/ | Ctrl+/ | The shortcut list |
|
|
340
|
+
| Esc or Home | Esc or Home | Back to the whole tree, the launch view |
|
|
341
|
+
| O | O | Move the overview to the next corner |
|
|
342
|
+
| Page Up / Page Down | PageUp / PageDown | Larger / smaller font |
|
|
343
|
+
|
|
344
|
+
Mouse wheel, also the same everywhere: plain zooms both axes, **Shift**
|
|
345
|
+
vertical only, **Shift+Alt** (macOS: Shift+Option) horizontal only,
|
|
346
|
+
**Ctrl+Shift** the font size. Inside a text box only the combos that cannot
|
|
347
|
+
interfere with typing fire (fit, zoom, search, the list); the plain keys
|
|
348
|
+
never do. The letters follow the desktop Archaeopteryx where it has the
|
|
349
|
+
action (its Alt+O, Alt+U, Alt+E and ⌘0, ⌘G). There is no key for
|
|
350
|
+
re-rooting, by decision. On Linux, Ctrl+Shift+U inside a text field is the
|
|
351
|
+
desktop's Unicode entry: it stays with the text field there, as it should.
|
|
352
|
+
|
|
353
|
+
## Sharing a view
|
|
354
|
+
|
|
355
|
+
A view is what you made of a tree with the panel: the layout and display
|
|
356
|
+
type, which labels show, the colour and shape fields, both searches, the
|
|
357
|
+
clade you switched to, the clades you collapsed, the font, node and branch
|
|
358
|
+
sizes, the rotation, the tracks. On the demo pages it rides in the URL's
|
|
359
|
+
`#` hash and follows every change, so the address bar is always a link to
|
|
360
|
+
what is on screen: copy it (**Copy link to this view** in the toolbar) and
|
|
361
|
+
the recipient opens the same tree in the same view. Opening your own file
|
|
362
|
+
keeps the view in the hash too, so the same file reopened at that address
|
|
363
|
+
comes back as you left it. Zoom, pan, the legend's position and the node
|
|
364
|
+
selection are not part of a view; a shared view opens fitted.
|
|
365
|
+
|
|
366
|
+
Embedders get the same four pieces: the handle's `getViewState()` and
|
|
367
|
+
`applyViewState(state)`, the config's `view` (open straight into one) and
|
|
368
|
+
`onViewChange(state, encoded)` (called when it changes), and
|
|
369
|
+
`archaeopteryx.encodeViewState()` / `decodeViewState()` for the hash form,
|
|
370
|
+
which reads like
|
|
371
|
+
`layout=circular&colorBy=tax:common_name&show=name,external&font=9&collapsed=12,44&a=HUMAN&af=Any+Text&am=contains`.
|
|
372
|
+
Nodes are named by their launch-time preorder index, so a view belongs to
|
|
373
|
+
the tree it was made on; a key a view leaves out keeps its current value,
|
|
374
|
+
and anything that does not fit the tree is skipped.
|
|
241
375
|
|
|
242
376
|
## Protein domain architectures
|
|
243
377
|
|
|
@@ -287,6 +421,8 @@ displayed), and a 1-based **column ruler**. **Hover any residue** for its
|
|
|
287
421
|
alignment column, its position within that sequence's own ungapped residues,
|
|
288
422
|
its full name, class, and Kyte-Doolittle hydropathy. The **Alignment**
|
|
289
423
|
checkbox under Display Data toggles the whole track.
|
|
424
|
+
To find a motif, pick **Molecular Sequence** in a search box: it matches the
|
|
425
|
+
residues as written, gap characters included, as the desktop does.
|
|
290
426
|
|
|
291
427
|
Alignments arrive with the tree: as phyloXML `<mol_seq is_aligned="true">`
|
|
292
428
|
elements, or in a **Nexus** file whose characters matrix accompanies its tree.
|
|
@@ -400,6 +536,13 @@ const viewer = archaeopteryx.launchArchaeopteryx(container, fileName, data, conf
|
|
|
400
536
|
const tree = archaeopteryx.parseTree(fileName, data);
|
|
401
537
|
const viewer = archaeopteryx.launch(container, tree, config);
|
|
402
538
|
|
|
539
|
+
// every tree the file holds (a Nexus TREES block, a multi-tree Newick,
|
|
540
|
+
// several phylogenies): launch() takes the list, shows the first, and
|
|
541
|
+
// the panel gets a picker for the rest
|
|
542
|
+
const trees = archaeopteryx.parseTrees(fileName, data);
|
|
543
|
+
const viewer = archaeopteryx.launch(container, trees, config);
|
|
544
|
+
viewer.showTree(1); // also viewer.getTreeIndex(), viewer.getTreeCount()
|
|
545
|
+
|
|
403
546
|
// later, e.g. when an SPA removes the view:
|
|
404
547
|
viewer.destroy();
|
|
405
548
|
```
|
|
@@ -489,9 +632,13 @@ The parser is picked from the data and the `location`: content starting with
|
|
|
489
632
|
`#NEXUS` (or a name ending in `.nex`/`.nexus`) is read as Nexus, JSON content
|
|
490
633
|
(or a name ending in `.json`) as an **Auspice/Nextstrain v2** `dataset.json`,
|
|
491
634
|
a name ending in `xml` as phyloXML, anything else as New Hampshire (Newick).
|
|
492
|
-
A
|
|
493
|
-
|
|
494
|
-
|
|
635
|
+
A file holding **several trees** — a Nexus TREES block, a Newick file with one
|
|
636
|
+
tree per `;`, a phyloXML with several phylogenies — opens on the first, and a
|
|
637
|
+
picker with previous / next buttons at the top of the control panel moves
|
|
638
|
+
between them; each tree opens fresh under the same config, nothing collapsed, the way a new tab
|
|
639
|
+
does on the desktop. A protein/DNA/RNA characters matrix in a Nexus file
|
|
640
|
+
(sequential or interleaved) lands on the tips as an aligned `mol_seq`, so the
|
|
641
|
+
alignment track appears just as it does for phyloXML.
|
|
495
642
|
|
|
496
643
|
An Auspice dataset opens on the **time view** (branch lengths from `num_date`
|
|
497
644
|
differences; a divergence-only build falls back to `div` differences): the
|
|
@@ -531,6 +678,7 @@ a popup any more, and nothing fails silently.
|
|
|
531
678
|
| **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
679
|
| **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
680
|
| **MrBayes** annotations | in (embedded in Newick/Nexus) | `prob=`/`prob.stddev=` blobs: posterior-probability clade support. | [8] |
|
|
681
|
+
| **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
682
|
| **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
683
|
| 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
684
|
|
|
@@ -623,7 +771,7 @@ shorter than the dot itself stays clean.
|
|
|
623
771
|
One object, passed as the third argument. It is optional, and the best
|
|
624
772
|
configuration is usually an empty one — almost everything that used to be
|
|
625
773
|
configured is now read off the tree (see **Intelligent pre-sets** above). The
|
|
626
|
-
|
|
774
|
+
thirty keys below are the ones no tree can answer for you.
|
|
627
775
|
|
|
628
776
|
There used to be two objects, `options` and `settings`, split by whether the
|
|
629
777
|
user could also change the value from the control panel. That was a fact about
|
|
@@ -659,6 +807,8 @@ copy-pastable JSON.
|
|
|
659
807
|
| `showSupportDots` | `false` | Open with the Support Dots marks on (the checkbox appears whenever the tree has confidences). |
|
|
660
808
|
| `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
809
|
| `searchAinitialValue` | `null` | Prefill search box A. |
|
|
810
|
+
| `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**. |
|
|
811
|
+
| `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
812
|
| `searchBinitialValue` | `null` | Prefill search box B. |
|
|
663
813
|
| `enableVisualizations` | `true` | Offer the Color / Shape visualizations (which fields they cover is decided from the tree). |
|
|
664
814
|
| `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 +1391,9 @@ labels shown AND, in a radial layout, radial rather than upright labels.
|
|
|
1241
1391
|
Scale: one factor for the tree, `f = W_eff / Lmax × 0.9` px per residue.
|
|
1242
1392
|
`W` (the track width) starts at `0.25 × viewport width`; `d+` / `d−` scale it
|
|
1243
1393
|
by 1.2 / 0.8 and stop at 2000 / 20. `W_eff = W` in the rectangular layout,
|
|
1244
|
-
`min(W, 0.2 × radius)`
|
|
1394
|
+
a width of the radial layouts' own, which starts at `min(W, 0.2 × radius)`
|
|
1395
|
+
and is then stepped by the same buttons (the desktop caps the drawn width at
|
|
1396
|
+
that fifth of the radius instead). `Lmax` is the longest architecture
|
|
1245
1397
|
in the displayed tree, counting every domain whatever its E-value, so the
|
|
1246
1398
|
threshold never rescales. The rectangular layout reserves `20 + W + 10` px
|
|
1247
1399
|
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;
|