phylotree 2.3.0 → 2.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 +93 -17
- package/bin/phylotree-distance.js +12 -10
- package/bin/phylotree-mrca.js +9 -7
- package/bin/phylotree-neighbor-join.js +9 -10
- package/bin/phylotree-reroot.js +13 -13
- package/bin/phylotree-shuffle.js +5 -5
- package/bin/phylotree-tag.js +13 -11
- package/bin/phylotree-tips.js +8 -6
- package/bin/phylotree-validate.js +5 -5
- package/bin/root-to-tip.js +11 -10
- package/bin/tip-date-extractor.js +17 -15
- package/dist/phylotree.d.ts +123 -0
- package/dist/phylotree.js +150 -176
- package/dist/phylotree.min.js +1 -1
- package/package.json +24 -25
- package/src/formats/phyloxml.js +48 -48
- package/src/index.js +2 -0
- package/src/render/nodes.js +1 -1
- package/src/render/selection-sets.js +10 -10
package/dist/phylotree.js
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.phylotree = global.phylotree || {}, global._, global._$1));
|
|
5
5
|
})(this, (function (exports, _, _$1) { 'use strict';
|
|
6
6
|
|
|
7
|
-
function
|
|
8
|
-
if (e && e.__esModule) return e;
|
|
7
|
+
function _interopNamespaceDefault(e) {
|
|
9
8
|
var n = Object.create(null);
|
|
10
9
|
if (e) {
|
|
11
10
|
Object.keys(e).forEach(function (k) {
|
|
@@ -18,12 +17,12 @@
|
|
|
18
17
|
}
|
|
19
18
|
});
|
|
20
19
|
}
|
|
21
|
-
n
|
|
20
|
+
n.default = e;
|
|
22
21
|
return Object.freeze(n);
|
|
23
22
|
}
|
|
24
23
|
|
|
25
|
-
var ___namespace = /*#__PURE__*/
|
|
26
|
-
var ___namespace$1 = /*#__PURE__*/
|
|
24
|
+
var ___namespace = /*#__PURE__*/_interopNamespaceDefault(_);
|
|
25
|
+
var ___namespace$1 = /*#__PURE__*/_interopNamespaceDefault(_$1);
|
|
27
26
|
|
|
28
27
|
function ascending$1(a, b) {
|
|
29
28
|
return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
|
@@ -98,7 +97,6 @@
|
|
|
98
97
|
const ascendingBisect = bisector(ascending$1);
|
|
99
98
|
const bisectRight = ascendingBisect.right;
|
|
100
99
|
bisector(number$2).center;
|
|
101
|
-
var bisect = bisectRight;
|
|
102
100
|
|
|
103
101
|
const e10 = Math.sqrt(50),
|
|
104
102
|
e5 = Math.sqrt(10),
|
|
@@ -182,19 +180,12 @@
|
|
|
182
180
|
}
|
|
183
181
|
|
|
184
182
|
var top = 1,
|
|
185
|
-
right = 2,
|
|
186
|
-
bottom = 3,
|
|
187
|
-
left = 4,
|
|
188
183
|
epsilon$1 = 1e-6;
|
|
189
184
|
|
|
190
185
|
function translateX(x) {
|
|
191
186
|
return "translate(" + x + ",0)";
|
|
192
187
|
}
|
|
193
188
|
|
|
194
|
-
function translateY(y) {
|
|
195
|
-
return "translate(0," + y + ")";
|
|
196
|
-
}
|
|
197
|
-
|
|
198
189
|
function number$1(scale) {
|
|
199
190
|
return d => +scale(d);
|
|
200
191
|
}
|
|
@@ -217,9 +208,9 @@
|
|
|
217
208
|
tickSizeOuter = 6,
|
|
218
209
|
tickPadding = 3,
|
|
219
210
|
offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5,
|
|
220
|
-
k =
|
|
221
|
-
x =
|
|
222
|
-
transform =
|
|
211
|
+
k = -1 ,
|
|
212
|
+
x = "y",
|
|
213
|
+
transform = translateX ;
|
|
223
214
|
|
|
224
215
|
function axis(context) {
|
|
225
216
|
var values = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain()) : tickValues,
|
|
@@ -250,7 +241,7 @@
|
|
|
250
241
|
text = text.merge(tickEnter.append("text")
|
|
251
242
|
.attr("fill", "currentColor")
|
|
252
243
|
.attr(x, k * spacing)
|
|
253
|
-
.attr("dy",
|
|
244
|
+
.attr("dy", "0em" ));
|
|
254
245
|
|
|
255
246
|
if (context !== selection) {
|
|
256
247
|
path = path.transition(context);
|
|
@@ -270,9 +261,7 @@
|
|
|
270
261
|
tickExit.remove();
|
|
271
262
|
|
|
272
263
|
path
|
|
273
|
-
.attr("d",
|
|
274
|
-
? (tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1)
|
|
275
|
-
: (tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1));
|
|
264
|
+
.attr("d", (tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1));
|
|
276
265
|
|
|
277
266
|
tick
|
|
278
267
|
.attr("opacity", 1)
|
|
@@ -289,7 +278,7 @@
|
|
|
289
278
|
.attr("fill", "none")
|
|
290
279
|
.attr("font-size", 10)
|
|
291
280
|
.attr("font-family", "sans-serif")
|
|
292
|
-
.attr("text-anchor",
|
|
281
|
+
.attr("text-anchor", "middle");
|
|
293
282
|
|
|
294
283
|
selection
|
|
295
284
|
.each(function() { this.__axis = position; });
|
|
@@ -1379,6 +1368,7 @@
|
|
|
1379
1368
|
}
|
|
1380
1369
|
|
|
1381
1370
|
// These are typically used in conjunction with noevent to ensure that we can
|
|
1371
|
+
// preventDefault on the event.
|
|
1382
1372
|
const nonpassivecapture = {capture: true, passive: false};
|
|
1383
1373
|
|
|
1384
1374
|
function noevent$2(event) {
|
|
@@ -3222,18 +3212,10 @@
|
|
|
3222
3212
|
}
|
|
3223
3213
|
|
|
3224
3214
|
var X = {
|
|
3225
|
-
|
|
3226
|
-
handles: ["w", "e"].map(type),
|
|
3227
|
-
input: function(x, e) { return x == null ? null : [[+x[0], e[0][1]], [+x[1], e[1][1]]]; },
|
|
3228
|
-
output: function(xy) { return xy && [xy[0][0], xy[1][0]]; }
|
|
3229
|
-
};
|
|
3215
|
+
};
|
|
3230
3216
|
|
|
3231
3217
|
var Y = {
|
|
3232
|
-
|
|
3233
|
-
handles: ["n", "s"].map(type),
|
|
3234
|
-
input: function(y, e) { return y == null ? null : [[e[0][0], +y[0]], [e[1][0], +y[1]]]; },
|
|
3235
|
-
output: function(xy) { return xy && [xy[0][1], xy[1][1]]; }
|
|
3236
|
-
};
|
|
3218
|
+
};
|
|
3237
3219
|
|
|
3238
3220
|
var XY = {
|
|
3239
3221
|
name: "xy",
|
|
@@ -3274,29 +3256,29 @@
|
|
|
3274
3256
|
};
|
|
3275
3257
|
|
|
3276
3258
|
var signsX = {
|
|
3277
|
-
overlay:
|
|
3278
|
-
selection:
|
|
3259
|
+
overlay: 1,
|
|
3260
|
+
selection: 1,
|
|
3279
3261
|
n: null,
|
|
3280
|
-
e:
|
|
3262
|
+
e: 1,
|
|
3281
3263
|
s: null,
|
|
3282
3264
|
w: -1,
|
|
3283
3265
|
nw: -1,
|
|
3284
|
-
ne:
|
|
3285
|
-
se:
|
|
3266
|
+
ne: 1,
|
|
3267
|
+
se: 1,
|
|
3286
3268
|
sw: -1
|
|
3287
3269
|
};
|
|
3288
3270
|
|
|
3289
3271
|
var signsY = {
|
|
3290
|
-
overlay:
|
|
3291
|
-
selection:
|
|
3272
|
+
overlay: 1,
|
|
3273
|
+
selection: 1,
|
|
3292
3274
|
n: -1,
|
|
3293
3275
|
e: null,
|
|
3294
|
-
s:
|
|
3276
|
+
s: 1,
|
|
3295
3277
|
w: null,
|
|
3296
3278
|
nw: -1,
|
|
3297
3279
|
ne: -1,
|
|
3298
|
-
se:
|
|
3299
|
-
sw:
|
|
3280
|
+
se: 1,
|
|
3281
|
+
sw: 1
|
|
3300
3282
|
};
|
|
3301
3283
|
|
|
3302
3284
|
function type(t) {
|
|
@@ -3332,11 +3314,11 @@
|
|
|
3332
3314
|
|| extent[0][1] === extent[1][1];
|
|
3333
3315
|
}
|
|
3334
3316
|
|
|
3335
|
-
function
|
|
3336
|
-
return brush
|
|
3317
|
+
function brush_default() {
|
|
3318
|
+
return brush(XY);
|
|
3337
3319
|
}
|
|
3338
3320
|
|
|
3339
|
-
function brush
|
|
3321
|
+
function brush(dim) {
|
|
3340
3322
|
var extent = defaultExtent$1,
|
|
3341
3323
|
filter = defaultFilter$1,
|
|
3342
3324
|
touchable = defaultTouchable$1,
|
|
@@ -4576,7 +4558,7 @@
|
|
|
4576
4558
|
}
|
|
4577
4559
|
|
|
4578
4560
|
return function(x) {
|
|
4579
|
-
var i =
|
|
4561
|
+
var i = bisectRight(domain, x, 1, j) - 1;
|
|
4580
4562
|
return r[i](d[i](x));
|
|
4581
4563
|
};
|
|
4582
4564
|
}
|
|
@@ -4789,7 +4771,7 @@
|
|
|
4789
4771
|
if (step < 0) while (++step <= 0) {
|
|
4790
4772
|
while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty
|
|
4791
4773
|
} else while (--step >= 0) {
|
|
4792
|
-
while (offseti(date,
|
|
4774
|
+
while (offseti(date, 1), !test(date)) {} // eslint-disable-line no-empty
|
|
4793
4775
|
}
|
|
4794
4776
|
}
|
|
4795
4777
|
});
|
|
@@ -6172,7 +6154,6 @@
|
|
|
6172
6154
|
new ZoomEvent(type, {
|
|
6173
6155
|
sourceEvent: this.sourceEvent,
|
|
6174
6156
|
target: zoom,
|
|
6175
|
-
type,
|
|
6176
6157
|
transform: this.that.__zoom,
|
|
6177
6158
|
dispatch: listeners
|
|
6178
6159
|
}),
|
|
@@ -7336,7 +7317,7 @@
|
|
|
7336
7317
|
return parse_int(trimmedStr, 16);
|
|
7337
7318
|
// }else if (options.oct && octRegex.test(str)) {
|
|
7338
7319
|
// return Number.parseInt(val, 8);
|
|
7339
|
-
}else if (trimmedStr.
|
|
7320
|
+
}else if (trimmedStr.includes('e') || trimmedStr.includes('E')) { //eNotation
|
|
7340
7321
|
return resolveEnotation(str,trimmedStr,options);
|
|
7341
7322
|
// }else if (options.parseBin && binRegex.test(str)) {
|
|
7342
7323
|
// return Number.parseInt(val, 2);
|
|
@@ -8622,20 +8603,20 @@
|
|
|
8622
8603
|
|
|
8623
8604
|
var node_operations = /*#__PURE__*/Object.freeze({
|
|
8624
8605
|
__proto__: null,
|
|
8625
|
-
graftANode: graftANode,
|
|
8626
8606
|
addChild: addChild,
|
|
8607
|
+
assignAttributes: assignAttributes,
|
|
8608
|
+
clearInternalNodes: clearInternalNodes,
|
|
8627
8609
|
createNode: createNode,
|
|
8628
8610
|
deleteANode: deleteANode,
|
|
8629
|
-
getTips: getTips,
|
|
8630
8611
|
getInternals: getInternals,
|
|
8631
|
-
getRootNode: getRootNode,
|
|
8632
|
-
getNodes: getNodes,
|
|
8633
8612
|
getNodeByName: getNodeByName,
|
|
8634
|
-
|
|
8613
|
+
getNodes: getNodes,
|
|
8614
|
+
getRootNode: getRootNode,
|
|
8615
|
+
getTips: getTips,
|
|
8616
|
+
graftANode: graftANode,
|
|
8635
8617
|
isLeafNode: isLeafNode,
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
selectAllDescendants: selectAllDescendants$1
|
|
8618
|
+
selectAllDescendants: selectAllDescendants$1,
|
|
8619
|
+
updateKeyName: updateKeyName
|
|
8639
8620
|
});
|
|
8640
8621
|
|
|
8641
8622
|
/**
|
|
@@ -9100,53 +9081,53 @@
|
|
|
9100
9081
|
|
|
9101
9082
|
var nexus = /*#__PURE__*/Object.freeze({
|
|
9102
9083
|
__proto__: null,
|
|
9103
|
-
|
|
9084
|
+
default: loadTree,
|
|
9104
9085
|
loadAnnotations: loadAnnotations,
|
|
9105
|
-
|
|
9086
|
+
parseAnnotations: parseAnnotations
|
|
9106
9087
|
});
|
|
9107
9088
|
|
|
9108
9089
|
// Changes XML to JSON
|
|
9109
9090
|
// Modified version from here: http://davidwalsh.name/convert-xml-json
|
|
9110
9091
|
function xmlToJson(xml) {
|
|
9111
9092
|
|
|
9112
|
-
|
|
9113
|
-
|
|
9114
|
-
|
|
9115
|
-
|
|
9116
|
-
|
|
9117
|
-
|
|
9118
|
-
|
|
9119
|
-
|
|
9120
|
-
|
|
9121
|
-
|
|
9122
|
-
|
|
9123
|
-
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9129
|
-
|
|
9130
|
-
|
|
9131
|
-
|
|
9132
|
-
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
|
|
9136
|
-
|
|
9137
|
-
|
|
9138
|
-
|
|
9139
|
-
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9147
|
-
|
|
9148
|
-
|
|
9149
|
-
|
|
9093
|
+
// Create the return object
|
|
9094
|
+
var obj = {};
|
|
9095
|
+
|
|
9096
|
+
if (xml.nodeType == 1) { // element
|
|
9097
|
+
// do attributes
|
|
9098
|
+
if (xml.attributes.length > 0) {
|
|
9099
|
+
obj["@attributes"] = {};
|
|
9100
|
+
for (var j = 0; j < xml.attributes.length; j++) {
|
|
9101
|
+
var attribute = xml.attributes.item(j);
|
|
9102
|
+
obj["@attributes"][attribute.nodeName] = attribute.nodeValue;
|
|
9103
|
+
}
|
|
9104
|
+
}
|
|
9105
|
+
} else if (xml.nodeType == 3) { // text
|
|
9106
|
+
obj = xml.nodeValue;
|
|
9107
|
+
}
|
|
9108
|
+
|
|
9109
|
+
// do children
|
|
9110
|
+
// If just one text node inside
|
|
9111
|
+
if (xml.hasChildNodes() && xml.childNodes.length === 1 && xml.childNodes[0].nodeType === 3) {
|
|
9112
|
+
obj = xml.childNodes[0].nodeValue;
|
|
9113
|
+
}
|
|
9114
|
+
else if (xml.hasChildNodes()) {
|
|
9115
|
+
for(var i = 0; i < xml.childNodes.length; i++) {
|
|
9116
|
+
var item = xml.childNodes.item(i);
|
|
9117
|
+
var nodeName = item.nodeName;
|
|
9118
|
+
if (typeof(obj[nodeName]) == "undefined") {
|
|
9119
|
+
obj[nodeName] = xmlToJson(item);
|
|
9120
|
+
} else {
|
|
9121
|
+
if (typeof(obj[nodeName].push) == "undefined") {
|
|
9122
|
+
var old = obj[nodeName];
|
|
9123
|
+
obj[nodeName] = [];
|
|
9124
|
+
obj[nodeName].push(old);
|
|
9125
|
+
}
|
|
9126
|
+
obj[nodeName].push(xmlToJson(item));
|
|
9127
|
+
}
|
|
9128
|
+
}
|
|
9129
|
+
}
|
|
9130
|
+
return obj;
|
|
9150
9131
|
}
|
|
9151
9132
|
|
|
9152
9133
|
var phyloxml_parser = function(xml, options) {
|
|
@@ -9154,8 +9135,8 @@
|
|
|
9154
9135
|
function parsePhyloxml(node, index) {
|
|
9155
9136
|
if (node.clade) {
|
|
9156
9137
|
if (!Array.isArray(node.clade)) {
|
|
9157
|
-
|
|
9158
|
-
}
|
|
9138
|
+
node.clade = [node.clade];
|
|
9139
|
+
}
|
|
9159
9140
|
node.clade.forEach(parsePhyloxml);
|
|
9160
9141
|
node.children = node.clade;
|
|
9161
9142
|
delete node.clade;
|
|
@@ -9177,20 +9158,20 @@
|
|
|
9177
9158
|
var tree_json;
|
|
9178
9159
|
|
|
9179
9160
|
if (typeof xml === "string") {
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
|
|
9186
|
-
|
|
9161
|
+
if (DOMParser) {
|
|
9162
|
+
const parser = new DOMParser();
|
|
9163
|
+
xml = parser.parseFromString(xml, "text/xml");
|
|
9164
|
+
} else {
|
|
9165
|
+
const parser = new XMLParser();
|
|
9166
|
+
xml = parser.parse(xml);
|
|
9167
|
+
}
|
|
9187
9168
|
}
|
|
9188
9169
|
|
|
9189
9170
|
xml = xmlToJson(xml);
|
|
9190
9171
|
var phylogeny = xml.phyloxml.phylogeny;
|
|
9191
9172
|
if (Array.isArray(phylogeny)) {
|
|
9192
|
-
|
|
9193
|
-
|
|
9173
|
+
phylogeny = phylogeny[0];
|
|
9174
|
+
console.warn("PhyloXML files with multiple phylogenies are not currently supported. Only the first phylogeny will be loaded.");
|
|
9194
9175
|
}
|
|
9195
9176
|
tree_json = phylogeny.clade;
|
|
9196
9177
|
tree_json.name = "root";
|
|
@@ -9854,9 +9835,9 @@
|
|
|
9854
9835
|
|
|
9855
9836
|
var rooting = /*#__PURE__*/Object.freeze({
|
|
9856
9837
|
__proto__: null,
|
|
9838
|
+
pathToRoot: pathToRoot,
|
|
9857
9839
|
reroot: reroot,
|
|
9858
|
-
rootpath: rootpath
|
|
9859
|
-
pathToRoot: pathToRoot
|
|
9840
|
+
rootpath: rootpath
|
|
9860
9841
|
});
|
|
9861
9842
|
|
|
9862
9843
|
function xCoord(d) {
|
|
@@ -10097,17 +10078,17 @@
|
|
|
10097
10078
|
|
|
10098
10079
|
var opt = /*#__PURE__*/Object.freeze({
|
|
10099
10080
|
__proto__: null,
|
|
10081
|
+
alignTips: alignTips,
|
|
10100
10082
|
css_classes: css_classes,
|
|
10101
10083
|
initializeCssClasses: initializeCssClasses,
|
|
10102
10084
|
internalNames: internalNames,
|
|
10103
|
-
radial: radial,
|
|
10104
|
-
alignTips: alignTips,
|
|
10105
|
-
nodeBubbleSize: nodeBubbleSize,
|
|
10106
10085
|
layoutHandler: layoutHandler,
|
|
10107
|
-
|
|
10086
|
+
nodeBubbleSize: nodeBubbleSize,
|
|
10108
10087
|
get nodeSpan () { return nodeSpan$1; },
|
|
10109
10088
|
predefined_selecters: predefined_selecters,
|
|
10110
|
-
|
|
10089
|
+
radial: radial,
|
|
10090
|
+
selectionCallback: selectionCallback$1,
|
|
10091
|
+
selectionLabel: selectionLabel
|
|
10111
10092
|
});
|
|
10112
10093
|
|
|
10113
10094
|
function shiftTip(d) {
|
|
@@ -10463,26 +10444,26 @@
|
|
|
10463
10444
|
function nodeLabel(attr) {
|
|
10464
10445
|
if (!arguments.length) return this._nodeLabel;
|
|
10465
10446
|
this._nodeLabel = attr ? attr : defNodeLabel;
|
|
10466
|
-
|
|
10447
|
+
this.update();
|
|
10467
10448
|
return this;
|
|
10468
10449
|
}
|
|
10469
10450
|
|
|
10470
10451
|
var render_nodes = /*#__PURE__*/Object.freeze({
|
|
10471
10452
|
__proto__: null,
|
|
10472
|
-
|
|
10453
|
+
defNodeLabel: defNodeLabel,
|
|
10473
10454
|
drawNode: drawNode,
|
|
10474
|
-
updateHasHiddenNodes: updateHasHiddenNodes,
|
|
10475
|
-
showInternalName: showInternalName,
|
|
10476
|
-
nodeSpan: nodeSpan,
|
|
10477
|
-
reclassNode: reclassNode,
|
|
10478
|
-
nodeVisible: nodeVisible,
|
|
10479
|
-
nodeNotshown: nodeNotshown,
|
|
10480
10455
|
hasHiddenNodes: hasHiddenNodes,
|
|
10456
|
+
internalLabel: internalLabel,
|
|
10481
10457
|
isNodeCollapsed: isNodeCollapsed,
|
|
10482
10458
|
nodeCssSelectors: nodeCssSelectors,
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10459
|
+
nodeLabel: nodeLabel,
|
|
10460
|
+
nodeNotshown: nodeNotshown,
|
|
10461
|
+
nodeSpan: nodeSpan,
|
|
10462
|
+
nodeVisible: nodeVisible,
|
|
10463
|
+
reclassNode: reclassNode,
|
|
10464
|
+
shiftTip: shiftTip,
|
|
10465
|
+
showInternalName: showInternalName,
|
|
10466
|
+
updateHasHiddenNodes: updateHasHiddenNodes
|
|
10486
10467
|
});
|
|
10487
10468
|
|
|
10488
10469
|
function cladeCssSelectors(css_classes) {
|
|
@@ -10748,12 +10729,12 @@
|
|
|
10748
10729
|
var render_edges = /*#__PURE__*/Object.freeze({
|
|
10749
10730
|
__proto__: null,
|
|
10750
10731
|
drawEdge: drawEdge,
|
|
10751
|
-
reclassEdge: reclassEdge,
|
|
10752
|
-
initializeEdgeLabels: initializeEdgeLabels,
|
|
10753
|
-
syncEdgeLabels: syncEdgeLabels,
|
|
10754
|
-
edgeVisible: edgeVisible,
|
|
10755
10732
|
edgeCssSelectors: edgeCssSelectors,
|
|
10756
|
-
|
|
10733
|
+
edgeVisible: edgeVisible,
|
|
10734
|
+
initializeEdgeLabels: initializeEdgeLabels,
|
|
10735
|
+
placeAlongAnEdge: placeAlongAnEdge,
|
|
10736
|
+
reclassEdge: reclassEdge,
|
|
10737
|
+
syncEdgeLabels: syncEdgeLabels
|
|
10757
10738
|
});
|
|
10758
10739
|
|
|
10759
10740
|
let d3_layout_phylotree_event_id = "phylotree.event";
|
|
@@ -10940,16 +10921,16 @@
|
|
|
10940
10921
|
|
|
10941
10922
|
var events = /*#__PURE__*/Object.freeze({
|
|
10942
10923
|
__proto__: null,
|
|
10943
|
-
toggleCollapse: toggleCollapse,
|
|
10944
|
-
resizeSvg: resizeSvg,
|
|
10945
|
-
rescale: rescale,
|
|
10946
|
-
triggerRefresh: triggerRefresh,
|
|
10947
10924
|
countUpdate: countUpdate,
|
|
10948
|
-
d3PhylotreeTriggerLayout: d3PhylotreeTriggerLayout,
|
|
10949
|
-
d3PhylotreeEventListener: d3PhylotreeEventListener,
|
|
10950
10925
|
d3PhylotreeAddEventListener: d3PhylotreeAddEventListener,
|
|
10926
|
+
d3PhylotreeEventListener: d3PhylotreeEventListener,
|
|
10927
|
+
d3PhylotreeSvgRotate: d3PhylotreeSvgRotate,
|
|
10951
10928
|
d3PhylotreeSvgTranslate: d3PhylotreeSvgTranslate,
|
|
10952
|
-
|
|
10929
|
+
d3PhylotreeTriggerLayout: d3PhylotreeTriggerLayout,
|
|
10930
|
+
rescale: rescale,
|
|
10931
|
+
resizeSvg: resizeSvg,
|
|
10932
|
+
toggleCollapse: toggleCollapse,
|
|
10933
|
+
triggerRefresh: triggerRefresh
|
|
10953
10934
|
});
|
|
10954
10935
|
|
|
10955
10936
|
let d3_layout_phylotree_context_menu_id = "d3_layout_phylotree_context_menu";
|
|
@@ -11487,15 +11468,15 @@
|
|
|
11487
11468
|
|
|
11488
11469
|
var menus = /*#__PURE__*/Object.freeze({
|
|
11489
11470
|
__proto__: null,
|
|
11490
|
-
nodeDropdownMenu: nodeDropdownMenu,
|
|
11491
11471
|
addCustomMenu: addCustomMenu,
|
|
11492
|
-
|
|
11472
|
+
clearSelection: clearSelection,
|
|
11473
|
+
deselectNodes: deselectNodes,
|
|
11493
11474
|
getSelection: getSelection,
|
|
11475
|
+
modifySelection: modifySelection,
|
|
11476
|
+
nodeDropdownMenu: nodeDropdownMenu,
|
|
11494
11477
|
selectAllDescendants: selectAllDescendants,
|
|
11495
|
-
selectionCallback: selectionCallback,
|
|
11496
11478
|
selectNodes: selectNodes,
|
|
11497
|
-
|
|
11498
|
-
clearSelection: clearSelection
|
|
11479
|
+
selectionCallback: selectionCallback
|
|
11499
11480
|
});
|
|
11500
11481
|
|
|
11501
11482
|
/**
|
|
@@ -11565,9 +11546,9 @@
|
|
|
11565
11546
|
|
|
11566
11547
|
var eventEmitter = /*#__PURE__*/Object.freeze({
|
|
11567
11548
|
__proto__: null,
|
|
11568
|
-
|
|
11549
|
+
emit: emit,
|
|
11569
11550
|
off: off,
|
|
11570
|
-
|
|
11551
|
+
on: on
|
|
11571
11552
|
});
|
|
11572
11553
|
|
|
11573
11554
|
/**
|
|
@@ -11610,11 +11591,11 @@
|
|
|
11610
11591
|
* @private
|
|
11611
11592
|
*/
|
|
11612
11593
|
function _injectSetStyles(sets) {
|
|
11613
|
-
const styleId =
|
|
11594
|
+
const styleId = "phylotree-selection-set-styles";
|
|
11614
11595
|
let styleEl = document.getElementById(styleId);
|
|
11615
11596
|
|
|
11616
11597
|
if (!styleEl) {
|
|
11617
|
-
styleEl = document.createElement(
|
|
11598
|
+
styleEl = document.createElement("style");
|
|
11618
11599
|
styleEl.id = styleId;
|
|
11619
11600
|
document.head.appendChild(styleEl);
|
|
11620
11601
|
}
|
|
@@ -11699,8 +11680,8 @@
|
|
|
11699
11680
|
return this;
|
|
11700
11681
|
}
|
|
11701
11682
|
|
|
11702
|
-
const nodeName = typeof node ===
|
|
11703
|
-
const nodeObj = typeof node ===
|
|
11683
|
+
const nodeName = typeof node === "string" ? node : node.data.name;
|
|
11684
|
+
const nodeObj = typeof node === "string"
|
|
11704
11685
|
? this.phylotree.getNodeByName(node)
|
|
11705
11686
|
: node;
|
|
11706
11687
|
|
|
@@ -11713,8 +11694,8 @@
|
|
|
11713
11694
|
this._selectionSets[setName].members.add(nodeName);
|
|
11714
11695
|
nodeObj._selectionSet = setName;
|
|
11715
11696
|
|
|
11716
|
-
this.emit(
|
|
11717
|
-
action:
|
|
11697
|
+
this.emit("setChange", {
|
|
11698
|
+
action: "add",
|
|
11718
11699
|
set: setName,
|
|
11719
11700
|
node: nodeObj,
|
|
11720
11701
|
allSets: this._getSetsSummary()
|
|
@@ -11741,8 +11722,8 @@
|
|
|
11741
11722
|
return this;
|
|
11742
11723
|
}
|
|
11743
11724
|
|
|
11744
|
-
const nodeName = typeof node ===
|
|
11745
|
-
const nodeObj = typeof node ===
|
|
11725
|
+
const nodeName = typeof node === "string" ? node : node.data.name;
|
|
11726
|
+
const nodeObj = typeof node === "string"
|
|
11746
11727
|
? this.phylotree.getNodeByName(node)
|
|
11747
11728
|
: node;
|
|
11748
11729
|
|
|
@@ -11752,8 +11733,8 @@
|
|
|
11752
11733
|
delete nodeObj._selectionSet;
|
|
11753
11734
|
}
|
|
11754
11735
|
|
|
11755
|
-
this.emit(
|
|
11756
|
-
action:
|
|
11736
|
+
this.emit("setChange", {
|
|
11737
|
+
action: "remove",
|
|
11757
11738
|
set: setName,
|
|
11758
11739
|
node: nodeObj,
|
|
11759
11740
|
allSets: this._getSetsSummary()
|
|
@@ -11832,17 +11813,17 @@
|
|
|
11832
11813
|
|
|
11833
11814
|
var selectionSets = /*#__PURE__*/Object.freeze({
|
|
11834
11815
|
__proto__: null,
|
|
11835
|
-
|
|
11816
|
+
_getSetsSummary: _getSetsSummary,
|
|
11836
11817
|
_injectSetStyles: _injectSetStyles,
|
|
11837
|
-
|
|
11818
|
+
addToSet: addToSet,
|
|
11838
11819
|
getActiveSet: getActiveSet,
|
|
11820
|
+
getNodeSet: getNodeSet,
|
|
11839
11821
|
getSetMembers: getSetMembers,
|
|
11840
|
-
addToSet: addToSet,
|
|
11841
|
-
removeFromSet: removeFromSet,
|
|
11842
|
-
_getSetsSummary: _getSetsSummary,
|
|
11843
11822
|
handleMultiSetClick: handleMultiSetClick,
|
|
11823
|
+
initializeSelectionSets: initializeSelectionSets,
|
|
11844
11824
|
isInSet: isInSet,
|
|
11845
|
-
|
|
11825
|
+
removeFromSet: removeFromSet,
|
|
11826
|
+
setActiveSet: setActiveSet
|
|
11846
11827
|
});
|
|
11847
11828
|
|
|
11848
11829
|
// replacement for d3.functor
|
|
@@ -12278,14 +12259,14 @@
|
|
|
12278
12259
|
this.resizeSvg(this.phylotree, this.svg, transitions);
|
|
12279
12260
|
|
|
12280
12261
|
if (this.options["brush"]) {
|
|
12281
|
-
var brush
|
|
12262
|
+
var brush = enclosure
|
|
12282
12263
|
.selectAll("." + css_classes["tree-selection-brush"])
|
|
12283
12264
|
.data([0])
|
|
12284
12265
|
.enter()
|
|
12285
12266
|
.insert("g", ":first-child")
|
|
12286
12267
|
.attr("class", css_classes["tree-selection-brush"]);
|
|
12287
12268
|
|
|
12288
|
-
var brush_object =
|
|
12269
|
+
var brush_object = brush_default()
|
|
12289
12270
|
.on("brush", (event, d) => {
|
|
12290
12271
|
var extent = event.selection,
|
|
12291
12272
|
shown_links = this.links.filter(edgeVisible);
|
|
@@ -12324,7 +12305,7 @@
|
|
|
12324
12305
|
//brush.call(d3.event.target.clear());
|
|
12325
12306
|
});
|
|
12326
12307
|
|
|
12327
|
-
brush
|
|
12308
|
+
brush.call(brush_object);
|
|
12328
12309
|
}
|
|
12329
12310
|
|
|
12330
12311
|
// Note: syncEdgeLabels() is called at the start of update() before edges are drawn
|
|
@@ -12685,12 +12666,7 @@
|
|
|
12685
12666
|
return n.depth;
|
|
12686
12667
|
});
|
|
12687
12668
|
|
|
12688
|
-
if (this.do_scaling && undef_BL)
|
|
12689
|
-
// requested scaling, but some branches had no branch lengths
|
|
12690
|
-
// redo layout without branch lengths
|
|
12691
|
-
this.do_scaling = false;
|
|
12692
|
-
this.phylotree.nodes.x = this.tree_layout(this.phylotree.nodes);
|
|
12693
|
-
}
|
|
12669
|
+
if (this.do_scaling && undef_BL) ;
|
|
12694
12670
|
|
|
12695
12671
|
let at_least_one_dimension_fixed = false;
|
|
12696
12672
|
|
|
@@ -12979,7 +12955,7 @@
|
|
|
12979
12955
|
this.draw_scale_bar.tickValues([domain_limit]);
|
|
12980
12956
|
} else {
|
|
12981
12957
|
let round = function(x, n) {
|
|
12982
|
-
return
|
|
12958
|
+
return Math.round(x);
|
|
12983
12959
|
};
|
|
12984
12960
|
|
|
12985
12961
|
let my_ticks = scale.ticks();
|
|
@@ -12992,9 +12968,7 @@
|
|
|
12992
12968
|
range_limit /
|
|
12993
12969
|
(this.shown_font_size *
|
|
12994
12970
|
scaleTickFormatter(my_ticks).length *
|
|
12995
|
-
2)
|
|
12996
|
-
0
|
|
12997
|
-
)
|
|
12971
|
+
2))
|
|
12998
12972
|
)
|
|
12999
12973
|
);
|
|
13000
12974
|
}
|
|
@@ -14685,7 +14659,7 @@
|
|
|
14685
14659
|
let N = n;
|
|
14686
14660
|
let totalDistances = getTotalDistances(distanceMatrixArr);
|
|
14687
14661
|
let dPrime = getDPrime(distanceMatrixArr, totalDistances, N);
|
|
14688
|
-
let [i, j
|
|
14662
|
+
let [i, j] = ijMinDPrime(dPrime, N);
|
|
14689
14663
|
let deltaMatrix = createDelta(totalDistances, N);
|
|
14690
14664
|
let limbLengthI = (distanceMatrixArr[i][j] + deltaMatrix[i][j]) / 2;
|
|
14691
14665
|
let limbLengthJ = (distanceMatrixArr[i][j] - deltaMatrix[i][j]) / 2;
|
|
@@ -14760,6 +14734,7 @@
|
|
|
14760
14734
|
exports.centerOfTree = centerOfTree;
|
|
14761
14735
|
exports.clusterPicker = clusterPicker;
|
|
14762
14736
|
exports.computeMidpoint = computeMidpoint;
|
|
14737
|
+
exports.extractDates = extract_dates;
|
|
14763
14738
|
exports.extract_dates = extract_dates;
|
|
14764
14739
|
exports.fitRootToTip = fitRootToTip;
|
|
14765
14740
|
exports.getDistanceMatrix = getDistanceMatrix;
|
|
@@ -14769,6 +14744,7 @@
|
|
|
14769
14744
|
exports.loadAnnotations = loadAnnotations;
|
|
14770
14745
|
exports.neighborJoining = neighborJoining;
|
|
14771
14746
|
exports.newickParser = newickParser;
|
|
14747
|
+
exports.pairwiseDistances = computePairwiseDistances;
|
|
14772
14748
|
exports.pairwise_distances = computePairwiseDistances;
|
|
14773
14749
|
exports.parseAnnotations = parseAnnotations;
|
|
14774
14750
|
exports.parseFasta = parseFasta;
|
|
@@ -14779,7 +14755,5 @@
|
|
|
14779
14755
|
exports.rootToTip = rootToTip;
|
|
14780
14756
|
exports.sackin = sackin;
|
|
14781
14757
|
|
|
14782
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
14783
|
-
|
|
14784
14758
|
}));
|
|
14785
14759
|
//# sourceMappingURL=phylotree.js.map
|