archaeopteryx 3.6.1 → 3.8.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 +97 -5
- package/archaeopteryx.d.ts +6 -1
- package/archaeopteryx.js +654 -21
- package/forester.js +1191 -58
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -322,6 +322,39 @@ a Newick or Nexus download never puts one where a support value goes.
|
|
|
322
322
|
gene families. *PLOS ONE*, 15(5), e0232950.
|
|
323
323
|
<https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0232950>
|
|
324
324
|
|
|
325
|
+
## Representative tips
|
|
326
|
+
|
|
327
|
+
A large tree often holds many near-identical tips. The tool row's
|
|
328
|
+
**representative tips** button thins them out the way the desktop
|
|
329
|
+
Archaeopteryx's Tools → Select Representative Tips does: the tips are grouped
|
|
330
|
+
into the largest clades whose tips are all close to each other, and one tip of
|
|
331
|
+
each group is kept. Distance is patristic, the sum of the branch lengths on
|
|
332
|
+
the path between two tips; in a tree without branch lengths it counts edges.
|
|
333
|
+
|
|
334
|
+
The dialog takes either a **distance cutoff**, and no two tips of a group are
|
|
335
|
+
then farther apart than it, or a **target number** of representatives, for
|
|
336
|
+
which the cutoff giving the nearest count the tree allows is used (a tie keeps
|
|
337
|
+
more tips; the count reached is reported). A distance cutoff needs branch
|
|
338
|
+
lengths. The tip kept is the group's **most central** one (the medoid, with
|
|
339
|
+
the smallest summed distance to its group-mates) or its **most divergent** one
|
|
340
|
+
(the longest terminal branch). Tips that are selected or found by a search can
|
|
341
|
+
be kept whatever their group: they stand in for their group's representative,
|
|
342
|
+
so more tips than the target may stay.
|
|
343
|
+
|
|
344
|
+
The tips kept show as search A's hits, with its colour, hit count and
|
|
345
|
+
step-through, and a summary offers **Create tree**: a tree of only those tips,
|
|
346
|
+
added to the tree picker and opened drawn as the tree was — the same layout
|
|
347
|
+
and display type (phylogram, aligned or cladogram). It is named after the
|
|
348
|
+
tree and the count, as in
|
|
349
|
+
`mammals_233reps`, and its description says how it was made. An internal node
|
|
350
|
+
left with one child is replaced by that child, whose branch gains the node's
|
|
351
|
+
length; the new root keeps the original root's own branch length. The original
|
|
352
|
+
tree is not changed.
|
|
353
|
+
|
|
354
|
+
The grouping and the tips kept are the desktop's: they match its own results
|
|
355
|
+
on 129 generated trees in 5,666 settings (`test/fixtures/rep-contract.tsv`,
|
|
356
|
+
made by running the desktop's code).
|
|
357
|
+
|
|
325
358
|
## Metadata tables
|
|
326
359
|
|
|
327
360
|
A tree file rarely carries everything known about its tips. A **metadata
|
|
@@ -428,6 +461,12 @@ keeps the view in the hash too, so the same file reopened at that address
|
|
|
428
461
|
comes back as you left it. Zoom, pan, the legend's position and the node
|
|
429
462
|
selection are not part of a view; a shared view opens fitted.
|
|
430
463
|
|
|
464
|
+
In a file holding **several trees** each tree keeps its own view, so moving
|
|
465
|
+
between them with the picker brings each tree back as you had it (see
|
|
466
|
+
**Reading trees** below). The hash holds the view of the tree on screen, so
|
|
467
|
+
a link opens that tree the way it looks; the other trees' views last as long
|
|
468
|
+
as the page does.
|
|
469
|
+
|
|
431
470
|
Embedders get the same four pieces: the handle's `getViewState()` and
|
|
432
471
|
`applyViewState(state)`, the config's `view` (open straight into one) and
|
|
433
472
|
`onViewChange(state, encoded)` (called when it changes), and
|
|
@@ -508,7 +547,12 @@ youngest tip and labels that age (the ammonite demo ends at the K-Pg, 66).
|
|
|
508
547
|
|
|
509
548
|
Nodes with a date **range** (`minimum`/`maximum` — minimum is the younger
|
|
510
549
|
bound) draw uncertainty bars: translucent blue **HPD age bars** on internal
|
|
511
|
-
nodes,
|
|
550
|
+
nodes, and on tips whatever the axis says the range means. On **geologic**
|
|
551
|
+
time it is a fossil's observed range: sepia **fossil-range (FAD/LAD) bars with
|
|
552
|
+
end caps**. On **calendar** time it is the uncertainty of a **sampling date**
|
|
553
|
+
— a virus sample dated only to its month or year — drawn like an age bar,
|
|
554
|
+
slimmer, and only when it has a width: a tip dated to the day draws nothing.
|
|
555
|
+
Node
|
|
512
556
|
tooltips show the date. The **Time Axis** checkbox under Display Data toggles
|
|
513
557
|
everything; the axis needs a phylogram (branch lengths carry the time) and
|
|
514
558
|
the rectangular layout. **Time Grid** (off by default, like the desktop's
|
|
@@ -702,8 +746,15 @@ a name ending in `xml` as phyloXML, anything else as New Hampshire (Newick).
|
|
|
702
746
|
A file holding **several trees** — a Nexus TREES block, a Newick file with one
|
|
703
747
|
tree per `;`, a phyloXML with several phylogenies — opens on the first, and a
|
|
704
748
|
picker with previous / next buttons at the top of the control panel moves
|
|
705
|
-
between them
|
|
706
|
-
|
|
749
|
+
between them (also ⌘⇧< / ⌘⇧>). **Each tree is its own workspace:** you leave
|
|
750
|
+
a tree as you had it — layout, display type, labels, colours, sizes, tracks,
|
|
751
|
+
both searches, the clade you switched to and the ones you collapsed — and it
|
|
752
|
+
comes back that way. A tree you have not opened yet starts on its own
|
|
753
|
+
presets, read from its own content, in the layout and sizes you are already
|
|
754
|
+
using: stepping through ten trees of one file keeps them all circular, while
|
|
755
|
+
each still labels and colours itself its own way. Zoom and pan are not kept
|
|
756
|
+
(a tree opens fitted), and the views last as long as the page.
|
|
757
|
+
A protein/DNA/RNA characters matrix in a Nexus file
|
|
707
758
|
(sequential or interleaved) lands on the tips as an aligned `mol_seq`, so the
|
|
708
759
|
alignment track appears just as it does for phyloXML.
|
|
709
760
|
|
|
@@ -725,9 +776,34 @@ BEAST, BEAST 2, TreeAnnotator, FigTree and MrBayes — `posterior`, `prob`
|
|
|
725
776
|
(median/mean) with its `95%_HPD` (or range) becomes the node date the age
|
|
726
777
|
bars draw, FigTree's `!color` becomes the branch colour, and every other
|
|
727
778
|
field (`rate`, traits, ...) becomes a `beast:<key>` node property for
|
|
728
|
-
Color-by and search
|
|
779
|
+
Color-by and search (`mutations`, `mcc` and FigTree's `!`-prefixed display
|
|
780
|
+
directives are always text, never a gradient). **TreeTime**'s trees open as
|
|
781
|
+
what they are: its `timetree.nexus` carries dates only as `date=` annotations,
|
|
782
|
+
and those become node dates — calendar axis and all — where the date
|
|
783
|
+
differences reproduce the branch lengths, which is true of the time tree and
|
|
784
|
+
not of `divergence_tree.nexus`, though both carry the same annotations. Its
|
|
785
|
+
annotations land as `treetime:<key>` rather than `beast:<key>`, and its
|
|
786
|
+
`auspice_tree.json` opens as the Auspice dataset it is. FigTree's colour on a **taxon** — `'name'[&!color=...]` in the
|
|
787
|
+
TAXLABELS block — is that tip's **label** colour, carried as the desktop's
|
|
788
|
+
`style:font_color` property and drawn by Visual Styles. A number is a plain
|
|
789
|
+
decimal with an optional exponent: `0x1A` and `3f` are text.
|
|
790
|
+
**Auspice's "download Nexus"** annotations land where the
|
|
791
|
+
Auspice JSON reader puts the same dataset, so one Nextstrain build opens the
|
|
792
|
+
same way in either format: `num_date` is the node's date in years (and a
|
|
793
|
+
`nextstrain:num_date` property), `num_date_CI={lo,hi}` its interval — on a tip
|
|
794
|
+
too, where it is the sampling-date uncertainty — and `div` a
|
|
795
|
+
`nextstrain:div` property — but only on a tree that is actually time-scaled,
|
|
796
|
+
since Auspice writes the same annotations on its divergence tree: where the
|
|
797
|
+
year differences do not reproduce the branch lengths the dates stay properties
|
|
798
|
+
and no calendar axis is drawn. Inside an annotation a quote opens a string
|
|
799
|
+
only where a value starts, so a bare `country=Côte d'Ivoire` is one field with
|
|
800
|
+
an apostrophe in it. Classic `[&&NHX:...]` tags map to their phyloXML
|
|
729
801
|
equivalents (`S=` taxonomy, `T=` taxonomy id, `B=` support, `D=`
|
|
730
|
-
duplication/speciation event, `GN=`/`AC=` sequence name/accession)
|
|
802
|
+
duplication/speciation event, `GN=`/`AC=` sequence name/accession), read as
|
|
803
|
+
the desktop reads them: unquoted whitespace is formatting noise (`S=Homo
|
|
804
|
+
sapiens` is `Homosapiens`), a quoted value keeps its content
|
|
805
|
+
(`S="Homo sapiens"` is `Homo sapiens`), and the quotes themselves are never
|
|
806
|
+
part of the value. Plain
|
|
731
807
|
`[number]` brackets keep their old meaning (confidence values).
|
|
732
808
|
|
|
733
809
|
Both entry points **throw** on bad input — an undefined or empty tree, an
|
|
@@ -833,6 +909,21 @@ is always a fixed amount wider than the branch itself, so it tracks the
|
|
|
833
909
|
Branch Width slider instead of sitting at one fixed size. A branch drawn
|
|
834
910
|
shorter than the dot itself stays clean.
|
|
835
911
|
|
|
912
|
+
The **control panel itself** follows the same idea. It opens showing the
|
|
913
|
+
sections that describe the tree — what it can be coloured by, what it shows —
|
|
914
|
+
plus Search, and folds the ones that are adjustments to make later: Zoom,
|
|
915
|
+
Sizes and the domain controls. Whatever you open or close is then remembered, for the
|
|
916
|
+
page and across reloads, so a panel you have arranged stays arranged, even
|
|
917
|
+
when you switch to another tree. In a short window it also keeps itself to one
|
|
918
|
+
screen: opening a section folds the one you opened longest ago, but only while
|
|
919
|
+
the panel would not otherwise fit — on a tall screen nothing is ever folded for
|
|
920
|
+
you. Anything that puts something into a folded section opens it, so jumping to
|
|
921
|
+
the search box (⌘F / Ctrl+F), revealing Search B, or a tool reporting its
|
|
922
|
+
result as search hits all unfold Search. A host with little room to give can
|
|
923
|
+
also start the whole panel tighter and narrower with
|
|
924
|
+
[`panelDensity: 'compact'`](#configuration), or collapsed to its header bar
|
|
925
|
+
with `collapseControlPanel`.
|
|
926
|
+
|
|
836
927
|
## Configuration
|
|
837
928
|
|
|
838
929
|
One object, passed as the third argument. It is optional, and the best
|
|
@@ -857,6 +948,7 @@ copy-pastable JSON.
|
|
|
857
948
|
| Key | Default | What it does |
|
|
858
949
|
| --- | --- | --- |
|
|
859
950
|
| `collapseControlPanel` | `false` | Open with the control panel collapsed to just its header bar — the same state its own hide/show button toggles. |
|
|
951
|
+
| `panelDensity` | `'comfortable'` | `'compact'` tightens the control panel's spacing and narrows it from 214 to 196px, with the tree's left margin following. The same controls, nothing hidden — for a host page that has little room to give. |
|
|
860
952
|
| `enableDynamicSizing` | `true` | Size the tree to its container, and follow window resizes. |
|
|
861
953
|
| `displayWidth` | `800` | Width — only when dynamic sizing is off. |
|
|
862
954
|
| `displayHeight` | `600` | Height — only when dynamic sizing is off. |
|
package/archaeopteryx.d.ts
CHANGED
|
@@ -76,6 +76,9 @@ export interface ArchaeopteryxConfig {
|
|
|
76
76
|
/** Called once per settled redraw when the view changed: the state as
|
|
77
77
|
* getViewState() returns it, and its hash-ready string. */
|
|
78
78
|
onViewChange?: ((state: ViewState, encoded: string) => void) | null;
|
|
79
|
+
/** 'compact' tightens the control panel's spacing and narrows it (the
|
|
80
|
+
* tree's left margin follows). The same controls, nothing hidden. */
|
|
81
|
+
panelDensity?: 'comfortable' | 'compact';
|
|
79
82
|
pngExportScale?: number;
|
|
80
83
|
rootOffset?: number;
|
|
81
84
|
searchAinitialValue?: string | null;
|
|
@@ -158,7 +161,9 @@ export interface ViewerHandle {
|
|
|
158
161
|
/** Which of them is shown (0-based). */
|
|
159
162
|
getTreeIndex(): number;
|
|
160
163
|
/** Shows another tree of the launch in the same container under the
|
|
161
|
-
* same config
|
|
164
|
+
* same config: as you left it, or -- a tree not opened yet -- on its own
|
|
165
|
+
* presets in the current layout and sizes. Returns the handle for the
|
|
166
|
+
* new viewer. */
|
|
162
167
|
showTree(index: number): ViewerHandle;
|
|
163
168
|
/** The view as the panel left it (see ViewState). */
|
|
164
169
|
getViewState(): ViewState;
|