archaeopteryx 3.17.0 → 3.19.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
@@ -247,9 +247,20 @@ A phylogram carries a **scale bar** at the bottom left: a round number of
247
247
  branch-length units (1, 2 or 5 × 10ᵏ, whichever makes the bar about 100 px)
248
248
  with its length written above it. It is drawn with the tree, so it zooms and
249
249
  exports with it and its label always holds. A cladogram has nothing to
250
- measure and shows none, and a tree under a time axis leaves the measuring to
250
+ measure and shows none, and a tree under a scale axis leaves the measuring to
251
251
  the axis.
252
252
 
253
+ **Scale Axis** under Display Data (off by default, as on the desktop) draws a
254
+ labelled ruler under a phylogram, from 0 at the root out to the deepest tip, in
255
+ the tree's branch-length units, with the unit at its end when the tree states
256
+ one. **Scale Grid** adds a faint line at every tick, behind the tree. In the
257
+ circular layout the ruler runs out from the root along the gap between the last
258
+ tip and the first, and the grid lines become rings; the unrooted layout has no
259
+ axis. The ruler floats at the bottom of the window as the tree scrolls, and it
260
+ starts at a subtree view's own root. On a time tree the same switch draws the
261
+ time axis instead (below): a tree flipped to **Div** gets the distance ruler,
262
+ and one flipped back gets its time axis.
263
+
253
264
  In the two radial layouts the zoom row changes meaning, exactly as on the
254
265
  desktop: **Y+ / Y− become the plain + / − zoom** (a circle has one diameter;
255
266
  the mouse wheel zooms too, and never rotates), **X− / X+ become rotate** (a
@@ -479,7 +490,7 @@ too.
479
490
  | ⌘⇧E | Ctrl+Shift+E | Expand vertically until the labels fit |
480
491
  | ⌘⇧L | Ctrl+Shift+L | Next layout: rectangular, circular, unrooted |
481
492
  | ⌘⇧D | Ctrl+Shift+D | Next display type: phylogram, aligned, cladogram |
482
- | ⌘⇧X | Ctrl+Shift+X | Time axis on / off |
493
+ | ⌘⇧X | Ctrl+Shift+X | Time \| Div, where the tree offers it; the Scale Axis on / off otherwise |
483
494
  | ⌘⇧O | Ctrl+Shift+O | Ladderize |
484
495
  | ⌘⇧U | Ctrl+Shift+U | Uncollapse every clade |
485
496
  | ⌘F | Ctrl+F | Go to the search box |
@@ -504,9 +515,10 @@ desktop's Unicode entry: it stays with the text field there, as it should.
504
515
  A view is what you made of a tree with the panel: the layout and display
505
516
  type, which labels show, the colour and shape fields, both searches, the
506
517
  clade you switched to, the clades you collapsed, the font, node and branch
507
- sizes, the rotation, and the tracks — which track is shown, the heat map's
508
- column order (including one you arranged by hand) and whether the alignment
509
- is summarised as a logo. On the demo pages it rides in the URL's
518
+ sizes, the rotation, whether the branches show time or divergence, and the
519
+ tracks — which track is shown, the heat map's column order (including one
520
+ you arranged by hand) and whether the alignment is summarised as a logo. On
521
+ the demo pages it rides in the URL's
510
522
  `#` hash and follows every change, so the address bar is always a link to
511
523
  what is on screen: copy it (**Copy link to this view** in the toolbar) and
512
524
  the recipient opens the same tree in the same view. Opening your own file
@@ -722,25 +734,55 @@ Ages (`unit="mya"` and friends, or values that look like ages) get the
722
734
  **geologic axis**: two rows of ICS intervals in their official colours —
723
735
  Period over Epoch for most trees, coarser pairs for Precambrian-deep ones —
724
736
  plus a "Ma before present" ruler. Years (`unit="year"`, or values that look
725
- like calendar years) get a labelled **calendar axis** instead. The tree's
726
- layout itself never changes: time is an overlay calibrated by the dates, so
727
- it also works for a fossil-only tree, where the axis simply stops at the
728
- youngest tip and labels that age (the ammonite demo ends at the K-Pg, 66).
737
+ like calendar years) get a labelled **calendar axis**. The layout itself
738
+ never changes: time is an overlay calibrated by the dates, so it also works
739
+ for a fossil-only tree, where the axis stops at the youngest tip and labels
740
+ that age (the ammonite demo ends at the K-Pg, 66).
729
741
 
730
742
  Nodes with a date **range** (`minimum`/`maximum` — minimum is the younger
731
743
  bound) draw uncertainty bars: translucent blue **HPD age bars** on internal
