@weng-lab/genomebrowser 1.7.3 → 1.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,6 +7,7 @@ export interface QueryHooks {
7
7
  fetchBigData: LazyQueryExecFunction<any, OperationVariables>;
8
8
  fetchGene: LazyQueryExecFunction<any, OperationVariables>;
9
9
  fetchMotif: LazyQueryExecFunction<any, OperationVariables>;
10
+ getTrackData: (id: string) => TrackDataState | undefined;
10
11
  }
11
12
  export type FetcherContext<T extends Track = Track> = {
12
13
  track: T;
@@ -338,7 +338,7 @@ function Zh(e, t = Xh) {
338
338
  const Os = (e) => {
339
339
  const t = Yh(e), r = (n) => Zh(t, n);
340
340
  return Object.assign(r, t), r;
341
- }, Dr = ((e) => e ? Os(e) : Os), b_ = Tl;
341
+ }, Dr = ((e) => e ? Os(e) : Os), b1 = Tl;
342
342
  function Jh(e) {
343
343
  return xe(() => Tl(), e ?? []);
344
344
  }
@@ -4106,7 +4106,7 @@ Array[$i] || (function(e) {
4106
4106
  } finally {
4107
4107
  return e;
4108
4108
  }
4109
- })(M0()), { bind: __, noContext: w_ } = sn, Ri = new sn(), { hasOwnProperty: N0 } = Object.prototype, Qo = Array.from || function(e) {
4109
+ })(M0()), { bind: _1, noContext: w1 } = sn, Ri = new sn(), { hasOwnProperty: N0 } = Object.prototype, Qo = Array.from || function(e) {
4110
4110
  const t = [];
4111
4111
  return e.forEach((r) => t.push(r)), t;
4112
4112
  };
@@ -14797,9 +14797,8 @@ async function bt(e, t, r, n) {
14797
14797
  const u = performance.now() - i;
14798
14798
  return { data: c, source: "GQL", elapsed: u, url: e };
14799
14799
  })
14800
- ], s = await Promise.race([a, o]);
14801
- return console.log(s.url, `
14802
- `, s.source, "took", s.elapsed.toFixed(2), "ms"), s.data;
14800
+ ];
14801
+ return (await Promise.race([a, o])).data;
14803
14802
  }
14804
14803
  async function Zm(e) {
14805
14804
  const { track: t, expandedDomain: r, preRenderedWidth: n, queries: i } = e;
@@ -14870,7 +14869,7 @@ async function tg(e) {
14870
14869
  bt(t.signalURL, r, -1, n)
14871
14870
  ]), a = i[0].data[0], o = ((u = (c = i[1]) == null ? void 0 : c.data) == null ? void 0 : u.map((w) => w.value)) ?? [], s = (l = i[0]) != null && l.error || (h = i[1]) != null && h.error ? ((d = i[0]) == null ? void 0 : d.error) + `
14872
14871
  ` + ((f = i[1]) == null ? void 0 : f.error) : null;
14873
- return console.log(o), { data: { sequence: a, importance: o }, error: s };
14872
+ return { data: { sequence: a, importance: o }, error: s };
14874
14873
  }
14875
14874
  async function rg(e) {
14876
14875
  var s;
@@ -14905,13 +14904,17 @@ async function ng(e) {
14905
14904
  };
14906
14905
  }
