@abi-software/mapintegratedvuer 1.17.3-simulation.2 → 1.17.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.
Files changed (47) hide show
  1. package/dist/{ConnectivityGraph-9pXPgFJR.js → ConnectivityGraph-CNtSLKGZ.js} +19 -21
  2. package/dist/{ContentMixin-DIqgKIz6.js → ContentMixin-BImmmP1E.js} +521 -295
  3. package/dist/Flatmap-CakK_75H.js +202 -0
  4. package/dist/{Iframe-CCEA3d9c.js → Iframe-C7E9XJu7.js} +2 -2
  5. package/dist/{MultiFlatmap-Cuke1uNp.js → MultiFlatmap-DnDXuvTw.js} +3 -3
  6. package/dist/{Plot-B4oTBVAT.js → Plot-CxCj3uTj.js} +2 -2
  7. package/dist/Scaffold-D1NyLNzW.js +304 -0
  8. package/dist/Simulation-Br3Grrd6.js +28 -0
  9. package/dist/{index-_b4VBGHk.js → index-qyfmiqHe.js} +22862 -27602
  10. package/dist/mapintegratedvuer.js +1 -1
  11. package/dist/mapintegratedvuer.umd.cjs +232 -4291
  12. package/dist/style-DezYtA61.js +57 -0
  13. package/dist/style.css +1 -1
  14. package/package.json +5 -10
  15. package/src/App.vue +258 -285
  16. package/src/assets/styles.scss +1 -1
  17. package/src/components/ContextCard.vue +1 -0
  18. package/src/components/EventBus.js +3 -0
  19. package/src/components/MapContent.vue +4 -9
  20. package/src/components/SplitDialog.vue +6 -2
  21. package/src/components/SplitFlow.vue +445 -504
  22. package/src/components/scripts/utilities.js +1 -1
  23. package/src/components/viewers/ConnectivityGraph.vue +1 -9
  24. package/src/components/viewers/Flatmap.vue +83 -166
  25. package/src/components/viewers/Scaffold.vue +130 -78
  26. package/src/components/viewers/Simulation.vue +11 -118
  27. package/src/components.d.ts +0 -3
  28. package/src/main.js +3 -9
  29. package/src/mixins/ContentMixin.js +384 -496
  30. package/src/mixins/DynamicMarkerMixin.js +17 -50
  31. package/src/stores/connectivities.js +10 -1
  32. package/src/stores/entries.js +1 -1
  33. package/src/stores/settings.js +0 -4
  34. package/src/stores/splitFlow.js +352 -425
  35. package/dist/Flatmap-D7GVPV7o.js +0 -103422
  36. package/dist/Scaffold-Czz8X5kL.js +0 -310
  37. package/dist/Simulation-BKmz8zwm.js +0 -107
  38. package/dist/style-CM86xE3J.js +0 -119
  39. package/src/components/DummyRouteComponent.vue +0 -1
  40. package/src/components/EventBus.ts +0 -13
  41. package/src/components/FloatingWindow.vue +0 -142
  42. package/src/components/PlotComponent.vue +0 -56
  43. package/src/services/mapping.js +0 -69
  44. package/src/services/testData.js +0 -71
  45. package/src/stores/mapping.js +0 -29
  46. package/src/stores/simulationPlotStore.js +0 -124
  47. package/src/types/simulation.js +0 -18
@@ -1,21 +1,23 @@
1
- import { markRaw } from 'vue'
2
- import { getNerveNames, getParentsRegion } from '../components/SimulatedData.js'
3
- import EventBus from '../components/EventBus'
4
- import { mapStores } from 'pinia'
5
- import { useEntriesStore } from '../stores/entries'
6
- import { useSettingsStore } from '../stores/settings'
7
- import { useSplitFlowStore } from '../stores/splitFlow'
8
- import { useConnectivitiesStore } from '../stores/connectivities'
9
- import Tagging from '../services/tagging.js'
1
+ import { markRaw } from "vue";
2
+ import {
3
+ getNerveNames,
4
+ getParentsRegion,
5
+ } from "../components/SimulatedData.js";
6
+ import EventBus from "../components/EventBus";
7
+ import { mapStores } from 'pinia';
8
+ import { useEntriesStore } from '../stores/entries';
9
+ import { useSettingsStore } from '../stores/settings';
10
+ import { useSplitFlowStore } from '../stores/splitFlow';
11
+ import { useConnectivitiesStore } from '../stores/connectivities';
12
+ import Tagging from '../services/tagging.js';
10
13
 
11
- import { getFlatmapFilterOptions } from '@abi-software/map-utilities'
12
- import { FlatmapQueries } from '@abi-software/flatmapvuer'
13
- import { getKnowledgeSource, loadAndStoreKnowledge } from '@abi-software/flatmapvuer'
14
14
  import {
15
- getTermNerveMaps,
16
- getFilterOptions as getScaffoldFilterOptions,
17
- } from '@abi-software/scaffoldvuer/src/scripts/MappedNerves.js'
18
- import { defaultSpecies } from '../components/scripts/utilities.js'
15
+ getFlatmapFilterOptions,
16
+ } from '@abi-software/map-utilities'
17
+ import { FlatmapQueries } from "@abi-software/flatmapvuer/src/services/flatmapQueries.js";
18
+ import { getKnowledgeSource, loadAndStoreKnowledge } from "@abi-software/flatmapvuer/src/services/flatmapKnowledge.js";
19
+ import { getTermNerveMaps, getFilterOptions as getScaffoldFilterOptions } from "@abi-software/scaffoldvuer/src/scripts/MappedNerves.js";
20
+ import { defaultSpecies } from "../components/scripts/utilities.js";
19
21
 