732
- nodes, and on tips whatever the axis says the range means. On **geologic**
733
- time it is a fossil's observed range: sepia **fossil-range (FAD/LAD) bars with
734
- end caps**. On **calendar** time it is the uncertainty of a **sampling date**
735
- — a virus sample dated only to its month or year — drawn like an age bar,
736
- slimmer, and only when it has a width: a tip dated to the day draws nothing.
737
- Node
738
- tooltips show the date. The **Time Axis** checkbox under Display Data toggles
739
- everything; the axis needs a phylogram (branch lengths carry the time) and
740
- the rectangular layout. **Time Grid** (off by default, like the desktop's
741
- "Time axis grid lines") adds faint vertical lines behind the tree at the
742
- fine geologic-interval boundaries or the calendar year ticks, so a node's
743
- position can be read against the axis.
744
+ nodes, and on tips whatever the axis says the range means — on geologic
745
+ time a fossil's observed range, sepia **FAD/LAD bars with end caps**; on
746
+ calendar time the uncertainty of a **sampling date**, drawn like an age bar,
747
+ slimmer, and only when it has a width. Node tooltips show the date. The
748
+ **Scale Axis** checkbox under Display Data toggles everything; the axis needs
749
+ a phylogram and the rectangular or circular layout. In **circular** the bars
750
+ run along each node's spoke — on through the centre where a range reaches
751
+ back past the root's own age — the ruler runs out from the root along the
752
+ gap between the last tip and the first, turning with the tree, and a
753
+ geologic axis lays its intervals down as coloured rings. **Scale Grid** (off
754
+ by default) adds faint lines, or rings, at the fine interval boundaries or
755
+ the calendar years.
756
+
757
+ ### Time | Div
758
+
759
+ Where a tree can be laid out by **time** and by **divergence**, a
760
+ **Time | Div** switch appears beside the phylogram buttons (⌘⇧X). Two kinds
761
+ of tree state a divergence: an Auspice build, on its nodes (`div`), and a
762
+ BEAST clock-model tree, as a clock `rate` on every branch — its branch
763
+ lengths are time, and its divergence is each length times its rate, in
764
+ substitutions per site. A tree with neither has no second layout. A rate or
765
+ a recorded divergence is a plain decimal number (`0.01abc` is not one); a
766
+ negative divergence is a value, drawn at 0.
767
+
768
+ The switch is offered only when both layouts can state **every** branch —
769
+ every node dated, every branch with a length, and divergence on every node
770
+ or a rate on every branch — and each picture has some depth. A value the
771
+ file states counts, whether zero or negative; where one is missing the
772
+ switch is withheld rather than a branch drawn at a length the file never
773
+ gave. Whether the two pictures differ is not asked: a strict clock's
774
+ divergence is its time at another scale, and it is offered like any other.
775
+
776
+ Back in Time the tree has exactly the lengths it arrived with. A span that
777
+ runs backwards — a child dated before its parent, which real Nextstrain
778
+ builds state — keeps its sign, and is drawn at length 0 like any negative
779
+ branch length. The switch acts on the whole tree, also from a subtree view,
780
+ and a node deleted meanwhile leaves the branch that takes its place spanning
781
+ what both spanned, in either layout. The time axis is hidden while the
782
+ branches show divergence, and the Scale Axis measures distance instead. Each layout stamps the tree's `branch_length_unit`
783
+ (`subs/site`; for time the dates' unit, or `time`), so a tree saved while
784
+ Div is on screen says so and opens again showing divergence. All of this is
785
+ shared with the desktop.
744
786
 
745
787
  # forester.js
746
788
  forester.js is a general suite for dealing with phylogenetic trees.
@@ -940,16 +982,21 @@ A protein/DNA/RNA characters matrix in a Nexus file
940
982
  (sequential or interleaved) lands on the tips as an aligned `mol_seq`, so the
941
983
  alignment track appears just as it does for phyloXML.
942
984
 
943
- An Auspice dataset opens on the **time view** (branch lengths from `num_date`
944
- differences; a divergence-only build falls back to `div` differences): the
945
- calendar time axis and node-age bars come from `num_date` and its confidence
946
- interval, and every trait (country, host, clade, ...) becomes a
985
+ An Auspice dataset has no branch lengths of its own, so it opens in the
986
+ metric it states completely: the **time view** when every node states a
987
+ `num_date` (branch lengths are the `num_date` differences, sign kept), else
988
+ the divergence view when every node states a `div`, else time if any node is
989
+ dated. In the time view the calendar time axis and node-age bars come from
990
+ `num_date` and its confidence interval, and every trait (country, host,
991
+ clade, ...) becomes a
947
992
  `nextstrain:<trait>` node property — so Color-by, search and the node dialog
948
993
  pick them up. Both metrics are retained, and
949
994
  `forester.applyTimeBranchLengths(phy)` /
950
995
  `forester.applyDivergenceBranchLengths(phy)` /
951
- `forester.hasTimeAndDivergence(phy)` are the plumbing for a future
952
- time↔divergence display toggle.
996
+ `forester.hasTimeAndDivergence(phy)` are the plumbing behind the
997
+ **Time | Div** switch. The two `apply` functions answer `true` when they
998
+ laid the tree out, and `false` — leaving every branch length as it was —
999
+ when their layout cannot state every branch.
953
1000
 
954
1001
  **BEAST-style and NHX annotations** in Newick/Nexus input are always parsed
955
1002
  (they used to be discarded): in a `[&key=value,...]` blob — as written by
@@ -1129,7 +1176,8 @@ developer spec below). The checkboxes are still there to override it.
1129
1176
 
