@abi-software/flatmapvuer 1.8.2-beta.0 → 1.8.3-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "1.8.2-beta.0",
3
+ "version": "1.8.3-beta.0",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist/*",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@abi-software/flatmap-viewer": "3.2.13",
47
- "@abi-software/map-utilities": "^1.4.0",
47
+ "@abi-software/map-utilities": "^1.4.3-beta.0",
48
48
  "@abi-software/sparc-annotation": "0.3.2",
49
49
  "@abi-software/svg-sprite": "^1.0.1",
50
50
  "@element-plus/icons-vue": "^2.3.1",
package/src/App.vue CHANGED
@@ -283,6 +283,10 @@ export default {
283
283
  taxo: 'FunctionalConnectivity',
284
284
  displayWarning: true,
285
285
  },
286
+ Test: {
287
+ "taxo": "NCBITaxon:1",
288
+ "displayWarning": true
289
+ },
286
290
  },
287
291
  tooltipContent: undefined,
288
292
  tStyle: {
@@ -589,6 +589,7 @@ Please use `const` to assign meaningful names to them...
589
589
  :tooltipEntry="tooltipEntry"
590
590
  :annotationDisplay="viewingMode === 'Annotation'"
591
591
  @annotation="commitAnnotationEvent"
592
+ @onActionClick="onActionClick"
592
593
  />
593
594
  </div>
594
595
  </div>
@@ -638,6 +639,7 @@ import { mapState } from 'pinia'
638
639
  import { useMainStore } from '@/store/index'
639
640
  import { DrawToolbar, Tooltip, TreeControls } from '@abi-software/map-utilities'
640
641
  import '@abi-software/map-utilities/dist/style.css'
642
+ import EventBus from './EventBus.js'
641
643
 
642
644
  const ERROR_MESSAGE = 'cannot be found on the map.';
643
645
 
@@ -1882,6 +1884,14 @@ export default {
1882
1884
  }
1883
1885
  });
1884
1886
  },
1887
+ changeConnectivitySource: function (payload) {
1888
+ const { featureId, connectivitySource } = payload;
1889
+ const newwPromise = this.flatmapQueries.queryForConnectivityNew(this.mapImp, featureId, null, connectivitySource);
1890
+ Promise.resolve(newwPromise).then((result) => {
1891
+ this.tooltipEntry = this.flatmapQueries.updateTooltipData(this.tooltipEntry);
1892
+ this.$emit('connectivity-info-open', this.tooltipEntry);
1893
+ })
1894
+ },
1885
1895
  /**
1886
1896
  * @public
1887
1897
  * Function to create/display tooltips from the provided ``data``.
@@ -2203,6 +2213,10 @@ export default {
2203
2213
  // Get connectivity knowledge source | SCKAN release
2204
2214
  if (this.mapImp.provenance?.connectivity) {
2205
2215
  this.tooltipEntry['knowledge-source'] = getKnowledgeSource(this.mapImp);
2216
+
2217
+ // Map id and uuid to load connectivity information from the map
2218
+ this.tooltipEntry['mapId'] = this.mapImp.provenance.id;
2219
+ this.tooltipEntry['mapuuid'] = this.mapImp.provenance.uuid;
2206
2220
  }
2207
2221
  this.$emit('connectivity-info-open', this.tooltipEntry);
2208
2222
  }
@@ -2688,6 +2702,7 @@ export default {
2688
2702
  provenanceTaxonomy: feature.taxons,
2689
2703
  }
2690
2704
  if (this.viewingMode === "Exploration" || this.viewingMode === "Annotation") {
2705
+ this.featuresAlert = feature.alert
2691
2706
  this.checkAndCreatePopups(data)
2692
2707
  } else if (this.viewingMode === 'Neuron Connection') {
2693
2708
  setTimeout(() => {
@@ -2717,6 +2732,9 @@ export default {
2717
2732
  if (this.mapImp) return this.mapImp.search(term)
2718
2733
  return []
2719
2734
  },
2735
+ onActionClick: function (data) {
2736
+ EventBus.emit('onActionClick', data)
2737
+ },
2720
2738
  },
2721
2739
  props: {
2722
2740
  /**
@@ -46,12 +46,14 @@ function loadAndStoreKnowledge(mapImp, flatmapQueries) {
46
46
  where source="${knowledgeSource}"
47
47
  order by source desc`;
48
48
  const flatmapKnowledge = sessionStorage.getItem('flatmap-knowledge');
49
+ const flatmapKnowledgeSource = sessionStorage.getItem('flatmap-knowledge-source');
49
50
 
50
- if (!flatmapKnowledge) {
51
+ if (!flatmapKnowledge || flatmapKnowledgeSource !== knowledgeSource) {
51
52
  flatmapQueries.flatmapQuery(sql).then((response) => {
52
53
  const mappedData = response.values.map(x => x[0]);
53
54
  const parsedData = mappedData.map(x => JSON.parse(x));
54
55
  sessionStorage.setItem('flatmap-knowledge', JSON.stringify(parsedData));
56
+ sessionStorage.setItem('flatmap-knowledge-source', knowledgeSource);
55
57
  updateFlatmapKnowledgeCache();
56
58
  });
57
59
  }
@@ -69,6 +71,7 @@ function removeFlatmapKnowledgeCache() {
69
71
  const keys = [
70
72
  'flatmap-knowledge',
71
73
  'flatmap-knowledge-expiry',
74
+ 'flatmap-knowledge-source',
72
75
  ];
73
76
  keys.forEach((key) => {
74
77
  sessionStorage.removeItem(key);
@@ -125,6 +125,18 @@ let FlatmapQueries = function () {
125
125
  return tooltipData
126
126
  }
127
127
 
128
+ this.updateTooltipData = function (tooltipEntry) {
129
+ return {
130
+ ...tooltipEntry,
131
+ origins: this.origins,
132
+ originsWithDatasets: this.originsWithDatasets,
133
+ components: this.components,
134
+ componentsWithDatasets: this.componentsWithDatasets,
135
+ destinations: this.destinations,
136
+ destinationsWithDatasets: this.destinationsWithDatasets,
137
+ };
138
+ }
139
+
128
140
  this.createComponentsLabelList = function (components, lookUp) {
129
141
  let labelList = []
130
142
  components.forEach((n) => {
@@ -207,7 +219,7 @@ let FlatmapQueries = function () {
207
219
  return found.flat()
208
220
  }
209
221
 
210
- this.findComponents = function (connectivity, axons, dendrites) {
222
+ this.findComponents = function (connectivity, axons, dendrites, somas) {
211
223
  let dnodes = connectivity.connectivity.flat() // get nodes from edgelist
212
224
  let nodes = removeDuplicates(dnodes)
213
225
 
@@ -219,6 +231,9 @@ let FlatmapQueries = function () {
219
231
  if (inArray(axons, node)) {
220
232
  terminal = true
221
233
  }
234
+ if (somas && inArray(somas, node)) {
235
+ terminal = true
236
+ }
222
237
  if (inArray(dendrites, node)) {
223
238
  terminal = true
224
239
  }
@@ -245,14 +260,22 @@ let FlatmapQueries = function () {
245
260
  this.rawURLs = []
246
261
  if (!keastIds || keastIds.length == 0 || !keastIds[0]) return
247
262
 
248
- let prom1 = this.queryForConnectivityNew(mapImp, keastIds, signal) // This on returns a promise so dont need 'await'
263
+ // set connectivity source if available
264
+ const connectivitySource = localStorage.getItem('connectivity-source');
265
+
266
+ let prom1 = this.queryForConnectivityNew(mapImp, keastIds, signal, connectivitySource) // This on returns a promise so dont need 'await'
249
267
  let results = await Promise.all([prom1])
250
268
  return results
251
269
  }
252
270
 
253
- this.queryForConnectivityNew = function (mapImp, keastIds, signal, processConnectivity=true) {
271
+ this.queryForConnectivityNew = function (mapImp, keastIds, signal, connectivitySource, processConnectivity=true) {
254
272
  return new Promise((resolve) => {
255
- mapImp.queryKnowledge(keastIds[0])
273
+ const mapuuid = mapImp.provenance.uuid;
274
+ const queryAPI = connectivitySource === 'map'
275
+ ? this.queryMapConnectivity(mapuuid, keastIds[0])
276
+ : mapImp.queryKnowledge(keastIds[0]);
277
+
278
+ queryAPI
256
279
  .then((response) => {
257
280
  if (this.checkConnectivityExists(response)) {
258
281
  let connectivity = response;
@@ -287,6 +310,21 @@ let FlatmapQueries = function () {
287
310
  })
288
311
  }
289
312
 
313
+ this.queryMapConnectivity = async function (mapuuid, pathId) {
314
+ const url = this.flatmapApi + `flatmap/${mapuuid}/connectivity/${pathId}`;
315
+
316
+ try {
317
+ const response = await fetch(url);
318
+ if (!response.ok) {
319
+ throw new Error(`Response status: ${response.status}`);
320
+ }
321
+
322
+ return await response.json();
323
+ } catch (error) {
324
+ throw new Error(error);
325
+ }
326
+ },
327
+
290
328
  this.queryForConnectivity = function (mapImp, keastIds, signal, processConnectivity=true) {
291
329
  const data = { sql: this.buildConnectivitySqlStatement(keastIds) }
292
330
  const headers = {
@@ -399,23 +437,35 @@ let FlatmapQueries = function () {
399
437
  }
400
438
 
401
439
  this.processConnectivity = function (mapImp, connectivity) {
402
- const sourceKey = ["ilxtr:hasSomaLocatedIn"]
403
- const destinationKey = ["ilxtr:hasAxonPresynapticElementIn", "ilxtr:hasAxonSensorySubcellularElementIn"]
404
-
405
440
  return new Promise((resolve) => {
406
441
  let dendrites = []
407
442
  let axons = []
443
+ let somas = undefined
444
+ if (connectivity && connectivity["node-phenotypes"]) {
445
+ const sourceKey = ["ilxtr:hasSomaLocatedIn"]
446
+ const destinationKey = ["ilxtr:hasAxonPresynapticElementIn", "ilxtr:hasAxonSensorySubcellularElementIn"]
447
+ sourceKey.forEach((key)=>{
448
+ dendrites.push(...connectivity["node-phenotypes"][key])
449
+ })
450
+ dendrites = removeDuplicates(dendrites)
451
+ destinationKey.forEach((key)=>{
452
+ axons.push(...connectivity["node-phenotypes"][key])
453
+ })
454
+ axons = removeDuplicates(axons)
455
+ } else {
456
+ // Remove duplicates
457
+ axons = removeDuplicates(connectivity.axons)
458
+ //Somas will become part of origins, support this for future proof
459
+ if (connectivity.somas && connectivity.somas.length > 0) {
460
+ dendrites.push(...connectivity.somas)
461
+ }
462
+ if (connectivity.dendrites && connectivity.dendrites.length > 0) {
463
+ dendrites.push(...connectivity.dendrites)
464
+ }
465
+ somas = connectivity.somas
466
+ }
408
467
 
409
- sourceKey.forEach((key)=>{
410
- dendrites.push(...connectivity["node-phenotypes"][key])
411
- })
412
- dendrites = removeDuplicates(dendrites)
413
- destinationKey.forEach((key)=>{
414
- axons.push(...connectivity["node-phenotypes"][key])
415
- })
416
- axons = removeDuplicates(axons)
417
- const components = this.findComponents(connectivity, axons, dendrites)
418
-
468
+ const components = this.findComponents(connectivity, axons, dendrites, somas)
419
469
  // Create list of ids to get labels for
420
470
  const conIds = this.findAllIdsFromConnectivity(connectivity)
421
471
  // Create readable labels from the nodes. Setting this to 'this.origins' updates the display