UNPKG

taxonium-component

Version:

React component for exploring large phylogenetic trees in the browser

76 lines (75 loc) 2.24 kB
import { B as d } from "./index-CpJXUZUB.js"; import { u as l } from "./JBrowsePanel-BNE3gNW1.js"; import { r as u } from "./rxjs-L4bS73F7.js"; import { m as c, a as g } from "./merge-BKxtGK-k.js"; function m(o) { const e = o.slice(o.lastIndexOf("/") + 1); return e.slice(0, e.lastIndexOf(".")); } class A extends d.BaseFeatureDataAdapter { async getAdapters() { const e = this.getSubAdapter; if (!e) throw new Error("no getSubAdapter available"); let a = this.getConf("subadapters"); return a != null && a.length || (a = this.getConf("bigWigs").map((s) => ({ type: "BigWigAdapter", source: m(s), bigWigLocation: { uri: s } }))), Promise.all(a.map(async (r) => { const s = (await e(r)).dataAdapter; return { source: r.name || s.id, ...r, dataAdapter: s }; })); } async getRefNames(e) { const a = await this.getAdapters(), r = await Promise.all(a.map((s) => s.dataAdapter.getRefNames(e))); return [...new Set(r.flat())]; } async getGlobalStats(e) { const a = await this.getAdapters(), r = (await Promise.all(a.map((t) => { var p, n; return (n = (p = t.dataAdapter).getGlobalStats) === null || n === void 0 ? void 0 : n.call(p, e); }))).filter((t) => !!t), s = l.min(r.map((t) => t.scoreMin)), i = l.max(r.map((t) => t.scoreMax)); return { scoreMin: s, scoreMax: i }; } getFeatures(e, a = {}) { return u.ObservableCreate(async (r) => { const s = await this.getAdapters(); c(...s.map((i) => i.dataAdapter.getFeatures(e, a).pipe(g((t) => t.get("source") ? t : new l.SimpleFeature({ ...t.toJSON(), uniqueId: `${i.source}-${t.id()}`, source: i.source }))))).subscribe(r); }, a.stopToken); } async getMultiRegionFeatureDensityStats(e) { return { featureDensity: 0 }; } async getSources(e) { return (await this.getAdapters()).map(({ dataAdapter: r, source: s, name: i, ...t }) => ({ name: s, __name: i, ...t })); } } A.capabilities = [ "hasResolution", "hasLocalStats", "hasGlobalStats" ]; export { A as default }; //# sourceMappingURL=MultiWiggleAdapter-DMVIk4oX.js.map