20
22
  function capitalise(text) {
21
23
  return text[0].toUpperCase() + text.substring(1)
@@ -23,7 +25,7 @@ function capitalise(text) {
23
25
 
24
26
  /* eslint-disable no-alert, no-console */
25
27
  export default {
26
- emits: ['flatmap-provenance-ready', 'resource-selected', 'species-changed'],
28
+ emits: [ "flatmap-provenance-ready", "resource-selected", "species-changed"],
27
29
  props: {
28
30
  /**
29
31
  * Object containing information for
@@ -43,39 +45,38 @@ export default {
43
45
  computed: {
44
46
  ...mapStores(useEntriesStore, useSettingsStore, useSplitFlowStore, useConnectivitiesStore),
45
47
  idNamePair() {
46
- return this.splitFlowStore.idNamePair
48
+ return this.splitFlowStore.idNamePair;
47
49
  },
48
50
  useHelpModeDialog() {
49
- return this.settingsStore.useHelpModeDialog
51
+ return this.settingsStore.useHelpModeDialog;
50
52
  },
51
53
  connectivityInfoSidebar() {
52
- return this.settingsStore.connectivityInfoSidebar
54
+ return this.settingsStore.connectivityInfoSidebar;
53
55
  },
54
56
  annotationSidebar() {
55
- return this.settingsStore.annotationSidebar
57
+ return this.settingsStore.annotationSidebar;
56
58
  },
57
59
  // Hide local settings if global settings are shown
58
60
  showLocalSettings() {
59
- return !this.showGlobalSettings
61
+ return !this.showGlobalSettings;
60
62
  },
61
63
  },
62
- beforeUnmount: function () {
63
- this.alive = false
64
+ beforeUnmount: function() {
65
+ this.alive = false;
64
66
  },
65
67
  mounted: function () {
66
- this.multiflatmapRef = this.$refs.multiflatmap
67
- this.flatmapRef = this.$refs.flatmap
68
- this.scaffoldRef = this.$refs.scaffold
69
- this.iframeRef = this.$refs.iframe
70
- this.plotRef = this.$refs.plot
71
- this.simulationRef = this.$refs.simulation
68
+ this.multiflatmapRef = markRaw(this.$refs.multiflatmap);
69
+ this.flatmapRef = markRaw(this.$refs.flatmap);
70
+ this.iframeRef = markRaw(this.$refs.iframe);
71
+ this.plotRef = markRaw(this.$refs.plot);
72
+ this.simulationRef = markRaw(this.$refs.simulation);
72
73
  // load connectivity with mock human male flatmap
73
- if (this.scaffoldRef || this.iframeRef || this.plotRef || this.simulationRef) {
74
- this.loadExplorerConfig()
74
+ if (this.iframeRef || this.plotRef || this.simulationRef) {
75
+ this.loadExplorerConfig();
75
76
  }
76
- this.connectivityKnowledge = this.connectivitiesStore.globalConnectivities
77
- this.connectivityFilterOptions = this.connectivitiesStore.filterOptions
78
- this.connectivityFilterSources = this.connectivitiesStore.filterSources
77
+ this.connectivityKnowledge = this.connectivitiesStore.globalConnectivities;
78
+ this.connectivityFilterOptions = this.connectivitiesStore.filterOptions;
79
+ this.connectivityFilterSources = this.connectivitiesStore.filterSources;
79
80
  },
80
81
  methods: {
81
82
  toggleMinimap: function (option, prevState) {
@@ -86,15 +87,13 @@ export default {
86
87
  if (option === true) {
87
88
  // Only create minimap when it is not created before or destroyed
88
89
  if (prevState === false) {
89
- const minimapOptions = mapImp.options?.minimap || {
90
- position: 'top-right',
91
- }
92
- mapImp.createMinimap(minimapOptions)
93
- currentFlatmap.addResizeButtonToMinimap()
94
- currentFlatmap.minimapSmall = false
90
+ const minimapOptions = mapImp.options?.minimap || { position: 'top-right' };
91
+ mapImp.createMinimap(minimapOptions);
92
+ currentFlatmap.addResizeButtonToMinimap();
93
+ currentFlatmap.minimapSmall = false;
95
94
  }
96
95
  } else {
97
- mapImp.closeMinimap()
96
+ mapImp.closeMinimap();
98
97
  }
99
98
  }
100
99
  }
@@ -102,60 +101,60 @@ export default {
102
101
  onConnectivityItemClose() {
103
102
  if (this?.alive) {
104
103
  if (this.multiflatmapRef) {
105
- const currentFlatmap = this.multiflatmapRef.getCurrentFlatmap()
104
+ const currentFlatmap = this.multiflatmapRef.getCurrentFlatmap();
106
105
  if (currentFlatmap) {
107
- currentFlatmap.closeTooltip()
106
+ currentFlatmap.closeTooltip();
108
107
  }
109
108
  }
110
109
  if (this.flatmapRef) {
111
- this.flatmapRef.closeTooltip()
110
+ this.flatmapRef.closeTooltip();
112
111
  }
113
112
  }
114
113
  },
115
114
  getState: function () {
116
- return undefined
115
+ return undefined;
117
116
  },
118
117
  openMap: function (type) {
119
- EventBus.emit('OpenNewMap', type)
120
- this.trackOpenMap(`open_new_${type}_map`)
118
+ EventBus.emit("OpenNewMap", type);
119
+ this.trackOpenMap(`open_new_${type}_map`);
121
120
  },
122
121
  onMapmanagerLoaded: function (mapManager) {
123
- this.settingsStore.updateMapManager(mapManager)
122
+ this.settingsStore.updateMapManager(mapManager);
124
123
  },
125
124
  trackOpenMap: function (category) {
126
125
  // GA Tagging
127
126
  // Open map tracking
128
127
  Tagging.sendEvent({
129
- event: 'interaction_event',
130
- event_name: 'portal_maps_open_map',
131
- category: category,
132
- location: 'open_new_map',
133
- })
128
+ 'event': 'interaction_event',
129
+ 'event_name': 'portal_maps_open_map',
130
+ 'category': category,
131
+ 'location': 'open_new_map'
132
+ });
134
133
  },
135
- updateEntryLabel: function (label) {
134
+ updateEntryLabel: function(label) {
136
135
  if (label) {
137
- this.entriesStore.updateLabelForEntry(this.entry, label)
136
+ this.entriesStore.updateLabelForEntry(this.entry, label);
138
137
  }
139
138
  },
140
- updateEntryTitle: function (title) {
139
+ updateEntryTitle: function(title) {
141
140
  if (title) {
142
- this.entriesStore.updateTitleForEntry(this.entry, title)
141
+ this.entriesStore.updateTitleForEntry(this.entry, title);
143
142
  }
144
143
  },
145
- updateWithViewUrl: function () {
146
- return
144
+ updateWithViewUrl: function() {
145
+ return;
147
146
  },
148
147
  /**
149
148
  * Perform a local search on this contentvuer
150
149
  */
151
150
  search: function () {
152
- return false
151
+ return false;
153
152
  },
154
153
  /**
155
154
  * Get a list of search suggestions on this contentvuer
156
155
  */
157
156
  searchSuggestions: function () {
158
- return
157
+ return;
159
158
  },
160
159
  /**
161
160
  * Callback when the vuers emit a selected event.
@@ -164,206 +163,148 @@ export default {
164
163
  const resource = resources[0]
165
164
  // Skip processing if resources already has actions
166
165
  if (this.resourceHasAction(resource)) {
167
- EventBus.emit('PopoverActionClick', resource)
168
- return
166
+ EventBus.emit("PopoverActionClick", resource);
167
+ return;
169
168
  }
170
169
 
171
- let returnedAction = undefined
172
- let fireResourceSelected = false
170
+ let returnedAction = undefined;
171
+ let action = "none";
172
+ let fireResourceSelected = false;
173
173
  const result = {
174
174
  paneIndex: this.entry.id,
175
175
  type: type,
176
176
  resource: resources,
177
177
  internalName: undefined,
178
178
  eventType: undefined,
179
- }
179
+ };
180
180
 
181
- if (type == 'MultiFlatmap' || type == 'Flatmap') {
182
- result.internalName = resource?.feature?.label
183
- ? resource.feature.label
184
- : this.idNamePair[resource.feature.models]
185
- if (resource.eventType == 'click') {
186
- result.eventType = 'selected'
187
- if (resource.feature.type == 'marker') {
188
- let label = result.internalName
181
+ if (type == "MultiFlatmap" || type == "Flatmap") {
182
+ result.internalName = resource?.feature?.label ?
183
+ resource.feature.label : this.idNamePair[resource.feature.models];
184
+ if (resource.eventType == "click") {
185
+ result.eventType = "selected";
186
+ if (resource.feature.type == "marker") {
187
+ let label = result.internalName;
189
188
  // `resource.feature.id` is the marker identifier (not featureId or models)
190
189
  if (this.settingsStore.isFeaturedMarkerIdentifier(resource.feature.id)) {
191
190
  // It is a featured dataset search for DOI.
192
191
  returnedAction = {
193
- type: 'Search',
192
+ type: "Search",
194
193
  term: this.settingsStore.featuredMarkerDoi(resource.feature.id),
195
194
  featuredDataset: true,
196
- }
195
+ };
197
196
  } else {
198
- if (resource.protocol) {
199
- let term = resource.feature.models ? resource.feature.models : resource.feature.variable;
200
- if (!term && this.markerToUberonID) {
201
- term = this.markerToUberonID[resource.feature.id]
202
- }
203
- returnedAction = {
204
- type: 'ProtocolSearch',
205
- protocol: resource.protocol,
206
- term: term,
197
+ // Facet search on anatomy if it is not a keyword search
198
+ returnedAction = {
199
+ type: "Facet",
200
+ facets: [label],
201
+ };
202
+ let labels = new Set();
203
+ // 'marker-terms' changed to 'dataset-terms' in flatmap-viewer@4.3.5
204
+ resource.feature['dataset-terms'].forEach((term) => {
205
+ labels.add(term.label ? term.label : term.term);
206
+ });
207
+ if (labels.size === 0) {
208
+ labels.add(label);
209
+ }
210
+ returnedAction.facets = [...labels];
211
+ // The number of current level labels will reduce as zoom in flatmap
212
+ if (
213
+ this.settingsStore.hasAppliedFacets(labels) &&
214
+ this.settingsStore.appliedFacets.length <= labels.size
215
+ ) {
216
+ return;
217
+ }
218
+ /* Add to the filter list as and if there is selected facets */
219
+ if (this.settingsStore.appliedFacets.length) {
220
+ if (!this.settingsStore.hasAppliedFacets(labels)) {
221
+ const newFacets = [...new Set([
222
+ ...this.settingsStore.appliedFacets,
223
+ ...labels
224
+ ])];
225
+ this.settingsStore.updateAppliedFacets(newFacets);
207
226
  }
208
227
  } else {
209
- // Facet search on anatomy if it is not a keyword search
210
- returnedAction = {
211
- type: 'Facet',
212
- facets: [label],
228
+ if (labels.size > 1) {
229
+ returnedAction.type = "Facets";
213
230
  }
214
- let labels = new Set()
215
- // 'marker-terms' changed to 'dataset-terms' in flatmap-viewer@4.3.5
216
- resource.feature['dataset-terms'].forEach((term) => {
217
- labels.add(term.label ? term.label : term.term)
218
- })
219
- if (labels.size === 0) {
220
- labels.add(label)
221
- }
222
- returnedAction.facets = [...labels]
223
- // The number of current level labels will reduce as zoom in flatmap
224
- if (
225
- this.settingsStore.hasAppliedFacets(labels) &&
226
- this.settingsStore.appliedFacets.length <= labels.size
227
- ) {
228
- return
229
- }
230
- /* Add to the filter list as and if there is selected facets */
231
- if (this.settingsStore.appliedFacets.length) {
232
- if (!this.settingsStore.hasAppliedFacets(labels)) {
233
- const newFacets = [...new Set([...this.settingsStore.appliedFacets, ...labels])]
234
- this.settingsStore.updateAppliedFacets(newFacets)
235
- }
236
- } else {
237
- if (labels.size > 1) {
238
- returnedAction.type = 'Facets'
239
- }
240
- this.settingsStore.updateAppliedFacets(returnedAction.facets)
241
- }
242
- }
243
- fireResourceSelected = true
244
- if (type == 'MultiFlatmap') {
245
- const flatmap = this.$refs.multiflatmap.getCurrentFlatmap().mapImp
246
- flatmap.clearSearchResults()
231
+ this.settingsStore.updateAppliedFacets(returnedAction.facets);
247
232
  }
248
233
  }
234
+ fireResourceSelected = true;
235
+ if (type == "MultiFlatmap") {
236
+ const flatmap = this.$refs.multiflatmap.getCurrentFlatmap().mapImp;
237
+ flatmap.clearSearchResults();
238
+ }
249
239
  }
250
- } else if (resource.eventType == 'mouseenter') {
251
- result.eventType = 'highlighted'
252
- fireResourceSelected = true
240
+ } else if (resource.eventType == "mouseenter") {
241
+ result.eventType = "highlighted";
242
+ fireResourceSelected = true;
253
243
  }
254
- } else if (type == 'Scaffold') {
244
+ } else if (type == "Scaffold") {
255
245
  if (resource) {
256
- if (resource.data?.id === undefined || resource.data?.id === '') {
257
- resource.data.id = resource.data?.group
246
+ if (resource.data?.id === undefined || resource.data?.id === "") {
247
+ resource.data.id = resource.data?.group;
258
248
  }
259
- result.internalName = resource.data.id
249
+ result.internalName = resource.data.id;
260
250
  // Facet search if marker is clicked
261
251
  if (resource.data.lastActionOnMarker === true) {
262
252
  returnedAction = {
263
- type: 'Facet',
253
+ type: "Facet",
264
254
  facets: [capitalise(resource.data.id)],
265
- }
255
+ };
266
256
  }
267
257
  }
268
- result.eventType = 'selected'
269
- fireResourceSelected = true
258
+ result.eventType = "selected";
259
+ fireResourceSelected = true;
260
+ action = "search";
270
261
  }
271
- if (returnedAction) EventBus.emit('PopoverActionClick', returnedAction)
272
- if (fireResourceSelected) this.$emit('resource-selected', result)
262
+ if (returnedAction) EventBus.emit("PopoverActionClick", returnedAction);
263
+ if (fireResourceSelected) this.$emit("resource-selected", result);
273
264
  },