1130
1177
  The same data-driven rule applies to the two big overlays: a tree whose tips
1131
1178
  carry an aligned `mol_seq` opens with its **sequence alignment** showing, and
1132
- a tree with phyloXML `<date>` elements opens with its **time axis** drawn —
1179
+ a tree with phyloXML `<date>` elements that opens shown in time has its
1180
+ **time axis** drawn —
1133
1181
  each with a checkbox under Display Data to turn it off.
1134
1182
 
1135
1183
  Support and branch-length values draw **2 px smaller than the label font**
@@ -1145,8 +1193,8 @@ between them rather than either one being shrunk.
1145
1193
 
1146
1194
  The **control panel itself** follows the same idea. It opens showing the
1147
1195
  sections that describe the tree — what it can be coloured by, what it shows —
1148
- plus Search, and folds the ones that are adjustments to make later: Zoom,
1149
- Sizes and the domain controls. Whatever you open or close is then remembered, for the
1196
+ plus Search, and folds the ones that are adjustments to make later: View &
1197
+ Tools, Sizes and the domain controls. Whatever you open or close is then remembered, for the
1150
1198
  page and across reloads, so a panel you have arranged stays arranged, even
1151
1199
  when you switch to another tree. In a short window it also keeps itself to one
1152
1200
  screen: opening a section folds the one you opened longest ago, and dragging
@@ -1313,8 +1361,8 @@ copy-pastable JSON.
1313
1361
  | `domainLabels` | `'domains'` | Where domain names go: `'domains'` (on the boxes), `'legend'` (a card), or `'none'`. |
1314
1362
  | `domainGlow` | `false` | Open with the glow around each domain box on. |
1315
1363
  | `domainEvalueExponent` | `-3` | The E-value threshold's exponent at launch, an integer from `-20` to `3`: domains with an E-value at or under `10^exponent` are drawn. |
1316
- | `showTimeAxis` | tree-derived | Open with the time axis shown. Default: on when the tree carries `<date>` elements, off otherwise — an explicit `true`/`false` overrides that. |
1317
- | `timeAxisGrid` | `false` | Open with the Time Grid vertical lines on (only meaningful — and only offered as a checkbox — while the time axis itself is shown). |
1364
+ | `showScaleAxis` | tree-derived | Open with the scale axis shown: the time axis on a time tree whose branches show time, a distance axis on any other phylogram. Default: on when the tree carries `<date>` elements and opens shown in time, off otherwise (a dated tree that opens in divergence is a divergence tree on screen) — an explicit `true`/`false` overrides that. |
1365
+ | `showScaleGrid` | `false` | Open with the Scale Grid lines on (only meaningful — and only offered as a checkbox — while the scale axis itself is shown). |
1318
1366
  | `showSupportDots` | `false` | Open with the Support Dots marks on (the checkbox appears whenever the tree has confidences). |
1319
1367
  | `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. |
1320
1368
  | `searchAinitialValue` | `null` | Prefill search box A. |
@@ -1337,7 +1385,7 @@ copy-pastable JSON.
1337
1385
  ### Anything else throws
1338
1386
 
1339
1387
  An unrecognised key is an error, whether it was removed in this modernization
1340
- or simply mistyped (the two deprecated keys below are the exception — they
1388
+ or simply mistyped (the deprecated keys below are the exception — they
1341
1389
  warn rather than throw):
1342
1390
 
1343
1391
  ```
@@ -1352,14 +1400,15 @@ whatever it names.
1352
1400
 
1353
1401
  ### Accepted, with a warning
1354
1402
 
