@abi-software/flatmapvuer 0.3.10 → 0.3.12-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 +493 -1984
- package/dist/flatmapvuer.common.js.map +1 -1
- package/dist/flatmapvuer.css +1 -1
- package/dist/flatmapvuer.umd.js +493 -1984
- 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 +90 -1
- package/package.json +1 -1
- package/src/components/FlatmapVuer.vue +51 -10
- package/src/components/MultiFlatmapVuer.vue +127 -16
- package/src/components/PubmedViewer.vue +29 -78
- package/src/components/Tooltip.vue +35 -32
package/package-lock.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
|
"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
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<div class="beta-popovers">
|
|
13
13
|
<div>
|
|
14
14
|
<el-popover
|
|
15
|
-
:content="warningMessage"
|
|
15
|
+
:content="isLegacy ? 'This is a legacy map, you may view the latest map instead.' : warningMessage"
|
|
16
16
|
placement="right"
|
|
17
17
|
:appendToBody="false"
|
|
18
18
|
trigger="manual"
|
|
@@ -27,7 +27,13 @@
|
|
|
27
27
|
@mouseout="hideToolitip(6)"
|
|
28
28
|
v-popover:warningPopover
|
|
29
29
|
>
|
|
30
|
-
|
|
30
|
+
<template v-if="isLegacy">
|
|
31
|
+
<span class="warning-text">Legacy Map</span>
|
|
32
|
+
<div class="latest-map-text" @click="viewLatestMap">Click here for the latest map</div>
|
|
33
|
+
</template>
|
|
34
|
+
<template v-else>
|
|
35
|
+
<span class="warning-text">Beta</span>
|
|
36
|
+
</template>
|
|
31
37
|
</i>
|
|
32
38
|
</div>
|
|
33
39
|
<el-popover
|
|
@@ -294,6 +300,19 @@ export default {
|
|
|
294
300
|
this.mapImp = undefined;
|
|
295
301
|
},
|
|
296
302
|
methods: {
|
|
303
|
+
viewLatestMap: function() {
|
|
304
|
+
let biologicalSex = this.biologicalSex ? this.biologicalSex : undefined;
|
|
305
|
+
//Human requires special handling
|
|
306
|
+
if (this.entry === "NCBITaxon:9606") {
|
|
307
|
+
biologicalSex = "PATO:0000384";
|
|
308
|
+
}
|
|
309
|
+
const state = {
|
|
310
|
+
entry: this.entry,
|
|
311
|
+
biologicalSex,
|
|
312
|
+
viewport: this.mapImp.getState()
|
|
313
|
+
};
|
|
314
|
+
this.$emit("view-latest-map", state);
|
|
315
|
+
},
|
|
297
316
|
backgroundChangeCallback: function(colour) {
|
|
298
317
|
this.currentBackground = colour;
|
|
299
318
|
if (this.mapImp) {
|
|
@@ -463,6 +482,7 @@ export default {
|
|
|
463
482
|
this.tooltipVisible = true;
|
|
464
483
|
this.tooltipContent = content;
|
|
465
484
|
this.tooltipContent.uberon = feature;
|
|
485
|
+
this.tooltipContent.source = data.feature.source;
|
|
466
486
|
this.tooltipContent.title = data.label;
|
|
467
487
|
this.tooltipContent.featureIds = [feature];
|
|
468
488
|
this.tooltipContent.actions.push({
|
|
@@ -480,6 +500,7 @@ export default {
|
|
|
480
500
|
this.tooltipVisible = true;
|
|
481
501
|
this.tooltipContent = content;
|
|
482
502
|
this.tooltipContent.uberon = feature;
|
|
503
|
+
this.tooltipContent.source = data.feature.source;
|
|
483
504
|
this.tooltipContent.title = data.label;
|
|
484
505
|
this.tooltipContent.actions.push({
|
|
485
506
|
title: "View dataset",
|
|
@@ -618,13 +639,17 @@ export default {
|
|
|
618
639
|
// be loaded, overriding ``taxon`` and ``biologicalSex``.
|
|
619
640
|
|
|
620
641
|
let identifier = { taxon: this.entry };
|
|
621
|
-
if (state
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
642
|
+
if (state) {
|
|
643
|
+
if (state.uuid) {
|
|
644
|
+
identifier = { uuid: state.uuid };
|
|
645
|
+
} else if (state.entry) {
|
|
646
|
+
identifier.taxon = state.entry;
|
|
647
|
+
if (state.biologicalSex) {
|
|
648
|
+
identifier["biologicalSex"] = state.biologicalSex;
|
|
649
|
+
} else if (identifier.taxon === "NCBITaxon:9606") {
|
|
650
|
+
//For backward compatibility
|
|
651
|
+
identifier["biologicalSex"] ="PATO:0000384";
|
|
652
|
+
}
|
|
628
653
|
}
|
|
629
654
|
} else {
|
|
630
655
|
// Set the bioloicalSex now if map is not resumed from
|
|
@@ -667,8 +692,11 @@ export default {
|
|
|
667
692
|
this.mapImp.setState(state.viewport);
|
|
668
693
|
});
|
|
669
694
|
} else if (state) {
|
|
670
|
-
if (this.entry == state.entry)
|
|
695
|
+
if (this.entry == state.entry) {
|
|
671
696
|
this._viewportToBeSet = state.viewport;
|
|
697
|
+
if (this.mapImp && !this.loading)
|
|
698
|
+
this.mapImp.setState(this._viewportToBeSet);
|
|
699
|
+
}
|
|
672
700
|
}
|
|
673
701
|
},
|
|
674
702
|
showMinimap: function(flag) {
|
|
@@ -753,6 +781,10 @@ export default {
|
|
|
753
781
|
type: String,
|
|
754
782
|
default: "Beta feature - This map is based on the connectivity of a rat. New connectivity and species specificity will be added as the SPARC program progress."
|
|
755
783
|
},
|
|
784
|
+
isLegacy: {
|
|
785
|
+
type: Boolean,
|
|
786
|
+
default: false
|
|
787
|
+
},
|
|
756
788
|
displayLatestChanges: {
|
|
757
789
|
type: Boolean,
|
|
758
790
|
default: false,
|
|
@@ -866,6 +898,15 @@ export default {
|
|
|
866
898
|
vertical-align: 5px;
|
|
867
899
|
}
|
|
868
900
|
|
|
901
|
+
.latest-map-text {
|
|
902
|
+
color: $app-primary-color;;
|
|
903
|
+
font-family: Asap, sans-serif;
|
|
904
|
+
font-size: 12px;
|
|
905
|
+
margin-top: 5px;
|
|
906
|
+
vertical-align: 10px;
|
|
907
|
+
cursor: pointer;
|
|
908
|
+
}
|
|
909
|
+
|
|
869
910
|
.latest-changesicon {
|
|
870
911
|
color: $success;
|
|
871
912
|
|
|
@@ -36,7 +36,9 @@
|
|
|
36
36
|
:warningMessage="warningMessage"
|
|
37
37
|
:displayLatestChanges="item.displayLatestChanges"
|
|
38
38
|
:latestChangesMessage="item.latestChangesMessage"
|
|
39
|
+
:isLegacy="item.isLegacy"
|
|
39
40
|
:ref="key"
|
|
41
|
+
@view-latest-map="viewLatestMap"
|
|
40
42
|
@resource-selected="FlatmapSelected"
|
|
41
43
|
@ready="FlatmapReady"
|
|
42
44
|
@pan-zoom-callback="panZoomCallback"
|
|
@@ -70,6 +72,13 @@ Vue.use(Option);
|
|
|
70
72
|
Vue.use(Select);
|
|
71
73
|
Vue.use(Popover)
|
|
72
74
|
|
|
75
|
+
const TAXON_UUID = {
|
|
76
|
+
"NCBITaxon:10114": "01fedbf9-d783-509c-a10c-827941ab13da",
|
|
77
|
+
"NCBITaxon:9823": "a336ac04-24db-561f-a25f-1c994fe17410",
|
|
78
|
+
"NCBITaxon:9606": "42ed6323-f645-5fbe-bada-9581819cf689",
|
|
79
|
+
"NCBITaxon:10090": "25285fab-48a0-5620-a6a0-f9a0374837d5",
|
|
80
|
+
"NCBITaxon:9685": "73060497-46a6-52bf-b975-cac511c127cb"
|
|
81
|
+
}
|
|
73
82
|
|
|
74
83
|
export default {
|
|
75
84
|
name: "MultiFlatmapVuer",
|
|
@@ -89,6 +98,8 @@ export default {
|
|
|
89
98
|
.then(response => response.json())
|
|
90
99
|
.then(data => {
|
|
91
100
|
this.speciesList= {};
|
|
101
|
+
//Check each key in the provided availableSpecies against the one
|
|
102
|
+
// on the server, add them to the Select if the key is found
|
|
92
103
|
Object.keys(this.availableSpecies).forEach(key => {
|
|
93
104
|
for (let i = 0; i < data.length; i++) {
|
|
94
105
|
if (this.availableSpecies[key].taxo === data[i].taxon) {
|
|
@@ -106,6 +117,7 @@ export default {
|
|
|
106
117
|
}
|
|
107
118
|
});
|
|
108
119
|
if (!this.state) {
|
|
120
|
+
//No state resuming, set the current flatmap to {this.initial}
|
|
109
121
|
if (this.initial && this.speciesList[this.initial] !== undefined) {
|
|
110
122
|
this.activeSpecies = this.initial;
|
|
111
123
|
} else {
|
|
@@ -147,13 +159,95 @@ export default {
|
|
|
147
159
|
let map = this.getCurrentFlatmap();
|
|
148
160
|
map.showMarkerPopup(featureId, node, options);
|
|
149
161
|
},
|
|
150
|
-
flatmapChanged: function(species){
|
|
162
|
+
flatmapChanged: function(species, viewport){
|
|
151
163
|
if (this.activeSpecies != species)
|
|
152
164
|
this.activeSpecies = species;
|
|
153
|
-
this.$refs[this.activeSpecies][0].createFlatmap();
|
|
165
|
+
this.$refs[this.activeSpecies][0].createFlatmap(viewport);
|
|
154
166
|
this.$emit('flatmapChanged', this.activeSpecies);
|
|
155
167
|
},
|
|
156
|
-
|
|
168
|
+
/**
|
|
169
|
+
* Function to switch to the latest existing map from
|
|
170
|
+
* a legacy map of the same species.
|
|
171
|
+
*
|
|
172
|
+
* @private
|
|
173
|
+
*/
|
|
174
|
+
viewLatestMap: function(state) {
|
|
175
|
+
const keys = Object.keys(this.speciesList);
|
|
176
|
+
for (let i = 0; i < keys.length; i++) {
|
|
177
|
+
const species = this.speciesList[keys[i]];
|
|
178
|
+
if (!species.isLegacy &&
|
|
179
|
+
(species.taxo === state.entry) &&
|
|
180
|
+
(species.biologicalSex === state.biologicalSex)) {
|
|
181
|
+
this.flatmapChanged(keys[i], state);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
createLegacyEntry: function(state, taxo, uuid) {
|
|
187
|
+
if (uuid && taxo) {
|
|
188
|
+
let name = "Legacy";
|
|
189
|
+
if (state.species) {
|
|
190
|
+
if (state.species.slice(0, 6) === "Legacy")
|
|
191
|
+
name = state.species;
|
|
192
|
+
else
|
|
193
|
+
name = name + ` ${state.species}`;
|
|
194
|
+
}
|
|
195
|
+
this.speciesList[name] = {
|
|
196
|
+
taxo: taxo,
|
|
197
|
+
isLegacy: true,
|
|
198
|
+
displayWarning: true
|
|
199
|
+
};
|
|
200
|
+
return {
|
|
201
|
+
species: name,
|
|
202
|
+
state: {
|
|
203
|
+
entry: taxo,
|
|
204
|
+
uuid: uuid
|
|
205
|
+
},
|
|
206
|
+
viewport: state.state.viewport,
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
/**
|
|
211
|
+
* Function used to translate the legacy map state to one that can be used in current
|
|
212
|
+
* flatmap if required. If it is a legacy, an Select entry will be added
|
|
213
|
+
*
|
|
214
|
+
* @private
|
|
215
|
+
*/
|
|
216
|
+
updateState: function(state) {
|
|
217
|
+
return new Promise((resolve) => {
|
|
218
|
+
if (state && state.state) {
|
|
219
|
+
const mapState = state.state;
|
|
220
|
+
//uuid is not in the state, this is a legacy map
|
|
221
|
+
if (!mapState.uuid) {
|
|
222
|
+
if (mapState.entry) {
|
|
223
|
+
const uuid = mapState.entry in TAXON_UUID ? TAXON_UUID[mapState.entry] : undefined;
|
|
224
|
+
const newState = this.createLegacyEntry(state, mapState.entry, uuid);
|
|
225
|
+
resolve(newState ? newState : state);
|
|
226
|
+
}
|
|
227
|
+
} else if (mapState.entry) {
|
|
228
|
+
//uuid is in the state but should be checked if it is the latest map
|
|
229
|
+
//for that taxon
|
|
230
|
+
return new Promise(() => {
|
|
231
|
+
const mapManager = new (require("@abi-software/flatmap-viewer")).MapManager(this.flatmapAPI);
|
|
232
|
+
//mapManager.findMap_ is an async function so we need to wrap this with a promise
|
|
233
|
+
mapManager.findMap_({taxon: mapState.entry}).then(map => {
|
|
234
|
+
if (map.uuid !== mapState.uuid) {
|
|
235
|
+
return this.createLegacyEntry(state, mapState.entry, mapState.uuid);
|
|
236
|
+
}
|
|
237
|
+
}).then(newState => {
|
|
238
|
+
resolve(newState ? newState : state);
|
|
239
|
+
})
|
|
240
|
+
.catch(() => {
|
|
241
|
+
resolve(state);
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
//Create a new state and add the legacy map to the select
|
|
246
|
+
}
|
|
247
|
+
resolve(state);
|
|
248
|
+
});
|
|
249
|
+
},
|
|
250
|
+
/**
|
|
157
251
|
* Function used for getting the current states of the scene. This exported states
|
|
158
252
|
* can be imported using the importStates method.
|
|
159
253
|
*
|
|
@@ -177,19 +271,24 @@ export default {
|
|
|
177
271
|
setState: function(state) {
|
|
178
272
|
if (state) {
|
|
179
273
|
this.initialise().then(() => {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
if (
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
this.$
|
|
187
|
-
|
|
274
|
+
//Update state if required
|
|
275
|
+
this.updateState(state).then(currentState => {
|
|
276
|
+
if (currentState.species && (currentState.species !== this.activeSpecies)) {
|
|
277
|
+
this.activeSpecies = currentState.species;
|
|
278
|
+
if (currentState.state) {
|
|
279
|
+
//Wait for next tick when the refs are ready for rendering
|
|
280
|
+
this.$nextTick(() => {
|
|
281
|
+
if (this.activeSpecies in this.$refs) {
|
|
282
|
+
this.$refs[this.activeSpecies][0].createFlatmap(currentState.state);
|
|
283
|
+
this.$emit('flatmapChanged', this.activeSpecies);
|
|
284
|
+
}
|
|
285
|
+
})
|
|
286
|
+
}
|
|
287
|
+
} else if (currentState.state) {
|
|
288
|
+
let map = this.getCurrentFlatmap();
|
|
289
|
+
map.setState(currentState.state);
|
|
188
290
|
}
|
|
189
|
-
}
|
|
190
|
-
let map = this.getCurrentFlatmap();
|
|
191
|
-
map.setState(state.state);
|
|
192
|
-
}
|
|
291
|
+
});
|
|
193
292
|
})
|
|
194
293
|
}
|
|
195
294
|
},
|
|
@@ -242,7 +341,19 @@ export default {
|
|
|
242
341
|
type: String,
|
|
243
342
|
default: "Beta feature - This map is based on the connectivity of a rat. New connectivity and species specificity will be added as the SPARC program progress."
|
|
244
343
|
},
|
|
245
|
-
availableSpecies: {
|
|
344
|
+
availableSpecies: {
|
|
345
|
+
type: Object,
|
|
346
|
+
default: function() {
|
|
347
|
+
return {
|
|
348
|
+
"Human Female":{taxo: "NCBITaxon:9606", biologicalSex: "PATO:0000383", iconClass:"mapicon-icon_human", displayWarning:true},
|
|
349
|
+
"Human Male":{taxo: "NCBITaxon:9606", biologicalSex: "PATO:0000384", iconClass:"mapicon-icon_human", displayWarning:true},
|
|
350
|
+
"Rat":{taxo: "NCBITaxon:10114", iconClass:"mapicon-icon_rat", displayLatestChanges: true},
|
|
351
|
+
"Mouse":{taxo: "NCBITaxon:10090", iconClass:"mapicon-icon_mouse", displayWarning: true},
|
|
352
|
+
"Pig":{taxo: "NCBITaxon:9823", iconClass:"mapicon-icon_pig", displayWarning: true},
|
|
353
|
+
"Cat":{taxo: "NCBITaxon:9685", iconClass:"mapicon-icon_cat", displayWarning: true},
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
},
|
|
246
357
|
/**
|
|
247
358
|
* State containing state of the flatmap.
|
|
248
359
|
*/
|
|
@@ -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/?'
|