274
265
  resourceHasAction: function (resource) {
275
266
  return (
276
- resource &&
277
- (resource.type === 'URL' ||
278
- resource.type === 'Search' ||
279
- resource.type === 'Neuron Search' ||
280
- resource.type == 'Facet' ||
281
- resource.type == 'Facets')
282
- )
283
- },
284
- /**
285
- * Get the term to zoom/highlight in a synchronisation event,
286
- * if it cannot be found in the map, it will perform several
287
- * calls to try to ge a valid name/id.
288
- */
289
- getNameAndIdFromSyncData: async function (data) {
290
- let name = data.internalName
291
- if (name === undefined && data.resource) {
292
- name = data.resource.label
293
- }
294
- let id = undefined
295
- if (data.resource && data.resource.resource) {
296
- id = data.resource.resource[0]
297
- }
298
- if (this.entry.type === 'Scaffold') {
299
- const objects = this.$refs.scaffold.findObjectsWithGroupName(name)
300
- // If a region is not found use a hardcoded list to determine
301
- // its parents region first
302
- if (objects.length === 0) {
303
- //Use nerve mapping
304
- if (data.resource && data.resource.feature) {
305
- const matched = getNerveNames(data.resource.feature.models)
306
- if (matched.length > 0) return matched
307
- }
308
- let matched = getParentsRegion(name)
309
- if (matched) {
310
- return matched
311
- }
312
- // Hardcoded list failed - use an endpoint to find its parents
313
- if (id && data.eventType === 'selected') {
314
- return fetch(`${this.apiLocation}get-related-terms/${id}`)
315
- .then((response) => response.json())
316
- .then((data) => {
317
- if (data.uberon?.array.length > 0) {
318
- name = data.uberon.array[0].name.charAt(0).toUpperCase() + data.uberon.array[0].name.slice(1)
319
- id = data.uberon.array[0].id.toUpperCase()
320
- return { id, name }
321
- }
322
- })
323
- }
324
- }
325
- } else if (this.entry.type === 'MultiFlatmap') {
326
- if (name === 'Bladder') {
327
- name = 'Urinary Bladder'
328
- } else {
329
- const matched = getNerveNames(name)
330
- if (matched.length > 0) name = matched[0]
331
- }
332
- }
333
- return { id, name }
267
+ resource && (
268
+ resource.type === "URL" ||
269
+ resource.type === "Search" ||
270
+ resource.type === "Neuron Search" ||
271
+ resource.type == "Facet" ||
272
+ resource.type == "Facets"
273
+ )
274
+ );
334
275
  },
335
276
  // Get the species and andaotmy info for the featured datasets
