@abi-software/flatmapvuer 0.3.5 → 0.3.6

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-lock.json CHANGED
@@ -1,19 +1,18 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
7
7
  "@abi-software/flatmap-viewer": {
8
- "version": "2.2.1-beta.8",
9
- "resolved": "https://registry.npmjs.org/@abi-software/flatmap-viewer/-/flatmap-viewer-2.2.1-beta.8.tgz",
10
- "integrity": "sha512-oMGQW2V7JvuA84HtO8EyQZcimMD5g+8WA3Myvq636q6dQw4v7QdMRu9jdj9WdcwuIViVvOpOEGuqowSn8GzZzw==",
8
+ "version": "2.2.0-beta.16",
9
+ "resolved": "https://registry.npmjs.org/@abi-software/flatmap-viewer/-/flatmap-viewer-2.2.0-beta.16.tgz",
10
+ "integrity": "sha512-1Eu4IRJFcQANNBuNK/kRVyzP8kRz+FXulPZKoWS62Mvf2B9D1YjmqQ1+ldO5bbCxZiwH5xhH4AGOFi2KJ54lkQ==",
11
11
  "requires": {
12
12
  "@babel/runtime": "^7.10.4",
13
13
  "@turf/area": "^6.0.1",
14
14
  "@turf/bbox": "^6.0.1",
15
15
  "@turf/helpers": "^6.1.4",
16
- "bezier-js": "^6.1.0",
17
16
  "maplibre-gl": ">=1.15.3",
18
17
  "minisearch": "^2.2.1",
19
18
  "polylabel": "^1.1.0"
@@ -3081,11 +3080,6 @@
3081
3080
  "tweetnacl": "^0.14.3"
3082
3081
  }
3083
3082
  },
3084
- "bezier-js": {
3085
- "version": "6.1.0",
3086
- "resolved": "https://registry.npmjs.org/bezier-js/-/bezier-js-6.1.0.tgz",
3087
- "integrity": "sha512-oc8fkHqG0R+dQuNiXVbPMB0cc8iDqkLAjbA2gq26QmV8tZqW9GGI7iNEX1ioRWlZperQS7v5BX03+9FLVWZbSw=="
3088
- },
3089
3083
  "bfj": {
3090
3084
  "version": "6.1.2",
3091
3085
  "resolved": "https://registry.npmjs.org/bfj/-/bfj-6.1.2.tgz",
@@ -6581,16 +6575,6 @@
6581
6575
  "integrity": "sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs=",
6582
6576
  "dev": true
6583
6577
  },
6584
- "global-prefix": {
6585
- "version": "3.0.0",
6586
- "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-3.0.0.tgz",
6587
- "integrity": "sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==",
6588
- "requires": {
6589
- "ini": "^1.3.5",
6590
- "kind-of": "^6.0.2",
6591
- "which": "^1.3.1"
6592
- }
6593
- },
6594
6578
  "globals": {
6595
6579
  "version": "11.12.0",
6596
6580
  "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
@@ -7264,11 +7248,6 @@
7264
7248
  "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
7265
7249
  "dev": true
7266
7250
  },
