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