@abi-software/flatmapvuer 0.3.7 → 0.3.9
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/LICENSE +201 -201
- package/README.md +105 -105
- package/babel.config.js +14 -14
- package/dist/flatmapvuer.common.js +1418 -1004
- package/dist/flatmapvuer.common.js.map +1 -1
- package/dist/flatmapvuer.css +1 -1
- package/dist/flatmapvuer.umd.js +1418 -1004
- 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 +14210 -13923
- package/package.json +71 -67
- package/public/index.html +17 -17
- package/src/App.vue +164 -161
- package/src/assets/_variables.scss +43 -43
- package/src/assets/styles.scss +7 -7
- package/src/components/EventBus.js +2 -2
- package/src/components/FlatmapVuer.vue +1413 -1374
- package/src/components/MultiFlatmapVuer.vue +361 -351
- package/src/components/PubmedViewer.vue +198 -198
- package/src/components/Tooltip.vue +591 -591
- package/src/components/index.js +9 -9
- package/src/components/legends/Legends.vue +66 -66
- package/src/icons/fonts/mapicon-species.eot +0 -0
- package/src/icons/fonts/mapicon-species.svg +14 -14
- package/src/icons/fonts/mapicon-species.ttf +0 -0
- package/src/icons/fonts/mapicon-species.woff +0 -0
- package/src/icons/mapicon-species-style.css +42 -42
- package/src/legends/legend.svg +26 -0
- package/src/main.js +8 -8
- package/vue.config.js +31 -31
- package/src/nerve-map.js +0 -99
|
@@ -1,199 +1,199 @@
|
|
|
1
|
-
<template>
|
|
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>
|
|
19
|
-
</div>
|
|
20
|
-
</template>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<script>
|
|
24
|
-
/* 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
|
-
|
|
41
|
-
export default {
|
|
42
|
-
name: "Tooltip",
|
|
43
|
-
props: {
|
|
44
|
-
entry: {
|
|
45
|
-
type: Object,
|
|
46
|
-
default: () => {}
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
watch: {
|
|
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
|
-
}
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
inject: ['flatmapAPI'],
|
|
60
|
-
data: function() {
|
|
61
|
-
return {
|
|
62
|
-
data: {},
|
|
63
|
-
pubmeds: [],
|
|
64
|
-
pubmedIds: [],
|
|
65
|
-
loading: {response: true, publications: true}
|
|
66
|
-
};
|
|
67
|
-
},
|
|
68
|
-
mounted: function() {
|
|
69
|
-
if (this.entry.featureIds)
|
|
70
|
-
this.flatmapQuery(this.entry.featureIds)
|
|
71
|
-
},
|
|
72
|
-
methods: {
|
|
73
|
-
stripPMIDPrefix: function (pubmedId){
|
|
74
|
-
return pubmedId.split(':')[1]
|
|
75
|
-
},
|
|
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
|
-
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
|
|
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/`, {
|
|
111
|
-
method: 'POST',
|
|
112
|
-
headers: {
|
|
113
|
-
'Content-Type': 'application/json',
|
|
114
|
-
},
|
|
115
|
-
body: JSON.stringify(data),
|
|
116
|
-
})
|
|
117
|
-
.then(response => response.json())
|
|
118
|
-
.then(data => {
|
|
119
|
-
this.responseData = data
|
|
120
|
-
this.loading.response = false
|
|
121
|
-
|
|
122
|
-
// create links for each pubmedId
|
|
123
|
-
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
|
-
this.$emit('pubmedSearchUrl', this.pubmedSearchUrl(data.values.map(id=>this.stripPMIDPrefix(id[0]))))
|
|
132
|
-
} else {
|
|
133
|
-
this.$emit('pubmedSearchUrl', '') // Clears the pubmed search button
|
|
134
|
-
}
|
|
135
|
-
})
|
|
136
|
-
.catch((error) => {
|
|
137
|
-
console.error('Error:', error)
|
|
138
|
-
})
|
|
139
|
-
},
|
|
140
|
-
pubmedSearchUrl: function(ids) {
|
|
141
|
-
let url = 'https://pubmed.ncbi.nlm.nih.gov/?'
|
|
142
|
-
let params = new URLSearchParams()
|
|
143
|
-
params.append('term', ids)
|
|
144
|
-
return url + params.toString()
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
</script>
|
|
149
|
-
|
|
150
|
-
<style scoped lang="scss">
|
|
151
|
-
@import "~element-ui/packages/theme-chalk/src/link";
|
|
152
|
-
@import "~element-ui/packages/theme-chalk/src/carousel";
|
|
153
|
-
@import "~element-ui/packages/theme-chalk/src/carousel-item";
|
|
154
|
-
|
|
155
|
-
.attribute-title{
|
|
156
|
-
font-size: 16px;
|
|
157
|
-
font-weight: 600;
|
|
158
|
-
/* font-weight: bold; */
|
|
159
|
-
text-transform: uppercase;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.attribute-content{
|
|
163
|
-
font-size: 14px;
|
|
164
|
-
font-weight: 400;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.el-link {
|
|
168
|
-
color: $app-primary-color;
|
|
169
|
-
text-decoration: none;
|
|
170
|
-
word-wrap: break-word;
|
|
171
|
-
&:hover, &:focus{
|
|
172
|
-
color: $app-primary-color;
|
|
173
|
-
text-decoration: underline;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
::v-deep .el-carousel__button {
|
|
178
|
-
background-color: $app-primary-color;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.button {
|
|
182
|
-
margin-left: 0px !important;
|
|
183
|
-
margin-top: 0px !important;
|
|
184
|
-
font-size: 14px !important;
|
|
185
|
-
background-color: $app-primary-color;
|
|
186
|
-
color: #fff;
|
|
187
|
-
&:hover{
|
|
188
|
-
color: #fff !important;
|
|
189
|
-
background: #ac76c5 !important;
|
|
190
|
-
border: 1px solid #ac76c5 !important;
|
|
191
|
-
}
|
|
192
|
-
&+.button {
|
|
193
|
-
margin-top: 10px !important;
|
|
194
|
-
background-color: $app-primary-color;
|
|
195
|
-
color: #fff;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
1
|
+
<template>
|
|
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>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<script>
|
|
24
|
+
/* 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
|
+
|
|
41
|
+
export default {
|
|
42
|
+
name: "Tooltip",
|
|
43
|
+
props: {
|
|
44
|
+
entry: {
|
|
45
|
+
type: Object,
|
|
46
|
+
default: () => {}
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
watch: {
|
|
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
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
inject: ['flatmapAPI'],
|
|
60
|
+
data: function() {
|
|
61
|
+
return {
|
|
62
|
+
data: {},
|
|
63
|
+
pubmeds: [],
|
|
64
|
+
pubmedIds: [],
|
|
65
|
+
loading: {response: true, publications: true}
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
mounted: function() {
|
|
69
|
+
if (this.entry.featureIds)
|
|
70
|
+
this.flatmapQuery(this.entry.featureIds)
|
|
71
|
+
},
|
|
72
|
+
methods: {
|
|
73
|
+
stripPMIDPrefix: function (pubmedId){
|
|
74
|
+
return pubmedId.split(':')[1]
|
|
75
|
+
},
|
|
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
|
+
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
|
|
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/`, {
|
|
111
|
+
method: 'POST',
|
|
112
|
+
headers: {
|
|
113
|
+
'Content-Type': 'application/json',
|
|
114
|
+
},
|
|
115
|
+
body: JSON.stringify(data),
|
|
116
|
+
})
|
|
117
|
+
.then(response => response.json())
|
|
118
|
+
.then(data => {
|
|
119
|
+
this.responseData = data
|
|
120
|
+
this.loading.response = false
|
|
121
|
+
|
|
122
|
+
// create links for each pubmedId
|
|
123
|
+
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
|
+
this.$emit('pubmedSearchUrl', this.pubmedSearchUrl(data.values.map(id=>this.stripPMIDPrefix(id[0]))))
|
|
132
|
+
} else {
|
|
133
|
+
this.$emit('pubmedSearchUrl', '') // Clears the pubmed search button
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
.catch((error) => {
|
|
137
|
+
console.error('Error:', error)
|
|
138
|
+
})
|
|
139
|
+
},
|
|
140
|
+
pubmedSearchUrl: function(ids) {
|
|
141
|
+
let url = 'https://pubmed.ncbi.nlm.nih.gov/?'
|
|
142
|
+
let params = new URLSearchParams()
|
|
143
|
+
params.append('term', ids)
|
|
144
|
+
return url + params.toString()
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
</script>
|
|
149
|
+
|
|
150
|
+
<style scoped lang="scss">
|
|
151
|
+
@import "~element-ui/packages/theme-chalk/src/link";
|
|
152
|
+
@import "~element-ui/packages/theme-chalk/src/carousel";
|
|
153
|
+
@import "~element-ui/packages/theme-chalk/src/carousel-item";
|
|
154
|
+
|
|
155
|
+
.attribute-title{
|
|
156
|
+
font-size: 16px;
|
|
157
|
+
font-weight: 600;
|
|
158
|
+
/* font-weight: bold; */
|
|
159
|
+
text-transform: uppercase;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.attribute-content{
|
|
163
|
+
font-size: 14px;
|
|
164
|
+
font-weight: 400;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.el-link {
|
|
168
|
+
color: $app-primary-color;
|
|
169
|
+
text-decoration: none;
|
|
170
|
+
word-wrap: break-word;
|
|
171
|
+
&:hover, &:focus{
|
|
172
|
+
color: $app-primary-color;
|
|
173
|
+
text-decoration: underline;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
::v-deep .el-carousel__button {
|
|
178
|
+
background-color: $app-primary-color;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.button {
|
|
182
|
+
margin-left: 0px !important;
|
|
183
|
+
margin-top: 0px !important;
|
|
184
|
+
font-size: 14px !important;
|
|
185
|
+
background-color: $app-primary-color;
|
|
186
|
+
color: #fff;
|
|
187
|
+
&:hover{
|
|
188
|
+
color: #fff !important;
|
|
189
|
+
background: #ac76c5 !important;
|
|
190
|
+
border: 1px solid #ac76c5 !important;
|
|
191
|
+
}
|
|
192
|
+
&+.button {
|
|
193
|
+
margin-top: 10px !important;
|
|
194
|
+
background-color: $app-primary-color;
|
|
195
|
+
color: #fff;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
199
|
</style>
|