7267
- "ini": {
7268
- "version": "1.3.8",
7269
- "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
7270
- "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="
7271
- },
7272
7251
  "inquirer": {
7273
7252
  "version": "7.3.3",
7274
7253
  "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz",
@@ -7762,7 +7741,8 @@
7762
7741
  "isexe": {
7763
7742
  "version": "2.0.0",
7764
7743
  "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
7765
- "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA="
7744
+ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
7745
+ "dev": true
7766
7746
  },
7767
7747
  "isobject": {
7768
7748
  "version": "3.0.1",
@@ -7915,7 +7895,8 @@
7915
7895
  "kind-of": {
7916
7896
  "version": "6.0.3",
7917
7897
  "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
7918
- "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw=="
7898
+ "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
7899
+ "dev": true
7919
7900
  },
7920
7901
  "launch-editor": {
7921
7902
  "version": "2.2.1",
@@ -8193,32 +8174,31 @@
8193
8174
  }
8194
8175
  },
8195
8176
  "maplibre-gl": {
8196
- "version": "2.4.0",
8197
- "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-2.4.0.tgz",
8198
- "integrity": "sha512-csNFylzntPmHWidczfgCZpvbTSmhaWvLRj9e1ezUDBEPizGgshgm3ea1T5TCNEEBq0roauu7BPuRZjA3wO4KqA==",
8177
+ "version": "2.1.9",
8178
+ "resolved": "https://registry.npmjs.org/maplibre-gl/-/maplibre-gl-2.1.9.tgz",
8179
+ "integrity": "sha512-pnWJmILeZpgA5QSI7K7xFK3yrkyYTd9srw3fCi2Ca52Phm78hsznPwUErEQcZLfxXKn/1h9t8IPdj0TH0NBNbg==",
8199
8180
  "requires": {
8200
- "@mapbox/geojson-rewind": "^0.5.2",
8181
+ "@mapbox/geojson-rewind": "^0.5.1",
8201
8182
  "@mapbox/jsonlint-lines-primitives": "^2.0.2",
8202
8183
  "@mapbox/mapbox-gl-supported": "^2.0.1",
8203
8184
  "@mapbox/point-geometry": "^0.1.0",
8204
- "@mapbox/tiny-sdf": "^2.0.5",
8185
+ "@mapbox/tiny-sdf": "^2.0.4",
8205
8186
  "@mapbox/unitbezier": "^0.0.1",
8206
8187
  "@mapbox/vector-tile": "^1.3.1",
8207
8188
  "@mapbox/whoots-js": "^3.1.0",
8208
- "@types/geojson": "^7946.0.10",
8189
+ "@types/geojson": "^7946.0.8",
8209
8190
  "@types/mapbox__point-geometry": "^0.1.2",
8210
8191
  "@types/mapbox__vector-tile": "^1.3.0",
8211
8192
  "@types/pbf": "^3.0.2",
8212
8193
  "csscolorparser": "~1.0.3",
8213
- "earcut": "^2.2.4",
8194
+ "earcut": "^2.2.3",
8214
8195
  "geojson-vt": "^3.2.1",
8215
8196
  "gl-matrix": "^3.4.3",
8216
- "global-prefix": "^3.0.0",
8217
8197
  "murmurhash-js": "^1.0.0",
8218
8198
  "pbf": "^3.2.1",
8219
8199
  "potpack": "^1.0.2",
8220
8200
  "quickselect": "^2.0.0",
8221
- "supercluster": "^7.1.5",
8201
+ "supercluster": "^7.1.4",
8222
8202
  "tinyqueue": "^2.0.3",
8223
8203
  "vt-pbf": "^3.1.3"
8224
8204
  }
@@ -13679,6 +13659,7 @@
13679
13659
  "version": "1.3.1",
13680
13660
  "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
13681
13661
  "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
13662
+ "dev": true,
13682
13663
  "requires": {
13683
13664
  "isexe": "^2.0.0"
13684
13665
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "main": "./dist/flatmapvuer.common.js",
5
5
  "files": [
6
6
  "dist/*",
@@ -10,14 +10,13 @@
10
10
  "*.js"
11
11
  ],
12
12
  "scripts": {
13
- "start": "vue-cli-service serve",
14
13
  "serve": "vue-cli-service serve --port 8082",
15
14
  "build": "vue-cli-service build --dest test_html --mode staging",
16
15
  "build-bundle": "vue-cli-service build --target lib --name flatmapvuer ./src/components/index.js",
17
16
  "lint": "vue-cli-service lint"
18
17
  },
19
18
  "dependencies": {
20
- "@abi-software/flatmap-viewer": "^2.2.1-beta.8",
19
+ "@abi-software/flatmap-viewer": "^2.2.0-beta.16",
21
20
  "@abi-software/svg-sprite": "^0.1.14",
22
21
  "core-js": "^3.3.2",
23
22
  "css-element-queries": "^1.2.2",
package/src/App.vue CHANGED
@@ -91,8 +91,8 @@ export default {
91
91
  displayCloseButton: false,
92
92
  initial: "Rat",
93
93
  helpMode: false,
94
- //flatmapAPI: "https://mapcore-demo.org/current/flatmap/v2/"
95
- flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v3/"
94
+ flatmapAPI: "https://mapcore-demo.org/current/flatmap/v2/"
95
+ // flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v3/"
96
96
  // flatmapAPI: "https://mapcore-demo.org/fccb/flatmap/"
97
97
  // flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v1/"
98
98
  }
@@ -28,7 +28,6 @@
28
28
  </div>
29
29
  <div v-for="origin in origins" class="attribute-content" :key="origin">
30
30
  {{ capitalise(origin) }}
31
- <div class="seperator"></div>
32
31
  </div>
33
32
  <el-button v-show="originsWithDatasets.length > 0" class="button" @click="openDendrites">
34
33
  Explore origin data
@@ -38,7 +37,6 @@
38
37
  <div class="attribute-title">Components</div>
39
38
  <div v-for="component in components" class="attribute-content" :key="component">
40
39
  {{ capitalise(component) }}
41
- <div class="seperator"></div>
42
40
  </div>
43
41
  </div>
44
42
  <div v-if="this.destinations" class="block">
@@ -58,7 +56,6 @@
58
56
  </div>
59
57
  <div v-for="destination in destinations" class="attribute-content" :key="destination">
60
58
  {{ capitalise(destination) }}
61
- <div class="seperator"></div>
62
59
  </div>
63
60
  <el-button v-show="destinationsWithDatasets.length > 0" class="button" @click="openAxons">
64
61
  Explore destination data
@@ -112,12 +109,6 @@ const titleCase = (str) => {
112
109
  return str.replace(/\w\S*/g, (t) => { return t.charAt(0).toUpperCase() + t.substr(1).toLowerCase() });
113
110
  }
114
111
 
115
- const inArray = function(ar1, ar2){
116
- let as1 = JSON.stringify(ar1)
117
- let as2 = JSON.stringify(ar2)
118
- return as1.indexOf(as2) !== -1
119
- }
120
-
121
112
  const capitalise = function(str){
122
113
  if (str)
123
114
  return str.charAt(0).toUpperCase() + str.slice(1)
@@ -204,32 +195,6 @@ export default {
204
195
  pubmedSearchUrlUpdate: function (val){
205
196
  this.pubmedSearchUrl = val
206
197
  },
207
- findAllIdsFromConnectivity(connectivity){
208
- let dnodes = connectivity.connectivity.flat() // get nodes from edgelist
209
- let nodes = [...new Set(dnodes)] // remove duplicates
210
- let found = []
211
- nodes.forEach(n=>{
212
- if (Array.isArray(n)){
213
- found.push(n.flat())
214
- } else {
215
- found.push(n)
216
- }
217
- })
218
- return [... new Set(found.flat())]
219
- },
220
- flattenConntectivity(connectivity){
221
- let dnodes = connectivity.flat() // get nodes from edgelist
222
- let nodes = [...new Set(dnodes)] // remove duplicates
223
- let found = []
224
- nodes.forEach(n=>{
225
- if (Array.isArray(n)){
226
- found.push(n.flat())
227
- } else {
228
- found.push(n)
229
- }
230
- })
231
- return found.flat()
232
- },
233
198
  findComponents: function(connectivity){
234
199
  let dnodes = connectivity.connectivity.flat() // get nodes from edgelist
235
200
  let nodes = [...new Set(dnodes)] // remove duplicates
@@ -237,20 +202,26 @@ export default {
237
202
  let found = []
238
203
  let terminal = false
239
204
  nodes.forEach(node=>{
240
- terminal = false
241
- // Check if the node is an destination or origin (note that they are labelled dendrite and axon as opposed to origin and destination)
242
- if(inArray(connectivity.axons,node)){
243
- terminal = true
244
- }
245
- if(inArray(connectivity.dendrites, node)){
246
- terminal = true
247
- }
248
- if (!terminal){
249
- found.push(node)
250
- }
205
+ let n = node.flat() // Find all terms on the node
206
+ terminal = false
207
+
208
+ // Check if the node is an destination or origin (note that they are labelled dendrite and axon as opposed to origin and destination)
209
+ n.forEach(s=>{
210
+ if(connectivity.axons.includes(s)){
211
+ terminal = true
212
+ }
213
+ if(connectivity.dendrites.includes(s)){
214
+ terminal = true
215
+ }
216
+ })
217
+ if (!terminal){
218
+ found.push(node)
219
+ }
251
220
  })
252
221
 
253
- return found
222
+ // remove duplicates
223
+ let foundUnique = [...new Set(found.map(n=>n[0]))]
224
+ return foundUnique
254
225
  },
255
226
  getOrganCuries: function(){
256
227
  fetch(`${this.sparcAPI}get-organ-curies/`)
@@ -305,29 +276,6 @@ export default {
305
276
  })
306
277
  })
307
278
  },
308
- createComponentsLabelList: function(components, lookUp){
309
- let labelList = []
310
- components.forEach(n=>{
311
- labelList.push(this.createLabelFromNeuralNode(n[0]), lookUp)
312
- if (n.length === 2){
313
- labelList.push(this.createLabelFromNeuralNode(n[1]), lookUp)
314
- }
315
- })
316
- return labelList
317
- },
318
- createLabelFromNeuralNode: function(node, lookUp){
319
- let label = lookUp[node[0]]
320
- if (node.length === 2 && node[1].length > 0){
321
- node[1].forEach(n=>{
322
- if (lookUp[n] == undefined){
323
- label += `, ${n}`
324
- } else {
325
- label += `, ${lookUp[n]}`
326
- }
327
- })
328
- }
329
- return label
330
- },
331
279
  pathwayQuery: function(keastIds){
332
280
  this.destinations = []
333
281
  this.origins = []
@@ -345,30 +293,20 @@ export default {
345
293
  .then(response => response.json())
346
294
  .then(data => {
347
295
  let connectivity = JSON.parse(data.values[0][0])
348
-
349
- // Filter the origin and destinations from components
350
296
  let components = this.findComponents(connectivity)
351
297
 
352
- // process the nodes for finding datasets
353
- let componentsFlat = this.flattenConntectivity(components)
354
- let axons = connectivity.axons
355
- let dendrites = connectivity.dendrites
356
- let axonsFlat = this.flattenConntectivity(axons)
357
- let dendritesFlat = this.flattenConntectivity(dendrites)
358
-
359
- let conIds = this.findAllIdsFromConnectivity(connectivity) // Create list of ids to get labels for
360
-
361
- // Create readable labels from the nodes. Setting this to 'this.origins' updates the display
298
+ // Create list of ids to get labels for
299
+ let conIds = connectivity.axons.concat(connectivity.dendrites.concat(components))
362
300
  this.createLabelLookup(conIds).then(lookUp=>{
363
- this.destinations = axons.map(a=>this.createLabelFromNeuralNode(a,lookUp))
364
- this.origins = dendrites.map(d=>this.createLabelFromNeuralNode(d,lookUp))
365
- this.components = components.map(c=>this.createLabelFromNeuralNode(c, lookUp))
301
+ this.destinations = connectivity.axons.map(a=>lookUp[a])
302
+ this.origins = connectivity.dendrites.map(d=>lookUp[d])
303
+ this.components = components.map(c=>lookUp[c])
366
304
  })
367
305
 
368
306
  // Filter for the anatomy which is annotated on datasets
369
- this.destinationsWithDatasets = this.uberons.filter(ub => axonsFlat.indexOf(ub.id) !== -1)
370
- this.originsWithDatasets = this.uberons.filter(ub => dendritesFlat.indexOf(ub.id) !== -1)
371
- this.componentsWithDatasets = this.uberons.filter(ub => componentsFlat.indexOf(ub.id) !== -1)
307
+ this.destinationsWithDatasets = this.uberons.filter(ub => connectivity.axons.indexOf(ub.id) !== -1)
308
+ this.originsWithDatasets = this.uberons.filter(ub => connectivity.dendrites.indexOf(ub.id) !== -1)
309
+ this.componentsWithDatasets = this.uberons.filter(ub => connectivity.dendrites.indexOf(ub.id) !== -1)
372
310
  this.loading = false
373
311
  })
374
312
  .catch((error) => {
@@ -441,12 +379,6 @@ export default {
441
379
  margin-left: 8px;
442
380
  }
443
381
 
444
- .seperator {
445
- width:90%;
446
- height:0.5px;
447
- background-color:#bfbec2;
448
- }
449
-
450
382
  .main {
451
383
  font-size: 14px;
452
384
  text-align: left;