@abi-software/flatmapvuer 0.2.5 → 0.3.0-beta-2
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 +519 -169
- package/dist/flatmapvuer.common.js.map +1 -1
- package/dist/flatmapvuer.css +1 -1
- package/dist/flatmapvuer.umd.js +519 -169
- 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 +193 -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-2",
|
|
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.2
|
|
3
|
+
"version": "0.3.0-beta-2",
|
|
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,20 @@ 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
|
+
if (str)
|
|
83
|
+
return str.charAt(0).toUpperCase() + str.slice(1)
|
|
84
|
+
return ""
|
|
85
|
+
}
|
|
86
|
+
|
|
63
87
|
export default {
|
|
64
88
|
components: { PubmedViewer },
|
|
65
89
|
name: "Tooltip",
|
|
@@ -72,21 +96,32 @@ export default {
|
|
|
72
96
|
type: Object,
|
|
73
97
|
default: undefined
|
|
74
98
|
},
|
|
75
|
-
/**
|
|
76
|
-
* Specify the endpoint of the flatmap server.
|
|
77
|
-
*/
|
|
78
|
-
flatmapAPI: {
|
|
79
|
-
type: String,
|
|
80
|
-
default: "https://mapcore-demo.org/flatmaps/"
|
|
81
|
-
}
|
|
82
99
|
},
|
|
83
100
|
data: function() {
|
|
84
101
|
return {
|
|
85
102
|
activeSpecies: undefined,
|
|
86
103
|
appendToBody: false,
|
|
87
|
-
pubmedSearchUrl: ''
|
|
104
|
+
pubmedSearchUrl: '',
|
|
105
|
+
loading: false,
|
|
106
|
+
axons: [],
|
|
107
|
+
dendrites: [],
|
|
108
|
+
components: [],
|
|
109
|
+
axonsWithDatasets: [],
|
|
110
|
+
dendritesWithDatasets: [],
|
|
111
|
+
uberons: [{id: undefined, name: undefined}]
|
|
88
112
|
};
|
|
89
113
|
},
|
|
114
|
+
inject: ['sparcAPI', 'flatmapAPI'],
|
|
115
|
+
watch: {
|
|
116
|
+
'content.featureIds': {
|
|
117
|
+
handler: function(){
|
|
118
|
+
this.pathwayQuery(this.content.featureIds)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
mounted: function(){
|
|
123
|
+
this.getOrganCuries()
|
|
124
|
+
},
|
|
90
125
|
methods: {
|
|
91
126
|
resourceSelected: function(action) {
|
|
92
127
|
this.$emit("resource-selected", action);
|
|
@@ -94,14 +129,140 @@ export default {
|
|
|
94
129
|
titleCase: function(title){
|
|
95
130
|
return titleCase(title)
|
|
96
131
|
},
|
|
132
|
+
capitalise: function(text){
|
|
133
|
+
return capitalise(text)
|
|
134
|
+
},
|
|
97
135
|
onClose: function() {
|
|
98
|
-
this.$emit("onClose")
|
|
136
|
+
this.$emit("onClose")
|
|
99
137
|
},
|
|
100
138
|
openUrl: function(url){
|
|
101
139
|
window.open(url, '_blank')
|
|
102
140
|
},
|
|
141
|
+
openAxons: function(){
|
|
142
|
+
EventBus.$emit('onActionClick', {type:'Facets', labels: this.axonsWithDatasets.map(a=>a.name)})
|
|
143
|
+
},
|
|
144
|
+
openDendrites: function(){
|
|
145
|
+
EventBus.$emit('onActionClick', {type:'Facets', labels: this.dendritesWithDatasets.map(a=>a.name)})
|
|
146
|
+
},
|
|
103
147
|
pubmedSearchUrlUpdate: function (val){
|
|
104
148
|
this.pubmedSearchUrl = val
|
|
149
|
+
},
|
|
150
|
+
findComponents: function(connectivity){
|
|
151
|
+
let dnodes = connectivity.connectivity.flat() // get nodes from edgelist
|
|
152
|
+
let nodes = [...new Set(dnodes)] // remove duplicates
|
|
153
|
+
|
|
154
|
+
let found = []
|
|
155
|
+
let terminal = false
|
|
156
|
+
nodes.forEach(node=>{
|
|
157
|
+
let n = node.flat() // Find all terms on the node
|
|
158
|
+
terminal = false
|
|
159
|
+
|
|
160
|
+
// Check if the node is an axon or dendrite
|
|
161
|
+
n.forEach(s=>{
|
|
162
|
+
if(connectivity.axons.includes(s)){
|
|
163
|
+
terminal = true
|
|
164
|
+
}
|
|
165
|
+
if(connectivity.dendrites.includes(s)){
|
|
166
|
+
terminal = true
|
|
167
|
+
}
|
|
168
|
+
})
|
|
169
|
+
if (!terminal){
|
|
170
|
+
found.push(node)
|
|
171
|
+
}
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
// remove duplicates
|
|
175
|
+
let foundUnique = [...new Set(found.map(n=>n[0]))]
|
|
176
|
+
return foundUnique
|
|
177
|
+
},
|
|
178
|
+
getOrganCuries: function(){
|
|
179
|
+
fetch(`${this.sparcAPI}get-organ-curies/`)
|
|
180
|
+
.then(response=>response.json())
|
|
181
|
+
.then(data=>{
|
|
182
|
+
this.uberons = data.uberon.array
|
|
183
|
+
})
|
|
184
|
+
},
|
|
185
|
+
buildConnectivitySqlStatement: function(keastIds) {
|
|
186
|
+
let sql = 'select knowledge from knowledge where entity in ('
|
|
187
|
+
if (keastIds.length === 1) {
|
|
188
|
+
sql += `'${keastIds[0]}')`
|
|
189
|
+
} else if (keastIds.length > 1) {
|
|
190
|
+
for (let i in keastIds) {
|
|
191
|
+
sql += `'${keastIds[i]}'${i >= keastIds.length - 1 ? ')' : ','} `
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return sql
|
|
195
|
+
},
|
|
196
|
+
buildLabelSqlStatement: function(uberons) {
|
|
197
|
+
let sql = 'select entity, label from labels where entity in ('
|
|
198
|
+
if (uberons.length === 1) {
|
|
199
|
+
sql += `'${uberons[0]}')`
|
|
200
|
+
} else if (uberons.length > 1) {
|
|
201
|
+
for (let i in uberons) {
|
|
202
|
+
sql += `'${uberons[i]}'${i >= uberons.length - 1 ? ')' : ','} `
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return sql
|
|
206
|
+
},
|
|
207
|
+
createLabelLookup: function(uberons) {
|
|
208
|
+
return new Promise(resolve=> {
|
|
209
|
+
let uberonMap = {}
|
|
210
|
+
const data = { sql: this.buildLabelSqlStatement(uberons)}
|
|
211
|
+
fetch(`${this.flatmapAPI}knowledge/query/`, {
|
|
212
|
+
method: 'POST',
|
|
213
|
+
headers: {
|
|
214
|
+
'Content-Type': 'application/json',
|
|
215
|
+
},
|
|
216
|
+
body: JSON.stringify(data),
|
|
217
|
+
})
|
|
218
|
+
.then(response => response.json())
|
|
219
|
+
.then(payload => {
|
|
220
|
+
const entity = payload.keys.indexOf("entity");
|
|
221
|
+
const label = payload.keys.indexOf("label");
|
|
222
|
+
if (entity > -1 && label > -1) {
|
|
223
|
+
payload.values.forEach(pair => {
|
|
224
|
+
uberonMap[pair[entity]] = pair[label];
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
resolve(uberonMap)
|
|
228
|
+
})
|
|
229
|
+
})
|
|
230
|
+
},
|
|
231
|
+
pathwayQuery: function(keastIds){
|
|
232
|
+
this.axons = []
|
|
233
|
+
this.dendrites = []
|
|
234
|
+
this.components = []
|
|
235
|
+
this.loading = true
|
|
236
|
+
if (!keastIds || keastIds.length == 0) return
|
|
237
|
+
const data = { sql: this.buildConnectivitySqlStatement(keastIds)};
|
|
238
|
+
fetch(`${this.flatmapAPI}knowledge/query/`, {
|
|
239
|
+
method: 'POST',
|
|
240
|
+
headers: {
|
|
241
|
+
'Content-Type': 'application/json',
|
|
242
|
+
},
|
|
243
|
+
body: JSON.stringify(data),
|
|
244
|
+
})
|
|
245
|
+
.then(response => response.json())
|
|
246
|
+
.then(data => {
|
|
247
|
+
let connectivity = JSON.parse(data.values[0][0])
|
|
248
|
+
let components = this.findComponents(connectivity)
|
|
249
|
+
|
|
250
|
+
// Create list of ids to get labels for
|
|
251
|
+
let conIds = connectivity.axons.concat(connectivity.dendrites.concat(components))
|
|
252
|
+
this.createLabelLookup(conIds).then(lookUp=>{
|
|
253
|
+
this.axons = connectivity.axons.map(a=>lookUp[a])
|
|
254
|
+
this.dendrites = connectivity.dendrites.map(d=>lookUp[d])
|
|
255
|
+
this.components = components.map(c=>lookUp[c])
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
// Filter for the anatomy which is annotated on datasets
|
|
259
|
+
this.axonsWithDatasets = this.uberons.filter(ub => connectivity.axons.indexOf(ub.id) !== -1)
|
|
260
|
+
this.dendritesWithDatasets = this.uberons.filter(ub => connectivity.dendrites.indexOf(ub.id) !== -1)
|
|
261
|
+
this.loading = false
|
|
262
|
+
})
|
|
263
|
+
.catch((error) => {
|
|
264
|
+
console.error('Error:', error);
|
|
265
|
+
})
|
|
105
266
|
}
|
|
106
267
|
}
|
|
107
268
|
};
|
|
@@ -171,6 +332,15 @@ export default {
|
|
|
171
332
|
min-width: 16rem;
|
|
172
333
|
}
|
|
173
334
|
|
|
335
|
+
.title{
|
|
336
|
+
font-size: 18px;
|
|
337
|
+
font-weight: 500;
|
|
338
|
+
font-weight: bold;
|
|
339
|
+
padding-bottom: 8px;
|
|
340
|
+
color: rgb(131, 0, 191);
|
|
341
|
+
|
|
342
|
+
}
|
|
343
|
+
|
|
174
344
|
.attribute-title{
|
|
175
345
|
font-size: 16px;
|
|
176
346
|
font-weight: 600;
|
|
@@ -180,7 +350,7 @@ export default {
|
|
|
180
350
|
|
|
181
351
|
.attribute-content{
|
|
182
352
|
font-size: 14px;
|
|
183
|
-
font-weight:
|
|
353
|
+
font-weight: 500;
|
|
184
354
|
}
|
|
185
355
|
|
|
186
356
|
.popover-container {
|
|
File without changes
|