@abi-software/mapintegratedvuer 1.17.1 → 1.17.3-simulation.1

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 (43) hide show
  1. package/dist/{ConnectivityGraph-BL4B9GZX.js → ConnectivityGraph-9pXPgFJR.js} +2 -2
  2. package/dist/{ContentMixin-Djmb_gqk.js → ContentMixin-DIqgKIz6.js} +279 -536
  3. package/dist/Flatmap-D7GVPV7o.js +103422 -0
  4. package/dist/{Iframe-ByYxT4Yq.js → Iframe-CCEA3d9c.js} +2 -2
  5. package/dist/{MultiFlatmap-DSkdlRiS.js → MultiFlatmap-Cuke1uNp.js} +3 -3
  6. package/dist/{Plot-ymkHVq_A.js → Plot-B4oTBVAT.js} +2 -2
  7. package/dist/{Scaffold-bw7posKm.js → Scaffold-Czz8X5kL.js} +79 -53
  8. package/dist/Simulation-BKmz8zwm.js +107 -0
  9. package/dist/{index-CwfUgFL1.js → index-_b4VBGHk.js} +30002 -25408
  10. package/dist/mapintegratedvuer.js +1 -1
  11. package/dist/mapintegratedvuer.umd.cjs +4291 -229
  12. package/dist/style-CM86xE3J.js +119 -0
  13. package/dist/style.css +1 -1
  14. package/package.json +10 -5
  15. package/src/App.vue +285 -258
  16. package/src/assets/styles.scss +1 -1
  17. package/src/components/ContextCard.vue +0 -1
  18. package/src/components/DummyRouteComponent.vue +1 -0
  19. package/src/components/EventBus.ts +13 -0
  20. package/src/components/FloatingWindow.vue +142 -0
  21. package/src/components/MapContent.vue +9 -4
  22. package/src/components/PlotComponent.vue +56 -0
  23. package/src/components/SplitDialog.vue +1 -6
  24. package/src/components/SplitFlow.vue +504 -444
  25. package/src/components/scripts/utilities.js +1 -1
  26. package/src/components/viewers/Flatmap.vue +166 -83
  27. package/src/components/viewers/Simulation.vue +118 -11
  28. package/src/components.d.ts +3 -0
  29. package/src/main.js +9 -3
  30. package/src/mixins/ContentMixin.js +467 -406
  31. package/src/mixins/DynamicMarkerMixin.js +50 -17
  32. package/src/services/mapping.js +69 -0
  33. package/src/services/testData.js +71 -0
  34. package/src/stores/entries.js +1 -1
  35. package/src/stores/mapping.js +29 -0
  36. package/src/stores/settings.js +4 -0
  37. package/src/stores/simulationPlotStore.js +124 -0
  38. package/src/stores/splitFlow.js +425 -352
  39. package/src/types/simulation.js +18 -0
  40. package/dist/Flatmap-uPEQNDkK.js +0 -202
  41. package/dist/Simulation-C_gdqDes.js +0 -28
  42. package/dist/style-Czqe2bTf.js +0 -57
  43. 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,39 +43,39 @@ 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) {
@@ -88,13 +86,15 @@ export default {
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,122 @@ 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
- };
197
- } else {
198
- // Facet search on anatomy if it is not a keyword search
199
- returnedAction = {
200
- type: "Facet",
201
- facets: [label],
202
- };
203
- let labels = new Set();
204
- // 'marker-terms' changed to 'dataset-terms' in flatmap-viewer@4.3.5
205
- resource.feature['dataset-terms'].forEach((term) => {
206
- labels.add(term.label ? term.label : term.term);
207
- });
208
- if (labels.size === 0) {
209
- labels.add(label);
210
- }
211
- returnedAction.facets = [...labels];
212
- // The number of current level labels will reduce as zoom in flatmap
213
- if (
214
- this.settingsStore.hasAppliedFacets(labels) &&
215
- this.settingsStore.appliedFacets.length <= labels.size
216
- ) {
217
- return;
218
196
  }
219
- /* Add to the filter list as and if there is selected facets */
220
- if (this.settingsStore.appliedFacets.length) {
221
- if (!this.settingsStore.hasAppliedFacets(labels)) {
222
- const newFacets = [...new Set([
223
- ...this.settingsStore.appliedFacets,
224
- ...labels
225
- ])];
226
- this.settingsStore.updateAppliedFacets(newFacets);
197
+ } 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,
227
207
  }
228
208
  } else {
229
- if (labels.size > 1) {
230
- returnedAction.type = "Facets";
209
+ // Facet search on anatomy if it is not a keyword search
210
+ returnedAction = {
211
+ type: 'Facet',
212
+ facets: [label],
213
+ }
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)
231
241
  }
232
- this.settingsStore.updateAppliedFacets(returnedAction.facets);
233
242
  }
