@abi-software/mapintegratedvuer 1.8.0-beta.1 → 1.8.0-isan.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/ContentMixin-EFP5brsx.js +706 -0
  2. package/dist/{Flatmap-BMowLXfS.js → Flatmap-pz7hsrjo.js} +62 -60
  3. package/dist/{Iframe-fNcVYbXe.js → Iframe-CJ_SIovr.js} +2 -2
  4. package/dist/{MultiFlatmap-DuKi1y2A.js → MultiFlatmap-jpkWW4Qi.js} +46 -37
  5. package/dist/{Plot-3jlnqIiS.js → Plot-Ua4prIQw.js} +2 -2
  6. package/dist/{Scaffold-Brboi1Ah.js → Scaffold-BQg2FztI.js} +7197 -7151
  7. package/dist/Simulation-CL_BXWNM.js +30 -0
  8. package/dist/{index-B_H6BPK_.js → index-CL-1I7C9.js} +23281 -21202
  9. package/dist/mapintegratedvuer.js +1 -1
  10. package/dist/mapintegratedvuer.umd.cjs +1663 -1009
  11. package/dist/{style-Bt2YbWCx.js → style-g0koDyqm.js} +70640 -67659
  12. package/dist/style.css +1 -1
  13. package/package.json +8 -7
  14. package/src/App.vue +3 -14
  15. package/src/assets/header-icon.scss +7 -0
  16. package/src/components/ContentBar.vue +5 -1
  17. package/src/components/DialogToolbarContent.vue +87 -15
  18. package/src/components/FlatmapContextCard.vue +11 -8
  19. package/src/components/MapContent.vue +11 -21
  20. package/src/components/SplitFlow.vue +183 -108
  21. package/src/components/viewers/Flatmap.vue +6 -7
  22. package/src/components/viewers/MultiFlatmap.vue +25 -7
  23. package/src/components/viewers/Scaffold.vue +2 -2
  24. package/src/components/viewers/Simulation.vue +19 -1
  25. package/src/components.d.ts +4 -0
  26. package/src/mixins/ContentMixin.js +140 -80
  27. package/src/mixins/DynamicMarkerMixin.js +3 -1
  28. package/src/stores/settings.js +13 -10
  29. package/dist/ContentMixin-B9DtqhYT.js +0 -357
  30. package/dist/Simulation-BPEbHrzv.js +0 -22
@@ -9,6 +9,9 @@ import { useSettingsStore } from '../stores/settings';
9
9
  import { useSplitFlowStore } from '../stores/splitFlow';
10
10
  import Tagging from '../services/tagging.js';
11
11
 
12
+ import { FlatmapQueries } from "@abi-software/flatmapvuer/src/services/flatmapQueries.js";
13
+ import { getKnowledgeSource, loadAndStoreKnowledge } from "@abi-software/flatmapvuer/src/services/flatmapKnowledge.js";
14
+
12
15
  function capitalise(text) {
13
16
  return text[0].toUpperCase() + text.substring(1)
14
17
  }
@@ -73,8 +76,6 @@ export default {
73
76
  EventBus.emit("OpenNewMap", type);
74
77
  this.trackOpenMap(`open_new_${type}_map`);
75
78
  }
76
-
77
- this.onConnectivityInfoClose();
78
79
  },
