archaeopteryx 3.21.0 → 3.23.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 +255 -9
- package/archaeopteryx.d.ts +24 -0
- package/archaeopteryx.js +1797 -38
- package/forester.js +762 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ nothing is uploaded. Its **Expert options** panel exercises every launch
|
|
|
24
24
|
config key live and shows the exact config JSON to copy into your own
|
|
25
25
|
`launch()` call.
|
|
26
26
|
|
|
27
|
-
* [Auspice / Nextstrain JSON](https://cmzmasek.github.io/archaeopteryx-js/demo.html?tree=auspice)
|
|
27
|
+
* [Auspice / Nextstrain JSON (Time | Div, Clock plot)](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
30
|
* [Flavivirus mature peptides (10 trees)](https://cmzmasek.github.io/archaeopteryx-js/demo.html?tree=flavivirus)
|
|
@@ -33,6 +33,7 @@ config key live and shows the exact config JSON to copy into your own
|
|
|
33
33
|
* [Caliciviridae (186 strains)](https://cmzmasek.github.io/archaeopteryx-js/demo.html?tree=caliciviridae_500)
|
|
34
34
|
* [Adenoviridae (321 strains)](https://cmzmasek.github.io/archaeopteryx-js/demo.html?tree=adenoviridae)
|
|
35
35
|
* [Apaf-1 gene family (domain architectures)](https://cmzmasek.github.io/archaeopteryx-js/demo.html?tree=apaf)
|
|
36
|
+
* [Genome regions (gene arrows, anchored)](https://cmzmasek.github.io/archaeopteryx-js/demo.html?tree=genome_regions)
|
|
36
37
|
* [Clustergram (heat map + column clustering)](https://cmzmasek.github.io/archaeopteryx-js/demo.html?tree=clustergram)
|
|
37
38
|
* [Nucleotide alignment (600 columns)](https://cmzmasek.github.io/archaeopteryx-js/demo.html?tree=alignment_nt)
|
|
38
39
|
* [Genome alignment (150 × 30,000 columns)](https://cmzmasek.github.io/archaeopteryx-js/demo.html?tree=genome_alignment)
|
|
@@ -589,6 +590,81 @@ warning, never fatal. The tracks ride into the SVG, PDF and PNG exports.
|
|
|
589
590
|
This is the desktop's domain display, drawn to the same numbers
|
|
590
591
|
(`test/domain_test.js` holds them).
|
|
591
592
|
|
|
593
|
+
## Genome regions
|
|
594
|
+
|
|
595
|
+
A tree whose tips are genomes can carry (part of) each genome: its genes as
|
|
596
|
+
`<sequence>` elements, one per gene, each with a `<location>` on a contig and
|
|
597
|
+
its family in an `<annotation ref="…">`, plus one `<sequence type="dna">`
|
|
598
|
+
record per contig. The viewer draws them as a **gene track** beside the
|
|
599
|
+
tips: a thin backbone per genome with an **arrow per gene**, pointing by
|
|
600
|
+
strand, coloured by family, on one scale shared by the whole tree so
|
|
601
|
+
distances compare across genomes. The rows are **anchored**: the anchor
|
|
602
|
+
family's gene sits at the same place in every row, pointing right, and the
|
|
603
|
+
neighbours follow — a genome carrying it on the other strand is mirrored —
|
|
604
|
+
so gene order, inversions, insertions and deletions read down the tree, as
|
|
605
|
+
in BV-BRC's Compare Region Viewer. A family met in one genome only is grey,
|
|
606
|
+
a gene with no family lighter grey, so conserved order stands out. A bar at
|
|
607
|
+
the end of a backbone marks a contig end; the track's own scale bar under
|
|
608
|
+
the rows reads in kb. The track appears from the start whenever a tree
|
|
609
|
+
carries regions; the **Genes** checkbox under Display Data toggles it, and
|
|
610
|
+
the **Genome regions** section holds the controls:
|
|
611
|
+
|
|
612
|
+
* **Track width** `−` / `+` — the widest row starts at a quarter of the
|
|
613
|
+
window and scales by 0.8 / 1.2 per press (hold to repeat).
|
|
614
|
+
* **Anchor** — `Auto` (the family single-copy in the most genomes, at least
|
|
615
|
+
half of them; the choice is named), any family that can anchor two
|
|
616
|
+
genomes or more, or `None`, which left-aligns the rows.
|
|
617
|
+
* **Family** — which annotation namespace colours the genes and anchors the
|
|
618
|
+
rows, offered when the genes carry more than one (a BV-BRC export carries
|
|
619
|
+
both PGfams and PLfams).
|
|
620
|
+
* **Labels** — `On genes` (the symbol, when it fits), `Legend` (a card of
|
|
621
|
+
the families with their commonest product and genome counts, draggable,
|
|
622
|
+
double-click to send it home), or `None`.
|
|
623
|
+
|
|
624
|
+
**Hovering an arrow** reads the gene out: symbol, product, family, location,
|
|
625
|
+
length, the genome it belongs to and its accession; **clicking** opens its
|
|
626
|
+
BV-BRC feature page for a BV-BRC accession (`fig|…`) or NCBI's protein page
|
|
627
|
+
for a GenBank / RefSeq one. In the circular and unrooted layouts the arrows
|
|
628
|
+
ride each named tip's spoke, as the domain tracks do, and both tracks can
|
|
629
|
+
show at once, the genes past the domains. Whole genomes are for viruses; a
|
|
630
|
+
bacterial genome is shown as a window of a few dozen genes around a gene of
|
|
631
|
+
interest, chosen by whoever writes the file. The tree is labelled by node
|
|
632
|
+
name: a genome's sequences describe the region beside the tip, not the tip.
|
|
633
|
+
|
|
634
|
+
The file needs nothing phyloXML has not got — `<location>` is the schema's
|
|
635
|
+
"location of a sequence on a genome/chromosome", an annotation's `ref` its
|
|
636
|
+
reference to an external database:
|
|
637
|
+
|
|
638
|
+
```xml
|
|
639
|
+
<clade>
|
|
640
|
+
<name>Brucella melitensis bv. 1 str. 16M</name>
|
|
641
|
+
<sequence type="dna"> <!-- the contig record, FIRST -->
|
|
642
|
+
<accession source="RefSeq">NC_003317.1</accession>
|
|
643
|
+
<name>chromosome I</name>
|
|
644
|
+
<location>NC_003317.1:1-2117144</location>
|
|
645
|
+
</sequence>
|
|
646
|
+
<sequence type="protein"> <!-- one per gene, any order -->
|
|
647
|
+
<accession source="BV-BRC">fig|224914.11.peg.1021</accession>
|
|
648
|
+
<symbol>dnaK</symbol>
|
|
649
|
+
<name>Chaperone protein DnaK</name>
|
|
650
|
+
<location>NC_003317.1:1055720-1057636(-)</location>
|
|
651
|
+
<annotation ref="pgfam:PGF_00019355"></annotation>
|
|
652
|
+
</sequence>
|
|
653
|
+
</clade>
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
A location is `contig:start-end(+)`, 1-based and inclusive, split on its
|
|
657
|
+
last colon; a located sequence **with** a strand is a gene, one **without**
|
|
658
|
+
is the contig's record, whose span says where the contig ends. The record
|
|
659
|
+
comes first because a tip's first sequence is "the" sequence to every other
|
|
660
|
+
reader. A tip's genes on a second contig are not drawn (one contig per
|
|
661
|
+
genome: the one with the most genes) and a location not in the grammar is
|
|
662
|
+
skipped; both are counted in a console warning. The demo is synthetic
|
|
663
|
+
([Genome regions](https://cmzmasek.github.io/archaeopteryx-js/demo.html?tree=genome_regions),
|
|
664
|
+
twelve genomes with one row per rule: an inversion, a deletion, two
|
|
665
|
+
insertions, a mirrored genome, a contig end, two contigs, overlapping genes,
|
|
666
|
+
a doubled anchor); `test/gene_test.js` pins its numbers.
|
|
667
|
+
|
|
592
668
|
## Sequence alignments
|
|
593
669
|
|
|
594
670
|
A tree whose tips carry `<mol_seq is_aligned="true">` shows the alignment as
|
|
@@ -810,6 +886,59 @@ branches show divergence, and the Scale Axis measures distance instead. Each lay
|
|
|
810
886
|
Div is on screen says so and opens again showing divergence. All of this is
|
|
811
887
|
shared with the desktop.
|
|
812
888
|
|
|
889
|
+
### Clock plot
|
|
890
|
+
|
|
891
|
+
Beside the switch, a **Clock plot** button opens a panel that plots each
|
|
892
|
+
tip's **date** against its **divergence** from the root, with a straight
|
|
893
|
+
line through the tips — the root-to-tip plot of TempEst and TreeTime, and
|
|
894
|
+
Auspice's clock view. Under the plot:
|
|
895
|
+
|
|
896
|
+
- **Rate** — the slope of the line: substitutions per site per year (per
|
|
897
|
+
unit of the tree's dates where they are not calendar years). Negative
|
|
898
|
+
where the tips' divergence falls with time.
|
|
899
|
+
- **Root date, by the line** — the date at which the line comes down to the
|
|
900
|
+
root's divergence — over **Root date, in the tree**, the one the tree
|
|
901
|
+
states. How far apart they are is the point of showing both.
|
|
902
|
+
- **R²** and the number of **Tips** in the fit.
|
|
903
|
+
|
|
904
|
+
The line is ordinary least squares over the **tips only**: a tip's date is
|
|
905
|
+
an observation, an ancestor's was inferred (usually with a clock), and
|
|
906
|
+
counting it would have the estimate confirm itself. It is not forced through
|
|
907
|
+
the root. Tips share ancestry, so R² describes the fit and is no
|
|
908
|
+
significance test. On a BEAST clock-model tree the divergence *is* each
|
|
909
|
+
branch's time × its clock rate, so there the plot shows the model's rates,
|
|
910
|
+
not a measurement of its own (a strict clock is a perfect line), and the
|
|
911
|
+
panel says so.
|
|
912
|
+
|
|
913
|
+
The panel is **linked to the tree** and stays open while you work in it
|
|
914
|
+
(drag it by its title):
|
|
915
|
+
|
|
916
|
+
- a point wears its node's colour in the tree — the Color visualization,
|
|
917
|
+
search hits, the selection;
|
|
918
|
+
- pointing at a point lights its node in the tree (the collapsed clade
|
|
919
|
+
holding it, if it is hidden in one), and pointing at a node in the tree
|
|
920
|
+
rings its point;
|
|
921
|
+
- **clicking** a point selects or deselects its node, and **dragging** a box
|
|
922
|
+
selects the tips in it — the tree's own selection, so an outlier found on
|
|
923
|
+
the plot is found in the tree. **Deselect all** clears it;
|
|
924
|
+
- tips with one date and one divergence — identical sequences sampled on one
|
|
925
|
+
day — are drawn on one spot, and that dot answers for all of them: the
|
|
926
|
+
readout says how many tips are there and names the first five, all of them
|
|
927
|
+
light up in the tree, and a click selects them all (or deselects them all,
|
|
928
|
+
where all were selected);
|
|
929
|
+
- in a subtree view the plot is the clade's, with the clade's own line.
|
|
930
|
+
|
|
931
|
+
**Regression line** shows and hides the line. **Internal nodes** adds the
|
|
932
|
+
ancestors' points, each at its own date and divergence; the panel opens
|
|
933
|
+
without them, since the line is the tips' and a deep root would crowd them
|
|
934
|
+
into a corner.
|
|
935
|
+
|
|
936
|
+
The button is offered on a tree that has **Time | Div** and whose line can
|
|
937
|
+
be drawn: three tips or more, not all on one date. A tree sampled at one
|
|
938
|
+
moment has no slope to estimate. (A tree whose branch lengths are divergence
|
|
939
|
+
and whose tips alone are dated — the tree a root-to-tip plot is run on
|
|
940
|
+
*before* dating — has no plot yet.)
|
|
941
|
+
|
|
813
942
|
# forester.js
|
|
814
943
|
forester.js is a general suite for dealing with phylogenetic trees.
|
|
815
944
|
|
|
@@ -1020,7 +1149,10 @@ pick them up. Both metrics are retained, and
|
|
|
1020
1149
|
`forester.applyTimeBranchLengths(phy)` /
|
|
1021
1150
|
`forester.applyDivergenceBranchLengths(phy)` /
|
|
1022
1151
|
`forester.hasTimeAndDivergence(phy)` are the plumbing behind the
|
|
1023
|
-
**Time | Div** switch
|
|
1152
|
+
**Time | Div** switch (and `forester.clockPlotKind(phy)` /
|
|
1153
|
+
`forester.clockPlotData(phy, view)` / `forester.clockRegression(xs, ys)`
|
|
1154
|
+
behind the **Clock plot**: which trees have one, its points and its
|
|
1155
|
+
least-squares line). The two `apply` functions answer `true` when they
|
|
1024
1156
|
laid the tree out, and `false` — leaving every branch length as it was —
|
|
1025
1157
|
when their layout cannot state every branch.
|
|
1026
1158
|
|
|
@@ -1100,7 +1232,7 @@ when the sequences are of unequal length, why it cannot.
|
|
|
1100
1232
|
size* (the default) is the whole tree, re-laid-out large enough that no tip
|
|
1101
1233
|
name has to be hidden — in rows in the rectangular layout, around the ring in
|
|
1102
1234
|
the circular one — and cropped to the drawing, with the legends (colour,
|
|
1103
|
-
shape, domains, the heat-map ring's scale) stacked beside the tree rather
|
|
1235
|
+
shape, domains, gene families, the heat-map ring's scale) stacked beside the tree rather
|
|
1104
1236
|
than over it. The window itself is left exactly as it was. An unrooted fan
|
|
1105
1237
|
is enlarged only while that still frees names: tips on very short branches
|
|
1106
1238
|
can collide at any size. An alignment track is drawn as its window, the
|
|
@@ -1389,6 +1521,10 @@ copy-pastable JSON.
|
|
|
1389
1521
|
| `domainLabels` | `'domains'` | Where domain names go: `'domains'` (on the boxes), `'legend'` (a card), or `'none'`. |
|
|
1390
1522
|
| `domainGlow` | `false` | Open with the glow around each domain box on. |
|
|
1391
1523
|
| `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. |
|
|
1524
|
+
| `showGenes` | tree-derived | Open with the gene track shown. Default: on when any tip carries a genome region (two or more located genes), off otherwise — an explicit `true`/`false` overrides that. |
|
|
1525
|
+
| `geneAnchor` | `'auto'` | The family the gene track's rows line up on: `'auto'` (the family single-copy in the most genomes), `'none'` (left-aligned rows), or a family ref such as `'pgfam:PGF_00019355'`. |
|
|
1526
|
+
| `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'`. |
|
|
1527
|
+
| `geneLabels` | `'genes'` | Where gene symbols go: `'genes'` (on the arrows), `'legend'` (a card of the families), or `'none'`. |
|
|
1392
1528
|
| `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. |
|
|
1393
1529
|
| `showScaleGrid` | `false` | Open with the Scale Grid lines on (only meaningful — and only offered as a checkbox — while the scale axis itself is shown). |
|
|
1394
1530
|
| `showSupportDots` | `false` | Open with the Support Dots marks on (the checkbox appears whenever the tree has confidences). |
|
|
@@ -1930,7 +2066,10 @@ Two rules, in order:
|
|
|
1930
2066
|
of the current pick's (substantially more economical) takes it.
|
|
1931
2067
|
|
|
1932
2068
|
A field with no printable values is never checked (apaf's sequences carry
|
|
1933
|
-
only domain architectures, so its Sequence box starts unchecked).
|
|
2069
|
+
only domain architectures, so its Sequence box starts unchecked). On a tree
|
|
2070
|
+
of genomes the sequence field has none either: a tip's located sequences —
|
|
2071
|
+
its contig record and its genes — describe the region drawn beside it, not
|
|
2072
|
+
the tip, so the node name stands. The choice
|
|
1934
2073
|
is logged to the console at launch, and the user can recheck anything — the
|
|
1935
2074
|
rules only set the initial state.
|
|
1936
2075
|
|
|
@@ -2063,6 +2202,68 @@ numbers — apaf.xml: 31 tips, `Lmax` 2080, 202 domains; 9 names / 166 boxes
|
|
|
2063
2202
|
at 1e−3; the palette; 22_MOUSE's box offsets at `W = 300` — are the
|
|
2064
2203
|
desktop's, in `test/domain_test.js`.
|
|
2065
2204
|
|
|
2205
|
+
### The gene track
|
|
2206
|
+
|
|
2207
|
+
Data model (forester): a tip's `sequences` with a `location` the grammar
|
|
2208
|
+
reads (`forester.parseSequenceLocation`: `contig:start-end(+)`, split on the
|
|
2209
|
+
last colon, 1-based, `end ≥ start`) are genes when the strand is given and
|
|
2210
|
+
contig records when not; `forester.geneRegionOf(node)` is the tip's genes
|
|
2211
|
+
on ONE contig (the most genes, ties to the first listed) in position order,
|
|
2212
|
+
that contig's record, the span and the count left out; null without a gene.
|
|
2213
|
+
A gene's family in a namespace is its first annotation ref with that prefix
|
|
2214
|
+
(`geneFamilyOf`); `geneFamilyNamespaces` ranks the prefixes by use.
|
|
2215
|
+
`collectBasicTreeProperties` sets `geneRegions` when some tip carries two
|
|
2216
|
+
genes or more (a gene-family tree locating one gene per tip is not a tree
|
|
2217
|
+
of genomes) and `maxGeneRegionLength`; `treeStatistics` counts
|
|
2218
|
+
`tipsWithGenes`. Anchor: `geneAnchorCandidates` counts per family the
|
|
2219
|
+
regions carrying it exactly once (`single`) and at all; `geneDefaultAnchor`
|
|
2220
|
+
is the top one when `single` is at least half the regions, ties by code
|
|
2221
|
+
unit. Rows: `geneTrackRows(regions, anchor, ns)` maps every row onto one
|
|
2222
|
+
coordinate in bp — an anchored row's anchor midpoint at 0, mirrored
|
|
2223
|
+
(`x → −x`, directions flipped) when the anchor is on `−`; a row with no
|
|
2224
|
+
anchor gene, or two, left-aligned at the anchored rows' leftmost edge (0
|
|
2225
|
+
without any). The backbone is the span padded by 2% (`GENE_REGION_PAD`),
|
|
2226
|
+
clamped to the record's span with a cap where it was clamped (caps swap
|
|
2227
|
+
with the flip). Lanes: greedy by start, the first of two that is free, else
|
|
2228
|
+
the one that frees first. Scale: `f = W / (extent.max − extent.min) × 0.9`
|
|
2229
|
+
px per bp, `W` by the domain track's rules (a quarter of the viewport,
|
|
2230
|
+
−/+ by 0.8/1.2, 20…2000; radial `min(W, 0.2 × radius)`), kept apart from
|
|
2231
|
+
the domain track's width. Placement as the domain tracks and past them when
|
|
2232
|
+
both show: rectangular `start = _w + nodeLabelGap + labelSpace +
|
|
2233
|
+
_domainReserve + 20`, reserve `20 + W + 10` in `_geneReserve` (counted
|
|
2234
|
+
wherever `_w` is); circular `r0 = maxRad + labelSpace + domainRadialExtent
|
|
2235
|
+
+ 4`; unrooted `start = labelSpace + domainRadialExtent + 4`; the radial fit
|
|
2236
|
+
adds `4 + W + 10`. Arrow: `geneArrowPath(x, y, w, h, dir)`, head
|
|
2237
|
+
`min(h/2, w)`, a triangle when shorter than its head; two lanes share the
|
|
2238
|
+
height (`max(3, h/2)` each); each arrow is its own path carrying
|
|
2239
|
+
`__aptxGene` for the readout, with a 1 px `darken(base, 0.3)` border; the
|
|
2240
|
+
backbone (1 px) and the caps (1.5 px bars) are one path per track, one per
|
|
2241
|
+
row in the radial layouts. Symbol (or gene name) on the body in `min(font,
|
|
2242
|
+
h − 2)` px when over 4 px and at most `w − head − 4` wide, rectangular
|
|
2243
|
+
only. Colours: the families SHARED over the tree (two regions or more),
|
|
2244
|
+
sorted by code unit, take the domain palette (`domainQualitativeColor`) in
|
|
2245
|
+
order; a singleton `#9e9e9e`, no family `#cfcfcf`; dealt at load and on a
|
|
2246
|
+
namespace change. The kb bar: `geneScaleBar(f, 80)`, a round number of bp
|
|
2247
|
+
labelled in kb from 1000 up, 12 px under the lowest row. Legend
|
|
2248
|
+
(`'legend'`): title `Gene families (<ns>)`, rows `product (regions)` in
|
|
2249
|
+
screen order over the view (`geneFamilySummary` with the tree's shared set,
|
|
2250
|
+
so a family shown once in a subtree keeps its colour), then `unique to one
|
|
2251
|
+
genome (n)` and `no family (n)`; home bottom-right, drag keeps its place as
|
|
2252
|
+
a fraction of the view, double-click sends it home. Links: `geneReference`
|
|
2253
|
+
— BV-BRC's feature page for `fig|…` or a BV-BRC / PATRIC source, NCBI's
|
|
2254
|
+
protein page for GenBank / RefSeq / UniProt. State: `showGenes` (auto-on
|
|
2255
|
+
with `geneRegions`), `geneAnchor` (`'auto'` | `'none'` | a ref),
|
|
2256
|
+
`geneFamily` (`'auto'` | a namespace), `geneLabels`; the view carries
|
|
2257
|
+
`genes`, `geneLabels`, and `geneAnchor` / `geneFamily` as the EFFECTIVE
|
|
2258
|
+
values. Labels: on a tree with `geneRegions`, a tip whose first sequence is
|
|
2259
|
+
located contributes no sequence text to the label suggestion
|
|
2260
|
+
(`suggestLabelFields`), so the node name stands. Gates as the domain
|
|
2261
|
+
tracks (external labels on, radial labels in a radial layout, a name the
|
|
2262
|
+
crowding rule left). Fixture `test/data/genome_regions.xml`, generated by
|
|
2263
|
+
`test/make_genome_regions_fixture.js` (the demo copy is byte-identical and
|
|
2264
|
+
a test says so); the numbers in `test/gene_test.js`, the SVG in
|
|
2265
|
+
`test/browser/genes.html`.
|
|
2266
|
+
|
|
2066
2267
|
### The alignment track
|
|
2067
2268
|
|
|
2068
2269
|
Data model: per-tip `sequences[0].mol_seq = {is_aligned, value}` (the gapped
|
|
@@ -2212,7 +2413,7 @@ the tree ≥ 220 px))`. It is budgeted **before** the alignment, and the
|
|
|
2212
2413
|
alignment's own band then yields to it: the matrix wants a fixed, finite width
|
|
2213
2414
|
while the alignment's band is a window that scrolls and so loses nothing by
|
|
2214
2415
|
giving way. (Budgeted the other way round, an 18-column matrix got a 60 px
|
|
2215
|
-
sliver.) It sits between the domain tracks and the alignment, its right edge at
|
|
2416
|
+
sliver.) It sits between the domain and gene tracks and the alignment, its right edge at
|
|
2216
2417
|
`displayWidth − rootOffset − msaReserve`. Rows tile the cluster height by the
|
|
2217
2418
|
same once-derived midpoints the alignment uses. Column width is
|
|
2218
2419
|
`clamp(band / columns, 3, 14)`; past `band / 3` columns the matrix shows a
|
|
@@ -2395,6 +2596,46 @@ figure never carries an artefact of where the view happened to be scrolled.
|
|
|
2395
2596
|
(The desktop pins its axes to the viewport bottom always; sticky is a
|
|
2396
2597
|
deliberate difference.)
|
|
2397
2598
|
|
|
2599
|
+
### The clock plot
|
|
2600
|
+
|
|
2601
|
+
**Model** (`forester.js`, pure). `forester.clockPlotKind(phy)` answers
|
|
2602
|
+
`'divergence'` or `null`: the tree has Time and Div
|
|
2603
|
+
(`forester.hasTimeAndDivergence`) and three tips or more, not all on one
|
|
2604
|
+
date. It is asked of the **tree**, never of the view. A second kind,
|
|
2605
|
+
`'root-to-tip'` — divergence branch lengths, dated tips, no dated ancestors —
|
|
2606
|
+
is described beside the function and not built. `forester.clockPlotData(phy,
|
|
2607
|
+
view)` returns `{kind, forward, unit, fromRates, points, root, fit}`: a point
|
|
2608
|
+
`{node, date, div, tip}` per node of the view (a tip also carries its
|
|
2609
|
+
`residual`), `forward` false where the dates are ages, `fromRates` true where
|
|
2610
|
+
the divergence is time × clock rate, and `fit` =
|
|
2611
|
+
`forester.clockRegression(dates, divergences)` over the tips — ordinary least
|
|
2612
|
+
squares about the means, `{n, slope, intercept, r2}` — plus `rate` (the slope
|
|
2613
|
+
in the direction time runs) and `rootDate` (where the line reaches the view
|
|
2614
|
+
root's divergence; `null` unless the rate is positive). `fit` is `null` for a
|
|
2615
|
+
view with fewer than three tips or one date. `forester.calendarTickMonths`
|
|
2616
|
+
gives month ticks for a span too short for whole years.
|
|
2617
|
+
|
|
2618
|
+
**Panel** (`archaeopteryx.js`, the "Clock plot" section). A modeless
|
|
2619
|
+
`makeDialogShell` dialog, dragged by its title, placed in the tree area's top
|
|
2620
|
+
right corner and below anything the host page keeps there. The drawing is one
|
|
2621
|
+
SVG in the panel's own `--p-*` inks. `renderClockPlot` runs at the end of
|
|
2622
|
+
every `update()`: it works the points out and lays them down again only when
|
|
2623
|
+
the top of the view or its node count changed, or a checkbox did; otherwise
|
|
2624
|
+
it only goes over the points' colours. A point's colour is its node's in the
|
|
2625
|
+
tree (found, selected, the Color visualization, the file's styles).
|
|
2626
|
+
|
|
2627
|
+
**The link.** Pointer events on the SVG: the nearest point within 7 px, and
|
|
2628
|
+
with it every point of its kind within 1 px of it — one dot for tips that
|
|
2629
|
+
share a date and a divergence. The dot's nodes are lit through
|
|
2630
|
+
`showHoverGlow(node, also)` (each as the tree shows it: a tip hidden in a
|
|
2631
|
+
collapsed clade lights the clade); a click toggles them in `_selectedNodes`,
|
|
2632
|
+
a dragged box adds the tips inside it; `mouseover` on a tree node rings its
|
|
2633
|
+
point. Closing is synchronous: nothing waits for the dialog's `close` event.
|
|
2634
|
+
|
|
2635
|
+
There is no config key and no view key for the panel yet, and it is not part
|
|
2636
|
+
of any download. The numbers are pinned in `test/clock_test.js` (computed by
|
|
2637
|
+
hand), the panel in `test/browser/clock_plot.html`.
|
|
2638
|
+
|
|
2398
2639
|
## Node selection
|
|
2399
2640
|
|
|
2400
2641
|
With `enableManualNodeSelection` on, the node menu gains **Select/Deselect Node**
|
|
@@ -2408,7 +2649,12 @@ var selected = archaeopteryx.getSelectedNodes(); // array of node objects
|
|
|
2408
2649
|
Selected nodes are drawn in the selection colour, which is fixed so that it
|
|
2409
2650
|
stays distinguishable from the two search colours.
|
|
2410
2651
|
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2652
|
+
The **Clock plot** selects too, whatever this setting says: a click on a
|
|
2653
|
+
point, or a box dragged over tips, changes the same selection.
|
|
2654
|
+
|
|
2655
|
+
Every change of the selection — from the node menu or from the clock plot —
|
|
2656
|
+
dispatches a `selected_nodes_changed_event` on `document`, so the embedding
|
|
2657
|
+
application can read the selection then, or whenever it wants from its own
|
|
2658
|
+
button. Nothing announces "the user is done selecting". (Versions before 3.0
|
|
2659
|
+
carried a dormant, never-rendered "Submit Selected" button in the source; it
|
|
2660
|
+
was removed.)
|
package/archaeopteryx.d.ts
CHANGED
|
@@ -60,12 +60,25 @@ export interface ArchaeopteryxConfig {
|
|
|
60
60
|
collapseControlPanel?: boolean;
|
|
61
61
|
displayHeight?: number;
|
|
62
62
|
displayWidth?: number;
|
|
63
|
+
/** The domain tracks' E-value threshold at launch, as an exponent: -20 to 3. */
|
|
64
|
+
domainEvalueExponent?: number;
|
|
65
|
+
domainGlow?: boolean;
|
|
66
|
+
domainLabels?: 'none' | 'domains' | 'legend';
|
|
63
67
|
enableAccessToDatabases?: boolean;
|
|
64
68
|
enableDownloads?: boolean;
|
|
65
69
|
enableDynamicSizing?: boolean;
|
|
66
70
|
enableManualNodeSelection?: boolean;
|
|
67
71
|
enableSubtreeDeletion?: boolean;
|
|
68
72
|
enableVisualizations?: boolean;
|
|
73
|
+
/** The family the gene track's rows line up on: 'auto' (the family
|
|
74
|
+
* single-copy in the most genomes), 'none' (left-aligned rows), or a
|
|
75
|
+
* family ref such as 'pgfam:PGF_00019355'. */
|
|
76
|
+
geneAnchor?: string;
|
|
77
|
+
/** The annotation namespace that colours the genes and anchors the rows:
|
|
78
|
+
* 'auto' (the one most genes carry) or a prefix such as 'pgfam'. */
|
|
79
|
+
geneFamily?: string;
|
|
80
|
+
/** Where gene symbols go: on the arrows, in a legend of the families, or nowhere. */
|
|
81
|
+
geneLabels?: 'none' | 'genes' | 'legend';
|
|
69
82
|
initialVisualization?: string | null;
|
|
70
83
|
ladderizeTree?: boolean;
|
|
71
84
|
layout?: Layout;
|
|
@@ -98,6 +111,11 @@ export interface ArchaeopteryxConfig {
|
|
|
98
111
|
* while heatmapColumnOrder is 'manual'. A ref the tree has not got is
|
|
99
112
|
* ignored; a column this does not name follows the ones it does. */
|
|
100
113
|
heatmapManualOrder?: string[] | null;
|
|
114
|
+
/** The domain tracks. Default: on when any tip carries a domain architecture. */
|
|
115
|
+
showDomainArchitectures?: boolean;
|
|
116
|
+
/** The gene track (genome regions). Default: on when any tip carries two
|
|
117
|
+
* or more located genes. */
|
|
118
|
+
showGenes?: boolean;
|
|
101
119
|
showHeatmap?: boolean;
|
|
102
120
|
showMsa?: boolean;
|
|
103
121
|
/** Summarize the alignment as a sequence logo instead of a conservation
|
|
@@ -179,6 +197,12 @@ export interface ViewState {
|
|
|
179
197
|
domainLabels?: 'none' | 'domains' | 'legend';
|
|
180
198
|
domainGlow?: boolean;
|
|
181
199
|
domainEvalue?: number;
|
|
200
|
+
genes?: boolean;
|
|
201
|
+
/** The anchor family in effect: a ref, or 'none'. */
|
|
202
|
+
geneAnchor?: string;
|
|
203
|
+
/** The family namespace in effect. */
|
|
204
|
+
geneFamily?: string;
|
|
205
|
+
geneLabels?: 'none' | 'genes' | 'legend';
|
|
182
206
|
scaleAxis?: boolean;
|
|
183
207
|
scaleGrid?: boolean;
|
|
184
208
|
/** @deprecated the name of scaleAxis in older links; still read. */
|