234
- }
235
- fireResourceSelected = true;
236
- if (type == "MultiFlatmap") {
237
- const flatmap = this.$refs.multiflatmap.getCurrentFlatmap().mapImp;
238
- flatmap.clearSearchResults();
243
+ fireResourceSelected = true
244
+ if (type == 'MultiFlatmap') {
245
+ const flatmap = this.$refs.multiflatmap.getCurrentFlatmap().mapImp
246
+ flatmap.clearSearchResults()
247
+ }
239
248
  }
240
249
  }
241
- } else if (resource.eventType == "mouseenter") {
242
- result.eventType = "highlighted";
243
- fireResourceSelected = true;
250
+ } else if (resource.eventType == 'mouseenter') {
251
+ result.eventType = 'highlighted'
252
+ fireResourceSelected = true
244
253
  }
245
- } else if (type == "Scaffold") {
254
+ } else if (type == 'Scaffold') {
246
255
  if (resource) {
247
- if (resource.data?.id === undefined || resource.data?.id === "") {
248
- resource.data.id = resource.data?.group;
256
+ if (resource.data?.id === undefined || resource.data?.id === '') {
257
+ resource.data.id = resource.data?.group
249
258
  }
250
- result.internalName = resource.data.id;
259
+ result.internalName = resource.data.id
251
260
  // Facet search if marker is clicked
252
261
  if (resource.data.lastActionOnMarker === true) {
253
262
  returnedAction = {
254
- type: "Facet",
263
+ type: 'Facet',
255
264
  facets: [capitalise(resource.data.id)],
256
- };
265
+ }
257
266
  }
258
267
  }
259
- result.eventType = "selected";
260
- fireResourceSelected = true;
261
- action = "search";
268
+ result.eventType = 'selected'
269
+ fireResourceSelected = true
262
270
  }
263
- if (returnedAction) EventBus.emit("PopoverActionClick", returnedAction);
264
- if (fireResourceSelected) this.$emit("resource-selected", result);
271
+ if (returnedAction) EventBus.emit('PopoverActionClick', returnedAction)
272
+ if (fireResourceSelected) this.$emit('resource-selected', result)
265
273
  },
266
274
  resourceHasAction: function (resource) {
267
275
  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
- );
276
+ resource &&
277
+ (resource.type === 'URL' ||
278
+ resource.type === 'Search' ||
279
+ resource.type === 'Neuron Search' ||
280
+ resource.type == 'Facet' ||
281
+ resource.type == 'Facets')
282
+ )
276
283
  },
277
284
  /**
278
285
  * Get the term to zoom/highlight in a synchronisation event,
@@ -280,85 +287,83 @@ export default {
280
287
  * calls to try to ge a valid name/id.
281
288
  */
282
289
  getNameAndIdFromSyncData: async function (data) {
283
- let name = data.internalName;
290
+ let name = data.internalName
284
291
  if (name === undefined && data.resource) {
285
- name = data.resource.label;
292
+ name = data.resource.label
286
293
  }
287
- let id = undefined;
294
+ let id = undefined
288
295
  if (data.resource && data.resource.resource) {
289
- id = data.resource.resource[0];
296
+ id = data.resource.resource[0]
290
297
  }
291
- if (this.entry.type === "Scaffold") {
292
- const objects = this.$refs.scaffold.findObjectsWithGroupName(name);
298
+ if (this.entry.type === 'Scaffold') {
299
+ const objects = this.$refs.scaffold.findObjectsWithGroupName(name)
293
300
  // If a region is not found use a hardcoded list to determine
294
301
  // its parents region first
295
302
  if (objects.length === 0) {
296
303
  //Use nerve mapping
297
304
  if (data.resource && data.resource.feature) {
298
- const matched = getNerveNames(data.resource.feature.models);
299
- if (matched.length > 0) return matched;
305
+ const matched = getNerveNames(data.resource.feature.models)
306
+ if (matched.length > 0) return matched
300
307
  }
301
- let matched = getParentsRegion(name);
308
+ let matched = getParentsRegion(name)
302
309
  if (matched) {
303
- return matched;
310
+ return matched
304
311
  }
305
312
  // Hardcoded list failed - use an endpoint to find its parents
306
- if (id && data.eventType === "selected") {
313
+ if (id && data.eventType === 'selected') {
307
314
  return fetch(`${this.apiLocation}get-related-terms/${id}`)
308
- .then(response => response.json())
309
- .then(data => {
315
+ .then((response) => response.json())
316
+ .then((data) => {
310
317
  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 };
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 }
316
321
  }
317
- });
322
+ })
318
323
  }
319
324
  }
320
- } else if (this.entry.type === "MultiFlatmap") {
321
- if (name === "Bladder") {
322
- name = "Urinary Bladder";
325
+ } else if (this.entry.type === 'MultiFlatmap') {
326
+ if (name === 'Bladder') {
327
+ name = 'Urinary Bladder'
323
328
  } else {
324
- const matched = getNerveNames(name);
325
- if (matched.length > 0) name = matched[0];
329
+ const matched = getNerveNames(name)
330
+ if (matched.length > 0) name = matched[0]
326
331
  }
327
332
  }
328
- return { id, name };
333
+ return { id, name }
329
334
  },