79
80
  onMapmanagerLoaded: function (mapManager) {
80
81
  this.settingsStore.updateMapManager(mapManager);
@@ -107,42 +108,37 @@ export default {
107
108
  /**
108
109
  * Callback when the vuers emit a selected event.
109
110
  */
110
- resourceSelected: function (type, resource) {
111
+ resourceSelected: function (type, resources) {
112
+ const resource = resources[0]
111
113
  // Skip processing if resources already has actions
112
- if (this.resourceHasAction(resource)) {
114
+ if (resource && this.resourceHasAction(resource)) {
113
115
  EventBus.emit("PopoverActionClick", resource);
114
116
  return;
115
117
  }
116
-
117
118
  let returnedAction = undefined;
118
119
  let action = "none";
119
120
  let fireResourceSelected = false;
120
121
  const result = {
121
122
  paneIndex: this.entry.id,
122
123
  type: type,
123
- resource: resource,
124
+ resource: resources,
124
125
  internalName: undefined,
125
126
  eventType: undefined,
126
127
  };
127
-
128
-
129
128
  if (type == "MultiFlatmap" || type == "Flatmap") {
130
- result.internalName = resource?.feature?.label ? resource.feature.label : this.idNamePair[resource.feature.models];
129
+ const flatmapImp = this.getFlatmapImp();
130
+ result.internalName = resource?.feature?.label ?
131
+ resource.feature.label : this.idNamePair[resource.feature.models];
131
132
  if (resource.eventType == "click") {
132
133
  result.eventType = "selected";
133
134
  if (resource.feature.type == "marker") {
135
+
134
136
  let label = result.internalName;
135
- if (
136
- this.settingsStore.isFeaturedMarkerIdentifier(
137
- resource.feature.id
138
- )
139
- ) {
137
+ if (this.settingsStore.isFeaturedMarkerIdentifier(resource.feature.id)) {
140
138
  // It is a featured dataset search for DOI.
141
139
  returnedAction = {
142
140
  type: "Search",
143
- term: this.settingsStore.featuredMarkerDoi(
144
- resource.feature.id
145
- ),
141
+ term: this.settingsStore.featuredMarkerDoi(resource.feature.id),
146
142
  featuredDataset: true,
147
143
  };
148
144
  } else {
@@ -151,17 +147,43 @@ export default {
151
147
  type: "Facet",
152
148
  facet: label,
153
149
  facetPropPath: "anatomy.organ.category.name",
150
+ facetSubPropPath: "anatomy.organ.name",
154
151
  term: "Anatomical structure",
155
152
  };
153
+ let labels = new Set();
154
+ if (resource?.feature['marker-terms']) {
155
+ if(resource.feature['marker-terms'].length > 0) {
156
+ resource.feature['marker-terms'].forEach((term) => {
157
+ labels.add(term.label)
158
+ });
159
+ labels.add(label)
160
+ if (labels.size > 0) {
161
+ returnedAction = {
162
+ type: "Facets",
163
+ labels: [...labels],
164
+ };
165
+ }
166
+ } else if (resource?.feature?.models) {
167
+ returnedAction = {
168
+ type: "PMRSearch",
169
+ term: resource.feature.models,
170
+ };
171
+ }
172
+ }
156
173
  }
157
-
158
174
  fireResourceSelected = true;
159
175
  if (type == "MultiFlatmap") {
160
- const flatmap =
161
- this.$refs.multiflatmap.getCurrentFlatmap().mapImp;
162
- flatmap.clearSearchResults();
176
+ flatmapImp.clearSearchResults();
163
177
  }
164
178
  } else if (resource.feature.type == "feature") {
179
+ if (flatmapImp.options && flatmapImp.options.style === 'functional') {
180
+ if (resource.feature?.hyperlinks?.pmr) {
181
+ returnedAction = {
182
+ type: "URL",
183
+ resource: resource.feature?.hyperlinks?.pmr,
184
+ };
185
+ }
186
+ }
165
187
  // Do no open scaffold in sync map
166
188
  if (this.syncMode) {
167
189
  fireResourceSelected = true;
@@ -174,16 +196,16 @@ export default {
174
196
  fireResourceSelected = true;
175
197
  }
176
198
  } else if (type == "Scaffold") {
177
- if (resource && resource[0]) {
178
- if (resource[0].data?.id === undefined || resource[0].data?.id === "") {
179
- resource[0].data.id = resource[0].data?.group;
199
+ if (resource) {
200
+ if (resource.data?.id === undefined || resource.data?.id === "") {
201
+ resource.data.id = resource.data?.group;
180
202
  }
181
- result.internalName = resource[0].data.id;
203
+ result.internalName = resource.data.id;
182
204
  // Facet search if marker is clicked
183
- if (resource[0].data.lastActionOnMarker === true) {
205
+ if (resource.data.lastActionOnMarker === true) {
184
206
  returnedAction = {
185
207
  type: "Facet",
186
- facet: capitalise(resource[0].data.id),
208
+ facet: capitalise(resource.data.id),
187
209
  facetPropPath: "anatomy.organ.category.name",
188
210
  term: "Anatomical structure",
189
211
  };
@@ -248,7 +270,7 @@ export default {
248
270
  return fetch(`${this.apiLocation}get-related-terms/${id}`)
249
271
  .then(response => response.json())
250
272
  .then(data => {
251
- if (data.uberon.array.length > 0) {
273
+ if (data.uberon?.array.length > 0) {
252
274
  name =
253
275
  data.uberon.array[0].name.charAt(0).toUpperCase() +
254
276
  data.uberon.array[0].name.slice(1);
@@ -458,75 +480,64 @@ export default {
458
480
  this.endHelp();
459
481
  }
460
482
  },
461
- getConnectivitiesByDOI: async function (hoverDOI) {
462
- const currentFlatmap = this.$refs.multiflatmap.getCurrentFlatmap();
463
- const response = await currentFlatmap.searchConnectivitiesByReference(hoverDOI);
464
- return response;
465
- },
466
- highlightAnatomies: async function (mapImp, hoverAnatomies, hoverDOI) {
467
- const itemsToHighlight = [...hoverAnatomies];
468
- const hoverHighlightOptions = this.settingsStore.hoverHighlightOptions;
483
+ flatmapHighlight: async function (flatmap, hoverAnatomies, hoverDOI, hoverConnectivity) {
484
+ let toHighlight = [...hoverAnatomies, ...hoverConnectivity];
485
+ const globalSettings = this.settingsStore.globalSettings;
486
+
469
487
 
470
488
  // to highlight connected paths
471
- if (hoverHighlightOptions.highlightConnectedPaths) {
472
- const connectionsFromFeatures = await mapImp.queryPathsForFeatures(hoverAnatomies);
473
- if (connectionsFromFeatures) {
474
- itemsToHighlight.push(...connectionsFromFeatures);
489
+ if (globalSettings.highlightConnectedPaths) {
490
+ const hoverEntry = hoverAnatomies.length ? hoverAnatomies :
491
+ hoverConnectivity.length ? hoverConnectivity :
492
+ []
493
+ const connectedPaths = await flatmap.retrieveConnectedPaths(hoverEntry);
494
+ if (connectedPaths) {
495
+ toHighlight.push(...connectedPaths);
475
496
  }
476
497
  }
477
498
 
478
499
  // to highlight related paths from reference DOI
479
- if (hoverHighlightOptions.highlightDOIPaths) {
480
- const connectionsFromDOI = await this.getConnectivitiesByDOI(hoverDOI);
500
+ if (globalSettings.highlightDOIPaths) {
501
+ const connectionsFromDOI = await flatmap.searchConnectivitiesByReference(hoverDOI);
481
502
  if (connectionsFromDOI) {
482
- itemsToHighlight.push(...connectionsFromDOI);
503
+ toHighlight.push(...connectionsFromDOI);
483
504
  }
484
505
  }
485
-
486
- return itemsToHighlight;
506
+ toHighlight = [...new Set(toHighlight)];
507
+ return toHighlight;
487
508
  },
488
- mapHoverHighlight: function () {
509
+ cardHoverHighlight: function () {
489
510
  if (this.visible) {
490
511
  const hoverAnatomies = this.settingsStore.hoverAnatomies;
491
512
  const hoverOrgans = this.settingsStore.hoverOrgans;
492
513
  const hoverDOI = this.settingsStore.hoverDOI;
493
- let mapImp = null;
494
- let scaffold = null;
495
-
496
- if (this.flatmapRef) {
497
- mapImp = this.$refs.flatmap.mapImp;
498
- }
514
+ const hoverConnectivity = this.settingsStore.hoverConnectivity;
499
515
 
500
- if (this.multiflatmapRef) {
501
- mapImp = this.$refs.multiflatmap.getCurrentFlatmap().mapImp;
502
- }
503
-
504
- if (this.scaffoldRef) {
505
- scaffold = this.$refs.scaffold;
506
- }
516
+ let flatmap = null;
517
+ let scaffold = null;
518
+ if (this.flatmapRef) flatmap = this.$flatmapRef;
519
+ if (this.multiflatmapRef) flatmap = this.$multiflatmapRef;
520
+ if (this.scaffoldRef) scaffold = this.$scaffoldRef;
507
521
 
508
522
  // reset
509
- if (mapImp) {
510
- mapImp.clearSearchResults();
523
+ if ((this.multiflatmapRef || this.flatmapRef) && flatmap) {
524
+ flatmap.mapImp.clearSearchResults();
525
+ } else if (this.scaffoldRef && scaffold) {
526
+ scaffold.changeHighlightedByName(hoverOrgans, "", false);
511
527
  }
512
528
 
513
- if (hoverAnatomies.length || hoverOrgans.length) {
514
- clearTimeout(this.hoverDelay);
515
- if (this.multiflatmapRef || this.flatmapRef) {
516
- this.highlightAnatomies(mapImp, hoverAnatomies, hoverDOI).then((itemsToHighlight) => {
517
- mapImp.selectFeatures(itemsToHighlight);
529
+ if (hoverAnatomies.length || hoverOrgans.length || hoverDOI || hoverConnectivity.length) {
530
+ if ((this.multiflatmapRef || this.flatmapRef) && flatmap) {
531
+ this.flatmapHighlight(flatmap, hoverAnatomies, hoverDOI, hoverConnectivity).then((paths) => {
532
+ try {
533
+ flatmap.zoomToFeatures(paths);
534
+ } catch (error) {
535
+ console.log(error)
536
+ }
518
537
  });
519
- } else if (this.scaffoldRef) {
520
- scaffold?.changeHighlightedByName(hoverOrgans, "", false);
538
+ } else if (this.scaffoldRef && scaffold) {
539
+ scaffold.changeHighlightedByName(hoverOrgans, "", false);
521
540
  }
522
- } else {
523
- this.hoverDelay = setTimeout(() => {
524
- if (this.multiflatmapRef || this.flatmapRef) {
525
- mapImp?.clearSearchResults();
526
- } else if (this.scaffoldRef) {
527
- scaffold?.changeHighlightedByName(hoverOrgans, "", false);
528
- }
529
- }, 500);
530
541
  }
531
542
  }
532
543
  },
@@ -539,12 +550,58 @@ export default {
539
550
  onConnectivityInfoOpen: function (connectivityInfoData) {
540
551
  EventBus.emit('connectivity-info-open', connectivityInfoData);
541
552
  },
542
- onConnectivityInfoClose: function () {
543
- EventBus.emit('connectivity-info-close');
544
- },
545
553
  onConnectivityGraphError: function (errorInfo) {
546
554
  EventBus.emit('connectivity-graph-error', errorInfo);
547
555
  },
556
+ loadConnectivityKnowledge: async function (flatmap) {
557
+ const sckanVersion = getKnowledgeSource(flatmap);
558
+ const flatmapQueries = markRaw(new FlatmapQueries());
559
+ flatmapQueries.initialise(this.flatmapAPI);
560
+ const knowledge = await loadAndStoreKnowledge(flatmap, flatmapQueries);
561
+ this.connectivityKnowledge = knowledge.filter((item) => {
562
+ if (item.source === sckanVersion && item.connectivity?.length) return true;
563
+ return false;
564
+ });
565
+ EventBus.emit("connectivity-knowledge", this.connectivityKnowledge);
566
+ },
567
+ connectivityQueryFilter: async function (flatmap, payload) {
568
+ let results = this.connectivityKnowledge;
569
+ if (payload.type === "query-update") {
570
+ if (this.query !== payload.value) this.target = [];
571
+ this.query = payload.value;
572
+ } else if (payload.type === "filter-update") {
573
+ this.filter = payload.value;
574
+ this.target = [];
575
+ } else if (payload.type === "query-filter-update") {
576
+ this.query = payload.query;
577
+ this.filter = payload.filter;
578
+ this.target = payload.data;
579
+ // restore connectivity explorer content
580
+ if (!this.query) {
581
+ EventBus.emit("connectivity-knowledge", [...results]);
582
+ }
583
+ return;
584
+ }
585
+ if (this.query) {
586
+ let flag = "", order = [], suggestions = [], paths = [];
587
+ this.searchSuggestions(this.query, suggestions);
588
+ const labels = [...new Set(suggestions)];
589
+ flag = 'label';
590
+ order = labels;
591
+ if (labels.length === 1) {
592
+ const options = {
593
+ type: this.filter.map(f => f.facet.toLowerCase()),
594
+ target: this.target.map(d => d.id),
595
+ };
596
+ paths = await flatmap.retrieveConnectedPaths([this.query], options);
597
+ flag = 'id';
598
+ order = [this.query, ...paths.filter(item => item !== this.query)];
599
+ }
600
+ results = results.filter(item => paths.includes(item.id) || labels.includes(item.label));
601
+ results.sort((a, b) => order.indexOf(a[flag]) - order.indexOf(b[flag]));
602
+ }
603
+ EventBus.emit("connectivity-knowledge", results);
604
+ }
548
605
  },
549
606
  data: function () {
550
607
  return {
@@ -564,8 +621,11 @@ export default {
564
621
  scaffoldRef: null,
565
622
  scaffoldLoaded: false,
566
623
  isInHelp: false,
567
- hoverDelay: undefined,
568
624
  mapManager: undefined,
625
+ connectivityKnowledge: [],
626
+ query: "",
627
+ filter: [],
628
+ target: [], // Support origins/components/destinations term search
569
629
  };
570
630
  },
571
631
  created: function () {
@@ -40,8 +40,9 @@ export default {
40
40
 
41
41
  if (flatmapImp) {
42
42
  // Set the dataset markers
43
- let markers = this.settingsStore.globalSettings.displayMarker ? this.settingsStore.markers : [];
43
+ let markers = this.settingsStore.globalSettings.displayMarkers ? this.settingsStore.markers : [];
44
44
  markers = removeDuplicates(markers);
45
+ let multiMarkers = this.settingsStore.globalSettings.displayMarkers ? this.settingsStore.multiScaleMarkers : [];
45
46
  let fmMarkers = this.removeMarkersNotOnFlatmap(flatmapImp, markers);
46
47
  flatmapImp.clearMarkers();
47
48
  flatmapImp.clearDatasetMarkers();
@@ -54,6 +55,7 @@ export default {
54
55
  } else {
55
56
  flatmapImp.addDatasetMarkers(fmMarkers);
56
57
  }
58
+ flatmapImp.addMarkers(multiMarkers,{ className: "standard-marker" } );
57
59
 
58
60
  // Set the featured markers
59
61
  if (this.entry.type === "MultiFlatmap") {
@@ -11,6 +11,7 @@ export const useSettingsStore = defineStore('settings', {
11
11
  algoliaKey: undefined,
12
12
  algoliaId: undefined,
13
13
  pennsieveApi: undefined,
14
+ pmrHost: "https://models.physiomeproject.org/",
14
15
  flatmapAPI: undefined,
15
16
  nlLinkPrefix: undefined,
16
17
  mapManager: undefined,
@@ -18,9 +19,11 @@ export const useSettingsStore = defineStore('settings', {
18
19
  facets: { species: [], gender: [], organ: [] },
19
20
  numberOfDatasetsForFacets: [],
20
21
  markers: [],
22
+ multiScaleMarkers: ["cvs:functional.whole-body", "cvs:functional.tissue", "cvs:functional.cell"],
21
23
  hoverAnatomies: [],
22
24
  hoverOrgans: [],
23
25
  hoverDOI: '',
26
+ hoverConnectivity: [],
24
27
  featuredMarkers: [],
25
28
  featuredMarkerIdentifiers: [],
26
29
  featuredMarkerDois: [],
@@ -30,12 +33,11 @@ export const useSettingsStore = defineStore('settings', {
30
33
  useHelpModeDialog: false,
31
34
  connectivityInfoSidebar: true,
32
35
  annotationSidebar: true,
33
- hoverHighlightOptions: {
34
- highlightConnectedPaths: false,
35
- highlightDOIPaths: false,
36
- },
37
36
  globalSettings: {
38
- displayMarker: true,
37
+ displayMarkers: true,
38
+ highlightConnectedPaths: false,
39
+ highlightDOIPaths: false, // comment out to hide in settings
40
+ interactiveMode: 'dataset', // dataset, connectivity, multiscale
39
41
  },
40
42
  }
41
43
  },
@@ -53,7 +55,7 @@ export const useSettingsStore = defineStore('settings', {
53
55
  let updatedSettings = [];
54
56
  for (const [key, value] of Object.entries(settings)) {
55
57
  const attribute = state.globalSettings[key];
56
- if (!attribute || (attribute !== value)) {
58
+ if (attribute === undefined || (attribute !== value)) {
57
59
  updatedSettings.push(key);
58
60
  }
59
61
  }
@@ -91,13 +93,17 @@ export const useSettingsStore = defineStore('settings', {
91
93
  updateRootUrl(rootUrl) {
92
94
  this.rootUrl = rootUrl;
93
95
  },
96
+ updatePmrHost(pmrHost) {
97
+ this.pmrHost = pmrHost ? pmrHost : "https://models.physiomeproject.org/";
98
+ },
94
99
  updateMarkers(markers) {
95
100
  this.markers = markers;
96
101
  },
97
- updateHoverFeatures(anatomies, organs, doi) {
102
+ updateHoverFeatures(anatomies, organs, doi, connectivity) {
98
103
  this.hoverAnatomies = anatomies;
99
104
  this.hoverOrgans = organs;
100
105
  this.hoverDOI = doi;
106
+ this.hoverConnectivity = connectivity;
101
107
  },
102
108
  updateFeatured(datasetIdentifiers) {
103
109
  this.featuredMarkerIdentifiers = new Array(datasetIdentifiers.length);
@@ -181,9 +187,6 @@ export const useSettingsStore = defineStore('settings', {
181
187
  updateAnnotationSidebar(annotationSidebar) {
182
188
  this.annotationSidebar = annotationSidebar;
183
189
  },
184
- updateHoverHighlightOptions(hoverHighlightOptions) {
185
- this.hoverHighlightOptions = hoverHighlightOptions;
186
- },
187
190
  updateGlobalSettings(globalSettings) {
188
191
  for (const [key, value] of Object.entries(globalSettings)) {
189
192
  this.globalSettings[key] = value;