@abi-software/flatmapvuer 0.2.5 → 0.3.0-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/dist/flatmapvuer.common.js +504 -161
- package/dist/flatmapvuer.common.js.map +1 -1
- package/dist/flatmapvuer.css +1 -1
- package/dist/flatmapvuer.umd.js +504 -161
- package/dist/flatmapvuer.umd.js.map +1 -1
- package/dist/flatmapvuer.umd.min.js +1 -1
- package/dist/flatmapvuer.umd.min.js.map +1 -1
- package/package-lock.json +4 -4
- package/package.json +2 -2
- package/src/App.vue +7 -5
- package/src/components/EventBus.js +3 -0
- package/src/components/FlatmapVuer.vue +37 -8
- package/src/components/MultiFlatmapVuer.vue +10 -1
- package/src/components/PubmedViewer.vue +40 -26
- package/src/components/Tooltip.vue +187 -23
- package/src/components/flatmapQueries.js +0 -0
package/package-lock.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/flatmapvuer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-beta-0",
|
|
4
4
|
"lockfileVersion": 1,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@abi-software/flatmap-viewer": {
|
|
8
|
-
"version": "2.2.0-beta.
|
|
9
|
-
"resolved": "https://registry.npmjs.org/@abi-software/flatmap-viewer/-/flatmap-viewer-2.2.0-beta.
|
|
10
|
-
"integrity": "sha512-
|
|
8
|
+
"version": "2.2.0-beta.12",
|
|
9
|
+
"resolved": "https://registry.npmjs.org/@abi-software/flatmap-viewer/-/flatmap-viewer-2.2.0-beta.12.tgz",
|
|
10
|
+
"integrity": "sha512-2bDHZ3DSp3AFsUHYmJ6MPYyj6BHQv0GHU6Q+NSuK8eFUQZwYKJvlw4vkx9x+rPEZwuZUmxv7RrQQdw5FgOU6qA==",
|
|
11
11
|
"requires": {
|
|
12
12
|
"@babel/runtime": "^7.10.4",
|
|
13
13
|
"@turf/area": "^6.0.1",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/flatmapvuer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-beta-0",
|
|
4
4
|
"main": "./dist/flatmapvuer.common.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/*",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"lint": "vue-cli-service lint"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@abi-software/flatmap-viewer": "2.2.0-beta.
|
|
19
|
+
"@abi-software/flatmap-viewer": "^2.2.0-beta.12",
|
|
20
20
|
"@abi-software/svg-sprite": "^0.1.14",
|
|
21
21
|
"core-js": "^3.3.2",
|
|
22
22
|
"css-element-queries": "^1.2.2",
|
package/src/App.vue
CHANGED
|
@@ -53,8 +53,8 @@ export default {
|
|
|
53
53
|
this.$refs.multi.setState(this._mapSettings.pop());
|
|
54
54
|
},
|
|
55
55
|
FlatmapSelected: function(resource) {
|
|
56
|
-
if (resource.eventType
|
|
57
|
-
console.log(resource);
|
|
56
|
+
if (resource.eventType === "click")
|
|
57
|
+
console.log('resource', resource);
|
|
58
58
|
},
|
|
59
59
|
FlatmapReady: function(component) {
|
|
60
60
|
let taxon = component.mapImp.describes;
|
|
@@ -65,7 +65,7 @@ export default {
|
|
|
65
65
|
component.searchAndShowResult("heart");
|
|
66
66
|
},
|
|
67
67
|
panZoomcallback: function(payload) {
|
|
68
|
-
|
|
68
|
+
this.payload = payload
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
data: function(){
|
|
@@ -91,8 +91,10 @@ export default {
|
|
|
91
91
|
displayCloseButton: false,
|
|
92
92
|
initial: "Rat",
|
|
93
93
|
helpMode: false,
|
|
94
|
-
//flatmapAPI: "https://mapcore-demo.org/
|
|
95
|
-
flatmapAPI: "https://mapcore-demo.org/devel/flatmap/
|
|
94
|
+
// flatmapAPI: "https://mapcore-demo.org/current/flatmap/v2/"
|
|
95
|
+
// flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v3/"
|
|
96
|
+
flatmapAPI: "https://mapcore-demo.org/fccb/flatmap/"
|
|
97
|
+
// flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v1/"
|
|
96
98
|
}
|
|
97
99
|
},
|
|
98
100
|
mounted: function() {
|
|
@@ -216,7 +216,6 @@
|
|
|
216
216
|
ref="tooltip"
|
|
217
217
|
class="tooltip"
|
|
218
218
|
:content="tooltipContent"
|
|
219
|
-
:flatmapAPI="flatmapAPI"
|
|
220
219
|
@resource-selected="resourceSelected"
|
|
221
220
|
/>
|
|
222
221
|
</div>
|
|
@@ -240,6 +239,7 @@ import {
|
|
|
240
239
|
import lang from "element-ui/lib/locale/lang/en";
|
|
241
240
|
import locale from "element-ui/lib/locale";
|
|
242
241
|
import flatmapMarker from "../icons/flatmap-marker";
|
|
242
|
+
|
|
243
243
|
locale.use(lang);
|
|
244
244
|
Vue.use(Checkbox);
|
|
245
245
|
Vue.use(CheckboxGroup);
|
|
@@ -363,7 +363,7 @@ export default {
|
|
|
363
363
|
};
|
|
364
364
|
// Disable the nueron pop up for now.
|
|
365
365
|
if (data && data.type !== "marker")
|
|
366
|
-
this.checkAndCreatePopups(
|
|
366
|
+
this.checkAndCreatePopups(payload);
|
|
367
367
|
this.$emit("resource-selected", payload);
|
|
368
368
|
} else {
|
|
369
369
|
this.$emit("pan-zoom-callback", data);
|
|
@@ -412,15 +412,29 @@ export default {
|
|
|
412
412
|
let foundAnnotations = false;
|
|
413
413
|
this.tooltipVisible = false;
|
|
414
414
|
|
|
415
|
+
// nerve cuff check
|
|
416
|
+
if (data.feature.nodeId) {
|
|
417
|
+
let paths = this.mapImp.nodePathModels(data.feature.nodeId)
|
|
418
|
+
if (paths.size > 0){
|
|
419
|
+
foundAnnotations = true;
|
|
420
|
+
this.tooltipVisible = true;
|
|
421
|
+
this.tooltipContent = content;
|
|
422
|
+
this.tooltipContent.uberon = feature;
|
|
423
|
+
this.tooltipContent.title = data.label;
|
|
424
|
+
this.tooltipContent.featureIds = [...paths];
|
|
425
|
+
}
|
|
426
|
+
return true
|
|
427
|
+
}
|
|
428
|
+
|
|
415
429
|
// neural data check
|
|
416
|
-
if (feature)
|
|
417
|
-
if (feature.includes(
|
|
430
|
+
if (feature){
|
|
431
|
+
if (feature.includes('ilxtr:neuron')){
|
|
418
432
|
foundAnnotations = true;
|
|
419
433
|
this.tooltipVisible = true;
|
|
420
434
|
this.tooltipContent = content;
|
|
421
435
|
this.tooltipContent.uberon = feature;
|
|
422
436
|
this.tooltipContent.title = data.label;
|
|
423
|
-
this.tooltipContent.
|
|
437
|
+
this.tooltipContent.featureIds = [feature];
|
|
424
438
|
this.tooltipContent.actions.push({
|
|
425
439
|
title: "Search for dataset",
|
|
426
440
|
label: "Neuron Datasets",
|
|
@@ -604,13 +618,18 @@ export default {
|
|
|
604
618
|
if (this.mapImp) {
|
|
605
619
|
if (term === undefined || term === "") {
|
|
606
620
|
this.mapImp.clearSearchResults();
|
|
621
|
+
return true;
|
|
607
622
|
} else {
|
|
608
623
|
let searchResults = this.mapImp.search(term);
|
|
609
|
-
if (searchResults && searchResults.__featureIds.length > 0)
|
|
624
|
+
if (searchResults && searchResults.__featureIds.length > 0) {
|
|
610
625
|
this.mapImp.showSearchResults(searchResults);
|
|
611
|
-
|
|
626
|
+
return true;
|
|
627
|
+
}
|
|
628
|
+
else
|
|
629
|
+
this.mapImp.clearSearchResults();
|
|
612
630
|
}
|
|
613
631
|
}
|
|
632
|
+
return false;
|
|
614
633
|
}
|
|
615
634
|
},
|
|
616
635
|
props: {
|
|
@@ -668,6 +687,16 @@ export default {
|
|
|
668
687
|
flatmapAPI: {
|
|
669
688
|
type: String,
|
|
670
689
|
default: "https://mapcore-demo.org/flatmaps/"
|
|
690
|
+
},
|
|
691
|
+
sparcAPI: {
|
|
692
|
+
type: String,
|
|
693
|
+
default: "https://api.sparc.science/"
|
|
694
|
+
}
|
|
695
|
+
},
|
|
696
|
+
provide() {
|
|
697
|
+
return {
|
|
698
|
+
sparcAPI: this.sparcAPI,
|
|
699
|
+
flatmapAPI: this.flatmapAPI
|
|
671
700
|
}
|
|
672
701
|
},
|
|
673
702
|
data: function() {
|
|
@@ -691,7 +720,7 @@ export default {
|
|
|
691
720
|
loading: false,
|
|
692
721
|
flatmapMarker: flatmapMarker,
|
|
693
722
|
drawerOpen: true,
|
|
694
|
-
tooltipContent: {},
|
|
723
|
+
tooltipContent: { featureIds: []},
|
|
695
724
|
colourRadio: true,
|
|
696
725
|
outlinesRadio: true
|
|
697
726
|
};
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
:displayMinimap="displayMinimap"
|
|
47
47
|
style="height:100%"
|
|
48
48
|
:flatmapAPI="flatmapAPI"
|
|
49
|
+
:sparcAPI="sparcAPI"
|
|
49
50
|
/>
|
|
50
51
|
</div>
|
|
51
52
|
</template>
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
|
|
54
55
|
<script>
|
|
55
56
|
/* eslint-disable no-alert, no-console */
|
|
57
|
+
import EventBus from './EventBus'
|
|
56
58
|
import Vue from "vue";
|
|
57
59
|
import FlatmapVuer from "./FlatmapVuer.vue";
|
|
58
60
|
import { Col, Option, Select, Row, Popover } from "element-ui";
|
|
@@ -73,6 +75,9 @@ export default {
|
|
|
73
75
|
},
|
|
74
76
|
mounted: function() {
|
|
75
77
|
this.initialise();
|
|
78
|
+
EventBus.$on('onActionClick', (action) =>{
|
|
79
|
+
this.FlatmapSelected(action)
|
|
80
|
+
})
|
|
76
81
|
},
|
|
77
82
|
methods: {
|
|
78
83
|
initialise: function() {
|
|
@@ -83,7 +88,7 @@ export default {
|
|
|
83
88
|
this.speciesLis= {};
|
|
84
89
|
Object.keys(this.availableSpecies).forEach(key => {
|
|
85
90
|
for (let i = 0; i < data.length; i++) {
|
|
86
|
-
if (data[i].
|
|
91
|
+
if (data[i].taxon === this.availableSpecies[key].taxo) {
|
|
87
92
|
this.speciesList[key] = this.availableSpecies[key];
|
|
88
93
|
break;
|
|
89
94
|
}
|
|
@@ -241,6 +246,10 @@ export default {
|
|
|
241
246
|
type: String,
|
|
242
247
|
default: "https://mapcore-demo.org/flatmaps/"
|
|
243
248
|
},
|
|
249
|
+
sparcAPI: {
|
|
250
|
+
type: String,
|
|
251
|
+
default: "https://api.sparc.science/"
|
|
252
|
+
}
|
|
244
253
|
},
|
|
245
254
|
data: function() {
|
|
246
255
|
return {
|
|
@@ -26,7 +26,8 @@ import Vue from "vue";
|
|
|
26
26
|
import {
|
|
27
27
|
Link,
|
|
28
28
|
Carousel,
|
|
29
|
-
CarouselItem
|
|
29
|
+
CarouselItem,
|
|
30
|
+
Button
|
|
30
31
|
} from "element-ui";
|
|
31
32
|
import lang from "element-ui/lib/locale/lang/en";
|
|
32
33
|
import locale from "element-ui/lib/locale";
|
|
@@ -34,40 +35,39 @@ locale.use(lang);
|
|
|
34
35
|
Vue.use(Link);
|
|
35
36
|
Vue.use(Carousel);
|
|
36
37
|
Vue.use(CarouselItem);
|
|
38
|
+
Vue.use(Button);
|
|
37
39
|
|
|
38
40
|
|
|
39
41
|
export default {
|
|
40
42
|
name: "Tooltip",
|
|
41
|
-
props: {
|
|
42
|
-
|
|
43
|
-
type:
|
|
44
|
-
default:
|
|
43
|
+
props: {
|
|
44
|
+
entry: {
|
|
45
|
+
type: Object,
|
|
46
|
+
default: () => {}
|
|
45
47
|
},
|
|
46
|
-
/**
|
|
47
|
-
* Specify the endpoint of the flatmap server.
|
|
48
|
-
*/
|
|
49
|
-
flatmapAPI: {
|
|
50
|
-
type: String,
|
|
51
|
-
default: "https://mapcore-demo.org/flatmaps/"
|
|
52
|
-
}
|
|
53
48
|
},
|
|
54
49
|
watch: {
|
|
55
|
-
'featureId': function (val){
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
'entry.featureId': function (val){
|
|
51
|
+
this.flatmapQuery(val).then(pb => this.pubmeds = pb)
|
|
52
|
+
},
|
|
53
|
+
'entry.featureIds': {
|
|
54
|
+
handler: function(ids) {
|
|
55
|
+
this.flatmapQuery(ids)
|
|
56
|
+
}
|
|
58
57
|
}
|
|
59
58
|
},
|
|
60
|
-
|
|
61
|
-
},
|
|
59
|
+
inject: ['flatmapAPI'],
|
|
62
60
|
data: function() {
|
|
63
61
|
return {
|
|
62
|
+
data: {},
|
|
64
63
|
pubmeds: [],
|
|
65
64
|
pubmedIds: [],
|
|
66
65
|
loading: {response: true, publications: true}
|
|
67
66
|
};
|
|
68
67
|
},
|
|
69
68
|
mounted: function() {
|
|
70
|
-
|
|
69
|
+
if (this.entry.featureIds)
|
|
70
|
+
this.flatmapQuery(this.entry.featureIds)
|
|
71
71
|
},
|
|
72
72
|
methods: {
|
|
73
73
|
stripPMIDPrefix: function (pubmedId){
|
|
@@ -81,7 +81,7 @@ export default {
|
|
|
81
81
|
resolve(data.apa.format)
|
|
82
82
|
})
|
|
83
83
|
.catch((error) => {
|
|
84
|
-
console.error('Error:', error)
|
|
84
|
+
console.error('Error:', error)
|
|
85
85
|
});
|
|
86
86
|
})
|
|
87
87
|
},
|
|
@@ -89,12 +89,25 @@ export default {
|
|
|
89
89
|
let split = bibliographyString.split('https')
|
|
90
90
|
return [split[0], 'https' + split[1]]
|
|
91
91
|
},
|
|
92
|
-
|
|
92
|
+
buildPubmedSqlStatement: function(keastIds) {
|
|
93
|
+
let sql = 'select distinct publication from publications where entity in ('
|
|
94
|
+
if (keastIds.length === 1) {
|
|
95
|
+
sql += `'${keastIds[0]}')`
|
|
96
|
+
} else if (keastIds.length > 1) {
|
|
97
|
+
for (let i in keastIds) {
|
|
98
|
+
sql += `'${keastIds[i]}'${i >= keastIds.length - 1 ? ')' : ','} `
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return sql
|
|
102
|
+
},
|
|
103
|
+
flatmapQuery: function(keastIds){
|
|
104
|
+
if(!keastIds || keastIds.length === 0) return
|
|
93
105
|
this.pubmeds = []
|
|
94
106
|
this.loading.response = true
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
107
|
+
|
|
108
|
+
// fetch pubmed publications for the given ids
|
|
109
|
+
const data = { sql: this.buildPubmedSqlStatement(keastIds)};
|
|
110
|
+
fetch(`${this.flatmapAPI}knowledge/query/`, {
|
|
98
111
|
method: 'POST',
|
|
99
112
|
headers: {
|
|
100
113
|
'Content-Type': 'application/json',
|
|
@@ -105,19 +118,20 @@ export default {
|
|
|
105
118
|
.then(data => {
|
|
106
119
|
this.responseData = data
|
|
107
120
|
this.loading.response = false
|
|
121
|
+
|
|
122
|
+
// create links for each pubmedId
|
|
108
123
|
data.values.forEach(identifier => {
|
|
109
124
|
let ids = this.stripPMIDPrefix(identifier[0])
|
|
110
125
|
this.titleFromPubmed(ids).then( bib=>{
|
|
111
126
|
let [html, link] = this.splitLink(bib)
|
|
112
127
|
this.pubmeds.push({identifier: identifier[0] , html: html, url: link})
|
|
113
|
-
|
|
114
128
|
})
|
|
115
129
|
});
|
|
116
130
|
this.$emit('pubmedSearchUrl', this.pubmedSearchUrl(data.values.map(id=>this.stripPMIDPrefix(id[0]))))
|
|
117
131
|
})
|
|
118
132
|
.catch((error) => {
|
|
119
|
-
console.error('Error:', error)
|
|
120
|
-
|
|
133
|
+
console.error('Error:', error)
|
|
134
|
+
})
|
|
121
135
|
},
|
|
122
136
|
pubmedSearchUrl: function(ids) {
|
|
123
137
|
let url = 'https://pubmed.ncbi.nlm.nih.gov/?'
|
|
@@ -1,26 +1,42 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="tooltip-container">
|
|
3
|
-
<el-main v-if="content" class="main">
|
|
3
|
+
<el-main v-if="content" class="main" v-loading="loading">
|
|
4
4
|
<div class="block" v-if="content.title">
|
|
5
|
-
<span class="title">{{
|
|
5
|
+
<span class="title">{{capitalise(content.title)}}</span>
|
|
6
6
|
</div>
|
|
7
7
|
<div class="block" v-else>
|
|
8
8
|
<span class="title">{{content.featureId}}</span>
|
|
9
9
|
</div>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
<div v-if="
|
|
10
|
+
<!-- Currently we don't show the pubmed viewer, will remove once we are certain it won't be used -->
|
|
11
|
+
<pubmed-viewer v-if="content.featureIds" v-show="false" class="block" :entry="content" @pubmedSearchUrl="pubmedSearchUrlUpdate"/>
|
|
12
|
+
{{content.paths}}
|
|
13
|
+
<div v-if="this.components" class="block">
|
|
14
14
|
<div class="attribute-title">Components</div>
|
|
15
|
-
<
|
|
15
|
+
<div v-for="component in components" class="attribute-content" :key="component">
|
|
16
|
+
{{ capitalise(component) }}
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
<div v-if="this.dendrites" class="block">
|
|
20
|
+
<div class="attribute-title">Dendrites</div>
|
|
21
|
+
<div v-for="dendrite in dendrites" class="attribute-content" :key="dendrite">
|
|
22
|
+
{{ capitalise(dendrite) }}
|
|
23
|
+
</div>
|
|
24
|
+
<el-button v-show="dendritesWithDatasets.length > 0" class="button" @click="openDendrites">
|
|
25
|
+
Explore dendrite data
|
|
26
|
+
</el-button>
|
|
16
27
|
</div>
|
|
17
|
-
<div v-if="
|
|
18
|
-
<div class="attribute-title">
|
|
19
|
-
<
|
|
28
|
+
<div v-if="this.axons" class="block">
|
|
29
|
+
<div class="attribute-title">Axons</div>
|
|
30
|
+
<div v-for="axon in axons" class="attribute-content" :key="axon">
|
|
31
|
+
{{ capitalise(axon) }}
|
|
32
|
+
</div>
|
|
33
|
+
<el-button v-show="axonsWithDatasets.length > 0" class="button" @click="openAxons">
|
|
34
|
+
Explore axon data
|
|
35
|
+
</el-button>
|
|
20
36
|
</div>
|
|
21
|
-
<div v-if="content.
|
|
22
|
-
<div class="attribute-title">
|
|
23
|
-
<span class="attribute-content">{{content.
|
|
37
|
+
<div v-if="content.uberon" class="block">
|
|
38
|
+
<div class="attribute-title">Feature Id</div>
|
|
39
|
+
<span class="attribute-content">{{content.uberon}}</span>
|
|
24
40
|
</div>
|
|
25
41
|
<el-button v-for="action in content.actions" round :key="action.title"
|
|
26
42
|
class="button" @click="resourceSelected(action)">
|
|
@@ -54,12 +70,18 @@ Vue.use(Header);
|
|
|
54
70
|
Vue.use(Icon);
|
|
55
71
|
Vue.use(Main);
|
|
56
72
|
|
|
73
|
+
// pubmedviewer is currently not in use, but still under review so not ready to delete yet
|
|
57
74
|
import PubmedViewer from './PubmedViewer.vue'
|
|
75
|
+
import EventBus from './EventBus'
|
|
58
76
|
|
|
59
77
|
const titleCase = (str) => {
|
|
60
78
|
return str.replace(/\w\S*/g, (t) => { return t.charAt(0).toUpperCase() + t.substr(1).toLowerCase() });
|
|
61
79
|
}
|
|
62
80
|
|
|
81
|
+
const capitalise = function(str){
|
|
82
|
+
return str.charAt(0).toUpperCase() + str.slice(1)
|
|
83
|
+
}
|
|
84
|
+
|
|
63
85
|
export default {
|
|
64
86
|
components: { PubmedViewer },
|
|
65
87
|
name: "Tooltip",
|
|
@@ -72,21 +94,32 @@ export default {
|
|
|
72
94
|
type: Object,
|
|
73
95
|
default: undefined
|
|
74
96
|
},
|
|
75
|
-
/**
|
|
76
|
-
* Specify the endpoint of the flatmap server.
|
|
77
|
-
*/
|
|
78
|
-
flatmapAPI: {
|
|
79
|
-
type: String,
|
|
80
|
-
default: "https://mapcore-demo.org/flatmaps/"
|
|
81
|
-
}
|
|
82
97
|
},
|
|
83
98
|
data: function() {
|
|
84
99
|
return {
|
|
85
100
|
activeSpecies: undefined,
|
|
86
101
|
appendToBody: false,
|
|
87
|
-
pubmedSearchUrl: ''
|
|
102
|
+
pubmedSearchUrl: '',
|
|
103
|
+
loading: false,
|
|
104
|
+
axons: [],
|
|
105
|
+
dendrites: [],
|
|
106
|
+
components: [],
|
|
107
|
+
axonsWithDatasets: [],
|
|
108
|
+
dendritesWithDatasets: [],
|
|
109
|
+
uberons: [{id: undefined, name: undefined}]
|
|
88
110
|
};
|
|
89
111
|
},
|
|
112
|
+
inject: ['sparcAPI', 'flatmapAPI'],
|
|
113
|
+
watch: {
|
|
114
|
+
'content.featureIds': {
|
|
115
|
+
handler: function(){
|
|
116
|
+
this.pathwayQuery(this.content.featureIds)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
mounted: function(){
|
|
121
|
+
this.getOrganCuries()
|
|
122
|
+
},
|
|
90
123
|
methods: {
|
|
91
124
|
resourceSelected: function(action) {
|
|
92
125
|
this.$emit("resource-selected", action);
|
|
@@ -94,14 +127,136 @@ export default {
|
|
|
94
127
|
titleCase: function(title){
|
|
95
128
|
return titleCase(title)
|
|
96
129
|
},
|
|
130
|
+
capitalise: function(text){
|
|
131
|
+
return capitalise(text)
|
|
132
|
+
},
|
|
97
133
|
onClose: function() {
|
|
98
|
-
this.$emit("onClose")
|
|
134
|
+
this.$emit("onClose")
|
|
99
135
|
},
|
|
100
136
|
openUrl: function(url){
|
|
101
137
|
window.open(url, '_blank')
|
|
102
138
|
},
|
|
139
|
+
openAxons: function(){
|
|
140
|
+
EventBus.$emit('onActionClick', {type:'Facets', labels: this.axonsWithDatasets.map(a=>a.name)})
|
|
141
|
+
},
|
|
142
|
+
openDendrites: function(){
|
|
143
|
+
EventBus.$emit('onActionClick', {type:'Facets', labels: this.dendritesWithDatasets.map(a=>a.name)})
|
|
144
|
+
},
|
|
103
145
|
pubmedSearchUrlUpdate: function (val){
|
|
104
146
|
this.pubmedSearchUrl = val
|
|
147
|
+
},
|
|
148
|
+
findComponents: function(connectivity){
|
|
149
|
+
let dnodes = connectivity.connectivity.flat() // get nodes from edgelist
|
|
150
|
+
let nodes = [...new Set(dnodes)] // remove duplicates
|
|
151
|
+
|
|
152
|
+
let found = []
|
|
153
|
+
let terminal = false
|
|
154
|
+
nodes.forEach(node=>{
|
|
155
|
+
let n = node.flat() // Find all terms on the node
|
|
156
|
+
terminal = false
|
|
157
|
+
|
|
158
|
+
// Check if the node is an axon or dendrite
|
|
159
|
+
n.forEach(s=>{
|
|
160
|
+
if(connectivity.axons.includes(s)){
|
|
161
|
+
terminal = true
|
|
162
|
+
}
|
|
163
|
+
if(connectivity.dendrites.includes(s)){
|
|
164
|
+
terminal = true
|
|
165
|
+
}
|
|
166
|
+
})
|
|
167
|
+
if (!terminal){
|
|
168
|
+
found.push(node)
|
|
169
|
+
}
|
|
170
|
+
})
|
|
171
|
+
|
|
172
|
+
// remove duplicates
|
|
173
|
+
let foundUnique = [...new Set(found.map(n=>n[0]))]
|
|
174
|
+
return foundUnique
|
|
175
|
+
},
|
|
176
|
+
getOrganCuries: function(){
|
|
177
|
+
fetch(`${this.sparcAPI}get-organ-curies/`)
|
|
178
|
+
.then(response=>response.json())
|
|
179
|
+
.then(data=>{
|
|
180
|
+
this.uberons = data.uberon.array
|
|
181
|
+
})
|
|
182
|
+
},
|
|
183
|
+
buildConnectivitySqlStatement: function(keastIds) {
|
|
184
|
+
let sql = 'select knowledge from knowledge where entity in ('
|
|
185
|
+
if (keastIds.length === 1) {
|
|
186
|
+
sql += `'${keastIds[0]}')`
|
|
187
|
+
} else if (keastIds.length > 1) {
|
|
188
|
+
for (let i in keastIds) {
|
|
189
|
+
sql += `'${keastIds[i]}'${i >= keastIds.length - 1 ? ')' : ','} `
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return sql
|
|
193
|
+
},
|
|
194
|
+
buildLabelSqlStatement: function(uberons) {
|
|
195
|
+
let sql = 'select label from labels where entity in ('
|
|
196
|
+
if (uberons.length === 1) {
|
|
197
|
+
sql += `'${uberons[0]}')`
|
|
198
|
+
} else if (uberons.length > 1) {
|
|
199
|
+
for (let i in uberons) {
|
|
200
|
+
sql += `'${uberons[i]}'${i >= uberons.length - 1 ? ')' : ','} `
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return sql
|
|
204
|
+
},
|
|
205
|
+
createLabelLookup: function(uberons) {
|
|
206
|
+
return new Promise(resolve=> {
|
|
207
|
+
let uberonMap = {}
|
|
208
|
+
const data = { sql: this.buildLabelSqlStatement(uberons)}
|
|
209
|
+
fetch(`${this.flatmapAPI}knowledge/query/`, {
|
|
210
|
+
method: 'POST',
|
|
211
|
+
headers: {
|
|
212
|
+
'Content-Type': 'application/json',
|
|
213
|
+
},
|
|
214
|
+
body: JSON.stringify(data),
|
|
215
|
+
})
|
|
216
|
+
.then(response => response.json())
|
|
217
|
+
.then(data => {
|
|
218
|
+
uberons.forEach((el,i)=>{
|
|
219
|
+
uberonMap[el] = data.values[i][0]
|
|
220
|
+
})
|
|
221
|
+
resolve(uberonMap)
|
|
222
|
+
})
|
|
223
|
+
})
|
|
224
|
+
},
|
|
225
|
+
pathwayQuery: function(keastIds){
|
|
226
|
+
this.axons = []
|
|
227
|
+
this.dendrites = []
|
|
228
|
+
this.components = []
|
|
229
|
+
this.loading = true
|
|
230
|
+
if (!keastIds || keastIds.length == 0) return
|
|
231
|
+
const data = { sql: this.buildConnectivitySqlStatement(keastIds)};
|
|
232
|
+
fetch(`${this.flatmapAPI}knowledge/query/`, {
|
|
233
|
+
method: 'POST',
|
|
234
|
+
headers: {
|
|
235
|
+
'Content-Type': 'application/json',
|
|
236
|
+
},
|
|
237
|
+
body: JSON.stringify(data),
|
|
238
|
+
})
|
|
239
|
+
.then(response => response.json())
|
|
240
|
+
.then(data => {
|
|
241
|
+
let connectivity = JSON.parse(data.values[0][0])
|
|
242
|
+
let components = this.findComponents(connectivity)
|
|
243
|
+
|
|
244
|
+
// Create list of ids to get labels for
|
|
245
|
+
let conIds = connectivity.axons.concat(connectivity.dendrites.concat(components))
|
|
246
|
+
this.createLabelLookup(conIds).then(lookUp=>{
|
|
247
|
+
this.axons = connectivity.axons.map(a=>lookUp[a])
|
|
248
|
+
this.dendrites = connectivity.dendrites.map(d=>lookUp[d])
|
|
249
|
+
this.components = components.map(c=>lookUp[c])
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
// Filter for the anatomy which is annotated on datasets
|
|
253
|
+
this.axonsWithDatasets = this.uberons.filter(ub => connectivity.axons.indexOf(ub.id) !== -1)
|
|
254
|
+
this.dendritesWithDatasets = this.uberons.filter(ub => connectivity.dendrites.indexOf(ub.id) !== -1)
|
|
255
|
+
this.loading = false
|
|
256
|
+
})
|
|
257
|
+
.catch((error) => {
|
|
258
|
+
console.error('Error:', error);
|
|
259
|
+
})
|
|
105
260
|
}
|
|
106
261
|
}
|
|
107
262
|
};
|
|
@@ -171,6 +326,15 @@ export default {
|
|
|
171
326
|
min-width: 16rem;
|
|
172
327
|
}
|
|
173
328
|
|
|
329
|
+
.title{
|
|
330
|
+
font-size: 18px;
|
|
331
|
+
font-weight: 500;
|
|
332
|
+
font-weight: bold;
|
|
333
|
+
padding-bottom: 8px;
|
|
334
|
+
color: rgb(131, 0, 191);
|
|
335
|
+
|
|
336
|
+
}
|
|
337
|
+
|
|
174
338
|
.attribute-title{
|
|
175
339
|
font-size: 16px;
|
|
176
340
|
font-weight: 600;
|
|
@@ -180,7 +344,7 @@ export default {
|
|
|
180
344
|
|
|
181
345
|
.attribute-content{
|
|
182
346
|
font-size: 14px;
|
|
183
|
-
font-weight:
|
|
347
|
+
font-weight: 500;
|
|
184
348
|
}
|
|
185
349
|
|
|
186
350
|
.popover-container {
|
|
File without changes
|