330
335
  // Get the species and andaotmy info for the featured datasets
331
336
  getDatasetAnatomyInfo: function (identifier) {
332
337
  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;
338
+ .then((response) => response.json())
339
+ .then((data) => {
340
+ const resultPayload = data.result[0]
341
+ let markerCurie
337
342
  try {
338
- markerCurie = resultPayload.anatomy.organ[0].curie;
343
+ markerCurie = resultPayload.anatomy.organ[0].curie
339
344
  } catch (error) {
340
- markerCurie = undefined;
345
+ markerCurie = undefined
341
346
  }
342
- let markerDoi;
347
+ let markerDoi
343
348
  try {
344
- markerDoi = resultPayload.item.curie;
349
+ markerDoi = resultPayload.item.curie
345
350
  } catch (error) {
346
- markerDoi = undefined;
351
+ markerDoi = undefined
347
352
  }
348
- let markerSpecies;
353
+ let markerSpecies
349
354
  try {
350
- let index = 0;
351
- let found = false;
355
+ let index = 0
356
+ let found = false
352
357
  while (!found && index < resultPayload.organisms.subject.length) {
353
- const entry = resultPayload.organisms.subject[index];
358
+ const entry = resultPayload.organisms.subject[index]
354
359
  if (entry.species) {
355
- markerSpecies = entry.species.name;
356
- found = true;
360
+ markerSpecies = entry.species.name
361
+ found = true
357
362
  }
358
- index += 1;
363
+ index += 1
359
364
  }
360
365
  } catch (error) {
361
- markerSpecies = undefined;
366
+ markerSpecies = undefined
362
367
  }
363
368
  // can test the featured marker by uncommenting the line below:
364
369
  // markerSpecies = "Rat"
@@ -367,17 +372,17 @@ export default {
367
372
  marker: markerCurie,
368
373
  doi: markerDoi,
369
374
  species: markerSpecies,
370
- });
371
- });
375
+ })
376
+ })
372
377
  },
373
378
  // Check if the old featured dataset api has any info
374
379
  oldFeaturedDatasetApiHasInfo: async function () {
375
380
  let response = await fetch(`${this.apiLocation}get_featured_datasets_identifiers`)
376
381
  let data = await response.json()
377
382
  if (!data.identifiers || data.identifiers.length == 0) {
378
- return false;
383
+ return false
379
384
  } else {
380
- return data.identifiers;
385
+ return data.identifiers
381
386
  }
382
387
  },
383
388
  // Check if the new featured dataset api has any info
@@ -385,182 +390,219 @@ export default {
385
390
  let response = await fetch(`${this.apiLocation}get_featured_dataset`)
386
391
  let data = await response.json()
387
392
  if (!data.datasets || data.datasets.length == 0) {
388
- return false;
393
+ return false
389
394
  } else {
390
- return data.datasets.map(d => d.id);
395
+ return data.datasets.map((d) => d.id)
391
396
  }
392
397
  },
393
398
  flatmapResourceSelected: function (type, resources) {
394
- this.resourceSelected(type, resources);
399
+ this.resourceSelected(type, resources)
395
400
 
396
- const firstResource = resources[0];
397
- const { eventType, feature } = firstResource;
398
- const { viewingMode } = this.settingsStore.globalSettings;
401
+ const firstResource = resources[0]
402
+ const { eventType, feature } = firstResource
403
+ const { viewingMode } = this.settingsStore.globalSettings
399
404
 
400
405
  if (eventType === 'click' && feature.type === 'feature' && feature.models?.startsWith('ilxtr:')) {
401
406
  // Use only models data for GA tagging
402
407
  // 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
- });
408
+ const categories = []
409
+ resources.forEach((resource) => {
410
+ const { models } = resource.feature
411
+ categories.push(models)
412
+ })
408
413
 
409
414
  Tagging.sendEvent({
410
- 'event': 'interaction_event',
411
- 'event_name': 'portal_maps_connectivity',
412
- 'category': categories.join(', '),
413
- "location": type + ' ' + viewingMode
414
- });
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)
415
459
  }
416
460
  },
417
461
  /**
418
462
  * Get a list of featured datasets to display.
419
463
  */
420
464
  getFeaturedDatasets: async function () {
421
- let datasetIds = [];
465
+ let datasetIds = []
422
466
 
423
467
  // Check the two api endpoints for featured datasets, old one first
424
- let oldInfo = await this.oldFeaturedDatasetApiHasInfo();
425
- if (oldInfo) datasetIds = oldInfo;
468
+ let oldInfo = await this.oldFeaturedDatasetApiHasInfo()
469
+ if (oldInfo) datasetIds = oldInfo
426
470
  else {
427
- let newInfo = await this.newFeaturedDatasetApiHasInfo();
428
- if (newInfo) datasetIds = newInfo;
471
+ let newInfo = await this.newFeaturedDatasetApiHasInfo()
472
+ if (newInfo) datasetIds = newInfo
429
473
  }
430
474
  // Update the store with the new list of featured datasets
431
- this.settingsStore.updateFeatured(datasetIds);
432
- datasetIds.forEach(element => {
475
+ this.settingsStore.updateFeatured(datasetIds)
476
+ datasetIds.forEach((element) => {
433
477
  this.getDatasetAnatomyInfo(element)
434
- });
478
+ })
435
479
  },