336
277
  getDatasetAnatomyInfo: function (identifier) {
337
278
  fetch(`${this.apiLocation}dataset_info/anatomy?identifier=${identifier}`)
338
- .then((response) => response.json())
339
- .then((data) => {
340
- const resultPayload = data.result[0]
341
- let markerCurie
279
+ .then(response => response.json())
280
+ .then(data => {
281
+ const resultPayload = data.result[0];
282
+ let markerCurie;
342
283
  try {
343
- markerCurie = resultPayload.anatomy.organ[0].curie
284
+ markerCurie = resultPayload.anatomy.organ[0].curie;
344
285
  } catch (error) {
345
- markerCurie = undefined
286
+ markerCurie = undefined;
346
287
  }
347
- let markerDoi
288
+ let markerDoi;
348
289
  try {
349
- markerDoi = resultPayload.item.curie
290
+ markerDoi = resultPayload.item.curie;
350
291
  } catch (error) {
351
- markerDoi = undefined
292
+ markerDoi = undefined;
352
293
  }
353
- let markerSpecies
294
+ let markerSpecies;
354
295
  try {
355
- let index = 0
356
- let found = false
296
+ let index = 0;
297
+ let found = false;
357
298
  while (!found && index < resultPayload.organisms.subject.length) {
358
- const entry = resultPayload.organisms.subject[index]
299
+ const entry = resultPayload.organisms.subject[index];
359
300
  if (entry.species) {
360
- markerSpecies = entry.species.name
361
- found = true
301
+ markerSpecies = entry.species.name;
302
+ found = true;
362
303
  }
363
- index += 1
304
+ index += 1;
364
305
  }
365
306
  } catch (error) {
366
- markerSpecies = undefined
307
+ markerSpecies = undefined;
367
308
  }
368
309
  // can test the featured marker by uncommenting the line below:
369
310
  // markerSpecies = "Rat"
@@ -372,17 +313,17 @@ export default {
372
313
  marker: markerCurie,
373
314
  doi: markerDoi,
374
315
  species: markerSpecies,
375
- })
376
- })
316
+ });
317
+ });
377
318
  },
378
319
  // Check if the old featured dataset api has any info
379
320
  oldFeaturedDatasetApiHasInfo: async function () {
380
321
  let response = await fetch(`${this.apiLocation}get_featured_datasets_identifiers`)
381
322
  let data = await response.json()
382
323
  if (!data.identifiers || data.identifiers.length == 0) {
383
- return false
324
+ return false;
384
325
  } else {
385
- return data.identifiers
326
+ return data.identifiers;
386
327
  }
387
328
  },
388
329
  // Check if the new featured dataset api has any info
@@ -390,219 +331,182 @@ export default {
390
331
  let response = await fetch(`${this.apiLocation}get_featured_dataset`)
391
332
  let data = await response.json()
392
333
  if (!data.datasets || data.datasets.length == 0) {
393
- return false
334
+ return false;
394
335
  } else {
395
- return data.datasets.map((d) => d.id)
336
+ return data.datasets.map(d => d.id);
396
337
  }
397
338
  },
398
339
  flatmapResourceSelected: function (type, resources) {
399
- this.resourceSelected(type, resources)
340
+ this.resourceSelected(type, resources);
400
341
 
401
- const firstResource = resources[0]
402
- const { eventType, feature } = firstResource
403
- const { viewingMode } = this.settingsStore.globalSettings
342
+ const firstResource = resources[0];
343
+ const { eventType, feature } = firstResource;
344
+ const { viewingMode } = this.settingsStore.globalSettings;
404
345
 
405
346
  if (eventType === 'click' && feature.type === 'feature' && feature.models?.startsWith('ilxtr:')) {
406
347
  // Use only models data for GA tagging
407
348
  // There is character limit (100 characters) for event parameter value in GA
408
- const categories = []
409
- resources.forEach((resource) => {
410
- const { models } = resource.feature
411
- categories.push(models)
412
- })
349
+ const categories = [];
350
+ resources.forEach(resource => {
351
+ const { models } = resource.feature;
352
+ categories.push(models);
353
+ });
413
354
 
414
355
  Tagging.sendEvent({
415
- event: 'interaction_event',
416
- event_name: 'portal_maps_connectivity',
417
- category: categories.join(', '),
418
- location: type + ' ' + viewingMode,
419
- })
420
- }
421
- if (eventType === 'click' && feature.type === 'feature' && type === 'Flatmap') {
422
-
423
- let component = undefined;
424
- let variable = undefined;
425
- if (feature && feature.variable) {
426
- const components = feature.variable.split("/");
427
- if (components.length === 1) {
428
- variable = components[0]
429
- }
430
- if (components.length === 2) {
431
- component = components[0]
432
- variable = components[1]
433
- }
434
-
435
- }
436
- //Use the hard code list if variable is not available
437
- if (!variable) {
438
- const data = this.mappingStore.mapToCellMLIdentifiers(feature.mapUUID, feature.id)
439
- component = data?.component
440
- variable = data?.variable
441
- }
442
- if (!component || !variable) {
443
- return // No mapping found, do not proceed with the simulation request
444
- }
445
-
446
- const simulationDataRequest = {
447
- component,
448
- featureId: feature.id,
449
- label: feature.label,
450
- mapId: feature.mapUUID,
451
- offset: { left: 15, top: 15 },
452
- ownerId: this.entry.id,
453
- position: { x: this.elementX + this.left, y: this.elementY + this.top },
454
- protocol: firstResource.protocol,
455
- variable,
456
- windowId: `simulation-window-${this.entry.id}-${component}-${variable}`,
457
- }
458
- this.simulationPlotStore.requestSimulation(simulationDataRequest)
356
+ 'event': 'interaction_event',
357
+ 'event_name': 'portal_maps_connectivity',
358
+ 'category': categories.join(', '),
359
+ "location": type + ' ' + viewingMode
360
+ });
459
361
  }
460
362
  },
461
363
  /**
462
364
  * Get a list of featured datasets to display.
463
365
  */
464
366
  getFeaturedDatasets: async function () {
465
- let datasetIds = []
367
+ let datasetIds = [];
466
368
 
467
369
  // Check the two api endpoints for featured datasets, old one first
468
- let oldInfo = await this.oldFeaturedDatasetApiHasInfo()
469
- if (oldInfo) datasetIds = oldInfo
370
+ let oldInfo = await this.oldFeaturedDatasetApiHasInfo();
371
+ if (oldInfo) datasetIds = oldInfo;
470
372
  else {
471
- let newInfo = await this.newFeaturedDatasetApiHasInfo()
472
- if (newInfo) datasetIds = newInfo
373
+ let newInfo = await this.newFeaturedDatasetApiHasInfo();
374
+ if (newInfo) datasetIds = newInfo;
473
375
  }
474
376
  // Update the store with the new list of featured datasets
475
- this.settingsStore.updateFeatured(datasetIds)
476
- datasetIds.forEach((element) => {
377
+ this.settingsStore.updateFeatured(datasetIds);
378
+ datasetIds.forEach(element => {
477
379
  this.getDatasetAnatomyInfo(element)
478
- })
380
+ });
479
381
  },
480
382
  flatmapMarkerUpdate() {
481
- return
383
+ return;
482
384
  },
483
385
  onResize: function () {
484
- return
386
+ return;
485
387
  },
486
- updateViewerSettings: function () {
487
- return
388
+ updateViewerSettings: function() {
389
+ return;
488
390
  },
489
391
  startHelp: function () {
490
392
  if (this?.alive) {
491
393
  if (this.isInHelp === false) {
492
- this.helpMode = true
493
- window.addEventListener('mousedown', this.checkEndHelpMouseDown)
494
- this.isInHelp = true
394
+ this.helpMode = true;
395
+ window.addEventListener("mousedown", this.checkEndHelpMouseDown);
396
+ this.isInHelp = true;
495
397
  }
496
398
  }
497
399
  },
498
400
  endHelp: function () {
499
- window.removeEventListener('mousedown', this.checkEndHelpMouseDown)
500
- this.helpMode = false
401
+ window.removeEventListener("mousedown", this.checkEndHelpMouseDown);
402
+ this.helpMode = false;
501
403
  setTimeout(() => {
502
- this.isInHelp = false
503
- }, 200)
404
+ this.isInHelp = false;
405
+ }, 200);
504
406
  },
