@abi-software/mapintegratedvuer 1.9.0-beta.1 → 1.9.0-beta.2
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.
- package/dist/ContentMixin-DhYKJqtq.js +715 -0
- package/dist/{Flatmap-CxqtqzTG.js → Flatmap-CCNdXCt7.js} +59 -61
- package/dist/{Iframe-DEbnht3D.js → Iframe-DRy2XYXB.js} +2 -2
- package/dist/{MultiFlatmap-DB7ZL7mu.js → MultiFlatmap-C5wAg0Tx.js} +44 -35
- package/dist/{Plot-eTjN3jFm.js → Plot-D4qtJ6vo.js} +2 -2
- package/dist/{Scaffold-EQbo-XRc.js → Scaffold-BXhAyVhd.js} +13 -13
- package/dist/{Simulation-n3xUY1sG.js → Simulation-nAqMBk7o.js} +2 -2
- package/dist/{index-BFdnIlxA.js → index-z8CoyNjc.js} +29028 -22529
- package/dist/mapintegratedvuer.js +1 -1
- package/dist/mapintegratedvuer.umd.cjs +1654 -1003
- package/dist/{style-DeVkU2io.js → style-DwAEhcnj.js} +70580 -67617
- package/dist/style.css +1 -1
- package/package.json +5 -5
- package/src/App.vue +1 -13
- package/src/assets/header-icon.scss +7 -0
- package/src/components/ContentBar.vue +4 -2
- package/src/components/DialogToolbarContent.vue +87 -14
- package/src/components/MapContent.vue +15 -18
- package/src/components/SplitFlow.vue +149 -112
- package/src/components/viewers/Flatmap.vue +3 -4
- package/src/components/viewers/MultiFlatmap.vue +26 -8
- package/src/components/viewers/Scaffold.vue +2 -2
- package/src/mixins/ContentMixin.js +139 -76
- package/src/mixins/DynamicMarkerMixin.js +1 -1
- package/src/stores/settings.js +11 -9
- package/src/stores/splitFlow.js +6 -9
- package/dist/ContentMixin-CukPHyXB.js +0 -358
- package/src/components/markerZoomLevelsHardCoded.js +0 -250
@@ -0,0 +1,715 @@
|
|
1
|
+
import { markRaw as b } from "vue";
|
2
|
+
import { u as I, b as M, E as h, T as F, c as w, d as A } from "./index-z8CoyNjc.js";
|
3
|
+
import { mapStores as C } from "pinia";
|
4
|
+
const d = function(e) {
|
5
|
+
return e ? [...new Set(e.map((t) => JSON.stringify(t)))].map(
|
6
|
+
(t) => JSON.parse(t)
|
7
|
+
) : [];
|
8
|
+
}, g = [], S = async function(e, t) {
|
9
|
+
const n = t.filter(
|
10
|
+
(o) => g.some((a) => a.taxon === o)
|
11
|
+
), i = g.filter(
|
12
|
+
(o) => n.includes(o.taxon)
|
13
|
+
), s = t.filter(
|
14
|
+
(o) => !n.includes(o)
|
15
|
+
);
|
16
|
+
if (s.length) {
|
17
|
+
const o = await e.queryLabels(s);
|
18
|
+
if (o.length)
|
19
|
+
return o.forEach((a) => {
|
20
|
+
let { entity: r, label: l } = a;
|
21
|
+
l === "Mammalia" && (l = "Mammalia not otherwise specified");
|
22
|
+
const c = { taxon: r, label: l };
|
23
|
+
i.push(c), g.push(c);
|
24
|
+
}), i;
|
25
|
+
} else
|
26
|
+
return i;
|
27
|
+
}, y = function(e, t) {
|
28
|
+
if (!e || !t) return !1;
|
29
|
+
let n = JSON.stringify(e), i = JSON.stringify(t);
|
30
|
+
return n.indexOf(i) !== -1;
|
31
|
+
}, p = (e, t) => {
|
32
|
+
const n = e.name ?? e, i = t.name ?? t, s = n.toUpperCase(), o = i.toUpperCase();
|
33
|
+
return s < o ? -1 : s > o ? 1 : 0;
|
34
|
+
};
|
35
|
+
let $ = function() {
|
36
|
+
this.initialise = function(e) {
|
37
|
+
this.flatmapAPI = e, this.destinations = [], this.origins = [], this.components = [], this.rawURLs = [], this.controller = void 0, this.uberons = [], this.lookUp = [], this.connectivitySource = "sckan";
|
38
|
+
}, this.createTooltipData = async function(e, t) {
|
39
|
+
let n = [];
|
40
|
+
t.feature.hyperlinks && t.feature.hyperlinks.length > 0 ? n = t.feature.hyperlinks : n = this.rawURLs;
|
41
|
+
let i;
|
42
|
+
if (t.provenanceTaxonomy) {
|
43
|
+
i = [];
|
44
|
+
try {
|
45
|
+
const o = await S(e, t.provenanceTaxonomy);
|
46
|
+
o.length && o.forEach((a) => {
|
47
|
+
const { label: r } = a;
|
48
|
+
i.push(r);
|
49
|
+
});
|
50
|
+
} catch (o) {
|
51
|
+
console.log(o);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
return {
|
55
|
+
destinations: this.destinations,
|
56
|
+
origins: this.origins,
|
57
|
+
components: this.components,
|
58
|
+
destinationsWithDatasets: this.destinationsWithDatasets,
|
59
|
+
originsWithDatasets: this.originsWithDatasets,
|
60
|
+
componentsWithDatasets: this.componentsWithDatasets,
|
61
|
+
title: t.label,
|
62
|
+
featureId: t.resource,
|
63
|
+
hyperlinks: n,
|
64
|
+
provenanceTaxonomy: t.provenanceTaxonomy,
|
65
|
+
provenanceTaxonomyLabel: i,
|
66
|
+
connectivitySource: this.connectivitySource
|
67
|
+
};
|
68
|
+
}, this.updateTooltipData = function(e) {
|
69
|
+
return {
|
70
|
+
...e,
|
71
|
+
origins: this.origins,
|
72
|
+
originsWithDatasets: this.originsWithDatasets,
|
73
|
+
components: this.components,
|
74
|
+
componentsWithDatasets: this.componentsWithDatasets,
|
75
|
+
destinations: this.destinations,
|
76
|
+
destinationsWithDatasets: this.destinationsWithDatasets,
|
77
|
+
connectivitySource: this.connectivitySource
|
78
|
+
};
|
79
|
+
}, this.createComponentsLabelList = function(e, t) {
|
80
|
+
let n = [];
|
81
|
+
return e.forEach((i) => {
|
82
|
+
n.push(this.createLabelFromNeuralNode(i[0]), t), i.length === 2 && n.push(this.createLabelFromNeuralNode(i[1]), t);
|
83
|
+
}), n;
|
84
|
+
}, this.createLabelLookup = function(e, t) {
|
85
|
+
return new Promise(async (n) => {
|
86
|
+
let i = {};
|
87
|
+
this.uberons = [];
|
88
|
+
const s = await S(e, t);
|
89
|
+
s.length && (s.forEach((o) => {
|
90
|
+
const { taxon: a, label: r } = o;
|
91
|
+
i[a] = r, this.uberons.push({
|
92
|
+
id: a,
|
93
|
+
name: r
|
94
|
+
});
|
95
|
+
}), n(i));
|
96
|
+
});
|
97
|
+
}, this.buildConnectivitySqlStatement = function(e) {
|
98
|
+
let t = "select knowledge from knowledge where entity in (";
|
99
|
+
if (e.length === 1)
|
100
|
+
t += `'${e[0]}')`;
|
101
|
+
else if (e.length > 1)
|
102
|
+
for (let n in e)
|
103
|
+
t += `'${e[n]}'${n >= e.length - 1 ? ")" : ","} `;
|
104
|
+
return t;
|
105
|
+
}, this.buildLabelSqlStatement = function(e) {
|
106
|
+
let t = "select entity, label from labels where entity in (";
|
107
|
+
if (e.length === 1)
|
108
|
+
t += `'${e[0]}')`;
|
109
|
+
else if (e.length > 1)
|
110
|
+
for (let n in e)
|
111
|
+
t += `'${e[n]}'${n >= e.length - 1 ? ")" : ","} `;
|
112
|
+
return t;
|
113
|
+
}, this.findAllIdsFromConnectivity = function(e) {
|
114
|
+
let t = e.connectivity.flat(), n = [...new Set(t)], i = [];
|
115
|
+
return n.forEach((s) => {
|
116
|
+
Array.isArray(s) ? i.push(s.flat()) : i.push(s);
|
117
|
+
}), [...new Set(i.flat())];
|
118
|
+
}, this.flattenConnectivity = function(e) {
|
119
|
+
let t = e.flat(), n = [...new Set(t)], i = [];
|
120
|
+
return n.forEach((s) => {
|
121
|
+
Array.isArray(s) ? i.push(s.flat()) : i.push(s);
|
122
|
+
}), i.flat();
|
123
|
+
}, this.findComponents = function(e, t, n, i) {
|
124
|
+
let s = e.connectivity.flat(), o = d(s), a = [], r = !1;
|
125
|
+
return o.forEach((l) => {
|
126
|
+
r = !1, y(t, l) && (r = !0), i && y(i, l) && (r = !0), y(n, l) && (r = !0), r || a.push(l);
|
127
|
+
}), a;
|
128
|
+
}, this.retrieveFlatmapKnowledgeForEvent = async function(e, t) {
|
129
|
+
this.controller && this.controller.abort(), this.controller = new AbortController(), this.controller.signal;
|
130
|
+
const n = t.resource;
|
131
|
+
if (this.destinations = [], this.origins = [], this.components = [], this.rawURLs = [], !n || n.length === 0 || !n[0]) return;
|
132
|
+
let i = this.queryForConnectivityNew(e, n[0]);
|
133
|
+
return await Promise.all([i]);
|
134
|
+
}, this.queryForConnectivityNew = function(e, t, n = "sckan", i = !0) {
|
135
|
+
return this.connectivitySource = n, new Promise((s) => {
|
136
|
+
(n === "map" ? this.queryMapConnectivity(e.provenance.uuid, t) : e.queryKnowledge(t)).then((a) => {
|
137
|
+
if (this.checkConnectivityExists(a)) {
|
138
|
+
let r = a;
|
139
|
+
i ? this.processConnectivity(e, r).then((l) => {
|
140
|
+
a.references && (this.rawURLs = [...a.references]), s(l);
|
141
|
+
}) : s(r);
|
142
|
+
} else
|
143
|
+
s(!1);
|
144
|
+
}).catch((a) => {
|
145
|
+
a.name === "AbortError" || console.warn(`Unable to get the knowledge for the entity ${t}.`), s(!1);
|
146
|
+
});
|
147
|
+
});
|
148
|
+
}, this.queryMapConnectivity = async function(e, t) {
|
149
|
+
const n = this.flatmapAPI + `flatmap/${e}/connectivity/${t}`;
|
150
|
+
try {
|
151
|
+
const i = await fetch(n);
|
152
|
+
if (!i.ok)
|
153
|
+
throw new Error(`Response status: ${i.status}`);
|
154
|
+
return await i.json();
|
155
|
+
} catch (i) {
|
156
|
+
throw new Error(i);
|
157
|
+
}
|
158
|
+
}, this.queryMapPaths = async function(e) {
|
159
|
+
const t = this.flatmapAPI + `flatmap/${e}/pathways`;
|
160
|
+
try {
|
161
|
+
const n = await fetch(t);
|
162
|
+
if (!n.ok)
|
163
|
+
throw new Error(`Response status: ${n.status}`);
|
164
|
+
return await n.json();
|
165
|
+
} catch (n) {
|
166
|
+
throw new Error(n);
|
167
|
+
}
|
168
|
+
}, this.queryForConnectivity = function(e, t, n, i = !0) {
|
169
|
+
const s = { sql: this.buildConnectivitySqlStatement(t) }, o = {
|
170
|
+
method: "POST",
|
171
|
+
headers: {
|
172
|
+
"Content-Type": "application/json"
|
173
|
+
},
|
174
|
+
body: JSON.stringify(s),
|
175
|
+
...n ? { signal: n } : {}
|
176
|
+
// add signal to header if it exists
|
177
|
+
};
|
178
|
+
return new Promise((a) => {
|
179
|
+
fetch(`${this.flatmapAPI}knowledge/query/`, o).then((r) => r.json()).then((r) => {
|
180
|
+
if (this.connectivityExists(r)) {
|
181
|
+
let l = JSON.parse(r.values[0][0]);
|
182
|
+
i ? this.processConnectivity(e, l).then((c) => {
|
183
|
+
a(c);
|
184
|
+
}) : a(l);
|
185
|
+
} else
|
186
|
+
a(!1);
|
187
|
+
}).catch((r) => {
|
188
|
+
r.name === "AbortError" || console.error("Error:", r), a(!1);
|
189
|
+
});
|
190
|
+
});
|
191
|
+
}, this.checkConnectivityExists = function(e) {
|
192
|
+
var t;
|
193
|
+
return e && ((t = e.connectivity) == null ? void 0 : t.length);
|
194
|
+
}, this.connectivityExists = function(e) {
|
195
|
+
return !!(e.values && e.values.length > 0 && JSON.parse(e.values[0][0]).connectivity && JSON.parse(e.values[0][0]).connectivity.length > 0);
|
196
|
+
}, this.findIfNodeIsSingle = function(e) {
|
197
|
+
return e.length === 1 ? (console.error("Server returns a single node", e), e[0]) : e.length === 2 && e[1].length === 0 ? e[0] : !1;
|
198
|
+
}, this.createLabelFromNeuralNode = function(e, t) {
|
199
|
+
let n = this.findIfNodeIsSingle(e);
|
200
|
+
if (n)
|
201
|
+
return t[n];
|
202
|
+
let i = t[e[0]];
|
203
|
+
return e.length === 2 && e[1].length > 0 && e[1].forEach((s) => {
|
204
|
+
t[s] == null ? i += `, ${s}` : i += `, ${t[s]}`;
|
205
|
+
}), i;
|
206
|
+
}, this.flattenAndFindDatasets = function(e, t, n) {
|
207
|
+
let i = this.flattenConnectivity(e), s = this.flattenConnectivity(t), o = this.flattenConnectivity(n);
|
208
|
+
this.originsWithDatasets = this.uberons.filter(
|
209
|
+
(a) => i.indexOf(a.id) !== -1
|
210
|
+
).sort(p), this.componentsWithDatasets = this.uberons.filter(
|
211
|
+
(a) => s.indexOf(a.id) !== -1
|
212
|
+
).sort(p), this.destinationsWithDatasets = this.uberons.filter(
|
213
|
+
(a) => o.indexOf(a.id) !== -1
|
214
|
+
).sort(p);
|
215
|
+
}, this.processConnectivity = function(e, t) {
|
216
|
+
return new Promise((n) => {
|
217
|
+
let i = [], s = [], o;
|
218
|
+
if (t && t["node-phenotypes"]) {
|
219
|
+
const l = ["ilxtr:hasSomaLocatedIn"], c = ["ilxtr:hasAxonPresynapticElementIn", "ilxtr:hasAxonSensorySubcellularElementIn"];
|
220
|
+
l.forEach((u) => {
|
221
|
+
i.push(...t["node-phenotypes"][u]);
|
222
|
+
}), i = d(i), c.forEach((u) => {
|
223
|
+
s.push(...t["node-phenotypes"][u]);
|
224
|
+
}), s = d(s);
|
225
|
+
} else
|
226
|
+
s = d(t.axons), t.somas && t.somas.length > 0 && i.push(...t.somas), t.dendrites && t.dendrites.length > 0 && i.push(...t.dendrites), i = d(i), o = t.somas;
|
227
|
+
const a = this.findComponents(t, s, i, o), r = this.findAllIdsFromConnectivity(t);
|
228
|
+
this.createLabelLookup(e, r).then((l) => {
|
229
|
+
this.origins = i.map(
|
230
|
+
(c) => this.createLabelFromNeuralNode(c, l)
|
231
|
+
).sort(p), this.components = a.map(
|
232
|
+
(c) => this.createLabelFromNeuralNode(c, l)
|
233
|
+
).sort(p), this.destinations = s.map(
|
234
|
+
(c) => this.createLabelFromNeuralNode(c, l)
|
235
|
+
).sort(p), this.flattenAndFindDatasets(i, a, s), n({
|
236
|
+
ids: {
|
237
|
+
dendrites: i,
|
238
|
+
components: a,
|
239
|
+
axons: s
|
240
|
+
},
|
241
|
+
labels: {
|
242
|
+
origins: this.origins,
|
243
|
+
components: this.components,
|
244
|
+
destinations: this.destinations
|
245
|
+
}
|
246
|
+
});
|
247
|
+
});
|
248
|
+
});
|
249
|
+
}, this.buildPubmedSqlStatement = function(e) {
|
250
|
+
let t = "select distinct publication from publications where entity in (";
|
251
|
+
if (e.length === 1)
|
252
|
+
t += `'${e[0]}')`;
|
253
|
+
else if (e.length > 1)
|
254
|
+
for (let n in e)
|
255
|
+
t += `'${e[n]}'${n >= e.length - 1 ? ")" : ","} `;
|
256
|
+
return t;
|
257
|
+
}, this.buildPubmedSqlStatementForModels = function(e) {
|
258
|
+
return `select distinct publication from publications where entity = '${e}'`;
|
259
|
+
}, this.flatmapQuery = function(e) {
|
260
|
+
const t = { sql: e };
|
261
|
+
return fetch(`${this.flatmapAPI}knowledge/query/`, {
|
262
|
+
method: "POST",
|
263
|
+
headers: {
|
264
|
+
"Content-Type": "application/json"
|
265
|
+
},
|
266
|
+
body: JSON.stringify(t)
|
267
|
+
}).then((n) => n.json()).catch((n) => {
|
268
|
+
console.error("Error:", n);
|
269
|
+
});
|
270
|
+
};
|
271
|
+
};
|
272
|
+
function v(e) {
|
273
|
+
var n;
|
274
|
+
let t = "";
|
275
|
+
if ((n = e.provenance) != null && n.connectivity) {
|
276
|
+
const i = e.provenance.connectivity;
|
277
|
+
"knowledge-source" in i ? t = i["knowledge-source"] : "npo" in i && (t = `${i.npo.release}-npo`);
|
278
|
+
}
|
279
|
+
return t;
|
280
|
+
}
|
281
|
+
async function H(e, t) {
|
282
|
+
const n = v(e), i = `select knowledge from knowledge
|
283
|
+
where source="${n}"
|
284
|
+
order by source desc`;
|
285
|
+
E();
|
286
|
+
const s = sessionStorage.getItem("flatmap-knowledge"), o = sessionStorage.getItem("flatmap-knowledge-source");
|
287
|
+
if (!s || o !== n) {
|
288
|
+
const l = (await t.flatmapQuery(i)).values.map((c) => c[0]).map((c) => JSON.parse(c));
|
289
|
+
return sessionStorage.setItem("flatmap-knowledge", JSON.stringify(l)), sessionStorage.setItem("flatmap-knowledge-source", n), N(), l;
|
290
|
+
}
|
291
|
+
return JSON.parse(s);
|
292
|
+
}
|
293
|
+
function N() {
|
294
|
+
const n = (/* @__PURE__ */ new Date()).getTime() + 864e5;
|
295
|
+
sessionStorage.setItem("flatmap-knowledge-expiry", n);
|
296
|
+
}
|
297
|
+
function T() {
|
298
|
+
[
|
299
|
+
"flatmap-knowledge",
|
300
|
+
"flatmap-knowledge-expiry",
|
301
|
+
"flatmap-knowledge-source"
|
302
|
+
].forEach((t) => {
|
303
|
+
sessionStorage.removeItem(t);
|
304
|
+
});
|
305
|
+
}
|
306
|
+
function E() {
|
307
|
+
const e = sessionStorage.getItem("flatmap-knowledge-expiry");
|
308
|
+
(/* @__PURE__ */ new Date()).getTime() > e && T();
|
309
|
+
}
|
310
|
+
function P(e) {
|
311
|
+
return e[0].toUpperCase() + e.substring(1);
|
312
|
+
}
|
313
|
+
const k = {
|
314
|
+
emits: ["flatmap-provenance-ready", "resource-selected", "species-changed"],
|
315
|
+
props: {
|
316
|
+
/**
|
317
|
+
* Object containing information for
|
318
|
+
* the required viewing.
|
319
|
+
*/
|
320
|
+
entry: Object,
|
321
|
+
visible: {
|
322
|
+
type: Boolean,
|
323
|
+
default: !0
|
324
|
+
},
|
325
|
+
mouseHovered: {
|
326
|
+
type: Boolean,
|
327
|
+
default: !1
|
328
|
+
}
|
329
|
+
},
|
330
|
+
computed: {
|
331
|
+
...C(I, M),
|
332
|
+
idNamePair() {
|
333
|
+
return this.splitFlowStore.idNamePair;
|
334
|
+
},
|
335
|
+
syncMode() {
|
336
|
+
return this.splitFlowStore.syncMode;
|
337
|
+
},
|
338
|
+
useHelpModeDialog() {
|
339
|
+
return this.settingsStore.useHelpModeDialog;
|
340
|
+
},
|
341
|
+
connectivityInfoSidebar() {
|
342
|
+
return this.settingsStore.connectivityInfoSidebar;
|
343
|
+
},
|
344
|
+
annotationSidebar() {
|
345
|
+
return this.settingsStore.annotationSidebar;
|
346
|
+
}
|
347
|
+
},
|
348
|
+
mounted: function() {
|
349
|
+
h.on("startHelp", () => {
|
350
|
+
this.startHelp();
|
351
|
+
}), this.multiflatmapRef = this.$refs.multiflatmap, this.flatmapRef = this.$refs.flatmap, this.scaffoldRef = this.$refs.scaffold;
|
352
|
+
},
|
353
|
+
methods: {
|
354
|
+
toggleSyncMode: function() {
|
355
|
+
},
|
356
|
+
getState: function() {
|
357
|
+
},
|
358
|
+
openMap: function(e) {
|
359
|
+
e === "SYNC" ? (this.toggleSyncMode(), this.trackOpenMap("toggle_map_sync_mode")) : (h.emit("OpenNewMap", e), this.trackOpenMap(`open_new_${e}_map`));
|
360
|
+
},
|
361
|
+
onMapmanagerLoaded: function(e) {
|
362
|
+
this.settingsStore.updateMapManager(e);
|
363
|
+
},
|
364
|
+
trackOpenMap: function(e) {
|
365
|
+
F.sendEvent({
|
366
|
+
event: "interaction_event",
|
367
|
+
event_name: "portal_maps_open_map",
|
368
|
+
category: e,
|
369
|
+
location: "open_new_map"
|
370
|
+
});
|
371
|
+
},
|
372
|
+
updateWithViewUrl: function() {
|
373
|
+
},
|
374
|
+
/**
|
375
|
+
* Perform a local search on this contentvuer
|
376
|
+
*/
|
377
|
+
search: function() {
|
378
|
+
return !1;
|
379
|
+
},
|
380
|
+
/**
|
381
|
+
* Get a list of search suggestions on this contentvuer
|
382
|
+
*/
|
383
|
+
searchSuggestions: function() {
|
384
|
+
},
|
385
|
+
/**
|
386
|
+
* Callback when the vuers emit a selected event.
|
387
|
+
*/
|
388
|
+
resourceSelected: function(e, t) {
|
389
|
+
var a, r, l, c;
|
390
|
+
const n = t[0];
|
391
|
+
if (this.resourceHasAction(n)) {
|
392
|
+
h.emit("PopoverActionClick", n);
|
393
|
+
return;
|
394
|
+
}
|
395
|
+
let i, s = !1;
|
396
|
+
const o = {
|
397
|
+
paneIndex: this.entry.id,
|
398
|
+
type: e,
|
399
|
+
resource: t,
|
400
|
+
internalName: void 0,
|
401
|
+
eventType: void 0
|
402
|
+
};
|
403
|
+
if (e == "MultiFlatmap" || e == "Flatmap")
|
404
|
+
if (o.internalName = (a = n == null ? void 0 : n.feature) != null && a.label ? n.feature.label : this.idNamePair[n.feature.models], n.eventType == "click")
|
405
|
+
if (o.eventType = "selected", n.feature.type == "marker") {
|
406
|
+
let u = o.internalName;
|
407
|
+
if (this.settingsStore.isFeaturedMarkerIdentifier(n.feature.id))
|
408
|
+
i = {
|
409
|
+
type: "Search",
|
410
|
+
term: this.settingsStore.featuredMarkerDoi(n.feature.id),
|
411
|
+
featuredDataset: !0
|
412
|
+
};
|
413
|
+
else {
|
414
|
+
i = {
|
415
|
+
type: "Facet",
|
416
|
+
facet: u,
|
417
|
+
facetPropPath: "anatomy.organ.category.name",
|
418
|
+
facetSubPropPath: "anatomy.organ.name",
|
419
|
+
term: "Anatomical structure"
|
420
|
+
};
|
421
|
+
let f = /* @__PURE__ */ new Set();
|
422
|
+
n.feature["marker-terms"].forEach((m) => {
|
423
|
+
f.add(m.label);
|
424
|
+
}), f.add(u), f.size > 0 && (i = {
|
425
|
+
type: "Facets",
|
426
|
+
labels: [...f]
|
427
|
+
});
|
428
|
+
}
|
429
|
+
s = !0, e == "MultiFlatmap" && this.$refs.multiflatmap.getCurrentFlatmap().mapImp.clearSearchResults();
|
430
|
+
} else n.feature.type == "feature" && this.syncMode && (s = !0);
|
431
|
+
else n.eventType == "mouseenter" && (o.eventType = "highlighted", s = !0);
|
432
|
+
else e == "Scaffold" && (n && ((((r = n.data) == null ? void 0 : r.id) === void 0 || ((l = n.data) == null ? void 0 : l.id) === "") && (n.data.id = (c = n.data) == null ? void 0 : c.group), o.internalName = n.data.id, n.data.lastActionOnMarker === !0 && (i = {
|
433
|
+
type: "Facet",
|
434
|
+
facet: P(n.data.id),
|
435
|
+
facetPropPath: "anatomy.organ.category.name",
|
436
|
+
term: "Anatomical structure"
|
437
|
+
})), o.eventType = "selected", s = !0);
|
438
|
+
i && h.emit("PopoverActionClick", i), s && this.$emit("resource-selected", o);
|
439
|
+
},
|
440
|
+
resourceHasAction: function(e) {
|
441
|
+
return e.type === "URL" || e.type === "Search" || e.type === "Neuron Search" || e.type == "Facet" || e.type == "Facets";
|
442
|
+
},
|
443
|
+
/**
|
444
|
+
* Check if this viewer is currently visible
|
445
|
+
*/
|
446
|
+
isVisible: function() {
|
447
|
+
return this.splitFlowStore.getPaneNameById(this.entry.id) !== void 0;
|
448
|
+
},
|
449
|
+
displayTooltip: function() {
|
450
|
+
},
|
451
|
+
/**
|
452
|
+
* Get the term to zoom/highlight in a synchronisation event,
|
453
|
+
* if it cannot be found in the map, it will perform several
|
454
|
+
* calls to try to ge a valid name/id.
|
455
|
+
*/
|
456
|
+
getNameAndIdFromSyncData: async function(e) {
|
457
|
+
let t = e.internalName;
|
458
|
+
t === void 0 && e.resource && (t = e.resource.label);
|
459
|
+
let n;
|
460
|
+
if (e.resource && e.resource.resource && (n = e.resource.resource[0]), this.entry.type === "Scaffold") {
|
461
|
+
if (this.$refs.scaffold.findObjectsWithGroupName(t).length === 0) {
|
462
|
+
if (e.resource && e.resource.feature) {
|
463
|
+
const o = w(e.resource.feature.models);
|
464
|
+
if (o.length > 0) return o;
|
465
|
+
}
|
466
|
+
let s = A(t);
|
467
|
+
if (s)
|
468
|
+
return s;
|
469
|
+
if (n && e.eventType === "selected")
|
470
|
+
return fetch(`${this.apiLocation}get-related-terms/${n}`).then((o) => o.json()).then((o) => {
|
471
|
+
var a;
|
472
|
+
if (((a = o.uberon) == null ? void 0 : a.array.length) > 0)
|
473
|
+
return t = o.uberon.array[0].name.charAt(0).toUpperCase() + o.uberon.array[0].name.slice(1), n = o.uberon.array[0].id.toUpperCase(), { id: n, name: t };
|
474
|
+
});
|
475
|
+
}
|
476
|
+
} else if (this.entry.type === "MultiFlatmap")
|
477
|
+
if (t === "Bladder")
|
478
|
+
t = "Urinary Bladder";
|
479
|
+
else {
|
480
|
+
const i = w(t);
|
481
|
+
i.length > 0 && (t = i[0]);
|
482
|
+
}
|
483
|
+
return { id: n, name: t };
|
484
|
+
},
|
485
|
+
// Get the species and andaotmy info for the featured datasets
|
486
|
+
getDatasetAnatomyInfo: function(e) {
|
487
|
+
fetch(`${this.apiLocation}dataset_info/anatomy?identifier=${e}`).then((t) => t.json()).then((t) => {
|
488
|
+
const n = t.result[0];
|
489
|
+
let i;
|
490
|
+
try {
|
491
|
+
i = n.anatomy.organ[0].curie;
|
492
|
+
} catch {
|
493
|
+
i = void 0;
|
494
|
+
}
|
495
|
+
let s;
|
496
|
+
try {
|
497
|
+
s = n.item.curie;
|
498
|
+
} catch {
|
499
|
+
s = void 0;
|
500
|
+
}
|
501
|
+
let o;
|
502
|
+
try {
|
503
|
+
let a = 0, r = !1;
|
504
|
+
for (; !r && a < n.organisms.subject.length; ) {
|
505
|
+
const l = n.organisms.subject[a];
|
506
|
+
l.species && (o = l.species.name, r = !0), a += 1;
|
507
|
+
}
|
508
|
+
} catch {
|
509
|
+
o = void 0;
|
510
|
+
}
|
511
|
+
this.settingsStore.updateFeaturedMarker({
|
512
|
+
identifier: e,
|
513
|
+
marker: i,
|
514
|
+
doi: s,
|
515
|
+
species: o
|
516
|
+
});
|
517
|
+
});
|
518
|
+
},
|
519
|
+
// Check if the old featured dataset api has any info
|
520
|
+
oldFeaturedDatasetApiHasInfo: async function() {
|
521
|
+
let t = await (await fetch(`${this.apiLocation}get_featured_datasets_identifiers`)).json();
|
522
|
+
return !t.identifiers || t.identifiers.length == 0 ? !1 : t.identifiers;
|
523
|
+
},
|
524
|
+
// Check if the new featured dataset api has any info
|
525
|
+
newFeaturedDatasetApiHasInfo: async function() {
|
526
|
+
let t = await (await fetch(`${this.apiLocation}get_featured_dataset`)).json();
|
527
|
+
return !t.datasets || t.datasets.length == 0 ? !1 : t.datasets.map((n) => n.id);
|
528
|
+
},
|
529
|
+
/**
|
530
|
+
* Get a list of featured datasets to display.
|
531
|
+
*/
|
532
|
+
getFeaturedDatasets: async function() {
|
533
|
+
let e = [], t = await this.oldFeaturedDatasetApiHasInfo();
|
534
|
+
if (t) e = t;
|
535
|
+
else {
|
536
|
+
let n = await this.newFeaturedDatasetApiHasInfo();
|
537
|
+
n && (e = n);
|
538
|
+
}
|
539
|
+
this.settingsStore.updateFeatured(e), e.forEach((n) => {
|
540
|
+
this.getDatasetAnatomyInfo(n);
|
541
|
+
});
|
542
|
+
},
|
543
|
+
zoomToFeatures: function() {
|
544
|
+
},
|
545
|
+
handleSyncMouseEvent: async function(e) {
|
546
|
+
let t = await this.getNameAndIdFromSyncData(e);
|
547
|
+
e.eventType === "highlighted" ? this.highlightFeatures(t) : e.eventType === "selected" && this.displayTooltip(t);
|
548
|
+
},
|
549
|
+
/**
|
550
|
+
* Handle sync pan zoom event
|
551
|
+
*/
|
552
|
+
handleSyncPanZoomEvent: function() {
|
553
|
+
},
|
554
|
+
highlightFeatures: function() {
|
555
|
+
},
|
556
|
+
receiveSynchronisedEvent: async function(e) {
|
557
|
+
if (e.paneIndex !== this.entry.id)
|
558
|
+
e.eventType == "panZoom" || this.handleSyncMouseEvent(e);
|
559
|
+
else if (e.eventType == "selected") {
|
560
|
+
let t = await this.getNameAndIdFromSyncData(e);
|
561
|
+
this.zoomToFeatures(t, !1);
|
562
|
+
}
|
563
|
+
},
|
564
|
+
requestSynchronisedEvent: function() {
|
565
|
+
},
|
566
|
+
flatmapMarkerUpdate() {
|
567
|
+
},
|
568
|
+
onResize: function() {
|
569
|
+
},
|
570
|
+
startHelp: function() {
|
571
|
+
this.isInHelp === !1 && (this.helpMode = !0, window.addEventListener("mousedown", this.checkEndHelpMouseDown), this.isInHelp = !0);
|
572
|
+
},
|
573
|
+
endHelp: function() {
|
574
|
+
window.removeEventListener("mousedown", this.checkEndHelpMouseDown), this.helpMode = !1, setTimeout(() => {
|
575
|
+
this.isInHelp = !1;
|
576
|
+
}, 200);
|
577
|
+
},
|
578
|
+
onHelpModeShowNext: function() {
|
579
|
+
this.helpModeActiveItem += 1;
|
580
|
+
},
|
581
|
+
onHelpModeLastItem: function(e) {
|
582
|
+
e && (this.helpModeLastItem = !0);
|
583
|
+
},
|
584
|
+
onFinishHelpMode: function() {
|
585
|
+
this.helpMode = !1, this.helpModeActiveItem = 0, this.helpModeLastItem = !1;
|
586
|
+
},
|
587
|
+
onTooltipShown: function() {
|
588
|
+
this.$refs.multiflatmap && this.$refs.multiflatmapHelp && this.$refs.multiflatmapHelp.toggleTooltipHighlight(), this.$refs.flatmap && this.$refs.flatmapHelp && this.$refs.flatmapHelp.toggleTooltipHighlight(), this.$refs.scaffold && this.$refs.scaffoldHelp && this.$refs.scaffoldHelp.toggleTooltipHighlight();
|
589
|
+
},
|
590
|
+
onMapTooltipShown: function() {
|
591
|
+
this.$refs.multiflatmap && this.$refs.multiflatmapHelp && this.$refs.multiflatmapHelp.toggleTooltipPinHighlight(), this.$refs.flatmap && this.$refs.flatmapHelp && this.$refs.flatmapHelp.toggleTooltipPinHighlight(), this.$refs.scaffold && this.$refs.scaffoldHelp && this.$refs.scaffoldHelp.toggleTooltipPinHighlight();
|
592
|
+
},
|
593
|
+
/**
|
594
|
+
* End help-mode only if user clicks outside of help mode dialog.
|
595
|
+
*/
|
596
|
+
checkEndHelpMouseDown: function(e) {
|
597
|
+
e.target.closest(".help-mode-dialog") || this.endHelp();
|
598
|
+
},
|
599
|
+
flatmapHighlight: async function(e, t, n, i) {
|
600
|
+
let s = [...t, ...i];
|
601
|
+
const o = this.settingsStore.globalSettings;
|
602
|
+
if (o.highlightConnectedPaths) {
|
603
|
+
const a = t.length ? t : i.length ? i : [], r = await e.retrieveConnectedPaths(a);
|
604
|
+
r && s.push(...r);
|
605
|
+
}
|
606
|
+
if (o.highlightDOIPaths) {
|
607
|
+
const a = await e.searchConnectivitiesByReference(n);
|
608
|
+
a && s.push(...a);
|
609
|
+
}
|
610
|
+
return s = [...new Set(s)], s;
|
611
|
+
},
|
612
|
+
cardHoverHighlight: function() {
|
613
|
+
var e;
|
614
|
+
if (this.visible) {
|
615
|
+
const t = this.settingsStore.hoverAnatomies, n = this.settingsStore.hoverOrgans, i = this.settingsStore.hoverDOI, s = this.settingsStore.hoverConnectivity;
|
616
|
+
let o = null, a = null;
|
617
|
+
this.flatmapRef && (o = this.flatmapRef), this.multiflatmapRef && (o = this.multiflatmapRef.getCurrentFlatmap()), this.scaffoldRef && (a = this.scaffoldRef), clearTimeout(this.highlightDelay), !t.length && !n.length && !i && !s.length && ((this.multiflatmapRef || this.flatmapRef) && o ? (e = o.mapImp) == null || e.clearSearchResults() : this.scaffoldRef && a && a.changeHighlightedByName(n, "", !1)), this.highlightDelay = setTimeout(() => {
|
618
|
+
(t.length || n.length || i || s.length) && ((this.multiflatmapRef || this.flatmapRef) && o ? this.flatmapHighlight(o, t, i, s).then((r) => {
|
619
|
+
try {
|
620
|
+
o.zoomToFeatures(r);
|
621
|
+
} catch (l) {
|
622
|
+
console.log(l);
|
623
|
+
}
|
624
|
+
}) : this.scaffoldRef && a && a.changeHighlightedByName(n, "", !1));
|
625
|
+
}, 100);
|
626
|
+
}
|
627
|
+
},
|
628
|
+
onAnnotationOpen: function(e) {
|
629
|
+
h.emit("annotation-open", e);
|
630
|
+
},
|
631
|
+
onAnnotationClose: function() {
|
632
|
+
h.emit("annotation-close");
|
633
|
+
},
|
634
|
+
onConnectivityInfoOpen: function(e) {
|
635
|
+
h.emit("connectivity-info-open", e);
|
636
|
+
},
|
637
|
+
onConnectivityGraphError: function(e) {
|
638
|
+
h.emit("connectivity-graph-error", e);
|
639
|
+
},
|
640
|
+
loadConnectivityKnowledge: async function(e) {
|
641
|
+
const t = v(e), n = b(new $());
|
642
|
+
n.initialise(this.flatmapAPI);
|
643
|
+
const i = await H(e, n), s = e.uuid, o = await n.queryMapPaths(s), a = o ? o.paths : {};
|
644
|
+
this.connectivityKnowledge[s] = i.filter((r) => {
|
645
|
+
var l;
|
646
|
+
return !!(r.source === t && ((l = r.connectivity) != null && l.length) && r.id in a);
|
647
|
+
}), h.emit("connectivity-knowledge", { type: "default", data: this.connectivityKnowledge[s] });
|
648
|
+
},
|
649
|
+
getSearchedId: function(e, t) {
|
650
|
+
let n = [];
|
651
|
+
const i = e.mapImp.search(t);
|
652
|
+
return (i.__featureIds || i.featureIds).forEach((o) => {
|
653
|
+
var r;
|
654
|
+
const a = e.mapImp.annotation(o);
|
655
|
+
(r = a.label) != null && r.toLowerCase().includes(t.toLowerCase()) && a.models && !n.includes(a.models) && n.push(a.models);
|
656
|
+
}), n;
|
657
|
+
},
|
658
|
+
connectivityQueryFilter: async function(e, t) {
|
659
|
+
const n = e.mapImp.uuid;
|
660
|
+
let i = {
|
661
|
+
state: "default",
|
662
|
+
data: [...this.connectivityKnowledge[n]]
|
663
|
+
};
|
664
|
+
if (t && (t.type === "query-update" ? (this.query !== t.value && (this.target = []), this.query = t.value) : t.type === "filter-update" && (this.filter = t.value)), this.query) {
|
665
|
+
i.state = "processed";
|
666
|
+
let s = [], o = {};
|
667
|
+
const a = this.query.split(",").map((f) => f.trim());
|
668
|
+
for (let f = 0; f < a.length; f++)
|
669
|
+
s.push(this.getSearchedId(e, a[f]));
|
670
|
+
const r = await Promise.all(s), l = [...new Set(r.flat())];
|
671
|
+
let c = await e.retrieveConnectedPaths(l, o);
|
672
|
+
c = [...l, ...c.filter((f) => !l.includes(f))];
|
673
|
+
let u = this.connectivityKnowledge[n].filter((f) => c.includes(f.id));
|
674
|
+
u.sort((f, m) => c.indexOf(f.id) - c.indexOf(m.id)), i.data = u;
|
675
|
+
}
|
676
|
+
h.emit("connectivity-knowledge", i);
|
677
|
+
}
|
678
|
+
},
|
679
|
+
data: function() {
|
680
|
+
return {
|
681
|
+
apiLocation: void 0,
|
682
|
+
activeSpecies: "Human Male",
|
683
|
+
scaffoldCamera: void 0,
|
684
|
+
mainStyle: {
|
685
|
+
height: this.entry.datasetTitle ? "calc(100% - 30px)" : "100%",
|
686
|
+
width: "100%",
|
687
|
+
bottom: "0px"
|
688
|
+
},
|
689
|
+
helpMode: !1,
|
690
|
+
helpModeActiveItem: 0,
|
691
|
+
helpModeLastItem: !1,
|
692
|
+
multiflatmapRef: null,
|
693
|
+
flatmapRef: null,
|
694
|
+
scaffoldRef: null,
|
695
|
+
scaffoldLoaded: !1,
|
696
|
+
isInHelp: !1,
|
697
|
+
mapManager: void 0,
|
698
|
+
connectivityKnowledge: {},
|
699
|
+
query: "",
|
700
|
+
filter: [],
|
701
|
+
highlightDelay: void 0
|
702
|
+
};
|
703
|
+
},
|
704
|
+
created: function() {
|
705
|
+
this.flatmapAPI = void 0, this.apiLocation = void 0, this.settingsStore.flatmapAPI && (this.flatmapAPI = this.settingsStore.flatmapAPI), this.settingsStore.sparcApi && (this.apiLocation = this.settingsStore.sparcApi), this.settingsStore.mapManager && (this.mapManager = this.settingsStore.mapManager);
|
706
|
+
},
|
707
|
+
watch: {
|
708
|
+
helpMode: function(e) {
|
709
|
+
e || (this.helpModeActiveItem = 0);
|
710
|
+
}
|
711
|
+
}
|
712
|
+
};
|
713
|
+
export {
|
714
|
+
k as C
|
715
|
+
};
|