436
480
  flatmapMarkerUpdate() {
437
- return;
481
+ return
438
482
  },
439
483
  onResize: function () {
440
- return;
484
+ return
441
485
  },
442
- updateViewerSettings: function() {
443
- return;
486
+ updateViewerSettings: function () {
487
+ return
444
488
  },
445
489
  startHelp: function () {
446
490
  if (this?.alive) {
447
491
  if (this.isInHelp === false) {
448
- this.helpMode = true;
449
- window.addEventListener("mousedown", this.checkEndHelpMouseDown);
450
- this.isInHelp = true;
492
+ this.helpMode = true
493
+ window.addEventListener('mousedown', this.checkEndHelpMouseDown)
494
+ this.isInHelp = true
451
495
  }
452
496
  }
453
497
  },
454
498
  endHelp: function () {
455
- window.removeEventListener("mousedown", this.checkEndHelpMouseDown);
456
- this.helpMode = false;
499
+ window.removeEventListener('mousedown', this.checkEndHelpMouseDown)
500
+ this.helpMode = false
457
501
  setTimeout(() => {
458
- this.isInHelp = false;
459
- }, 200);
502
+ this.isInHelp = false
503
+ }, 200)
460
504
  },
461
505
  onHelpModeShowNext: function () {
462
- this.helpModeActiveItem += 1;
506
+ this.helpModeActiveItem += 1
463
507
  },
464
508
  onHelpModeLastItem: function (isLastItem) {
465
509
  if (isLastItem) {
466
- this.helpModeLastItem = true;
510
+ this.helpModeLastItem = true
467
511
  }
468
512
  },
469
513
  onFinishHelpMode: function () {
470
- this.helpMode = false;
514
+ this.helpMode = false
471
515
  // reset help mode to default values
472
- this.helpModeActiveItem = 0;
473
- this.helpModeLastItem = false;
516
+ this.helpModeActiveItem = 0
517
+ this.helpModeLastItem = false
474
518
  },
475
519
  onTooltipShown: function () {
476
520
  if (this.$refs.multiflatmap && this.$refs.multiflatmapHelp) {
477
- this.$refs.multiflatmapHelp.toggleTooltipHighlight();
521
+ this.$refs.multiflatmapHelp.toggleTooltipHighlight()
478
522
  }
479
523
 
480
524
  if (this.$refs.flatmap && this.$refs.flatmapHelp) {
481
- this.$refs.flatmapHelp.toggleTooltipHighlight();
525
+ this.$refs.flatmapHelp.toggleTooltipHighlight()
482
526
  }
483
527
 
484
528
  if (this.$refs.scaffold && this.$refs.scaffoldHelp) {
485
- this.$refs.scaffoldHelp.toggleTooltipHighlight();
529
+ this.$refs.scaffoldHelp.toggleTooltipHighlight()
486
530
  }
487
531
  },
488
532
  onMapTooltipShown: function () {
489
533
  if (this.$refs.multiflatmap && this.$refs.multiflatmapHelp) {
490
- this.$refs.multiflatmapHelp.toggleTooltipPinHighlight();
534
+ this.$refs.multiflatmapHelp.toggleTooltipPinHighlight()
491
535
  }
492
536
 
493
537
  if (this.$refs.flatmap && this.$refs.flatmapHelp) {
494
- this.$refs.flatmapHelp.toggleTooltipPinHighlight();
538
+ this.$refs.flatmapHelp.toggleTooltipPinHighlight()
495
539
  }
496
540
 
497
541
  if (this.$refs.scaffold && this.$refs.scaffoldHelp) {
498
- this.$refs.scaffoldHelp.toggleTooltipPinHighlight();
542
+ this.$refs.scaffoldHelp.toggleTooltipPinHighlight()
499
543
  }
500
544
  },
501
545
  /**
502
546
  * End help-mode only if user clicks outside of help mode dialog.
503
547
  */
504
548
  checkEndHelpMouseDown: function (e) {
505
- const el = e.target;
549
+ const el = e.target
506
550
  if (!el.closest('.help-mode-dialog')) {
507
- this.endHelp();
551
+ this.endHelp()
508
552
  }
509
553
  },