505
407
  onHelpModeShowNext: function () {
506
- this.helpModeActiveItem += 1
408
+ this.helpModeActiveItem += 1;
507
409
  },
508
410
  onHelpModeLastItem: function (isLastItem) {
509
411
  if (isLastItem) {
510
- this.helpModeLastItem = true
412
+ this.helpModeLastItem = true;
511
413
  }
512
414
  },
513
415
  onFinishHelpMode: function () {
514
- this.helpMode = false
416
+ this.helpMode = false;
515
417
  // reset help mode to default values
516
- this.helpModeActiveItem = 0
517
- this.helpModeLastItem = false
418
+ this.helpModeActiveItem = 0;
419
+ this.helpModeLastItem = false;
518
420
  },
519
421
  onTooltipShown: function () {
520
422
  if (this.$refs.multiflatmap && this.$refs.multiflatmapHelp) {
521
- this.$refs.multiflatmapHelp.toggleTooltipHighlight()
423
+ this.$refs.multiflatmapHelp.toggleTooltipHighlight();
522
424
  }
523
425
 
524
426
  if (this.$refs.flatmap && this.$refs.flatmapHelp) {
525
- this.$refs.flatmapHelp.toggleTooltipHighlight()
427
+ this.$refs.flatmapHelp.toggleTooltipHighlight();
526
428
  }
527
429
 
528
430
  if (this.$refs.scaffold && this.$refs.scaffoldHelp) {
529
- this.$refs.scaffoldHelp.toggleTooltipHighlight()
431
+ this.$refs.scaffoldHelp.toggleTooltipHighlight();
530
432
  }
531
433
  },
532
434
  onMapTooltipShown: function () {
533
435
  if (this.$refs.multiflatmap && this.$refs.multiflatmapHelp) {
534
- this.$refs.multiflatmapHelp.toggleTooltipPinHighlight()
436
+ this.$refs.multiflatmapHelp.toggleTooltipPinHighlight();
535
437
  }
536
438
 
537
439
  if (this.$refs.flatmap && this.$refs.flatmapHelp) {
538
- this.$refs.flatmapHelp.toggleTooltipPinHighlight()
440
+ this.$refs.flatmapHelp.toggleTooltipPinHighlight();
539
441
  }
540
442
 
541
443
  if (this.$refs.scaffold && this.$refs.scaffoldHelp) {
542
- this.$refs.scaffoldHelp.toggleTooltipPinHighlight()
444
+ this.$refs.scaffoldHelp.toggleTooltipPinHighlight();
543
445
  }
544
446
  },
545
447
  /**
546
448
  * End help-mode only if user clicks outside of help mode dialog.
547
449
  */
548
450
  checkEndHelpMouseDown: function (e) {
549
- const el = e.target
451
+ const el = e.target;
550
452
  if (!el.closest('.help-mode-dialog')) {
551
- this.endHelp()
453
+ this.endHelp();
552
454
  }
553
455
  },
554
456
  flatmapHighlight: async function (flatmap, hoverAnatomies, hoverDOI, hoverConnectivity) {
555
- let toHighlight = [...hoverAnatomies, ...hoverConnectivity]
556
- const globalSettings = this.settingsStore.globalSettings
457
+ let toHighlight = [...hoverAnatomies, ...hoverConnectivity];
458
+ const globalSettings = this.settingsStore.globalSettings;
557
459
 
558
460
  // to highlight connected paths
559
461
  if (globalSettings.highlightConnectedPaths) {
560
- const hoverEntry = hoverAnatomies.length ? hoverAnatomies : hoverConnectivity.length ? hoverConnectivity : []
561
- const connectedPaths = await flatmap.retrieveConnectedPaths(hoverEntry)
462
+ const hoverEntry = hoverAnatomies.length ? hoverAnatomies :
463
+ hoverConnectivity.length ? hoverConnectivity :
464
+ []
465
+ const connectedPaths = await flatmap.retrieveConnectedPaths(hoverEntry);
562
466
  if (connectedPaths) {
563
- toHighlight.push(...connectedPaths)
467
+ toHighlight.push(...connectedPaths);
564
468
  }
565
469
  }
566
470
 
567
471
  // to highlight related paths from reference DOI
568
472
  if (globalSettings.highlightDOIPaths) {
569
- const connectionsFromDOI = await flatmap.searchConnectivitiesByReference(hoverDOI)
473
+ const connectionsFromDOI = await flatmap.searchConnectivitiesByReference(hoverDOI);
570
474
  if (connectionsFromDOI) {
571
- toHighlight.push(...connectionsFromDOI)
475
+ toHighlight.push(...connectionsFromDOI);
572
476
  }
573
477
  }
574
- toHighlight = [...new Set(toHighlight)]
575
- return toHighlight
478
+ toHighlight = [...new Set(toHighlight)];
479
+ return toHighlight;
576
480
  },
577
481
  sidebarHoverHighlight: function (payload) {
578
- if (
579
- this.visible &&
580
- (((this.flatmapRef || this.multiflatmapRef) && this.flatmapReady) || (this.scaffoldRef && this.scaffoldLoaded))
482
+ if (this.visible && (
483
+ ((this.flatmapRef || this.multiflatmapRef) && this.flatmapReady) ||
484
+ (this.scaffoldRef && this.scaffoldLoaded))
581
485
  ) {
582
- const hoverAnatomies = this.settingsStore.hoverAnatomies
583
- const hoverOrgans = this.settingsStore.hoverOrgans
584
- const hoverDOI = this.settingsStore.hoverDOI
585
- const hoverConnectivity = this.settingsStore.hoverConnectivity
486
+ const hoverAnatomies = this.settingsStore.hoverAnatomies;
487
+ const hoverOrgans = this.settingsStore.hoverOrgans;
488
+ const hoverDOI = this.settingsStore.hoverDOI;
489
+ const hoverConnectivity = this.settingsStore.hoverConnectivity;
586
490
 
587
- let flatmap = null
588
- let scaffold = null
589
- if (this.flatmapRef) flatmap = this.flatmapRef
590
- if (this.multiflatmapRef) flatmap = this.multiflatmapRef.getCurrentFlatmap()
591
- if (this.scaffoldRef) scaffold = this.scaffoldRef
491
+ let flatmap = null;
492
+ let scaffold = null;
493
+ if (this.flatmapRef) flatmap = this.flatmapRef;
494
+ if (this.multiflatmapRef) flatmap = this.multiflatmapRef.getCurrentFlatmap();
495
+ if (this.scaffoldRef) scaffold = this.scaffoldRef;
592
496
 
593
497
  // reset
594
- clearTimeout(this.highlightDelay)
498
+ clearTimeout(this.highlightDelay);
595
499
  if (!hoverAnatomies.length && !hoverOrgans.length && !hoverDOI && !hoverConnectivity.length) {
596
500
  if ((this.multiflatmapRef || this.flatmapRef) && flatmap) {
597
501
  if (flatmap.mapImp && !flatmap.mapImp.contextLost) {
598
- flatmap.mapImp?.clearSearchResults()
502
+ flatmap.mapImp?.clearSearchResults();
599
503
  if (payload.connectivityProcessed) {
600
504
  // grey out all connectivity if no search results
601
505
  flatmap.mapImp?.setPaint({ dimmed: true })
602
506
  }
603
507
  }
604
508
  } else if (this.scaffoldRef && scaffold) {
605
- scaffold.changeHighlightedByName(hoverOrgans, '', false)
509
+ scaffold.changeHighlightedByName(hoverOrgans, "", false);
606
510
  }
607
511
  }
608
512
 
@@ -613,275 +517,254 @@ export default {
613
517
  try {
614
518
  flatmap.showConnectivityTooltips({
615
519
  connectivityInfo: { featureId: paths },
616
- data: [],
617
- })
520
+ data: []
521
+ });
618
522
  } catch (error) {
523
+ console.log(error)
619
524
  // only for connectivity hover highlight
620
525
  if (hoverConnectivity.length && flatmap.mapImp) {
621
- const uuid = flatmap.mapImp.uuid
526
+ const uuid = flatmap.mapImp.uuid;
622
527
  const found = paths.every((path) =>
623
- this.connectivityKnowledge[uuid].some((connectivity) => connectivity.id === path)
624
- )
528
+ this.connectivityKnowledge[uuid].some((connectivity) =>
529
+ connectivity.id === path
530
+ )
531
+ );
625
532
  if (!found) {
626
533
  if (flatmap.mapImp && !flatmap.mapImp.contextLost) {
627
- flatmap.mapImp.clearSearchResults()
534
+ flatmap.mapImp.clearSearchResults();
628
535
  }
629
536
  }
630
537
  }
631
538
  }
632
- })
539
+ });
633
540
  } else if (this.scaffoldRef && scaffold) {
634
- scaffold.changeHighlightedByName(hoverOrgans, '', false)
541
+ scaffold.changeHighlightedByName(hoverOrgans, "", false);
635
542
  }
