@abi-software/flatmapvuer 1.7.1 → 1.7.2-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.7.1",
3
+ "version": "1.7.2-beta.0",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist/*",
@@ -113,16 +113,10 @@ Please use `const` to assign meaningful names to them...
113
113
  </div>
114
114
  </template>
115
115
  <template #default>
116
- <b>Connectivity Graph</b>
116
+ <b>Connectivity References</b>
117
117
  <p>
118
- You can now view individual connectivity after clicking
119
- on a connection in exploration mode.
120
- </p>
121
- <b>Interactive connectivity list and graph</b>
122
- <p>
123
- Corresponding features on the map can be located when
124
- hovering or clicking on the features in the connecitivity
125
- list and graph.
118
+ Connectivity references have been improved and available
119
+ in various formats.
126
120
  </p>
127
121
  <b>Improved state storing</b>
128
122
  <p>
@@ -479,18 +473,35 @@ Please use `const` to assign meaningful names to them...
479
473
  </el-select>
480
474
  </el-row>
481
475
  </template>
482
- <el-row class="backgroundSpacer" v-if="displayFlightPathOption"></el-row>
483
- <el-row class="backgroundText" v-if="displayFlightPathOption">Flight path display</el-row>
484
- <el-row class="backgroundControl" v-if="displayFlightPathOption">
485
- <el-radio-group
486
- v-model="flightPath3DRadio"
487
- class="flatmap-radio"
488
- @change="setFlightPath3D"
489
- >
490
- <el-radio :value="false">2D</el-radio>
491
- <el-radio :value="true">3D</el-radio>
492
- </el-radio-group>
493
- </el-row>
476
+ <div v-if="viewingMode === 'Neuron Connection'">
477
+ <el-row class="backgroundSpacer"></el-row>
478
+ <el-row class="backgroundText">Connection path display</el-row>
479
+ <el-row class="backgroundControl">
480
+ <el-radio-group
481
+ v-model="connectionPathRadio"
482
+ class="flatmap-radio"
483
+ @change="setConnectionPath"
484
+ >
485
+ <el-radio value="origins">Origin</el-radio>
486
+ <el-radio value="components">Component</el-radio>
487
+ <el-radio value="destinations">Destination</el-radio>
488
+ </el-radio-group>
489
+ </el-row>
490
+ </div>
491
+ <div v-else>
492
+ <el-row class="backgroundSpacer" v-if="displayFlightPathOption"></el-row>
493
+ <el-row class="backgroundText" v-if="displayFlightPathOption">Flight path display</el-row>
494
+ <el-row class="backgroundControl" v-if="displayFlightPathOption">
495
+ <el-radio-group
496
+ v-model="flightPath3DRadio"
497
+ class="flatmap-radio"
498
+ @change="setFlightPath3D"
499
+ >
500
+ <el-radio :value="false">2D</el-radio>
501
+ <el-radio :value="true">3D</el-radio>
502
+ </el-radio-group>
503
+ </el-row>
504
+ </div>
494
505
  <el-row class="backgroundSpacer"></el-row>
495
506
  <el-row class="backgroundText">Organs display</el-row>
496
507
  <el-row class="backgroundControl">
@@ -1049,6 +1060,17 @@ export default {
1049
1060
  this.addAnnotationFeature()
1050
1061
  }
1051
1062
  },
1063
+ /**
1064
+ * @public
1065
+ * Function to switch the type of connection path display
1066
+ * @arg {Boolean} `flag`
1067
+ */
1068
+ setConnectionPath: function (flag) {
1069
+ this.connectionPathRadio = flag
1070
+ if (this.mapImp && this.currentActive) {
1071
+ this.highlightConnectedPaths([this.currentActive])
1072
+ }
1073
+ },
1052
1074
  /**
1053
1075
  * @public
1054
1076
  * Function to switch from 2D to 3D
@@ -1269,47 +1291,60 @@ export default {
1269
1291
  /**
1270
1292
  * @public
1271
1293
  * Function to highlight the connected paths
1272
- * by providing path model identifier, ``pathId``.
1273
- * @arg {String} `pathId`
1294
+ * by providing path model identifier, ``pathId`` or ``anatomicalId``.
1295
+ * @arg {String} `pathId` or `anatomicalId`
1274
1296
  */
