UNPKG

taxonium-component

Version:

React component for exploring large phylogenetic trees in the browser

73 lines (72 loc) 2.29 kB
import { u as l, s as w, t as P, j as S, M as k, N as m, O as E } from "./JBrowsePanel-BNE3gNW1.js"; async function Q(t, a) { const { rpcManager: e } = l.getSession(t), n = w.getConf(t, "numStdDev") || 3, { adapterConfig: g, autoscaleType: s } = t, r = P.getRpcSessionId(t), { currStatsBpPerPx: c } = a, p = { sessionId: r, adapterConfig: g, statusCallback: (o) => { S(t) && t.setMessage(o); }, ...a }; if (s === "global" || s === "globalsd") { const o = await e.call(r, "WiggleGetGlobalQuantitativeStats", p), { scoreMin: d, scoreMean: i, scoreStdDev: u } = o; return s === "globalsd" ? { ...o, scoreMin: d >= 0 ? 0 : i - n * u, scoreMax: i + n * u, currStatsBpPerPx: c } : { ...o, currStatsBpPerPx: c }; } if (s === "local" || s === "localsd") { const { dynamicBlocks: o, bpPerPx: d } = l.getContainingView(t), i = await e.call(r, "WiggleGetMultiRegionQuantitativeStats", { ...p, regions: o.contentBlocks.map((x) => { const { start: y, end: b } = x; return { ...JSON.parse(JSON.stringify(x)), start: Math.floor(y), end: Math.ceil(b) }; }), bpPerPx: d }), { scoreMin: u, scoreMean: v, scoreStdDev: M } = i; return s === "localsd" ? { ...i, scoreMin: u >= 0 ? 0 : v - n * M, scoreMax: v + n * M, currStatsBpPerPx: c } : { ...i, currStatsBpPerPx: c }; } if (s === "zscale") return e.call(r, "WiggleGetGlobalQuantitativeStats", p); throw new Error(`invalid autoscaleType '${s}'`); } function C(t) { k(t, m(async () => { try { if (t.quantitativeStatsReady) { const a = l.getContainingView(t), e = E.createStopToken(); t.setStatsLoading(e); const n = JSON.stringify(a.dynamicBlocks), g = await Q(t, { stopToken: e, filters: [], currStatsBpPerPx: a.bpPerPx, ...t.adapterProps() }); S(t) && t.updateQuantitativeStats(g, n); } } catch (a) { S(t) && !l.isAbortException(a) && (console.error(a), t.setError(a)); } }, { delay: 1e3 })); } export { C as getQuantitativeStatsAutorun }; //# sourceMappingURL=getQuantitativeStatsAutorun-XXftvspN.js.map