636
543
  }
637
- }, 100)
544
+ }, 100);
638
545
  }
639
546
  },
640
547
  onAnnotationOpen: function (payload) {
641
- EventBus.emit('annotation-open', payload)
548
+ EventBus.emit('annotation-open', payload);
642
549
  },
643
550
  onAnnotationClose: function () {
644
- EventBus.emit('sidebar-annotation-close')
551
+ EventBus.emit('sidebar-annotation-close');
645
552
  },
646
553
  updateOfflineAnnotationEnabled: function (payload) {
647
- EventBus.emit('update-offline-annotation-enabled', payload)
554
+ EventBus.emit('update-offline-annotation-enabled', payload);
648
555
  },
649
556
  onConnectivityInfoOpen: function (connectivityInfoData) {
650
- EventBus.emit('connectivity-info-open', connectivityInfoData)
557
+ EventBus.emit('connectivity-info-open', connectivityInfoData);
651
558
  },
652
559
  onConnectivityError: function (errorInfo) {
653
- EventBus.emit('connectivity-error', errorInfo)
560
+ EventBus.emit('connectivity-error', errorInfo);
654
561
  },
655
562
  onConnectivityInfoClose: function () {
656
- EventBus.emit('connectivity-info-close')
563
+ EventBus.emit('connectivity-info-close');
657
564
  },
