UNPKG

taxonium-component

Version:

React component for exploring large phylogenetic trees in the browser

90 lines (89 loc) 2.81 kB
import { B as y, a as x } from "./bbi-Bgo-D0LY.js"; import "./remoteFile-H_6BTCFF.js"; import { B } from "./index-CpJXUZUB.js"; import { aY as S, a1 as P, u as d } from "./JBrowsePanel-BNE3gNW1.js"; import { r as N } from "./rxjs-L4bS73F7.js"; class v extends y { /** * Retrieves a BlockView of a specific zoomLevel * * @param scale - number * * @param opts - An object containing basesPerSpan (e.g. pixels per basepair) * or scale used to infer the zoomLevel to use */ async getView(e, t) { const { zoomLevels: s, refsByName: r, uncompressBufSize: o } = await this.getHeader(t), u = 1 / e, c = s.length - 1; for (let i = c; i >= 0; i -= 1) { const n = s[i]; if (n && n.reductionLevel <= 2 * u) return new x(this.bbi, r, n.indexOffset, o > 0, "summary"); } return this.getUnzoomedView(t); } } var C = S(); class L extends B.BaseFeatureDataAdapter { async setupPre(e) { const { statusCallback: t = () => { } } = e || {}, s = this.pluginManager, r = new v({ filehandle: P.openLocation(this.getConf("bigWigLocation"), s) }); return { bigwig: r, header: await d.updateStatus("Downloading bigwig header", t, () => r.getHeader(e)) }; } async setup(e) { return this.setupP || (this.setupP = this.setupPre(e).catch((t) => { throw this.setupP = void 0, t; })), this.setupP; } async getRefNames(e) { const { header: t } = await this.setup(e); return Object.keys(t.refsByName); } async refIdToName(e) { var t; const { header: s } = await this.setup(); return (t = s.refsByNumber[e]) === null || t === void 0 ? void 0 : t.name; } async getGlobalStats(e) { const { header: t } = await this.setup(e); return C.rectifyStats(t.totalSummary); } getFeatures(e, t = {}) { const { refName: s, start: r, end: o } = e, { bpPerPx: u = 0, resolution: c = 1, stopToken: i, statusCallback: n = () => { } } = t; return N.ObservableCreate(async (g) => { const l = this.getConf("source"), h = this.getConf("resolutionMultiplier"), { bigwig: m } = await this.setup(t), w = await d.updateStatus("Downloading bigwig data", n, () => m.getFeatures(s, r, o, { ...t, basesPerSpan: u / c * h })); for (const a of w) { l && (a.source = l); const p = `${l}:${e.refName}:${a.start}-${a.end}`; a.refName = s, a.uniqueId = p, g.next({ get: (b) => a[b], id: () => p, toJSON: () => a }); } g.complete(); }, i); } async getMultiRegionFeatureDensityStats(e) { return { featureDensity: 0 }; } } L.capabilities = [ "hasResolution", "hasLocalStats", "hasGlobalStats" ]; export { L as default }; //# sourceMappingURL=BigWigAdapter-CP6Ip79f.js.map