510
554
  flatmapHighlight: async function (flatmap, hoverAnatomies, hoverDOI, hoverConnectivity) {
511
- let toHighlight = [...hoverAnatomies, ...hoverConnectivity];
512
- const globalSettings = this.settingsStore.globalSettings;
555
+ let toHighlight = [...hoverAnatomies, ...hoverConnectivity]
556
+ const globalSettings = this.settingsStore.globalSettings
513
557
 
514
558
  // to highlight connected paths
515
559
  if (globalSettings.highlightConnectedPaths) {
516
- const hoverEntry = hoverAnatomies.length ? hoverAnatomies :
517
- hoverConnectivity.length ? hoverConnectivity :
518
- []
519
- const connectedPaths = await flatmap.retrieveConnectedPaths(hoverEntry);
560
+ const hoverEntry = hoverAnatomies.length ? hoverAnatomies : hoverConnectivity.length ? hoverConnectivity : []
561
+ const connectedPaths = await flatmap.retrieveConnectedPaths(hoverEntry)
520
562
  if (connectedPaths) {
521
- toHighlight.push(...connectedPaths);
563
+ toHighlight.push(...connectedPaths)
522
564
  }
523
565
  }
524
566
 
525
567
  // to highlight related paths from reference DOI
526
568
  if (globalSettings.highlightDOIPaths) {
527
- const connectionsFromDOI = await flatmap.searchConnectivitiesByReference(hoverDOI);
569
+ const connectionsFromDOI = await flatmap.searchConnectivitiesByReference(hoverDOI)
528
570
  if (connectionsFromDOI) {
529
- toHighlight.push(...connectionsFromDOI);
571
+ toHighlight.push(...connectionsFromDOI)
530
572
  }
531
573
  }
532
- toHighlight = [...new Set(toHighlight)];
533
- return toHighlight;
574
+ toHighlight = [...new Set(toHighlight)]
575
+ return toHighlight
534
576
  },
535
577
  sidebarHoverHighlight: function (payload) {
536
- if (this.visible && (
537
- ((this.flatmapRef || this.multiflatmapRef) && this.flatmapReady) ||
538
- (this.scaffoldRef && this.scaffoldLoaded))
578
+ if (
579
+ this.visible &&
580
+ (((this.flatmapRef || this.multiflatmapRef) && this.flatmapReady) || (this.scaffoldRef && this.scaffoldLoaded))
539
581
  ) {
540
- const hoverAnatomies = this.settingsStore.hoverAnatomies;
541
- const hoverOrgans = this.settingsStore.hoverOrgans;
542
- const hoverDOI = this.settingsStore.hoverDOI;
543
- const hoverConnectivity = this.settingsStore.hoverConnectivity;
582
+ const hoverAnatomies = this.settingsStore.hoverAnatomies
583
+ const hoverOrgans = this.settingsStore.hoverOrgans
584
+ const hoverDOI = this.settingsStore.hoverDOI
585
+ const hoverConnectivity = this.settingsStore.hoverConnectivity
544
586
 
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;
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
550
592
 
551
593
  // reset
552
- clearTimeout(this.highlightDelay);
594
+ clearTimeout(this.highlightDelay)
553
595
  if (!hoverAnatomies.length && !hoverOrgans.length && !hoverDOI && !hoverConnectivity.length) {
554
596
  if ((this.multiflatmapRef || this.flatmapRef) && flatmap) {
555
597
  if (flatmap.mapImp && !flatmap.mapImp.contextLost) {
556
- flatmap.mapImp?.clearSearchResults();
598
+ flatmap.mapImp?.clearSearchResults()
557
599
  if (payload.connectivityProcessed) {
558
600
  // grey out all connectivity if no search results
559
601
  flatmap.mapImp?.setPaint({ dimmed: true })
560
602
  }
561
603
  }
562
604
  } else if (this.scaffoldRef && scaffold) {
563
- scaffold.changeHighlightedByName(hoverOrgans, "", false);
605
+ scaffold.changeHighlightedByName(hoverOrgans, '', false)
564
606
  }
565
607
  }
566
608
 
@@ -571,254 +613,275 @@ export default {
571
613
  try {
572
614
  flatmap.showConnectivityTooltips({
573
615
  connectivityInfo: { featureId: paths },
574
- data: []
575
- });
616
+ data: [],
617
+ })
576
618
  } catch (error) {
577
- console.log(error)
578
619
  // only for connectivity hover highlight
579
620
  if (hoverConnectivity.length && flatmap.mapImp) {
580
- const uuid = flatmap.mapImp.uuid;
621
+ const uuid = flatmap.mapImp.uuid
581
622
  const found = paths.every((path) =>
582
- this.connectivityKnowledge[uuid].some((connectivity) =>
583
- connectivity.id === path
584
- )
585
- );
623
+ this.connectivityKnowledge[uuid].some((connectivity) => connectivity.id === path)
624
+ )
586
625
  if (!found) {
587
626
  if (flatmap.mapImp && !flatmap.mapImp.contextLost) {
588
- flatmap.mapImp.clearSearchResults();
627
+ flatmap.mapImp.clearSearchResults()
589
628
  }
590
629
  }
591
630
  }
592
631
  }
593
- });
632
+ })
594
633
  } else if (this.scaffoldRef && scaffold) {
595
- scaffold.changeHighlightedByName(hoverOrgans, "", false);
634
+ scaffold.changeHighlightedByName(hoverOrgans, '', false)
596
635
  }
597
636
  }