1275
- highlightConnectedPaths: async function (payload) {
1297
+ highlightConnectedPaths: async function (payload, options = {}) {
1276
1298
  if (this.mapImp) {
1277
- let paths = [...this.mapImp.pathModelNodes(payload)]
1278
-
1279
1299
  // The line below is to get the path features from the geojson ids
1280
- let pathFeatures = paths.map((p) => this.mapImp.featureProperties(p))
1281
-
1282
- // Query the flatmap knowledge graph for connectivity, we use this to grab the origins
1283
- let connectivity = await this.flatmapQueries.queryForConnectivityNew(this.mapImp, payload)
1284
-
1285
- // Check and flatten the origins node graph
1286
- let originsFlat = connectivity?.ids?.dendrites?.flat().flat()
1287
-
1300
+ const connectedType = options.type || this.connectionPathRadio
1301
+ const nodeFeatureIds = [...this.mapImp.pathModelNodes(payload)]
1302
+ const pathsOfEntities = await this.mapImp.queryPathsForFeatures(payload)
1288
1303
  let toHighlight = []
1289
1304
  let highlight = false
1290
1305
 
1291
- // Loop through the path features and check if we have origin nodes
1292
- pathFeatures.forEach((p) => {
1293
-
1294
- // Get the nodes from each path feature
1295
- this.mapImp.nodePathModels(p.featureId).forEach((f) => {
1296
- highlight = true
1297
- // s2 here is the second level paths
1298
- let s2 = this.mapImp.pathModelNodes(f)
1299
- s2.forEach((s) => {
1300
- let s2Feature = this.mapImp.featureProperties([s]) // get the feature properties for s2
1301
- if (originsFlat.includes(s2Feature.models)) {
1302
- highlight = false // if we have an origin node, we don't want to highlight the path
1303
- return
1304
- }
1305
- })
1306
+ if (nodeFeatureIds.length) {
1307
+ let target = options.target || []
1308
+ if (!target.length) {
1309
+ // Query the flatmap knowledge graph for connectivity, we use this to grab the origins
1310
+ const connectivity = await this.flatmapQueries.queryForConnectivityNew(this.mapImp, payload)
1311
+ // Check and flatten the origins node graph
1312
+ const originsFlat = connectivity?.ids?.dendrites?.flat().flat()
1313
+ const componentsFlat = connectivity?.ids?.components?.flat().flat()
1314
+ const destinationsFlat = connectivity?.ids?.axons?.flat().flat()
1315
+ target = connectedType === "origins" ?
1316
+ originsFlat : connectedType === "components" ?
1317
+ componentsFlat : connectedType === "destinations" ?
1318
+ destinationsFlat : []
1319
+ }
1306
1320
 
1307
- if (highlight) {
1308
- toHighlight.push(f)
1309
- }
1321
+ // Loop through the node features and check if we have certain nodes
1322
+ nodeFeatureIds.forEach((featureId) => {
1323
+ // Get the paths from each node feature
1324
+ const pathsL2 = this.mapImp.nodePathModels(featureId)
1325
+ pathsL2.forEach((path) => {
1326
+ highlight = true
1327
+ // nodes of the second level path
1328
+ const nodeFeatureIdsL2 = this.mapImp.pathModelNodes(path)
1329
+ const nodeModelsL2 = nodeFeatureIdsL2.map((featureIdL2) => {
1330
+ return this.mapImp.featureProperties(featureIdL2).models
1331
+ })
1332
+ const intersection = target.filter(element => nodeModelsL2.includes(element))
1333
+ if (!intersection.length) highlight = false
1334
+ if (highlight && !toHighlight.includes(path)) toHighlight.push(path)
1335
+ })
1310
1336
  })
1311
- })
1312
-
1337
+ toHighlight = [...new Set([...toHighlight, ...payload])]
1338
+ } else if (pathsOfEntities.length) {
1339
+ pathsOfEntities.forEach((path) => {
1340
+ const nodeFeatureIds = this.mapImp.pathModelNodes(path)
1341
+ const nodeModels = nodeFeatureIds.map((featureId) => {
1342
+ return this.mapImp.featureProperties(featureId).models
1343
+ })
1344
+ if (nodeModels.includes(options.target[0])) toHighlight.push(path)
1345
+ })
1346
+ if (!toHighlight.length) toHighlight = options.target
1347
+ }
1313
1348
  // display connected paths
1314
1349
  this.mapImp.zoomToFeatures(toHighlight, { noZoomIn: true })
1315
1350
  }
@@ -1645,10 +1680,10 @@ export default {
1645
1680
  //The following will be used to track either a feature is selected
1646
1681
  this.statesTracking.activeClick = true
1647
1682
  this.statesTracking.activeTerm = data?.models
1683
+ this.currentActive = data.models ? data.models : ''
1648
1684
  if (this.viewingMode === 'Neuron Connection') {
1649
1685
  this.highlightConnectedPaths([data.models])
1650
1686
  } else {
1651
- this.currentActive = data.models ? data.models : ''
1652
1687
  // Drawing connectivity between features
1653
1688
  if (this.activeDrawTool && !this.isValidDrawnCreated) {
1654
1689
  // Check if flatmap features or existing drawn features
@@ -1862,8 +1897,7 @@ export default {
1862
1897
  }
1863
1898
  } else {
1864
1899
  //require data.resource && data.feature.source
1865
- let results =
1866
- await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.mapImp, data)
1900
+ const results = await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.mapImp, data)
1867
1901
  // The line below only creates the tooltip if some data was found on the path
1868
1902
  // the pubmed URLs are in knowledge response.references
1869
1903
  if (
@@ -1873,6 +1907,8 @@ export default {
1873
1907
  this.resourceForTooltip = data.resource[0]
1874
1908
  data.resourceForTooltip = this.resourceForTooltip
1875
1909
  this.createTooltipFromNeuronCuration(data)
1910
+ } else {
1911
+ this.createTooltipFromEntityCuration(data)
1876
1912
  }
1877
1913
  }
1878
1914
  },
@@ -1914,8 +1950,43 @@ export default {
1914
1950
  */
1915
1951
  createTooltipFromNeuronCuration: async function (data) {
1916
1952
  this.tooltipEntry = await this.flatmapQueries.createTooltipData(this.mapImp, data)
1953
+ this.tooltipEntry.neuronCuration = true
1917
1954
  this.displayTooltip(data.resource[0])
1918
1955
  },
1956
+ /**
1957
+ * @public
1958
+ * Function to create tooltip from Neuron Curation ``data``.
1959
+ * @arg {Object} `data`
1960
+ */
1961
+ createTooltipFromEntityCuration: async function (data) {
1962
+ this.tooltipEntry = await this.flatmapQueries.createTooltipData(this.mapImp, data)
1963
+ this.tooltipEntry.entityCuration = true
1964
+ let labels = []
1965
+ const pathsOfEntities = await this.mapImp.queryPathsForFeatures(data.resource)
1966
+ if (pathsOfEntities.length) {
1967
+ let componentsWithDatasets = []
1968
+ pathsOfEntities.forEach((path) => {
1969
+ const featureIds = this.mapImp.pathModelNodes(path)
1970
+ featureIds.forEach((id) => {
1971
+ const feature = this.mapImp.featureProperties(id)
1972
+ if (!labels.includes(feature.label)) {
1973
+ labels.push(feature.label)
1974
+ componentsWithDatasets.push({ id: feature.models, name: feature.label })
1975
+ }
1976
+ })
1977
+ })
1978
+ this.tooltipEntry = {
1979
+ ...this.tooltipEntry,
1980
+ origins: [data.label],
1981
+ originsWithDatasets: [{ id: data.resource[0], name: data.label }],
1982
+ components: labels,
1983
+ componentsWithDatasets: componentsWithDatasets,
1984
+ destinations: [],
1985
+ destinationsWithDatasets: [],
1986
+ }
1987
+ this.displayTooltip(data.resource[0])
1988
+ }
1989
+ },
1919
1990
  /**
1920
1991
  * @public
1921
1992
  * Function to show popup on map.
@@ -2317,6 +2388,7 @@ export default {
2317
2388
  if (identifier && identifier.uuid) state['uuid'] = identifier.uuid
2318
2389
  state['viewingMode'] = this.viewingMode
2319
2390
  state['searchTerm'] = this.statesTracking.activeTerm
2391
+ state['connectionPath'] = this.connectionPathRadio
2320
2392
  state['flightPath3D'] = this.flightPath3DRadio
2321
2393
  state['colour'] = this.colourRadio
2322
2394
  state['outlinesRadio'] = this.outlinesRadio
@@ -2913,6 +2985,7 @@ export default {
2913
2985
  connectivityTooltipVisible: false,
2914
2986
  drawerOpen: false,
2915
2987
  featuresAlert: undefined,
2988
+ connectionPathRadio: 'origins',
2916
2989
  flightPath3DRadio: false,
2917
2990
  displayFlightPathOption: false,
2918
2991
  colourRadio: true,