1355
- Two keys are neither current nor removed: they are accepted so an existing
1356
- embed keeps working, and warn on the console. Both concern Newick support
1357
- values.
1403
+ Four keys are neither current nor removed: they are accepted so an existing
1404
+ embed keeps working, and warn on the console.
1358
1405
 
1359
1406
  | Key | What happens |
1360
1407
  |---|---|
1361
1408
  | `nhConfidenceValuesAsInternalNames` | Translated to `internalNumericLabels`. **`true` becomes `'confidence'`, not `'auto'`** — `'auto'` is all-or-nothing and promotes nothing in a tree that mixes clade names with support, so a caller moved to it silently would lose promotions they had. An explicit `internalNumericLabels` always wins. |
1362
1409
  | `nhConfidenceValuesInBrackets` | Retired: ignored. It gated whether `[95]` is read as a confidence, but setting it `false` never reinterpreted the bracket — it *discarded* it, so the option's only effect was to throw support values away. A bracket that is not a number is a Newick comment and was ignored either way, and NHX / BEAST blobs go through a different path. Bracketed values are now always read as confidences. |
1410
+ | `showTimeAxis` | Translated to `showScaleAxis`, value unchanged: the switch now also draws a distance axis on a tree that is not in time. An explicit `showScaleAxis` always wins. |
1411
+ | `timeAxisGrid` | Translated to `showScaleGrid`, value unchanged. |
1363
1412
 
1364
1413
  ### What replaced the rest
1365
1414
 
@@ -2233,11 +2282,15 @@ loops). Calibration: the **largest** date value is the root age (geologic)
2233
2282
  or the present (calendar) — no unit conversion is done, so a Ga-valued tree
2234
2283
  is misbanded exactly as on the desktop.
2235
2284
 
2236
- Rendering (phylogram + rectangular only; the layout never changes): age→x is
2237
- `anchorX + (anchorAge − age) × corr` with `corr` the branch-length scale's
2238
- slope, anchored at the **deepest dated tip** rather than the root — the root
2239
- and its direct children carry a synthetic half-average branch length, which
2240
- would shift every band. The geologic axis draws
2285
+ Rendering (phylogram, rectangular or circular; the layout never changes):
2286
+ age→x is `anchorX + (anchorAge − age) × corr` with `corr` the branch-length
2287
+ scale's slope, anchored at the **deepest dated tip** rather than the root,
2288
+ so the root's own branch, drawn to scale where the file states one, shifts
2289
+ no band. In circular the same arithmetic runs along each spoke: a bar is a
2290
+ segment of its node's spoke (a bound past the root's estimate a negative
2291
+ radius, continued through the centre), the ruler a ray along the gap between
2292
+ the last tip and the first, the grid and the geologic intervals rings. The
2293
+ geologic axis draws
2241
2294
  `forester.geoBandRanks(rootAge)` — the finest of Period/Epoch, Era/Period,
2242
2295
  Eon/Era that still covers the range — as two 13 px rows of ICS intervals
2243
2296
  (official colours; ink by the same luminance rule), clipped to
@@ -104,9 +104,17 @@ export interface ArchaeopteryxConfig {
104
104
  * bar: each column a stack of letters as tall as its information content,
105
105
  * over the tips currently on screen. Only drawn with the track shown. */
106
106
  showMsaLogo?: boolean;
107
+ /** The scale axis under a phylogram: the time axis on a time tree whose
108
+ * branches show time, a distance axis on any other. Default: on for a
109
+ * time tree, off otherwise. */
110
+ showScaleAxis?: boolean;
111
+ /** Grid lines (rings, in circular) at the scale axis's ticks. */
112
+ showScaleGrid?: boolean;
107
113
  showSupportDots?: boolean;
114
+ /** @deprecated renamed showScaleAxis; still read, with a warning. */
108
115
  showTimeAxis?: boolean;
109
116
  supportDotMinimum?: number;
117
+ /** @deprecated renamed showScaleGrid; still read, with a warning. */
110
118
  timeAxisGrid?: boolean;
111
119
  /** Open straight into a view (getViewState / decodeViewState). */
112
120
  view?: ViewState | null;
@@ -165,7 +173,11 @@ export interface ViewState {
165
173
  domainLabels?: 'none' | 'domains' | 'legend';
166
174
  domainGlow?: boolean;
167
175
  domainEvalue?: number;
176
+ scaleAxis?: boolean;
177
+ scaleGrid?: boolean;
178
+ /** @deprecated the name of scaleAxis in older links; still read. */
168
179
  timeAxis?: boolean;
180
+ /** @deprecated the name of scaleGrid in older links; still read. */
169
181
  timeGrid?: boolean;
170
182
  searchA?: ViewSearch;
171
183
  searchB?: ViewSearch;