taxonium-component
Version:
React component for exploring large phylogenetic trees in the browser
35 lines (34 loc) • 2.46 kB
JavaScript
import { jsx as t, jsxs as n } from "react/jsx-runtime";
import { m as T, u as p, o as j, ay as S } from "./JBrowsePanel-BNE3gNW1.js";
import { forwardRef as x } from "react";
const k = T()(() => ({
td: {
whiteSpace: "nowrap"
}
})), w = (e = 0) => +(+e).toFixed(1), f = (e, d = 1) => `${w(e / (d || 1) * 100)}%`;
function D({ base: e, model: d }) {
var o;
const { visibleModifications: i } = d;
return e.startsWith("mod_") ? t("div", { style: {
width: 10,
height: 10,
background: (o = i.get(e.replace("mod_", ""))) === null || o === void 0 ? void 0 : o.color
} }) : null;
}
const P = x(function(d, o) {
const { feature: i, model: g } = d, { classes: y } = k(), a = i.get("start") + 1, u = i.get("end"), v = i.get("refName"), { refbase: m, readsCounted: h, depth: _, ref: l, ...$ } = i.get("snpinfo");
return t("div", { ref: o, children: n("table", { children: [t("caption", { children: [
v,
a === u ? p.toLocale(a) : `${p.toLocale(a)}..${p.toLocale(u)}`
].filter((s) => !!s).join(":") }), t("thead", { children: n("tr", { children: [t("th", {}), t("th", { children: "Base" }), t("th", { children: "Count" }), t("th", { children: "% of Total" }), t("th", { children: "Strands" })] }) }), n("tbody", { children: [n("tr", { children: [t("td", {}), t("td", { children: "Total" }), t("td", { children: h }), t("td", { children: " " }), t("td", { children: " " })] }), n("tr", { children: [t("td", {}), n("td", { children: ["REF ", m ? `(${m.toUpperCase()})` : ""] }), t("td", { children: l.entryDepth }), t("td", { children: f(l.entryDepth, h) }), n("td", { children: [l[-1] ? `${l[-1]}(-)` : "", l[1] ? `${l[1]}(+)` : ""] })] }), Object.entries($).map(([s, b]) => Object.entries(b).map(([c, r]) => n("tr", { children: [t("td", { children: t(D, { model: g, base: c }) }), n("td", { children: [c.toUpperCase(), " "] }), t("td", { className: y.td, children: [
r.entryDepth,
r.avgProbability !== void 0 ? `(avg. ${f(r.avgProbability)} prob.)` : ""
].filter((C) => !!C).join(" ") }), t("td", { children: c === "depth" || c === "skip" ? "---" : f(r.entryDepth, h) }), n("td", { children: [r[-1] ? `${r[-1]}(-)` : "", r[1] ? `${r[1]}(+)` : ""] })] }, `${s}_${c}`)))] })] }) });
}), E = j(function(e) {
const { model: d } = e, { featureUnderMouse: o } = d;
return o && o.get("type") === "skip" ? null : t(S, { TooltipContents: P, ...e });
});
export {
E as default
};
//# sourceMappingURL=Tooltip-DlPtfW1i.js.map