598
- }, 100);
637
+ }, 100)
599
638
  }
600
639
  },
601
640
  onAnnotationOpen: function (payload) {
602
- EventBus.emit('annotation-open', payload);
641
+ EventBus.emit('annotation-open', payload)
603
642
  },
604
643
  onAnnotationClose: function () {
605
- EventBus.emit('sidebar-annotation-close');
644
+ EventBus.emit('sidebar-annotation-close')
606
645
  },
607
646
  updateOfflineAnnotationEnabled: function (payload) {
608
- EventBus.emit('update-offline-annotation-enabled', payload);
647
+ EventBus.emit('update-offline-annotation-enabled', payload)
609
648
  },
610
649
  onConnectivityInfoOpen: function (connectivityInfoData) {
611
- EventBus.emit('connectivity-info-open', connectivityInfoData);
650
+ EventBus.emit('connectivity-info-open', connectivityInfoData)
612
651
  },
613
652
  onConnectivityError: function (errorInfo) {
614
- EventBus.emit('connectivity-error', errorInfo);
653
+ EventBus.emit('connectivity-error', errorInfo)
615
654
  },
616
655
  onConnectivityInfoClose: function () {
617
- EventBus.emit('connectivity-info-close');
656
+ EventBus.emit('connectivity-info-close')
618
657
  },
619
- onSidebarAnnotationClose: function() {
620
- return;
658
+ onSidebarAnnotationClose: function () {
659
+ return
621
660
  },
622
661
  onNeuronConnectionFeatureClick: function (payload) {
623
- EventBus.emit('neuron-connection-feature-click', payload);
662
+ EventBus.emit('neuron-connection-feature-click', payload)
624
663
  },
625
- showConnectivity: function() {
626
- return;
664
+ showConnectivity: function () {
665
+ return
627
666
  },
628
667
  showConnectivityTooltips: function () {
629
- return;
668
+ return
630
669
  },
631
- setVisibilityFilter: function() {
632
- return;
670
+ setVisibilityFilter: function () {
671
+ return
633
672
  },
634
673
  loadExplorerConfig: async function () {
635
- this.flatmapService = await this.mockUpFlatmapService();
636
- this.loadConnectivityExplorerConfig(this.flatmapService);
674
+ this.flatmapService = await this.mockUpFlatmapService()
675
+ this.loadConnectivityExplorerConfig(this.flatmapService)
637
676
  },
638
- mockUpFlatmapService: async function() {
639
- const flatmapResponse = await fetch(this.flatmapAPI);
640
- const flatmapJson = await flatmapResponse.json();
677
+ mockUpFlatmapService: async function () {
678
+ const flatmapResponse = await fetch(this.flatmapAPI)
679
+ const flatmapJson = await flatmapResponse.json()
641
680
  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();
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()
648
687
 
649
- this.flatmapQueries = markRaw(new FlatmapQueries());
650
- this.flatmapQueries.initialise(this.flatmapAPI);
688
+ this.flatmapQueries = markRaw(new FlatmapQueries())
689
+ this.flatmapQueries.initialise(this.flatmapAPI)
651
690
 
652
691
  const mapImp = {
653
- 'mapMetadata': {
654
- 'uuid': flatmapUuid,
655
- 'connectivity': {
692
+ mapMetadata: {
693
+ uuid: flatmapUuid,
694
+ connectivity: {
656
695
  ...latestFlatmap.sckan,
657
696
  },
658
697
  },
659
- 'pathways': pathwaysJson,
660
- 'resource': this.entry.resource,
698
+ pathways: pathwaysJson,
699
+ resource: this.entry.resource,
661
700
  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);
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)
667
707
  },
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;
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
674
716
  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
- }
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
+ }
683
725
  }
684
- return entityLabels;
726
+ return entityLabels
685
727
  },
686
- };
728
+ }
687
729
 
688
- const scaffoldFilterOptions = getScaffoldFilterOptions();
730
+ const scaffoldFilterOptions = getScaffoldFilterOptions()
689
731
  const combinedFilterOptions = async (flatmapImp, providedKnowledge) => {
690
- const providedPathways = undefined;
691
- const flatmapFilterOptions = await getFlatmapFilterOptions(this.flatmapAPI, flatmapImp, providedKnowledge, providedPathways);
692
- return [...scaffoldFilterOptions, ...flatmapFilterOptions];
693
- };
732
+ const providedPathways = undefined
733
+ const flatmapFilterOptions = await getFlatmapFilterOptions(
734
+ this.flatmapAPI,
735
+ flatmapImp,
736
+ providedKnowledge,
737
+ providedPathways
738
+ )
739
+ return [...scaffoldFilterOptions, ...flatmapFilterOptions]
740
+ }
694
741
 
695
742
  return {
696
- 'mockup': true,
743
+ mockup: true,
697
744
  getFilterOptions: combinedFilterOptions,
698
745
  getTermNerveMaps: getTermNerveMaps,
699
- 'mapImp': mapImp,
746
+ mapImp: mapImp,
700
747
  }
701
748
  },
