@abi-software/flatmapvuer 0.3.9 → 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/dist/flatmapvuer.common.js +272 -1927
- package/dist/flatmapvuer.common.js.map +1 -1
- package/dist/flatmapvuer.css +1 -1
- package/dist/flatmapvuer.umd.js +272 -1927
- 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 +6 -8
- package/src/components/FlatmapVuer.vue +17 -7
- package/src/components/PubmedViewer.vue +29 -78
- package/src/components/Tooltip.vue +35 -32
package/package-lock.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/flatmapvuer",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"lockfileVersion": 1,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@abi-software/flatmap-viewer": {
|
|
8
|
-
"version": "2.2.
|
|
9
|
-
"resolved": "https://registry.npmjs.org/@abi-software/flatmap-viewer/-/flatmap-viewer-2.2.
|
|
10
|
-
"integrity": "sha512-
|
|
8
|
+
"version": "2.2.9",
|
|
9
|
+
"resolved": "https://registry.npmjs.org/@abi-software/flatmap-viewer/-/flatmap-viewer-2.2.9.tgz",
|
|
10
|
+
"integrity": "sha512-UN7R84Xn2TeK9Fo/IEFSEKuauRroO5KMYKDUu4wfZQw0qzSC79OdJmHBOeIH4pkS+J4FRZfq+prS7cxiCNCyRw==",
|
|
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.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"main": "./dist/flatmapvuer.common.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/*",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"lint": "vue-cli-service lint"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@abi-software/flatmap-viewer": "^2.2.
|
|
24
|
+
"@abi-software/flatmap-viewer": "^2.2.9",
|
|
25
25
|
"@abi-software/svg-sprite": "^0.1.14",
|
|
26
26
|
"core-js": "^3.3.2",
|
|
27
27
|
"css-element-queries": "^1.2.2",
|
package/src/App.vue
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<el-row :gutter="20">
|
|
12
12
|
<el-button @click="helpMode = !helpMode" size="mini">Help Mode</el-button>
|
|
13
13
|
<el-button @click="saveSettings()" size="mini">Save Settings</el-button>
|
|
14
|
-
<el-button @click="restoreSettings()" size="mini">Restore Settings</el-button>
|
|
14
|
+
<el-button :disabled="mapSettings.length === 0" @click="restoreSettings()" size="mini">Restore Settings</el-button>
|
|
15
15
|
</el-row>
|
|
16
16
|
</div>
|
|
17
17
|
<el-button class="options-button" icon="el-icon-setting" slot="reference">Options</el-button>
|
|
@@ -46,11 +46,11 @@ export default {
|
|
|
46
46
|
name: 'app',
|
|
47
47
|
methods: {
|
|
48
48
|
saveSettings: function() {
|
|
49
|
-
this.
|
|
49
|
+
this.mapSettings.push(this.$refs.multi.getState());
|
|
50
50
|
},
|
|
51
51
|
restoreSettings: function() {
|
|
52
|
-
if (this.
|
|
53
|
-
this.$refs.multi.setState(this.
|
|
52
|
+
if (this.mapSettings.length > 0)
|
|
53
|
+
this.$refs.multi.setState(this.mapSettings.pop());
|
|
54
54
|
},
|
|
55
55
|
FlatmapSelected: function(resource) {
|
|
56
56
|
if (resource.eventType === "click")
|
|
@@ -94,15 +94,13 @@ export default {
|
|
|
94
94
|
displayCloseButton: false,
|
|
95
95
|
initial: "Rat",
|
|
96
96
|
helpMode: false,
|
|
97
|
+
mapSettings: [],
|
|
97
98
|
//flatmapAPI: "https://mapcore-demo.org/current/flatmap/v2/"
|
|
98
99
|
//flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v3/"
|
|
99
|
-
flatmapAPI: "https://mapcore-demo.org/
|
|
100
|
+
flatmapAPI: "https://mapcore-demo.org/current/flatmap/v3/"
|
|
100
101
|
// flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v1/"
|
|
101
102
|
}
|
|
102
103
|
},
|
|
103
|
-
mounted: function() {
|
|
104
|
-
this._mapSettings = [];
|
|
105
|
-
},
|
|
106
104
|
components: {
|
|
107
105
|
MultiFlatmapVuer,
|
|
108
106
|
}
|
|
@@ -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",
|
|
@@ -566,9 +568,15 @@ export default {
|
|
|
566
568
|
if (this.mapImp) {
|
|
567
569
|
let state = {
|
|
568
570
|
entry: this.entry,
|
|
569
|
-
biologicalSex: this.biologicalSex,
|
|
570
571
|
viewport: this.mapImp.getState()
|
|
571
572
|
};
|
|
573
|
+
const identifier = this.mapImp.getIdentifier();
|
|
574
|
+
if (this.biologicalSex)
|
|
575
|
+
state['biologicalSex'] = this.biologicalSex;
|
|
576
|
+
else if (identifier && identifier.biologicalSex)
|
|
577
|
+
state['biologicalSex'] = identifier.biologicalSex;
|
|
578
|
+
if (identifier && identifier.uuid)
|
|
579
|
+
state['uuid'] = identifier.uuid;
|
|
572
580
|
return state;
|
|
573
581
|
}
|
|
574
582
|
return undefined;
|
|
@@ -595,7 +603,7 @@ export default {
|
|
|
595
603
|
minimap = { position: "top-right" };
|
|
596
604
|
}
|
|
597
605
|
|
|
598
|
-
//As for flatmap-viewer@2.2.
|
|
606
|
+
//As for flatmap-viewer@2.2.7, see below for the documentation
|
|
599
607
|
//for the identifier:
|
|
600
608
|
|
|
601
609
|
//@arg identifier {string|Object}
|
|
@@ -703,7 +711,10 @@ export default {
|
|
|
703
711
|
},
|
|
704
712
|
props: {
|
|
705
713
|
entry: String,
|
|
706
|
-
biologicalSex:
|
|
714
|
+
biologicalSex: {
|
|
715
|
+
type: String,
|
|
716
|
+
default: ""
|
|
717
|
+
},
|
|
707
718
|
featureInfo: {
|
|
708
719
|
type: Boolean,
|
|
709
720
|
default: false
|
|
@@ -913,6 +924,9 @@ export default {
|
|
|
913
924
|
transparent 9px
|
|
914
925
|
);
|
|
915
926
|
}
|
|
927
|
+
&.other {
|
|
928
|
+
background: #888;
|
|
929
|
+
}
|
|
916
930
|
}
|
|
917
931
|
|
|
918
932
|
.flatmap-container {
|
|
@@ -1301,10 +1315,6 @@ export default {
|
|
|
1301
1315
|
}
|
|
1302
1316
|
}
|
|
1303
1317
|
|
|
1304
|
-
::v-deep .flatmap-popper {
|
|
1305
|
-
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
1318
|
::v-deep .popper-zoomout {
|
|
1309
1319
|
padding-right: 13px !important;
|
|
1310
1320
|
left: -21px !important;
|
|
@@ -1,42 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="pubmed-container">
|
|
3
|
-
|
|
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.
|
|
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.
|
|
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
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
.
|
|
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
|
-
|
|
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
|
-
|
|
77
|
+
} else { // Create pubmed url on models
|
|
78
|
+
this.pubmedQueryOnModels(this.entry.source)
|
|
134
79
|
}
|
|
135
80
|
})
|
|
136
|
-
|
|
137
|
-
|
|
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
|
-
<!--
|
|
74
|
-
|
|
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
|
-
|
|
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) => {
|