UNPKG

taxonium-component

Version:

React component for exploring large phylogenetic trees in the browser

72 lines (71 loc) 2.84 kB
import { B as C, f as b } from "./util-DIF6WZFN.js"; import { T as x } from "./tabixIndexedFile-WXUhSlHL.js"; import "./unzip-NIBF0hze.js"; import { B as w } from "./index-CpJXUZUB.js"; import { a1 as c, u as d, O as u } from "./JBrowsePanel-BNE3gNW1.js"; import { r as S } from "./rxjs-L4bS73F7.js"; class N extends w.BaseFeatureDataAdapter { constructor(e, a, t) { super(e, a, t); const s = this.getConf("bedGzLocation"), n = this.getConf(["index", "indexType"]), r = this.getConf(["index", "location"]), o = this.getConf("autoSql"), i = this.pluginManager; this.bed = new x({ filehandle: c.openLocation(s, i), csiFilehandle: n === "CSI" ? c.openLocation(r, i) : void 0, tbiFilehandle: n !== "CSI" ? c.openLocation(r, i) : void 0, chunkCacheSize: 50 * 2 ** 20 }), this.columnNames = this.getConf("columnNames"), this.scoreColumn = this.getConf("scoreColumn"), this.parser = new C({ autoSql: o }); } async getRefNames(e = {}) { return this.bed.getReferenceSequenceNames(e); } async getHeader(e) { return this.bed.getHeader(e); } async getMetadataPre2(e) { return this.setupP || (this.setupP = this.getMetadataPre().catch((a) => { throw this.setupP = void 0, a; })), this.setupP; } async getMetadataPre() { return { meta: await this.bed.getMetadata() }; } async getMetadata(e) { const { statusCallback: a = () => { } } = e || {}; return d.updateStatus("Downloading index", a, () => this.getMetadataPre2(e)); } async getNames() { if (this.columnNames.length) return this.columnNames; const t = (await this.getHeader()).split(/\n|\r\n|\r/).filter((s) => !!s).at(-1); return t != null && t.includes(" ") ? t.slice(1).split(" ").map((s) => s.trim()) : void 0; } getFeatures(e, a) { const { stopToken: t, statusCallback: s = () => { } } = a || {}; return S.ObservableCreate(async (n) => { const { meta: r } = await this.getMetadata(), { columnNumbers: o } = r, i = o.ref - 1, p = o.start - 1, m = o.end - 1, h = await this.getNames(); let l = performance.now(); u.checkStopToken(t), await d.updateStatus("Downloading features", s, () => this.bed.getLines(e.refName, e.start, e.end, { lineCallback: (f, g) => { performance.now() - l > 200 && (u.checkStopToken(t), l = performance.now()), n.next(new d.SimpleFeature(b({ line: f, colRef: i, colStart: p, colEnd: m, scoreColumn: this.scoreColumn, parser: this.parser, uniqueId: `${this.id}-${g}`, names: h }))); }, stopToken: t })), n.complete(); }, t); } } N.capabilities = ["getFeatures", "getRefNames"]; export { N as default }; //# sourceMappingURL=BedTabixAdapter-t35CC1kE.js.map