702
749
  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 = [];
750
+ const flatmapImp = flatmap.mapImp
751
+ const sckanVersion = getKnowledgeSource(flatmapImp)
752
+ const uuid = flatmap.mockup ? flatmapImp.resource : flatmapImp.uuid
753
+ let validNerves = []
707
754
 
708
755
  if (!this.connectivityKnowledge[sckanVersion]) {
709
- this.flatmapQueries = markRaw(new FlatmapQueries());
710
- this.flatmapQueries.initialise(this.flatmapAPI);
711
- const knowledge = await loadAndStoreKnowledge(flatmapImp, this.flatmapQueries);
756
+ this.flatmapQueries = markRaw(new FlatmapQueries())
757
+ this.flatmapQueries.initialise(this.flatmapAPI)
758
+ const knowledge = await loadAndStoreKnowledge(flatmapImp, this.flatmapQueries)
712
759
  this.connectivityKnowledge[sckanVersion] = knowledge
713
- .filter(item => item.connectivity?.length)
714
- .sort((a, b) => a.label.localeCompare(b.label));
760
+ .filter((item) => item.connectivity?.length)
761
+ .sort((a, b) => a.label.localeCompare(b.label))
715
762
  }
716
763
  if (!this.connectivityKnowledge[uuid]) {
717
- const pathways = flatmapImp.pathways?.paths || {};
718
- this.connectivityKnowledge[uuid] = this.connectivityKnowledge[sckanVersion]
719
- .filter(item => item.id in pathways);
764
+ const pathways = flatmapImp.pathways?.paths || {}
765
+ this.connectivityKnowledge[uuid] = this.connectivityKnowledge[sckanVersion].filter(
766
+ (item) => item.id in pathways
767
+ )
720
768
  }
721
769
  if (!this.connectivityFilterOptions[uuid] && !flatmap.mockup) {
722
- this.connectivityFilterOptions[uuid] = await flatmap.getFilterOptions(flatmapImp , this.connectivityKnowledge[uuid]);
770
+ this.connectivityFilterOptions[uuid] = await flatmap.getFilterOptions(
771
+ flatmapImp,
772
+ this.connectivityKnowledge[uuid]
773
+ )
723
774
  }
724
775
  if (flatmap.mockup) {
725
- const nerveMaps = flatmap.getTermNerveMaps() || {};
776
+ const nerveMaps = flatmap.getTermNerveMaps() || {}
726
777
  // deep copy the connectivity knowledge
727
778
  // to avoid modifying the original data
728
- const deepCopyConnectivityKnowledge = JSON.parse(JSON.stringify(this.connectivityKnowledge[uuid]));
779
+ const deepCopyConnectivityKnowledge = JSON.parse(JSON.stringify(this.connectivityKnowledge[uuid]))
729
780
  this.connectivityKnowledge[uuid] = deepCopyConnectivityKnowledge
730
781
  .map((item) => {
731
- let payload = item;
782
+ let payload = item
732
783
  if (item.nerves?.length) {
733
- const terms = item.nerves.flat(Infinity);
784
+ const terms = item.nerves.flat(Infinity)
734
785
  const nerveLabels = terms.reduce((acc, term) => {
735
786
  if (term in nerveMaps) {
736
- acc.push(nerveMaps[term]);
787
+ acc.push(nerveMaps[term])
737
788
  }
738
- return acc;
739
- }, []);
789
+ return acc
790
+ }, [])
740
791
  if (nerveLabels?.length) {
741
- validNerves.push(...nerveLabels);
742
- payload["nerve-label"] = nerveLabels.sort((a, b) => a.nerve.localeCompare(b.nerve));
792
+ validNerves.push(...nerveLabels)
793
+ payload['nerve-label'] = nerveLabels.sort((a, b) => a.nerve.localeCompare(b.nerve))
743
794
  }
744
795
  }
745
- return payload;
796
+ return payload
746
797
  })
747
- .filter((item) => item["nerve-label"]);
798
+ .filter((item) => item['nerve-label'])
748
799
 
749
800
  if (!this.connectivityFilterOptions[uuid]) {
750
- this.connectivityFilterOptions[uuid] = await flatmap.getFilterOptions(flatmapImp , this.connectivityKnowledge[uuid]);
801
+ this.connectivityFilterOptions[uuid] = await flatmap.getFilterOptions(
802
+ flatmapImp,
803
+ this.connectivityKnowledge[uuid]
804
+ )
751
805
  }
752
806
 
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
- })
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
+ })
764
817
  } else {
765
818
  if (!this.connectivityFilterSources[uuid]) {
766
- this.connectivityFilterSources[uuid] = flatmap.getFilterSources();
819
+ this.connectivityFilterSources[uuid] = flatmap.getFilterSources()
767
820
  }
768
- this.connectivitiesStore.updateFilterSources(this.connectivityFilterSources);
821
+ this.connectivitiesStore.updateFilterSources(this.connectivityFilterSources)
769
822
  }