658
- onSidebarAnnotationClose: function () {
659
- return
565
+ onSidebarAnnotationClose: function() {
566
+ return;
660
567
  },
661
568
  onNeuronConnectionFeatureClick: function (payload) {
662
- EventBus.emit('neuron-connection-feature-click', payload)
569
+ EventBus.emit('neuron-connection-feature-click', payload);
663
570
  },
664
- showConnectivity: function () {
665
- return
571
+ showConnectivity: function() {
572
+ return;
666
573
  },
667
574
  showConnectivityTooltips: function () {
668
- return
575
+ return;
669
576
  },
670
- setVisibilityFilter: function () {
671
- return
577
+ setVisibilityFilter: function() {
578
+ return;
672
579
  },
673
580
  loadExplorerConfig: async function () {
674
- this.flatmapService = await this.mockUpFlatmapService()
675
- this.loadConnectivityExplorerConfig(this.flatmapService)
581
+ this.flatmapService = await this.mockUpFlatmapService();
582
+ this.loadConnectivityExplorerConfig(this.flatmapService);
676
583
  },
677
- mockUpFlatmapService: async function () {
678
- const flatmapResponse = await fetch(this.flatmapAPI)
679
- const flatmapJson = await flatmapResponse.json()
584
+ mockUpFlatmapService: async function() {
585
+ const flatmapResponse = await fetch(this.flatmapAPI);
586
+ const flatmapJson = await flatmapResponse.json();
680
587
  const latestFlatmap = flatmapJson
681
- .filter((f) => f.id === 'human-flatmap_male')
682
- .sort((a, b) => b.created.localeCompare(a.created))[0]
683
- const flatmapUuid = latestFlatmap.uuid
684
- const flatmapSource = latestFlatmap.sckan['knowledge-source']
685
- const pathwaysResponse = await fetch(`${this.flatmapAPI}/flatmap/${flatmapUuid}/pathways`)
686
- const pathwaysJson = await pathwaysResponse.json()
588
+ .filter(f => f.id === 'human-flatmap_male')
589
+ .sort((a, b) => b.created.localeCompare(a.created))[0];
590
+ const flatmapUuid = latestFlatmap.uuid;
591
+ const flatmapSource = latestFlatmap.sckan['knowledge-source'];
592
+ const pathwaysResponse = await fetch(`${this.flatmapAPI}/flatmap/${flatmapUuid}/pathways`);
593
+ const pathwaysJson = await pathwaysResponse.json();
687
594
 
688
- this.flatmapQueries = markRaw(new FlatmapQueries())
689
- this.flatmapQueries.initialise(this.flatmapAPI)
595
+ this.flatmapQueries = markRaw(new FlatmapQueries());
596
+ this.flatmapQueries.initialise(this.flatmapAPI);
690
597
 
691
598
  const mapImp = {
692
- mapMetadata: {
693
- uuid: flatmapUuid,
694
- connectivity: {
599
+ 'mapMetadata': {
600
+ 'uuid': flatmapUuid,
601
+ 'connectivity': {
695
602
  ...latestFlatmap.sckan,
696
603
  },
697
604
  },
698
- pathways: pathwaysJson,
699
- resource: this.entry.resource,
605
+ 'pathways': pathwaysJson,
606
+ 'resource': this.entry.resource,
700
607
  knowledgeSource: flatmapSource,
701
- queryKnowledge: async (keastId) => {
702
- const sql =
703
- 'select knowledge from knowledge where (source=? or source is null) and entity=? order by source desc'
704
- const params = [flatmapSource, keastId]
705
- const response = await this.flatmapQueries.queryKnowledge(sql, params)
706
- return JSON.parse(response)
608
+ queryKnowledge : async (keastId) => {
609
+ const sql = 'select knowledge from knowledge where (source=? or source is null) and entity=? order by source desc';
610
+ const params = [flatmapSource, keastId];
611
+ const response = await this.flatmapQueries.queryKnowledge(sql, params);
612
+ return JSON.parse(response);
707
613
  },
708
- queryLabels: async (entities) => {
709
- const sql = `select source, entity, knowledge from knowledge where (source=? or source is null) and entity in (?${', ?'.repeat(
710
- entities.length - 1
711
- )}) order by entity, source desc`
712
- const params = [flatmapSource, ...entities]
713
- const response = await this.flatmapQueries.queryKnowledge(sql, params)
714
- const entityLabels = []
715
- let last_entity
614
+ queryLabels : async (entities) => {
615
+ const sql = `select source, entity, knowledge from knowledge where (source=? or source is null) and entity in (?${', ?'.repeat(entities.length-1)}) order by entity, source desc`;
616
+ const params = [flatmapSource, ...entities];
617
+ const response = await this.flatmapQueries.queryKnowledge(sql, params);
618
+ const entityLabels = [];
619
+ let last_entity;
716
620
  for (const row of response) {
717
- if (row[1] !== last_entity) {
718
- const knowledge = JSON.parse(row[2])
719
- entityLabels.push({
720
- entity: row[1],
721
- label: knowledge['label'] || row[1],
722
- })
723
- last_entity = row[1]
724
- }
621
+ if (row[1] !== last_entity) {
622
+ const knowledge = JSON.parse(row[2]);
623
+ entityLabels.push({
624
+ entity: row[1],
625
+ label: knowledge['label'] || row[1]
626
+ })
627
+ last_entity = row[1];
628
+ }
725
629
  }
726
- return entityLabels
630
+ return entityLabels;
727
631
  },
728
- }
632
+ };
729
633
 
730
- const scaffoldFilterOptions = getScaffoldFilterOptions()
634
+ const scaffoldFilterOptions = getScaffoldFilterOptions();
731
635
  const combinedFilterOptions = async (flatmapImp, providedKnowledge) => {
732
- const providedPathways = undefined
733
- const flatmapFilterOptions = await getFlatmapFilterOptions(
734
- this.flatmapAPI,
735
- flatmapImp,
736
- providedKnowledge,
737
- providedPathways
738
- )
739
- return [...scaffoldFilterOptions, ...flatmapFilterOptions]
740
- }
636
+ const providedPathways = undefined;
637
+ const flatmapFilterOptions = await getFlatmapFilterOptions(this.flatmapAPI, flatmapImp, providedKnowledge, providedPathways);
638
+ return [...scaffoldFilterOptions, ...flatmapFilterOptions];
639
+ };
741
640
 
742
641
  return {
743
- mockup: true,
642
+ 'mockup': true,
744
643
  getFilterOptions: combinedFilterOptions,
745
644
  getTermNerveMaps: getTermNerveMaps,
746
- mapImp: mapImp,
645
+ 'mapImp': mapImp,
747
646
  }
748
647
  },
749
648
  loadConnectivityExplorerConfig: async function (flatmap) {
750
- const flatmapImp = flatmap.mapImp
751
- const sckanVersion = getKnowledgeSource(flatmapImp)
752
- const uuid = flatmap.mockup ? flatmapImp.resource : flatmapImp.uuid
753
- let validNerves = []
649
+ const flatmapImp = flatmap.mapImp;
650
+ const sckanVersion = getKnowledgeSource(flatmapImp);
651
+ const uuid = flatmap.mockup ? flatmapImp.resource : flatmapImp.uuid;
652
+ let validNerves = [];
754
653
 
755
654
  if (!this.connectivityKnowledge[sckanVersion]) {
756
- this.flatmapQueries = markRaw(new FlatmapQueries())
757
- this.flatmapQueries.initialise(this.flatmapAPI)
758
- const knowledge = await loadAndStoreKnowledge(flatmapImp, this.flatmapQueries)
655
+ this.flatmapQueries = markRaw(new FlatmapQueries());
656
+ this.flatmapQueries.initialise(this.flatmapAPI);
657
+ const knowledge = await loadAndStoreKnowledge(flatmapImp, this.flatmapQueries);
759
658
  this.connectivityKnowledge[sckanVersion] = knowledge
760
- .filter((item) => item.connectivity?.length)
761
- .sort((a, b) => a.label.localeCompare(b.label))
659
+ .filter(item => item.connectivity?.length)
660
+ .sort((a, b) => a.label.localeCompare(b.label));
762
661
  }
763
662
  if (!this.connectivityKnowledge[uuid]) {
764
- const pathways = flatmapImp.pathways?.paths || {}
765
- this.connectivityKnowledge[uuid] = this.connectivityKnowledge[sckanVersion].filter(
766
- (item) => item.id in pathways
767
- )
663
+ const pathways = flatmapImp.pathways?.paths || {};
664
+ this.connectivityKnowledge[uuid] = this.connectivityKnowledge[sckanVersion]
665
+ .filter(item => item.id in pathways);
768
666
  }
769
667
  if (!this.connectivityFilterOptions[uuid] && !flatmap.mockup) {
770
- this.connectivityFilterOptions[uuid] = await flatmap.getFilterOptions(
771
- flatmapImp,
772
- this.connectivityKnowledge[uuid]
773
- )
668
+ this.connectivityFilterOptions[uuid] = await flatmap.getFilterOptions(flatmapImp , this.connectivityKnowledge[uuid]);
774
669
  }
775
670
  if (flatmap.mockup) {
776
- const nerveMaps = flatmap.getTermNerveMaps() || {}
671
+ const nerveMaps = flatmap.getTermNerveMaps() || {};
777
672
  // deep copy the connectivity knowledge
778
673
  // to avoid modifying the original data
779
- const deepCopyConnectivityKnowledge = JSON.parse(JSON.stringify(this.connectivityKnowledge[uuid]))
674
+ const deepCopyConnectivityKnowledge = JSON.parse(JSON.stringify(this.connectivityKnowledge[uuid]));
780
675
  this.connectivityKnowledge[uuid] = deepCopyConnectivityKnowledge
781
676
  .map((item) => {
782
- let payload = item
677
+ let payload = item;
783
678
  if (item.nerves?.length) {
784
- const terms = item.nerves.flat(Infinity)
679
+ const terms = item.nerves.flat(Infinity);
785
680
  const nerveLabels = terms.reduce((acc, term) => {
786
681
  if (term in nerveMaps) {
787
- acc.push(nerveMaps[term])
682
+ acc.push(nerveMaps[term]);
788
683
  }
789
- return acc
790
- }, [])
684
+ return acc;
685
+ }, []);
791
686
  if (nerveLabels?.length) {
792
- validNerves.push(...nerveLabels)
793
- payload['nerve-label'] = nerveLabels.sort((a, b) => a.nerve.localeCompare(b.nerve))
687
+ validNerves.push(...nerveLabels);
688
+ payload["nerve-label"] = nerveLabels.sort((a, b) => a.nerve.localeCompare(b.nerve));
794
689
  }
795
690
  }
796
- return payload
691
+ return payload;
797
692
  })
798
- .filter((item) => item['nerve-label'])
693
+ .filter((item) => item["nerve-label"]);
799
694
 
800
695
  if (!this.connectivityFilterOptions[uuid]) {
801
- this.connectivityFilterOptions[uuid] = await flatmap.getFilterOptions(
802
- flatmapImp,
803
- this.connectivityKnowledge[uuid]
804
- )
696
+ this.connectivityFilterOptions[uuid] = await flatmap.getFilterOptions(flatmapImp , this.connectivityKnowledge[uuid]);
805
697
  }
806
698
 
807
- validNerves = validNerves.map((nerve) => nerve.nerve.toLowerCase())
808
- const deepCopyFilterOption = JSON.parse(JSON.stringify(this.connectivityFilterOptions[uuid]))
809
- this.connectivityFilterOptions[uuid] = deepCopyFilterOption.map((option) => {
810
- if (option.key === 'scaffold.connectivity.nerve') {
811
- const newChildren = option.children.filter((child) => validNerves.includes(child.label.toLowerCase()))
812
- return { ...option, children: newChildren }
813
- } else {
814
- return option
815
- }
816
- })
699
+ validNerves = validNerves.map(nerve => nerve.nerve.toLowerCase());
700
+ const deepCopyFilterOption = JSON.parse(JSON.stringify(this.connectivityFilterOptions[uuid]));
701
+ this.connectivityFilterOptions[uuid] = deepCopyFilterOption
702
+ .map((option) => {
703
+ if (option.key === 'scaffold.connectivity.nerve') {
704
+ const newChildren = option.children.filter((child) => validNerves.includes(child.label.toLowerCase()));
705
+ return { ...option, children: newChildren };
706
+ } else {
707
+ return option;
708
+ }
709
+ })
817
710
  } else {
818
711
  if (!this.connectivityFilterSources[uuid]) {
819
- this.connectivityFilterSources[uuid] = flatmap.getFilterSources()
712
+ this.connectivityFilterSources[uuid] = flatmap.getFilterSources();
820
713
  }
821
- this.connectivitiesStore.updateFilterSources(this.connectivityFilterSources)
714
+ this.connectivitiesStore.updateFilterSources(this.connectivityFilterSources);
822
715
  }
823
- this.connectivitiesStore.updateFilterOptions(this.connectivityFilterOptions)
824
- this.connectivitiesStore.updateGlobalConnectivities(this.connectivityKnowledge)
825
- EventBus.emit('species-layout-connectivity-update')
716
+ this.connectivitiesStore.updateFilterOptions(this.connectivityFilterOptions);
717
+ this.connectivitiesStore.updateGlobalConnectivities(this.connectivityKnowledge);
718
+ EventBus.emit('species-layout-connectivity-update');
826
719
  },
827
720
  knowledgeTooltipQuery: async function (data) {
828
- await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.flatmapService.mapImp, { resource: [data.id] })
721
+ await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.flatmapService.mapImp, { resource: [data.id] });
829
722
  let tooltip = await this.flatmapQueries.createTooltipData(this.flatmapService.mapImp, {
830
723
  resource: [data.id],
831
724
  label: data.label,
832
725
  provenanceTaxonomy: data.taxons,
833
- feature: [],
726
+ feature: []
834
727
  })
835
- tooltip['knowledgeSource'] = getKnowledgeSource(this.flatmapService.mapImp)
836
- tooltip['mapId'] = this.flatmapService.mapImp.mapMetadata.id
837
- tooltip['mapuuid'] = this.flatmapService.mapImp.mapMetadata.uuid
838
- tooltip['nerve-label'] = data['nerve-label']
839
- tooltip['ready'] = true
840
- return tooltip
728
+ tooltip['knowledgeSource'] = getKnowledgeSource(this.flatmapService.mapImp);
729
+ tooltip['mapId'] = this.flatmapService.mapImp.mapMetadata.id;
730
+ tooltip['mapuuid'] = this.flatmapService.mapImp.mapMetadata.uuid;
731
+ tooltip['nerve-label'] = data['nerve-label'];
732
+ tooltip['ready'] = true;
733
+ return tooltip;
841
734
  },
842
735
  getKnowledgeTooltip: async function (payload) {
843
- this.tooltipEntry = []
844
- payload.data.forEach((d) =>
845
- this.tooltipEntry.push({
846
- title: d.label,
847
- featureId: [d.id],
848
- ready: false,
849
- })
850
- )
851
- EventBus.emit('connectivity-info-open', this.tooltipEntry)
736
+ this.tooltipEntry = [];
737
+ payload.data.forEach(d => this.tooltipEntry.push({ title: d.label, featureId: [d.id], ready: false }));
738
+ EventBus.emit('connectivity-info-open', this.tooltipEntry);
852
739
 
853
- let prom1 = []
740
+ let prom1 = [];
854
741
  // While having placeholders displayed, get details for all paths and then replace.
855
742
  for (let index = 0; index < payload.data.length; index++) {
856
- prom1.push(await this.knowledgeTooltipQuery(payload.data[index]))
743
+ prom1.push(await this.knowledgeTooltipQuery(payload.data[index]));
857
744
  }
858
- this.tooltipEntry = await Promise.all(prom1)
859
- const featureIds = this.tooltipEntry.map((tooltip) => tooltip.featureId[0])
745
+ this.tooltipEntry = await Promise.all(prom1);
746
+ const featureIds = this.tooltipEntry.map(tooltip => tooltip.featureId[0]);
860
747
  if (featureIds.length > 0) {
861
- EventBus.emit('connectivity-info-open', this.tooltipEntry)
748
+ EventBus.emit('connectivity-info-open', this.tooltipEntry);
862
749
  }
863
750
  },
864
751
  changeConnectivitySource: async function (payload, ongoingSource) {
865
- const { entry, connectivitySource } = payload
866
- const flatmapUUID = this?.flatmapService?.mapImp?.mapMetadata.uuid
752
+ const { entry, connectivitySource } = payload;
753
+ const flatmapUUID = this?.flatmapService?.mapImp?.mapMetadata.uuid;
867
754
  if (!ongoingSource.includes(flatmapUUID)) {
868
- ongoingSource.push(flatmapUUID)
869
- await this.flatmapQueries.queryForConnectivityNew(
870
- this.flatmapService.mapImp,
871
- entry.featureId[0],
872
- connectivitySource
873
- )
755
+ ongoingSource.push(flatmapUUID);
756
+ await this.flatmapQueries.queryForConnectivityNew(this.flatmapService.mapImp, entry.featureId[0], connectivitySource);
874
757
  this.tooltipEntry = this.tooltipEntry.map((tooltip) => {
875
758
  if (tooltip.featureId[0] === entry.featureId[0]) {
876
- return this.flatmapQueries.updateTooltipData(tooltip)
759
+ return this.flatmapQueries.updateTooltipData(tooltip);
877
760
  }
878
- return tooltip
761
+ return tooltip;
879
762
  })
880
- EventBus.emit('connectivity-info-open', this.tooltipEntry)
763
+ EventBus.emit('connectivity-info-open', this.tooltipEntry);
881
764
  }
882
765
  },
883
766
  trackEvent: function (data) {
884
- Tagging.sendEvent(data)
767
+ Tagging.sendEvent(data);
885
768
  },
886
769
  },
887
770
  data: function () {
@@ -890,9 +773,9 @@ export default {
890
773
  activeSpecies: defaultSpecies,
891
774
  scaffoldCamera: undefined,
892
775
  mainStyle: {
893
- height: this.entry.datasetTitle ? 'calc(100% - 30px)' : '100%',
894
- width: '100%',
895
- bottom: '0px',
776
+ height: this.entry.datasetTitle ? "calc(100% - 30px)" : "100%",
777
+ width: "100%",
778
+ bottom: "0px",
896
779
  },
897
780
  helpMode: false,
898
781
  helpModeActiveItem: 0,
@@ -900,6 +783,9 @@ export default {
900
783
  multiflatmapRef: null,
901
784
  flatmapRef: null,
902
785
  scaffoldRef: null,
786
+ iframeRef: null,
787
+ plotRef: null,
788
+ simulationRef: null,
903
789
  scaffoldLoaded: false,
904
790
  isInHelp: false,
905
791
  mapManager: undefined,
@@ -911,22 +797,24 @@ export default {
911
797
  flatmapService: undefined,
912
798
  flatmapQueries: undefined,
913
799
  tooltipEntry: [],
914
- }
800
+ };
915
801
  },
916
802
  created: function () {
917
- this.flatmapAPI = undefined
918
- this.apiLocation = undefined
919
- if (this.settingsStore.flatmapAPI) this.flatmapAPI = this.settingsStore.flatmapAPI
920
- if (this.settingsStore.sparcApi) this.apiLocation = this.settingsStore.sparcApi
803
+ this.flatmapAPI = undefined;
804
+ this.apiLocation = undefined;
805
+ if (this.settingsStore.flatmapAPI)
806
+ this.flatmapAPI = this.settingsStore.flatmapAPI;
807
+ if (this.settingsStore.sparcApi)
808
+ this.apiLocation = this.settingsStore.sparcApi;
921
809
  if (this.settingsStore.mapManager) {
922
- this.mapManager = this.settingsStore.mapManager
810
+ this.mapManager = this.settingsStore.mapManager;
923
811
  }
924
812
  },
925
813
  watch: {
926
814
  helpMode: function (newVal) {
927
815
  if (!newVal) {
928
- this.helpModeActiveItem = 0
816
+ this.helpModeActiveItem = 0;
929
817
  }
930
- },
818
+ }
931
819
  },
932
- }
820
+ };