archaeopteryx 3.4.0 → 3.5.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 CHANGED
@@ -27,6 +27,7 @@ config key live and shows the exact config JSON to copy into your own
27
27
  * [Auspice / Nextstrain JSON](https://cmzmasek.github.io/archaeopteryx-js/demo.html?tree=auspice)
28
28
  * [Swine H1 HA1 + alignment (Nexus)](https://cmzmasek.github.io/archaeopteryx-js/demo.html?tree=swh1)
29
29
  * [BEAST annotations (Nexus)](https://cmzmasek.github.io/archaeopteryx-js/demo.html?tree=beast)
30
+ * [Flavivirus mature peptides (10 trees)](https://cmzmasek.github.io/archaeopteryx-js/demo.html?tree=flavivirus)
30
31
  * [SARS-CoV-2 time tree (calendar)](https://cmzmasek.github.io/archaeopteryx-js/demo.html?tree=sarscov2)
31
32
  * [Herpesviridae DNA polymerase (201 tips)](https://cmzmasek.github.io/archaeopteryx-js/demo.html?tree=herpes_dnapol)
32
33
  * [Caliciviridae (186 strains)](https://cmzmasek.github.io/archaeopteryx-js/demo.html?tree=caliciviridae_500)
@@ -217,15 +218,24 @@ any node does — an event, a search hit, a selection, a visualization.
217
218
  internal node's whole clade into a wedge and opens it again; **Uncollapse
218
219
  Subtree** opens everything below a node; the tool row's uncollapse-all button
219
220
  (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
221
+ tree, and so does **Esc**. The wedge has its apex at the node, one edge
222
+ reaching the clade's nearest tip and the other its farthest, so the shape
223
+ shows how uneven the clade's branch lengths are, as iTOL draws it (one depth
224
+ step in a cladogram). Its label stands where a tip's would: on the label
225
+ column in the aligned phylogram and on the outer ring in circular, with the
226
+ same guide line; it is filled in the colour most of its tips wear under the current
227
+ Color-by (the colour
228
+ they wore, even when no tip on screen shares their value), grows gently taller with its tip count, and is named — the node's
224
229
  own name if it has one; else the one Color-by value nearly all its tips share,
225
230
  so a clade reads "Bovine · 12 tips" while you look at hosts; else the tips'
226
231
  common name prefix; always with the tip count, and with `[found/total]` while
227
232
  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
233
+ the tips on screen, so a collapsed clade's tips leave them,
234
+ and the counts follow every clade you fold or open. A clade holding search
235
+ hits is one dot in the overview and one stop for the hit navigator; one
236
+ holding selected tips is outlined in the selection colour, and filled when
237
+ all its tips are selected. Re-rooting opens any collapsed clade whose tips it
238
+ would change, such as one the new midpoint falls inside. Collapsing is
229
239
  display state only: nothing is removed, exports and downloads carry every
230
240
  tip, and the unrooted layout, which has no rows to fold, shows every clade
231
241
  open. The controls are the desktop's; the drawing and naming are this
@@ -248,6 +258,67 @@ also resets rotation and label direction. Unrooted
248
258
  additionally greys out the aligned-phylogram option and Auto-hide Labels
249
259
  (there is no common label edge, and no even row spacing to hide against).
250
260
 
261
+ ## Rooting
262
+
263
+ The tool row's re-root button asks how: **MAD re-root (Tria et al., 2017)**
264
+ or **Midpoint re-root** (hover over the MAD entry for the full citation). A
265
+ node's menu offers **Reroot** on the branch above that node. None of them is
266
+ offered for a tree whose phyloXML says `rerootable="false"`, nor for a time
267
+ tree, one whose internal nodes are mostly dated (BEAST node heights,
268
+ Nextstrain dates, phyloXML `<date>`s): a new root would contradict the dates.
269
+ For such a tree the re-root button and the node menu's Reroot are greyed,
270
+ their tooltip saying why, and a shared view's root is ignored.
271
+
272
+ A re-root can take the meaning away from data on internal nodes: a node's
273
+ name, taxonomy, sequence, events, distribution, date, references or node
274
+ properties describe its clade, and a new root changes the clade of every
275
+ node between the old root and the new one. So before re-rooting (from the
276
+ button's menu or the node menu), the change is worked out on a copy of the
277
+ tree, and when it would change the clade of any internal node carrying data,
278
+ a warning says how many (“This tree has data on 15 internal nodes.
279
+ Re-rooting changes the clade of 3 of them, so their data may no longer
280
+ describe them.”) with **Re-root** and **Cancel**. Branch lengths, support and
281
+ MAD values, branch colours and `style:` properties do not count: they belong
282
+ to the branch, or to the look.
283
+
284
+ A tree its file declares unrooted (phyloXML `rooted="false"`, Nexus `[&U]`),
285
+ shown in the unrooted layout, has no root to measure from. There the hover
286
+ card and Display Node Data show an internal node's **Tips around** — the tips
287
+ on each of its sides, smallest first, such as `2 · 3 · 5` — instead of
288
+ distance to parent, depth and tips below; a tip shows its **Branch length**
289
+ and no depth; and the Depth from Root, Distance from Root and Clade Size
290
+ search fields are not offered. The same tree in the rectangular or circular
291
+ layout keeps all of them, since those layouts draw a root.
292
+
293
+ **MAD rooting** (minimal ancestor deviation) roots the tree without assuming
294
+ a clock. The common ancestor of two tips ought to lie halfway between them,
295
+ so every branch and position is scored by how far the tip pairs' ancestors
296
+ fall from that halfway point, and the root goes where that deviation is
297
+ smallest [1]. It has been compared with other rooting methods on prokaryotic
298
+ gene families [2]. It needs branch lengths and at least three tips, and is
299
+ offered only then. The algorithm is the desktop Archaeopteryx's, and gives
300
+ the same roots; it runs in O(n²) time and O(n) memory (the 13,246-tip H5N1
301
+ demo tree roots in 0.4 s, measured in Node).
302
+
303
+ Every internal branch then carries its **MAD value**: the root-mean-square
304
+ deviation the tree would have with the root on that branch. Lower is better,
305
+ and the root's branch has the smallest. The **MAD Values** checkbox (Display
306
+ Data → Labels, present while the tree carries them) writes them on the
307
+ branches, ahead of any support value, as `MAD/support`: `0.02/95`. They are
308
+ not support, so the Confidence labels, Support Dots and the Confidence search
309
+ field leave them out. Midpoint or manual re-rooting removes them, since they
310
+ describe the MAD rooting only. A shared view remembers a MAD root. A phyloXML
311
+ download keeps them as `<confidence type="MAD">`, as the desktop writes them;
312
+ a Newick or Nexus download never puts one where a support value goes.
313
+
314
+ 1. Tria, F.D.K., Landan, G., Dagan, T. (2017). Phylogenetic rooting using
315
+ minimal ancestor deviation. *Nature Ecology & Evolution*, 1, 0193.
316
+ <https://www.nature.com/articles/s41559-017-0193>
317
+ 2. Wade, T., Rangel, L.T., Kundu, S., Fournier, G.P., Bansal, M.S. (2020).
318
+ Assessing the accuracy of phylogenetic rooting methods on prokaryotic
319
+ gene families. *PLOS ONE*, 15(5), e0232950.
320
+ <https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0232950>
321
+
251
322
  ## Metadata tables
252
323
 
253
324
  A tree file rarely carries everything known about its tips. A **metadata
@@ -270,6 +341,13 @@ nothing; a column the tree already carries under the same ref is replaced by
270
341
  the table's values. Quoted cells, `#` comment lines and Windows line ends are
271
342
  fine.
272
343
 
344
+ The node menu's **Download Ext. Node Data** writes the other direction: the
345
+ tips under a node as a tab-separated table, header first, with the desktop
346
+ Archaeopteryx's column names (`name`, `taxonomy_scientific_name`, …,
347
+ `branch_length`, then one column per property ref). A column no tip fills
348
+ is left out, and a `node_id` column comes first when tip names are blank or
349
+ repeated. Such a file opens again as a metadata table.
350
+
273
351
  Embedders do the same in two lines, before `launch()`:
274
352
 
275
353
  ```js
@@ -291,10 +369,12 @@ and **Inverse** apply to both.
291
369
  Hits are hard to miss: their labels take the search colour **in bold**, a
292
370
  translucent **pulsing halo** breathes behind each hit, and everything that is
293
371
  *not* a hit fades — the desktop's "dim non-matches", engaged only while at
294
- least one hit is actually visible, so a fruitless search never washes the
295
- tree out. The **overview** miniature marks every hit as a dot in the same
372
+ least one hit is on screen, so a fruitless search never washes the tree out.
373
+ A collapsed clade holding a hit counts as on screen: it stays bright, its
374
+ wedge outlined in the search colour and its label counting the hits, and
375
+ the rest fades even when every hit is inside collapsed clades. The **overview** miniature marks every hit as a dot in the same
296
376
  colour, and a **◀ k / N ▶** navigator appears under the search boxes: each
297
- press centres the previous / next hit in the viewport, wrapping around.
377
+ press centres the previous / next hit in the viewport, wrapping around. A collapsed clade holding hits is one dot and one stop.
298
378
 
299
379
  ## Keyboard
300
380
 
@@ -403,6 +483,8 @@ displayed), and a 1-based **column ruler**. **Hover any residue** for its
403
483
  alignment column, its position within that sequence's own ungapped residues,
404
484
  its full name, class, and Kyte-Doolittle hydropathy. The **Alignment**
405
485
  checkbox under Display Data toggles the whole track.
486
+ To find a motif, pick **Molecular Sequence** in a search box: it matches the
487
+ residues as written, gap characters included, as the desktop does.
406
488
 
407
489
  Alignments arrive with the tree: as phyloXML `<mol_seq is_aligned="true">`
408
490
  elements, or in a **Nexus** file whose characters matrix accompanies its tree.
@@ -615,7 +697,7 @@ a name ending in `xml` as phyloXML, anything else as New Hampshire (Newick).
615
697
  A file holding **several trees** — a Nexus TREES block, a Newick file with one
616
698
  tree per `;`, a phyloXML with several phylogenies — opens on the first, and a
617
699
  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
700
+ between them; each tree opens fresh under the same config, nothing collapsed, the way a new tab
619
701
  does on the desktop. A protein/DNA/RNA characters matrix in a Nexus file
620
702
  (sequential or interleaved) lands on the tips as an aligned `mol_seq`, so the
621
703
  alignment track appears just as it does for phyloXML.
@@ -114,15 +114,15 @@ export interface ViewState {
114
114
  display?: 'phylogram' | 'aligned' | 'cladogram';
115
115
  /** The ladderize direction applied. */
116
116
  order?: 'asc' | 'desc';
117
- /** Midpoint re-rooted. */
118
- root?: 'midpoint';
117
+ /** Re-rooted: at the midpoint, or by minimal ancestor deviation. */
118
+ root?: 'midpoint' | 'mad';
119
119
  subtree?: number;
120
120
  collapsed?: number[];
121
121
  /** A visualization id (as the Color-by menu values them), or 'none'. */
122
122
  colorBy?: string;
123
123
  shapeBy?: string;
124
124
  /** The panel's checked boxes: name, taxonomy, sequence, confidence,
125
- * branchLength, external, internal, nodeEvents, branchEvents,
125
+ * madValues, branchLength, external, internal, nodeEvents, branchEvents,
126
126
  * supportDots, shortNames, autoHide, visualizations, visualStyles, and
127
127
  * custom:<key> for a nodeLabels checkbox. */
128
128
  show?: string[];