770
- this.connectivitiesStore.updateFilterOptions(this.connectivityFilterOptions);
771
- this.connectivitiesStore.updateGlobalConnectivities(this.connectivityKnowledge);
772
- EventBus.emit('species-layout-connectivity-update');
823
+ this.connectivitiesStore.updateFilterOptions(this.connectivityFilterOptions)
824
+ this.connectivitiesStore.updateGlobalConnectivities(this.connectivityKnowledge)
825
+ EventBus.emit('species-layout-connectivity-update')
773
826
  },
774
827
  knowledgeTooltipQuery: async function (data) {
775
- await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.flatmapService.mapImp, { resource: [data.id] });
828
+ await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.flatmapService.mapImp, { resource: [data.id] })
776
829
  let tooltip = await this.flatmapQueries.createTooltipData(this.flatmapService.mapImp, {
777
830
  resource: [data.id],
778
831
  label: data.label,
779
832
  provenanceTaxonomy: data.taxons,
780
- feature: []
833
+ feature: [],
781
834
  })
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;
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
788
841
  },
789
842
  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);
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)
793
852
 
794
- let prom1 = [];
853
+ let prom1 = []
795
854
  // While having placeholders displayed, get details for all paths and then replace.
796
855
  for (let index = 0; index < payload.data.length; index++) {
797
- prom1.push(await this.knowledgeTooltipQuery(payload.data[index]));
856
+ prom1.push(await this.knowledgeTooltipQuery(payload.data[index]))
798
857
  }
799
- this.tooltipEntry = await Promise.all(prom1);
800
- const featureIds = this.tooltipEntry.map(tooltip => tooltip.featureId[0]);
858
+ this.tooltipEntry = await Promise.all(prom1)
859
+ const featureIds = this.tooltipEntry.map((tooltip) => tooltip.featureId[0])
801
860
  if (featureIds.length > 0) {
802
- EventBus.emit('connectivity-info-open', this.tooltipEntry);
861
+ EventBus.emit('connectivity-info-open', this.tooltipEntry)
803
862
  }
804
863
  },
805
864
  changeConnectivitySource: async function (payload, ongoingSource) {
806
- const { entry, connectivitySource } = payload;
807
- const flatmapUUID = this?.flatmapService?.mapImp?.mapMetadata.uuid;
865
+ const { entry, connectivitySource } = payload
866
+ const flatmapUUID = this?.flatmapService?.mapImp?.mapMetadata.uuid
808
867
  if (!ongoingSource.includes(flatmapUUID)) {
809
- ongoingSource.push(flatmapUUID);
810
- await this.flatmapQueries.queryForConnectivityNew(this.flatmapService.mapImp, entry.featureId[0], connectivitySource);
868
+ ongoingSource.push(flatmapUUID)
869
+ await this.flatmapQueries.queryForConnectivityNew(
870
+ this.flatmapService.mapImp,
871
+ entry.featureId[0],
872
+ connectivitySource
873
+ )
811
874
  this.tooltipEntry = this.tooltipEntry.map((tooltip) => {
812
875
  if (tooltip.featureId[0] === entry.featureId[0]) {
813
- return this.flatmapQueries.updateTooltipData(tooltip);
876
+ return this.flatmapQueries.updateTooltipData(tooltip)
814
877
  }
815
- return tooltip;
878
+ return tooltip
816
879
  })
817
- EventBus.emit('connectivity-info-open', this.tooltipEntry);
880
+ EventBus.emit('connectivity-info-open', this.tooltipEntry)
818
881
  }
819
882
  },
820
883
  trackEvent: function (data) {
821
- Tagging.sendEvent(data);
884
+ Tagging.sendEvent(data)
822
885
  },
823
886
  },
824
887
  data: function () {
@@ -827,9 +890,9 @@ export default {
827
890
  activeSpecies: defaultSpecies,
828
891
  scaffoldCamera: undefined,
829
892
  mainStyle: {
830
- height: this.entry.datasetTitle ? "calc(100% - 30px)" : "100%",
831
- width: "100%",
832
- bottom: "0px",
893
+ height: this.entry.datasetTitle ? 'calc(100% - 30px)' : '100%',
894
+ width: '100%',
895
+ bottom: '0px',
833
896
  },
834
897
  helpMode: false,
835
898
  helpModeActiveItem: 0,
@@ -848,24 +911,22 @@ export default {
848
911
  flatmapService: undefined,
849
912
  flatmapQueries: undefined,
850
913
  tooltipEntry: [],
851
- };
914
+ }
852
915
  },
853
916
  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;
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
860
921
  if (this.settingsStore.mapManager) {
861
- this.mapManager = this.settingsStore.mapManager;
922
+ this.mapManager = this.settingsStore.mapManager
862
923
  }
863
924
  },
864
925
  watch: {
865
926
  helpMode: function (newVal) {
866
927
  if (!newVal) {
867
- this.helpModeActiveItem = 0;
928
+ this.helpModeActiveItem = 0
868
929
  }
869
- }
930
+ },
870
931
  },
871
- };
932
+ }