archaeopteryx 3.25.0 → 3.27.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 +93 -108
- package/archaeopteryx.d.ts +59 -0
- package/archaeopteryx.js +944 -61
- package/forester.js +15 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -255,10 +255,14 @@ program's.
|
|
|
255
255
|
|
|
256
256
|
A phylogram carries a **scale bar** at the bottom left: a round number of
|
|
257
257
|
branch-length units (1, 2 or 5 × 10ᵏ, whichever makes the bar about 100 px)
|
|
258
|
-
with its length written above it
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
the
|
|
258
|
+
with its length written above it, followed by the unit the tree states
|
|
259
|
+
(phyloXML's `branch_length_unit`, e.g. `0.05 subs/site`) and by nothing when
|
|
260
|
+
it states none: a tree that does not say what its lengths measure gets no
|
|
261
|
+
guess. It is drawn with the tree, so it zooms and exports with it and its
|
|
262
|
+
label always holds. A cladogram has nothing to measure and shows none, and a
|
|
263
|
+
tree under a scale axis leaves the measuring to the axis. **Scale** under
|
|
264
|
+
Display Data > Options hides it (on by default; config `showScaleBar`, view
|
|
265
|
+
key `scaleBar`; the desktop's switch has the same name and defaults to off).
|
|
262
266
|
|
|
263
267
|
**Scale Axis** under Display Data (off by default, as on the desktop) draws a
|
|
264
268
|
labelled ruler under a phylogram, from 0 at the root out to the deepest tip, in
|
|
@@ -293,7 +297,8 @@ The card button in the panel header opens **Control panel**: one row for every
|
|
|
293
297
|
control the panel is currently showing, in the order it shows them, each with
|
|
294
298
|
the control's own glyph or name and the sentence that explains it — the layout
|
|
295
299
|
and display-type buttons included, drawn with the very glyph they carry in the
|
|
296
|
-
panel. The About box has a row for it too
|
|
300
|
+
panel. The About box has a row for it too, and one for
|
|
301
|
+
[Diagnostics](#diagnostics).
|
|
297
302
|
|
|
298
303
|
The display types say what they do and when they are greyed, whether or not
|
|
299
304
|
they are greyed in the view you are looking at: *"phylogram: branch lengths
|
|
@@ -1144,103 +1149,69 @@ names exactly what is missing (including "the loaded d3 is not usable as d3
|
|
|
1144
1149
|
version 7"). The optional export libraries stay page-level globals in every
|
|
1145
1150
|
loading style: `window.Canvg` (PNG), `window.jspdf` + svg2pdf.js (PDF).
|
|
1146
1151
|
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
(
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
year differences do not reproduce the branch lengths the dates stay properties
|
|
1211
|
-
and no calendar axis is drawn. Inside an annotation a quote opens a string
|
|
1212
|
-
only where a value starts, so a bare `country=Côte d'Ivoire` is one field with
|
|
1213
|
-
an apostrophe in it. Classic `[&&NHX:...]` tags map to their phyloXML
|
|
1214
|
-
equivalents (`S=` taxonomy, `T=` taxonomy id, `B=` support, `D=`
|
|
1215
|
-
duplication/speciation event, `GN=`/`AC=` sequence name/accession), read as
|
|
1216
|
-
the desktop reads them: unquoted whitespace is formatting noise (`S=Homo
|
|
1217
|
-
sapiens` is `Homosapiens`), a quoted value keeps its content
|
|
1218
|
-
(`S="Homo sapiens"` is `Homo sapiens`), and the quotes themselves are never
|
|
1219
|
-
part of the value. Plain
|
|
1220
|
-
`[number]` brackets keep their old meaning (confidence values).
|
|
1221
|
-
|
|
1222
|
-
Both entry points **throw** on bad input — an undefined or empty tree, an
|
|
1223
|
-
unparseable file, or a config key that no longer exists. Nothing is reported by
|
|
1224
|
-
a popup any more, and nothing fails silently.
|
|
1225
|
-
|
|
1226
|
-
## Supported file formats
|
|
1227
|
-
|
|
1228
|
-
| Format | I/O | What Archaeopteryx.js does with it | Ref. |
|
|
1229
|
-
|---|---|---|---|
|
|
1230
|
-
| **Newick** / New Hampshire (`.nwk`, `.nh`, `.tre`) | in / out | The base tree: topology, names, branch lengths, and bracketed confidence values. | [1] |
|
|
1231
|
-
| **NHX** — New Hampshire eXtended | in | `[&&NHX:...]` tags riding on Newick: taxonomy (`S=`, `T=`), sequence (`GN=`, `AC=`), support (`B=`), duplication/speciation events (`D=`). | [2] |
|
|
1232
|
-
| **Nexus** (`.nex`, `.nexus`) | in / out | One file for the tree(s) and, in a `CHARACTERS`/`DATA` block, an aligned protein/DNA/RNA matrix (sequential or interleaved) — the tree and its alignment together. | [3] |
|
|
1233
|
-
| **phyloXML** (`.xml`) | in / out | The richest native format: taxonomy, sequences and alignments, dates, confidences, branch colours and arbitrary metadata (custom properties). | [4] |
|
|
1234
|
-
| **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] |
|
|
1235
|
-
| **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] |
|
|
1236
|
-
| **MrBayes** annotations | in (embedded in Newick/Nexus) | `prob=`/`prob.stddev=` blobs: posterior-probability clade support. | [8] |
|
|
1237
|
-
| **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). | — |
|
|
1238
|
-
| **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] |
|
|
1239
|
-
| SVG · PNG · vector PDF | out | The drawn tree for publication or further editing — vector (SVG, PDF) or raster (PNG), either as shown on screen or the whole tree at full size (see [Downloads](#downloads)). General-purpose graphics formats, not phylogenetic data, so no literature reference applies. | — |
|
|
1240
|
-
|
|
1241
|
-
The parser for a given input is auto-detected (see **The entry points**
|
|
1242
|
-
above); the Download menu offers whichever output formats the current tree
|
|
1243
|
-
can carry.
|
|
1152
|
+
### Diagnostics
|
|
1153
|
+
|
|
1154
|
+
Checking at use rather than at load makes the viewer hard to break — and lets
|
|
1155
|
+
it run half-equipped without a word: no PDF in the Download menu, a retired
|
|
1156
|
+
config key ignored, a forced visualization overruled, each mentioned only in a
|
|
1157
|
+
console nobody has open. **`archaeopteryx.doctor()`** says what state the
|
|
1158
|
+
program is in on this page:
|
|
1159
|
+
|
|
1160
|
+
```javascript
|
|
1161
|
+
var report = archaeopteryx.doctor();
|
|
1162
|
+
report.ok; // false when something is wrong that nobody chooses
|
|
1163
|
+
report.summary; // "nothing to report", or "2 things to check"
|
|
1164
|
+
report.problems; // ['jspdf: loaded without svg2pdf.js: PDF export needs both, so it is off', ...]
|
|
1165
|
+
report.notes; // stated, not flagged
|
|
1166
|
+
report.libraries; // [{name, role, loaded, version, status, detail}, ...]
|
|
1167
|
+
report.functions; // [{name: 'PDF export', available: false, detail: 'jspdf and svg2pdf.js are not loaded'}, ...]
|
|
1168
|
+
report.launch; // {config, tips, tree, trees, container}, or null when no tree is on view
|
|
1169
|
+
report.text; // all of it as plain text, to paste into an issue
|
|
1170
|
+
console.log(archaeopteryx.doctor().text);
|
|
1171
|
+
```
|
|
1172
|
+
|
|
1173
|
+
It works before a launch, after a launch that threw, and in Node, and it never
|
|
1174
|
+
throws. The same report is in the viewer: the **About** box (a click on the
|
|
1175
|
+
program name) has a **Diagnostics** row that opens it, with a **Copy report**
|
|
1176
|
+
button — the copied text adds the keys passed to `launch()` (a string or a
|
|
1177
|
+
number as given, anything else as its kind: a tree or a callback is never
|
|
1178
|
+
copied) and the browser.
|
|
1179
|
+
|
|
1180
|
+
What is a **problem** and what is only stated:
|
|
1181
|
+
|
|
1182
|
+
| | |
|
|
1183
|
+
|---|---|
|
|
1184
|
+
| An optional library that is not loaded (canvg, jspdf, svg2pdf.js) | **stated**: "PNG export: off". Leaving one out is a site's choice. |
|
|
1185
|
+
| Half of a pair: jspdf without svg2pdf.js, or the other way round; svg2pdf.js loaded before jspdf | **problem** |
|
|
1186
|
+
| A library under its 2.x-era global (`window.canvg`, `window.jsPDF`) and not under the one this version reads; a `window.Canvg` without `fromString` | **problem** |
|
|
1187
|
+
| A d3 that is not version 7 (d3 4 to 6 have `d3.zoom` and `d3.cluster` too, so the launch check lets them through) | **problem**; a d3 7 older than 7.9 is a note |
|
|
1188
|
+
| `forester.js` and `archaeopteryx.js` from different releases (`forester.VERSION`) | **problem** |
|
|
1189
|
+
| A phyloxml older than 1.1.7: one that drops something when saving, or writes a node's style as the earlier releases did | **problem** — and "Read and save phyloXML" stays **on**, since it still reads and saves |
|
|
1190
|
+
| A phyloxml that only lays the file out differently from 1.1.7 (a newer release) | **note** |
|
|
1191
|
+
| phyloxml or sax not loaded, or a phyloxml that cannot read or write at all | **problem** |
|
|
1192
|
+
| What the last launch printed about its **config**: a deprecated key, an `initialVisualization` the tree cannot honour or that was overruled, a bad `pngExportScale`, a thrown `onViewChange`, and why a launch threw (`launchArchaeopteryx` included) | **problem** |
|
|
1193
|
+
| An export that failed (a clipboard the browser refused, a canvas too large), what the viewer left out of a tree (a domain or a gene it could not place), a size setting ignored | **note**: nothing a site's configuration decides |
|
|
1194
|
+
|
|
1195
|
+
Only forester, jsPDF and d3's script build state a version; the others are
|
|
1196
|
+
judged by what they do. The d3 the viewer was handed at load is the one
|
|
1197
|
+
reported, as `launch()` uses it — a d3 with no `version` (the ES-module build
|
|
1198
|
+
a bundler imports) is recognised by what only d3 7 has. phyloxml is given a
|
|
1199
|
+
small tree to write, and the result is read for what the older releases are
|
|
1200
|
+
known to do.
|
|
1201
|
+
|
|
1202
|
+
**While the report has a problem, a small dot follows the program name** in
|
|
1203
|
+
the panel header, and the name's tooltip says how many. It is neutral, not a
|
|
1204
|
+
warning colour: most of the people who see it are a site's visitors, who can
|
|
1205
|
+
do nothing about it. Nothing appears when an optional library is merely
|
|
1206
|
+
absent. The dot is brought up to date when a problem is recorded, when the
|
|
1207
|
+
page finishes loading, when the pointer enters the panel, when the About box
|
|
1208
|
+
opens and when `doctor()` is called — so a library that arrives after the
|
|
1209
|
+
launch puts it out without a relaunch.
|
|
1210
|
+
|
|
1211
|
+
The warnings belong to **the tree on view**: `showTree()` starts them afresh
|
|
1212
|
+
for the tree it moves to, and so does a new launch. A launch that is rejected
|
|
1213
|
+
while an earlier viewer is still on the page leaves that viewer's report as
|
|
1214
|
+
it was and adds one line saying what failed.
|
|
1244
1215
|
|
|
1245
1216
|
### Downloads
|
|
1246
1217
|
|
|
@@ -1552,6 +1523,7 @@ copy-pastable JSON.
|
|
|
1552
1523
|
| `geneFamily` | `'auto'` | The annotation namespace that colours the genes and anchors the rows: `'auto'` (the one most genes carry) or a prefix such as `'pgfam'`. |
|
|
1553
1524
|
| `geneLabels` | `'genes'` | Where gene symbols go: `'genes'` (on the arrows), `'legend'` (a card of the families), or `'none'`. |
|
|
1554
1525
|
| `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. |
|
|
1526
|
+
| `showScaleBar` | `true` | Open with the scale bar at the bottom left of a phylogram (a round length in the tree's branch-length unit). It gives way while the scale axis is shown either way. |
|
|
1555
1527
|
| `showScaleGrid` | `false` | Open with the Scale Grid lines on (only meaningful — and only offered as a checkbox — while the scale axis itself is shown). |
|
|
1556
1528
|
| `showSupportDots` | `false` | Open with the Support Dots marks on (the checkbox appears whenever the tree has confidences). |
|
|
1557
1529
|
| `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. |
|
|
@@ -1919,17 +1891,29 @@ exists, and clears the per-legend chip states.
|
|
|
1919
1891
|
Highest first, at each paint:
|
|
1920
1892
|
|
|
1921
1893
|
* **Label colour**: search/selection highlight → active Color visualization
|
|
1922
|
-
|
|
1894
|
+
(its colour; the theme ink for a node without a value) → `style:font_color`
|
|
1895
|
+
→ phyloXML branch colour → theme ink.
|
|
1923
1896
|
* **Node fill**: highlight → duplication/speciation event colour → active
|
|
1924
|
-
Color visualization
|
|
1925
|
-
|
|
1897
|
+
Color visualization (its colour; a node without a value draws no dot,
|
|
1898
|
+
or a hollow one while Node events are shown) → `style:node_color` (else
|
|
1899
|
+
`style:font_color`) → background.
|
|
1926
1900
|
* **Node outline**: darkened highlight → event colour → visualization fill
|
|
1927
|
-
→ style colour
|
|
1901
|
+
→ style colour (not while a Color visualization is active) → branch colour
|
|
1902
|
+
→ branch default.
|
|
1928
1903
|
* **Node shape path**: suppressed for highlighted/event nodes; chosen Shape
|
|
1929
1904
|
visualization → `style:node_shape`. A node earns its default dot when a
|
|
1930
1905
|
Color visualization is active (and no shape was drawn), or when it
|
|
1931
1906
|
carries `style:node_color` — `font_color` alone paints only the label.
|
|
1932
1907
|
|
|
1908
|
+
While a Color visualization is active the style colours are **not consulted
|
|
1909
|
+
for any node**, valued or not: not for the label, the dot, its outline, the
|
|
1910
|
+
hover glow or the clock plot's points. The visualization owns the colours and
|
|
1911
|
+
its legend explains them; a node without a value takes the default label
|
|
1912
|
+
colour and draws no dot. That is the desktop's rule (its TreePanel.setColor).
|
|
1913
|
+
Clearing the Color menu brings the file's colours back. Branch colours,
|
|
1914
|
+
shapes, font sizes and styles are not colours of the visualization's kind
|
|
1915
|
+
and stay.
|
|
1916
|
+
|
|
1933
1917
|
### Legend anatomy
|
|
1934
1918
|
|
|
1935
1919
|
One draggable SVG card per active visualization (colour, then shape,
|
|
@@ -2126,8 +2110,9 @@ honoured: `style:font_color`, `style:node_color`, `style:node_shape`
|
|
|
2126
2110
|
The **Visual Styles** checkbox — the desktop's "Visual Styles/Branch Colors",
|
|
2127
2111
|
shown when the tree carries either, on by default — turns them off and on,
|
|
2128
2112
|
and gates phyloXML `<color>` branch colours too, exactly as on the desktop.
|
|
2129
|
-
An active Color visualization outranks
|
|
2130
|
-
|
|
2113
|
+
An active Color visualization outranks the style colours for every node,
|
|
2114
|
+
valued or not, on labels and node dots alike, as on the desktop: set the
|
|
2115
|
+
Color menu to default to see the tree as its file styled it.
|
|
2131
2116
|
`style:` never appears in the Color / Shape menus — it is rendering, not data.
|
|
2132
2117
|
|
|
2133
2118
|
### Moving the legends
|
package/archaeopteryx.d.ts
CHANGED
|
@@ -138,6 +138,8 @@ export interface ArchaeopteryxConfig {
|
|
|
138
138
|
* branches show time, a distance axis on any other. Default: on for a
|
|
139
139
|
* time tree, off otherwise. */
|
|
140
140
|
showScaleAxis?: boolean;
|
|
141
|
+
/** The scale bar at the bottom left of a phylogram; on unless false. */
|
|
142
|
+
showScaleBar?: boolean;
|
|
141
143
|
/** Grid lines (rings, in circular) at the scale axis's ticks. */
|
|
142
144
|
showScaleGrid?: boolean;
|
|
143
145
|
showSupportDots?: boolean;
|
|
@@ -213,6 +215,7 @@ export interface ViewState {
|
|
|
213
215
|
geneLabels?: 'none' | 'genes' | 'legend';
|
|
214
216
|
scaleAxis?: boolean;
|
|
215
217
|
scaleGrid?: boolean;
|
|
218
|
+
scaleBar?: boolean;
|
|
216
219
|
/** @deprecated the name of scaleAxis in older links; still read. */
|
|
217
220
|
timeAxis?: boolean;
|
|
218
221
|
/** @deprecated the name of scaleGrid in older links; still read. */
|
|
@@ -256,6 +259,57 @@ export interface ViewerHandle {
|
|
|
256
259
|
* value, 'label' keeps them as names. */
|
|
257
260
|
export type InternalNumericLabels = 'auto' | 'confidence' | 'label';
|
|
258
261
|
|
|
262
|
+
/** One library's row in the diagnostics report. `status`: 'ok'; 'absent'
|
|
263
|
+
* (not loaded, and that is no fault: an optional library, or d3 outside a
|
|
264
|
+
* page); 'note' (stated, not flagged); 'problem' (lights the dot). */
|
|
265
|
+
export interface DoctorLibrary {
|
|
266
|
+
name: 'forester.js' | 'd3' | 'phyloxml' | 'sax' | 'canvg' | 'jspdf' | 'svg2pdf.js' | string;
|
|
267
|
+
role: 'required' | 'optional';
|
|
268
|
+
loaded: boolean;
|
|
269
|
+
/** Only d3 (its script build), jsPDF and forester state one. */
|
|
270
|
+
version: string | null;
|
|
271
|
+
status: 'ok' | 'absent' | 'note' | 'problem';
|
|
272
|
+
detail: string;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** What the user gets or does not get, with the reason when it is off. */
|
|
276
|
+
export interface DoctorFunction {
|
|
277
|
+
name: 'Read and save phyloXML' | 'PNG export' | 'Copy PNG' | 'PDF export' | string;
|
|
278
|
+
available: boolean;
|
|
279
|
+
detail: string;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/** The tree on view. A config value is given as passed when it is a
|
|
283
|
+
* string, a number, a boolean or null, and otherwise as its kind:
|
|
284
|
+
* '(function)', '(list of 3)', '(object)'. */
|
|
285
|
+
export interface DoctorLaunch {
|
|
286
|
+
config: Record<string, string | number | boolean | null>;
|
|
287
|
+
tips: number | null;
|
|
288
|
+
/** 1-based, of `trees`. */
|
|
289
|
+
tree: number;
|
|
290
|
+
trees: number;
|
|
291
|
+
container: { width: number; height: number } | null;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/** archaeopteryx.doctor(): the state of the program on this page. */
|
|
295
|
+
export interface DoctorReport {
|
|
296
|
+
program: string;
|
|
297
|
+
version: string;
|
|
298
|
+
/** false when something is wrong that nobody chooses. */
|
|
299
|
+
ok: boolean;
|
|
300
|
+
/** 'nothing to report', or '2 things to check'. */
|
|
301
|
+
summary: string;
|
|
302
|
+
problems: string[];
|
|
303
|
+
notes: string[];
|
|
304
|
+
libraries: DoctorLibrary[];
|
|
305
|
+
functions: DoctorFunction[];
|
|
306
|
+
/** null while no tree is on view. */
|
|
307
|
+
launch: DoctorLaunch | null;
|
|
308
|
+
environment: { userAgent: string | null; secureContext: boolean | null };
|
|
309
|
+
/** The whole report as plain text, for pasting into an issue. */
|
|
310
|
+
text: string;
|
|
311
|
+
}
|
|
312
|
+
|
|
259
313
|
export interface Archaeopteryx {
|
|
260
314
|
/** Launch the viewer into a container (a CSS selector or the element
|
|
261
315
|
* itself; an unresolvable container throws). Exactly three arguments.
|
|
@@ -294,6 +348,11 @@ export interface Archaeopteryx {
|
|
|
294
348
|
/** Module-level twin of the handle's getSelectedNodes. */
|
|
295
349
|
getSelectedNodes(): PhylogenyNode[];
|
|
296
350
|
|
|
351
|
+
/** The state of the program on this page: the libraries, the functions
|
|
352
|
+
* they switch off, what the launch on view warned about. Works before a
|
|
353
|
+
* launch, after one that threw, and in Node; never throws. */
|
|
354
|
+
doctor(): DoctorReport;
|
|
355
|
+
|
|
297
356
|
/** A view as a "key=value&..." string for a URL hash, and back. decode
|
|
298
357
|
* accepts a leading '#', ignores what it does not know, and returns
|
|
299
358
|
* null for nothing. */
|