@abi-software/mapintegratedvuer 1.16.1 → 1.16.3-simulation.0

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