14907
14906
  async function ig(e) {
14908
- return {
14907
+ var r, n;
14908
+ const t = (n = (r = e.queries).getTrackData) == null ? void 0 : n.call(r, e.track.id);
14909
+ return t != null && t.data ? t : {
14909
14910
  data: null,
14910
14911
  error: null
14911
14912
  };
14912
14913
  }
14913
14914
  async function ag(e) {
14914
- return {
14915
+ var r, n;
14916
+ const t = (n = (r = e.queries).getTrackData) == null ? void 0 : n.call(r, e.track.id);
14917
+ return t != null && t.data ? t : {
14915
14918
  data: null,
14916
14919
  error: null
14917
14920
  };
@@ -14936,7 +14939,8 @@ function sg() {
14936
14939
  const w = r(), E = i * a - 1, _ = {
14937
14940
  fetchBigData: l,
14938
14941
  fetchGene: h,
14939
- fetchMotif: d
14942
+ fetchMotif: d,
14943
+ getTrackData: u
14940
14944
  }, x = e.filter((y) => !u(y.id)).map((y) => ({ id: y.id, state: { data: null, error: null } }));
14941
14945
  x.length > 0 && c(x);
14942
14946
  const b = (await Promise.allSettled(
@@ -15187,7 +15191,7 @@ function bh({
15187
15191
  })
15188
15192
  ] });
15189
15193
  }
15190
- const mg = 0, qu = 255, I_ = [
15194
+ const mg = 0, qu = 255, I1 = [
15191
15195
  "#fd7f6f",
15192
15196
  "#7eb0d5",
15193
15197
  "#b2e061",
@@ -15197,7 +15201,7 @@ const mg = 0, qu = 255, I_ = [
15197
15201
  "#beb9db",
15198
15202
  "#fdcce5",
15199
15203
  "#8bd3c7"
15200
- ], R_ = [
15204
+ ], R1 = [
15201
15205
  "#e60049",
15202
15206
  "#0bb4ff",
15203
15207
  "#50e991",
@@ -17738,7 +17742,6 @@ function ty({
17738
17742
  width: f,
17739
17743
  children: A.transcripts.map((j, W) => {
17740
17744
  const V = Oh(j.transcript, _);
17741
- console.log(j);
17742
17745
  let Z;
17743
17746
  return o != null && o.toLowerCase().includes(j.transcript.name.toLowerCase()) ? Z = s : r !== "" && j.transcript.name.toLowerCase().includes(r == null ? void 0 : r.toLowerCase()) && (Z = c), /* @__PURE__ */ S.jsxs("g", { children: [
17744
17747
  /* @__PURE__ */ S.jsx(
@@ -20466,7 +20469,7 @@ function Kx() {
20466
20469
  }), () => m.disconnect();
20467
20470
  }, [n, e, t, r, f, E, l]), !n || d ? null : /* @__PURE__ */ S.jsx("g", { ref: h, id: "tooltip", transform: `translate(${i}, ${o})`, children: e });
20468
20471
  }
20469
- function e_({ children: e }) {
20472
+ function e1({ children: e }) {
20470
20473
  const t = we((o) => o.setSvgRef), r = rt(null), n = De((o) => o.getTotalHeight()), i = we((o) => o.browserWidth), a = It((o) => o.isFetching);
20471
20474
  return Ue(() => {
20472
20475
  t(r);
@@ -20497,7 +20500,7 @@ function e_({ children: e }) {
20497
20500
  }
20498
20501
  );
20499
20502
  }
20500
- function t_() {
20503
+ function t1() {
20501
20504
  const e = we((w) => w.browserWidth), t = we((w) => w.marginWidth), r = Qe, n = De((w) => w.getTotalHeight()) + Qe, [i, a] = Me([0, 0]), [o, s] = Me(!1), c = we((w) => w.svgRef), u = we((w) => w.domain), l = we((w) => w.setDomain), h = (w) => {
20502
20505
  if (!c || !c.current) return null;
20503
20506
  const E = El(w, c.current);
@@ -20558,7 +20561,7 @@ function El(e, t) {
20558
20561
  const n = t.getScreenCTM();
20559
20562
  return n ? r.matrixTransform(n.inverse()) : null;
20560
20563
  }
20561
- function r_() {
20564
+ function r1() {
20562
20565
  const e = It((f) => f.isFetching), t = we((f) => f.domain), r = we((f) => f.getExpandedDomain), [n, i] = Me(r()), a = we((f) => f.delta);
20563
20566
  Ue(() => {
20564
20567
  e || a !== 0 || i(r());
@@ -20569,7 +20572,7 @@ function r_() {
20569
20572
  /* @__PURE__ */ S.jsx("g", { id: "highlights-clipped", clipPath: "url(#highlight-clip)", children: /* @__PURE__ */ S.jsx(Th, { id: "highlights", children: o.map((f) => {
20570
20573
  let w = f.domain.chromosome;
20571
20574
  return w || (w = n.chromosome), w !== n.chromosome ? null : /* @__PURE__ */ S.jsx(
20572
- n_,
20575
+ n1,
20573
20576
  {
20574
20577
  highlight: f,
20575
20578
  totalWidth: l,
@@ -20582,14 +20585,14 @@ function r_() {
20582
20585
  }) }) })
20583
20586
  ] });
20584
20587
  }
20585
- function n_({
20588
+ function n1({
20586
20589
  highlight: e,
20587
20590
  browserDomain: t,
20588
20591
  totalHeight: r,
20589
20592
  totalWidth: n,
20590
20593
  marginWidth: i
20591
20594
  }) {
20592
- const a = e.domain, o = i_(a, t, n);
20595
+ const a = e.domain, o = i1(a, t, n);
20593
20596
  return /* @__PURE__ */ S.jsx(
20594
20597
  "rect",
20595
20598
  {
@@ -20603,17 +20606,17 @@ function n_({
20603
20606
  }
20604
20607
  );
20605
20608
  }
20606
- function i_(e, t, r) {
20609
+ function i1(e, t, r) {
20607
20610
  const n = t.end - t.start, i = (e.start - t.start) / n, a = (e.end - t.start) / n;
20608
20611
  return { start: i * r, end: a * r };
20609
20612
  }
20610
- function a_() {
20613
+ function a1() {
20611
20614
  const e = De((t) => t.ids);
20612
20615
  return sg(), /* @__PURE__ */ S.jsxs(S.Fragment, { children: [
20613
- /* @__PURE__ */ S.jsxs(e_, { children: [
20614
- /* @__PURE__ */ S.jsx(t_, {}),
20616
+ /* @__PURE__ */ S.jsxs(e1, { children: [
20617
+ /* @__PURE__ */ S.jsx(t1, {}),
20615
20618
  /* @__PURE__ */ S.jsx(Dh, { id: "ruler", transform: "translate(0, 0)", loading: !1, error: void 0, children: /* @__PURE__ */ S.jsx(jg, {}) }),
20616
- /* @__PURE__ */ S.jsx(r_, {}),
20619
+ /* @__PURE__ */ S.jsx(r1, {}),
20617
20620
  e.map((t) => /* @__PURE__ */ S.jsx(lx, { id: t }, t)),
20618
20621
  /* @__PURE__ */ S.jsx(Kx, {})
20619
20622
  ] }),
@@ -20621,7 +20624,7 @@ function a_() {
20621
20624
  /* @__PURE__ */ S.jsx(Xx, {})
20622
20625
  ] });
20623
20626
  }
20624
- function M_({ browserStore: e, trackStore: t, externalDataStore: r }) {
20627
+ function M1({ browserStore: e, trackStore: t, externalDataStore: r }) {
20625
20628
  const n = r ?? Jh([]), i = xe(() => Dl(), []), a = xe(() => Cl(), []), o = xe(() => Ol(), []), s = xe(() => Il(), []), c = xe(
20626
20629
  () => ({
20627
20630
  browserStore: e,
@@ -20634,10 +20637,10 @@ function M_({ browserStore: e, trackStore: t, externalDataStore: r }) {
20634
20637
  }),
20635
20638
  [e, t, n, i, a, o, s]
20636
20639
  );
20637
- return /* @__PURE__ */ S.jsx(ed, { value: c, children: /* @__PURE__ */ S.jsx(a_, {}) });
20640
+ return /* @__PURE__ */ S.jsx(ed, { value: c, children: /* @__PURE__ */ S.jsx(a1, {}) });
20638
20641
  }
20639
- const A_ = Bh;
20640
- function N_(e, t) {
20642
+ const A1 = Bh;
20643
+ function N1(e, t) {
20641
20644
  return xe(() => Bh(e), t ?? []);
20642
20645
  }
20643
20646
  function Bh(e) {
@@ -20699,8 +20702,8 @@ function Bh(e) {
20699
20702
  }
20700
20703
  }));
20701
20704
  }
20702
- const j_ = qh;
20703
- function P_(e, t) {
20705
+ const j1 = qh;
20706
+ function P1(e, t) {
20704
20707
  return xe(() => qh(e), t ?? []);
20705
20708
  }
20706
20709
  function qh(e = []) {
@@ -20788,31 +20791,31 @@ function qh(e = []) {
20788
20791
  }
20789
20792
  }));
20790
20793
  }
20791
- const o_ = "https://screen.api.wenglab.org/graphql", s_ = new Qf({
20792
- link: new kf({ uri: o_ }),
20794
+ const o1 = "https://screen.api.wenglab.org/graphql", s1 = new Qf({
20795
+ link: new kf({ uri: o1 }),
20793
20796
  cache: new Wf(),
20794
20797
  devtools: {
20795
20798
  enabled: !0,
20796
20799
  name: "Genome Browser"
20797
20800
  }
20798
20801
  });
20799
- function F_({ children: e }) {
20800
- return /* @__PURE__ */ S.jsx(Iv, { client: s_, children: e });
20802
+ function F1({ children: e }) {
20803
+ return /* @__PURE__ */ S.jsx(Iv, { client: s1, children: e });
20801
20804
  }
20802
- function c_(e, t, r, n) {
20805
+ function c1(e, t, r, n) {
20803
20806
  return n ? `M ${e} ${r * 0.1} L ${e + t} ${r / 2} L ${e} ${r * 0.9}` : `M ${e + t} ${r * 0.1} L ${e} ${r / 2} L ${e + t} ${r * 0.9}`;
20804
20807
  }
20805
- function u_(e) {
20806
- return /* @__PURE__ */ S.jsx("path", { d: c_(e.x, e.width, e.height, e.opening), fill: e.color });
20808
+ function u1(e) {
20809
+ return /* @__PURE__ */ S.jsx("path", { d: c1(e.x, e.width, e.height, e.opening), fill: e.color });
20807
20810
  }
20808
- const l_ = /* @__PURE__ */ new Map([
20811
+ const l1 = /* @__PURE__ */ new Map([
20809
20812
  ["stalk", (e) => e.stalk],
20810
20813
  ["gvar", (e) => e.default],
20811
20814
  ["gneg", (e) => Zt(e.default, 0.9)]
20812
20815
  ]);
20813
- function f_(e) {
20816
+ function f1(e) {
20814
20817
  var r;
20815
- const t = e.type.slice(0, 4) === "gpos" ? Zt(e.colors.default, 1 - +e.type.replace(/gpos/g, "") / 100) : (r = l_.get(e.type)) == null ? void 0 : r.call(null, e.colors);
20818
+ const t = e.type.slice(0, 4) === "gpos" ? Zt(e.colors.default, 1 - +e.type.replace(/gpos/g, "") / 100) : (r = l1.get(e.type)) == null ? void 0 : r.call(null, e.colors);
20816
20819
  return t === void 0 ? null : /* @__PURE__ */ S.jsx(
20817
20820
  "rect",
20818
20821
  {
@@ -20825,8 +20828,8 @@ function f_(e) {
20825
20828
  }
20826
20829
  );
20827
20830
  }
20828
- function h_(e) {
20829
- return e.x(e.highlight.end) - e.x(e.highlight.start) < 10 ? /* @__PURE__ */ S.jsx(d_, { highlight: e.highlight, x: e.x, height: e.height }) : /* @__PURE__ */ S.jsx(
20831
+ function h1(e) {
20832
+ return e.x(e.highlight.end) - e.x(e.highlight.start) < 10 ? /* @__PURE__ */ S.jsx(d1, { highlight: e.highlight, x: e.x, height: e.height }) : /* @__PURE__ */ S.jsx(
20830
20833
  "rect",
20831
20834
  {
20832
20835
  x: e.x(e.highlight.start),
@@ -20840,14 +20843,14 @@ function h_(e) {
20840
20843
  }
20841
20844
  );
20842
20845
  }
20843
- function d_(e) {
20846
+ function d1(e) {
20844
20847
  const { highlight: t, height: r, x: n } = e, i = `M ${n(t.start) - 5} 0 L ${n(t.start)} ${r * 0.2} L ${n(t.start) + 5} 0`, a = `M ${n(t.start) - 5} ${r} L ${n(t.start)} ${r * 0.8} L ${n(t.start) + 5} ${r}`;
20845
20848
  return /* @__PURE__ */ S.jsxs(S.Fragment, { children: [
20846
20849
  /* @__PURE__ */ S.jsx("path", { d: i, stroke: t.color || "#ff0000", strokeWidth: 3, fill: "none" }),
20847
20850
  /* @__PURE__ */ S.jsx("path", { d: a, stroke: t.color || "#ff0000", strokeWidth: 3, fill: "none" })
20848
20851
  ] });
20849
20852
  }
20850
- const p_ = qt`
20853
+ const p1 = qt`
20851
20854
  query cytobands($assembly: String!, $chromosome: String) {
20852
20855
  cytoband(assembly: $assembly, chromosome: $chromosome) {
20853
20856
  stain
@@ -20858,21 +20861,21 @@ const p_ = qt`
20858
20861
  }
20859
20862
  }
20860
20863
  }
20861
- `, v_ = {
20864
+ `, v1 = {
20862
20865
  default: "#000000",
20863
20866
  centromere: "#880000",
20864
20867
  stalk: "#ff0000"
20865
20868
  };
20866
- function B_({
20869
+ function B1({
20867
20870
  assembly: e,
20868
20871
  currentDomain: t
20869
20872
  }) {
20870
- const i = { ...t, color: "rgba(50,50,255,0.75)" }, a = "translate(0,0)", { data: o, loading: s, error: c } = Uv(p_, {
20873
+ const i = { ...t, color: "rgba(50,50,255,0.75)" }, a = "translate(0,0)", { data: o, loading: s, error: c } = Uv(p1, {
20871
20874
  variables: {
20872
20875
  assembly: e,
20873
20876
  chromosome: t.chromosome || ""
20874
20877
  }
20875
- }), u = v_;
20878
+ }), u = v1;
20876
20879
  if (s)
20877
20880
  return /* @__PURE__ */ S.jsx("g", { width: 700, height: 20, children: /* @__PURE__ */ S.jsx("text", { x: "350", y: "15", textAnchor: "middle", style: { fontSize: "14px", fontFamily: "sans-serif" }, children: "Loading..." }) });
20878
20881
  if (c)
@@ -20880,7 +20883,7 @@ function B_({
20880
20883
  "Error: ",
20881
20884
  c.message
20882
20885
  ] }) });
20883
- const l = { start: 0, end: Math.max(...o.cytoband.map((f) => f.coordinates.end)) }, h = m_(
20886
+ const l = { start: 0, end: Math.max(...o.cytoband.map((f) => f.coordinates.end)) }, h = m1(
20884
20887
  {
20885
20888
  start: l.start,
20886
20889
  end: l.end,
@@ -20893,7 +20896,7 @@ function B_({
20893
20896
  o.cytoband.map((f, w) => {
20894
20897
  const E = h(f.coordinates.start), _ = h(f.coordinates.end) - E;
20895
20898
  return f.stain === "acen" ? /* @__PURE__ */ S.jsx(
20896
- u_,
20899
+ u1,
20897
20900
  {
20898
20901
  width: _,
20899
20902
  x: E,
@@ -20902,10 +20905,10 @@ function B_({
20902
20905
  opening: d++ === 0
20903
20906
  },
20904
20907
  w
20905
- ) : /* @__PURE__ */ S.jsx(f_, { type: f.stain, width: _, x: E, height: 20, colors: u, opacity: 1 }, w);
20908
+ ) : /* @__PURE__ */ S.jsx(f1, { type: f.stain, width: _, x: E, height: 20, colors: u, opacity: 1 }, w);
20906
20909
  }),
20907
20910
  i ? /* @__PURE__ */ S.jsx(
20908
- h_,
20911
+ h1,
20909
20912
  {
20910
20913
  onMouseOut: () => {
20911
20914
  },
@@ -20917,29 +20920,29 @@ function B_({
20917
20920
  ) : null
20918
20921
  ] });
20919
20922
  }
20920
- function m_(e, t) {
20923
+ function m1(e, t) {
20921
20924
  return (r) => (r - e.start) * t / (e.end - e.start);
20922
20925
  }
20923
- function q_(e, t, r) {
20926
+ function q1(e, t, r) {
20924
20927
  const n = r((a) => a.setTrackData), i = r((a) => a.isFetching);
20925
20928
  Ue(() => {
20926
20929
  i || (t.loading ? n(e, { data: null, error: null }) : t.error ? n(e, { data: null, error: t.error.message }) : t.data && n(e, { data: t.data, error: null }));
20927
20930
  }, [t.data, t.loading, t.error, i, e, n]);
20928
20931
  }
20929
20932
  export {
20930
- M_ as Browser,
20931
- B_ as Cytobands,
20933
+ M1 as Browser,
20934
+ B1 as Cytobands,
20932
20935
  dt as DisplayMode,
20933
- F_ as GQLWrapper,
20934
- I_ as Pastels,
20936
+ F1 as GQLWrapper,
20937
+ I1 as Pastels,
20935
20938
  Te as TrackType,
20936
- R_ as Vibrant,
20937
- A_ as createBrowserStore,
20938
- N_ as createBrowserStoreMemo,
20939
- b_ as createDataStore,
20939
+ R1 as Vibrant,
20940
+ A1 as createBrowserStore,
20941
+ N1 as createBrowserStoreMemo,
20942
+ b1 as createDataStore,
20940
20943
  Jh as createDataStoreMemo,
20941
- j_ as createTrackStore,
20942
- P_ as createTrackStoreMemo,
20943
- q_ as useCustomData
20944
+ j1 as createTrackStore,
20945
+ P1 as createTrackStoreMemo,
20946
+ q1 as useCustomData
20944
20947
  };
20945
20948
  //# sourceMappingURL=genomebrowser.es.js.map