@abi-software/flatmapvuer 0.3.10 → 0.3.11

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "0.3.9",
3
+ "version": "0.3.11",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -2001,6 +2001,7 @@
2001
2001
  "thread-loader": "^2.1.3",
2002
2002
  "url-loader": "^2.2.0",
2003
2003
  "vue-loader": "^15.9.2",
2004
+ "vue-loader-v16": "npm:vue-loader@^16.1.0",
2004
2005
  "vue-style-loader": "^4.1.2",
2005
2006
  "webpack": "^4.0.0",
2006
2007
  "webpack-bundle-analyzer": "^3.8.0",
@@ -13191,6 +13192,94 @@
13191
13192
  }
13192
13193
  }
13193
13194
  },
13195
+ "vue-loader-v16": {
13196
+ "version": "npm:vue-loader@16.8.3",
13197
+ "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.8.3.tgz",
13198
+ "integrity": "sha512-7vKN45IxsKxe5GcVCbc2qFU5aWzyiLrYJyUuMz4BQLKctCj/fmCa0w6fGiiQ2cLFetNcek1ppGJQDCup0c1hpA==",
13199
+ "dev": true,
13200
+ "optional": true,
13201
+ "requires": {
13202
+ "chalk": "^4.1.0",
13203
+ "hash-sum": "^2.0.0",
13204
+ "loader-utils": "^2.0.0"
13205
+ },
13206
+ "dependencies": {
13207
+ "ansi-styles": {
13208
+ "version": "4.3.0",
13209
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
13210
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
13211
+ "dev": true,
13212
+ "optional": true,
13213
+ "requires": {
13214
+ "color-convert": "^2.0.1"
13215
+ }
13216
+ },
13217
+ "chalk": {
13218
+ "version": "4.1.2",
13219
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
13220
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
13221
+ "dev": true,
13222
+ "optional": true,
13223
+ "requires": {
13224
+ "ansi-styles": "^4.1.0",
13225
+ "supports-color": "^7.1.0"
13226
+ }
13227
+ },
13228
+ "color-convert": {
13229
+ "version": "2.0.1",
13230
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
13231
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
13232
+ "dev": true,
13233
+ "optional": true,
13234
+ "requires": {
13235
+ "color-name": "~1.1.4"
13236
+ }
13237
+ },
13238
+ "color-name": {
13239
+ "version": "1.1.4",
13240
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
13241
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
13242
+ "dev": true,
13243
+ "optional": true
13244
+ },
13245
+ "has-flag": {
13246
+ "version": "4.0.0",
13247
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
13248
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
13249
+ "dev": true,
13250
+ "optional": true
13251
+ },
13252
+ "json5": {
13253
+ "version": "2.2.1",
13254
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz",
13255
+ "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==",
13256
+ "dev": true,
13257
+ "optional": true
13258
+ },
13259
+ "loader-utils": {
13260
+ "version": "2.0.4",
13261
+ "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz",
13262
+ "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==",
13263
+ "dev": true,
13264
+ "optional": true,
13265
+ "requires": {
13266
+ "big.js": "^5.2.2",
13267
+ "emojis-list": "^3.0.0",
13268
+ "json5": "^2.1.2"
13269
+ }
13270
+ },
13271
+ "supports-color": {
13272
+ "version": "7.2.0",
13273
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
13274
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
13275
+ "dev": true,
13276
+ "optional": true,
13277
+ "requires": {
13278
+ "has-flag": "^4.0.0"
13279
+ }
13280
+ }
13281
+ }
13282
+ },
13194
13283
  "vue-style-loader": {
13195
13284
  "version": "4.1.3",
13196
13285
  "resolved": "https://registry.npmjs.org/vue-style-loader/-/vue-style-loader-4.1.3.tgz",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "main": "./dist/flatmapvuer.common.js",
5
5
  "files": [
6
6
  "dist/*",
@@ -463,6 +463,7 @@ export default {
463
463
  this.tooltipVisible = true;
464
464
  this.tooltipContent = content;
465
465
  this.tooltipContent.uberon = feature;
466
+ this.tooltipContent.source = data.feature.source;
466
467
  this.tooltipContent.title = data.label;
467
468
  this.tooltipContent.featureIds = [feature];
468
469
  this.tooltipContent.actions.push({
@@ -480,6 +481,7 @@ export default {
480
481
  this.tooltipVisible = true;
481
482
  this.tooltipContent = content;
482
483
  this.tooltipContent.uberon = feature;
484
+ this.tooltipContent.source = data.feature.source;
483
485
  this.tooltipContent.title = data.label;
484
486
  this.tooltipContent.actions.push({
485
487
  title: "View dataset",
@@ -1,42 +1,12 @@
1
1
  <template>
2
2
  <div class="pubmed-container">
3
- <div v-loading="loading.response" class="block">
4
- <div class="attribute-title">Pubmed Resources</div>
5
- <br/>
6
- <el-carousel
7
- :autoplay="false"
8
- indicator-position="outside"
9
- height="250px" width="200px"
10
- >
11
- <el-carousel-item v-for="(pub, i) in pubmeds" :key="i">
12
- <div class="attribute-content">
13
- <div v-html="pub.html"/>
14
- <el-link :href="pub.url" :underline="false" class="el-link" target="_blank">{{pub.url}}</el-link>
15
- </div>
16
- </el-carousel-item>
17
- </el-carousel>
18
- </div>
3
+ <!-- To view old pubmed display go to: https://github.com/Tehsurfer/flatmapvuer/commit/eca131f8d32cdcac4d136d1722d7fe4df25f6c3a -->
19
4
  </div>
20
5
  </template>
21
6
 
22
7
 
23
8
  <script>
24
9
  /* eslint-disable no-alert, no-console */
25
- import Vue from "vue";
26
- import {
27
- Link,
28
- Carousel,
29
- CarouselItem,
30
- Button
31
- } from "element-ui";
32
- import lang from "element-ui/lib/locale/lang/en";
33
- import locale from "element-ui/lib/locale";
34
- locale.use(lang);
35
- Vue.use(Link);
36
- Vue.use(Carousel);
37
- Vue.use(CarouselItem);
38
- Vue.use(Button);
39
-
40
10
 
41
11
  export default {
42
12
  name: "Tooltip",
@@ -47,48 +17,27 @@ export default {
47
17
  },
48
18
  },
49
19
  watch: {
50
- 'entry.featureId': function (val){
51
- this.flatmapQuery(val).then(pb => this.pubmeds = pb)
52
- },
53
20
  'entry.featureIds': {
54
21
  handler: function(ids) {
55
- this.flatmapQuery(ids)
22
+ this.pubmedQueryOnIds(ids)
56
23
  }
57
24
  }
58
25
  },
59
26
  inject: ['flatmapAPI'],
60
27
  data: function() {
61
28
  return {
62
- data: {},
63
29
  pubmeds: [],
64
30
  pubmedIds: [],
65
- loading: {response: true, publications: true}
66
31
  };
67
32
  },
68
33
  mounted: function() {
69
34
  if (this.entry.featureIds)
70
- this.flatmapQuery(this.entry.featureIds)
35
+ this.pubmedQueryOnIds(this.entry.featureIds)
71
36
  },
72
37
  methods: {
73
38
  stripPMIDPrefix: function (pubmedId){
74
39
  return pubmedId.split(':')[1]
75
40
  },
76
- titleFromPubmed: function (pubmedId){
77
- return new Promise((resolve) => {
78
- fetch(`https://api.ncbi.nlm.nih.gov/lit/ctxp/v1/pubmed/?format=citation&contenttype=json&id=${pubmedId}`)
79
- .then(response => response.json())
80
- .then(data => {
81
- resolve(data.apa.format)
82
- })
83
- .catch((error) => {
84
- console.error('Error:', error)
85
- });
86
- })
87
- },
88
- splitLink(bibliographyString){
89
- let split = bibliographyString.split('https')
90
- return [split[0], 'https' + split[1]]
91
- },
92
41
  buildPubmedSqlStatement: function(keastIds) {
93
42
  let sql = 'select distinct publication from publications where entity in ('
94
43
  if (keastIds.length === 1) {
@@ -100,14 +49,12 @@ export default {
100
49
  }
101
50
  return sql
102
51
  },
103
- flatmapQuery: function(keastIds){
104
- if(!keastIds || keastIds.length === 0) return
105
- this.pubmeds = []
106
- this.loading.response = true
107
-
108
- // fetch pubmed publications for the given ids
109
- const data = { sql: this.buildPubmedSqlStatement(keastIds)};
110
- fetch(`${this.flatmapAPI}knowledge/query/`, {
52
+ buildPubmedSqlStatementForModels: function(model) {
53
+ return `select distinct publication from publications where entity = '${model}'`
54
+ },
55
+ flatmapQuery: function(sql){
56
+ const data = { sql: sql}
57
+ return fetch(`${this.flatmapAPI}knowledge/query/`, {
111
58
  method: 'POST',
112
59
  headers: {
113
60
  'Content-Type': 'application/json',
@@ -115,27 +62,31 @@ export default {
115
62
  body: JSON.stringify(data),
116
63
  })
117
64
  .then(response => response.json())
118
- .then(data => {
65
+ .catch((error) => {
66
+ console.error('Error:', error)
67
+ })
68
+ },
69
+ pubmedQueryOnIds: function(keastIds){
70
+ if(!keastIds || keastIds.length === 0) return
71
+ const sql = this.buildPubmedSqlStatement(keastIds)
72
+ this.flatmapQuery(sql).then(data=>{
119
73
  this.responseData = data
120
- this.loading.response = false
121
-
122
- // create links for each pubmedId
74
+ // Create pubmed url on paths if we have them
123
75
  if (data.values.length > 0){
124
- data.values.forEach(identifier => {
125
- let ids = this.stripPMIDPrefix(identifier[0])
126
- this.titleFromPubmed(ids).then( bib=>{
127
- let [html, link] = this.splitLink(bib)
128
- this.pubmeds.push({identifier: identifier[0] , html: html, url: link})
129
- })
130
- });
131
76
  this.$emit('pubmedSearchUrl', this.pubmedSearchUrl(data.values.map(id=>this.stripPMIDPrefix(id[0]))))
132
- } else {
133
- this.$emit('pubmedSearchUrl', '') // Clears the pubmed search button
77
+ } else { // Create pubmed url on models
78
+ this.pubmedQueryOnModels(this.entry.source)
134
79
  }
135
80
  })
136
- .catch((error) => {
137
- console.error('Error:', error)
138
- })
81
+ },
82
+ pubmedQueryOnModels(source){
83
+ this.flatmapQuery(this.buildPubmedSqlStatementForModels(source)).then(data=>{
84
+ if (Array.isArray(data.values) && data.values.length > 0){
85
+ this.$emit('pubmedSearchUrl', this.pubmedSearchUrl(data.values.map(id=>this.stripPMIDPrefix(id[0]))))
86
+ } else {
87
+ this.$emit('pubmedSearchUrl', '') // Clears the pubmed search button
88
+ }
89
+ })
139
90
  },
140
91
  pubmedSearchUrl: function(ids) {
141
92
  let url = 'https://pubmed.ncbi.nlm.nih.gov/?'
@@ -8,8 +8,6 @@
8
8
  <span class="title">{{content.featureId}}</span>
9
9
  </div>
10
10
  <div class="content-container scrollbar">
11
- <!-- Currently we don't show the pubmed viewer, will remove once we are certain it won't be used -->
12
- <pubmed-viewer v-if="content.featureIds" v-show="false" class="block" :entry="content" @pubmedSearchUrl="pubmedSearchUrlUpdate"/>
13
11
  {{content.paths}}
14
12
  <div v-if="this.origins" class="block">
15
13
  <div>
@@ -65,17 +63,12 @@
65
63
  </el-button>
66
64
  </div>
67
65
 
68
- <!-- We will serach on components until we can search on neurons -->
69
66
  <el-button v-show="components.length > 0" class="button" @click="openAll">
70
67
  Search for data on components
71
68
  </el-button>
72
69
 
73
- <!-- Disable neuron search until it is ready -->
74
- <!-- <el-button v-for="action in content.actions" round :key="action.title"
75
- class="button" @click="resourceSelected(action)">
76
- <i v-if="action.title === 'Search for datasets' || action.title === 'View Dataset' " class="el-icon-coin"></i>
77
- {{action.title}}
78
- </el-button> -->
70
+ <!-- pubmed-viewer is just used for processing pubmed requests (no display) -->
71
+ <pubmed-viewer v-if="content.featureIds" v-show="false" :entry="content" @pubmedSearchUrl="pubmedSearchUrlUpdate"/>
79
72
  <el-button v-if="pubmedSearchUrl != ''" class="button" icon="el-icon-notebook-2" @click="openUrl(pubmedSearchUrl)">
80
73
  Open publications in pubmed
81
74
  </el-button>
@@ -333,6 +326,38 @@ export default {
333
326
  }
334
327
  return label
335
328
  },
329
+ processConnectivity(connectivity){
330
+ // Filter the origin and destinations from components
331
+ let components = this.findComponents(connectivity)
332
+
333
+ // Remove duplicates
334
+ let axons = removeDuplicates(connectivity.axons)
335
+ let dendrites = removeDuplicates(connectivity.dendrites)
336
+
337
+ // Create list of ids to get labels for
338
+ let conIds = this.findAllIdsFromConnectivity(connectivity)
339
+
340
+ // Create readable labels from the nodes. Setting this to 'this.origins' updates the display
341
+ this.createLabelLookup(conIds).then(lookUp=>{
342
+ this.destinations = axons.map(a=>this.createLabelFromNeuralNode(a,lookUp))
343
+ this.origins = dendrites.map(d=>this.createLabelFromNeuralNode(d,lookUp))
344
+ this.components = components.map(c=>this.createLabelFromNeuralNode(c, lookUp))
345
+ })
346
+
347
+ this.flattenAndFindDatasets(components, axons, dendrites)
348
+ },
349
+ flattenAndFindDatasets(components, axons, dendrites){
350
+
351
+ // process the nodes for finding datasets (Note this is not critical to the tooltip, only for the 'search on components' button)
352
+ let componentsFlat = this.flattenConntectivity(components)
353
+ let axonsFlat = this.flattenConntectivity(axons)
354
+ let dendritesFlat = this.flattenConntectivity(dendrites)
355
+
356
+ // Filter for the anatomy which is annotated on datasets
357
+ this.destinationsWithDatasets = this.uberons.filter(ub => axonsFlat.indexOf(ub.id) !== -1)
358
+ this.originsWithDatasets = this.uberons.filter(ub => dendritesFlat.indexOf(ub.id) !== -1)
359
+ this.componentsWithDatasets = this.uberons.filter(ub => componentsFlat.indexOf(ub.id) !== -1)
360
+ },
336
361
  pathwayQuery: function(keastIds){
337
362
  this.destinations = []
338
363
  this.origins = []
@@ -350,29 +375,7 @@ export default {
350
375
  .then(response => response.json())
351
376
  .then(data => {
352
377
  let connectivity = JSON.parse(data.values[0][0])
353
- // Filter the origin and destinations from components
354
- let components = this.findComponents(connectivity)
355
-
356
- // process the nodes for finding datasets
357
- let componentsFlat = this.flattenConntectivity(components)
358
- let axons = removeDuplicates(connectivity.axons)
359
- let dendrites = removeDuplicates(connectivity.dendrites)
360
- let axonsFlat = this.flattenConntectivity(axons)
361
- let dendritesFlat = this.flattenConntectivity(dendrites)
362
-
363
- let conIds = this.findAllIdsFromConnectivity(connectivity) // Create list of ids to get labels for
364
-
365
- // Create readable labels from the nodes. Setting this to 'this.origins' updates the display
366
- this.createLabelLookup(conIds).then(lookUp=>{
367
- this.destinations = axons.map(a=>this.createLabelFromNeuralNode(a,lookUp))
368
- this.origins = dendrites.map(d=>this.createLabelFromNeuralNode(d,lookUp))
369
- this.components = components.map(c=>this.createLabelFromNeuralNode(c, lookUp))
370
- })
371
-
372
- // Filter for the anatomy which is annotated on datasets
373
- this.destinationsWithDatasets = this.uberons.filter(ub => axonsFlat.indexOf(ub.id) !== -1)
374
- this.originsWithDatasets = this.uberons.filter(ub => dendritesFlat.indexOf(ub.id) !== -1)
375
- this.componentsWithDatasets = this.uberons.filter(ub => componentsFlat.indexOf(ub.id) !== -1)
378
+ this.processConnectivity(connectivity)
376
379
  this.loading = false
377
380
  })
378
381
  .catch((error) => {