taxonium-component
Version:
React component for exploring large phylogenetic trees in the browser
66 lines (65 loc) • 2.21 kB
JavaScript
import { B as v } from "./index-BnQfM3Nw.js";
import { a2 as F, a3 as E, u as r } from "./JBrowsePanel-uJIA-L6s.js";
import { r as $ } from "./rxjs-BnZkaVAs.js";
class B extends v.BaseFeatureDataAdapter {
async configure() {
var e;
const o = await ((e = this.getSubAdapter) === null || e === void 0 ? void 0 : e.call(this, this.getConf("sequenceAdapter")));
if (!o)
throw new Error("Error getting subadapter");
return o.dataAdapter;
}
async getRefNames() {
return (await this.configure()).getRefNames();
}
getFeatures(e, o) {
return $.ObservableCreate(async (c) => {
var d;
const g = await this.configure(), h = 1e4, n = e.end + h, i = Math.max(0, e.start - h);
if (n < 0 || i > n) {
c.complete();
return;
}
const l = g.getFeatures({
...e,
start: i,
end: n
}, o), m = ((d = (await F(l.pipe(E())))[0]) === null || d === void 0 ? void 0 : d.get("seq")) || "", p = this.getConf("search"), x = this.getConf("searchForward"), w = this.getConf("searchReverse"), A = this.getConf("caseInsensitive"), u = new RegExp(p, `g${A ? "i" : ""}`);
if (p) {
if (x) {
const f = m.matchAll(u);
for (const t of f) {
const a = i + t.index, s = i + t.index + t[0].length;
r.doesIntersect2(a, s, e.start, e.end) && c.next(new r.SimpleFeature({
uniqueId: `${this.id}-${a}-${t[0]}-pos`,
refName: e.refName,
start: a,
end: s,
name: t[0],
strand: 1
}));
}
}
if (w) {
const f = r.revcom(m).matchAll(u);
for (const t of f) {
const a = n - t.index, s = n - t.index - t[0].length;
r.doesIntersect2(s, a, e.start, e.end) && c.next(new r.SimpleFeature({
uniqueId: `${this.id}-${s}-${t[0]}-neg`,
refName: e.refName,
start: s,
end: a,
name: t[0],
strand: -1
}));
}
}
}
c.complete();
});
}
}
export {
B as default
};
//# sourceMappingURL=SequenceSearchAdapter-CaFz3leo.js.map