@abi-software/flatmapvuer 0.4.1-beta.0 → 0.4.1-beta.1
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 +950 -643
- package/dist/flatmapvuer.common.js.map +1 -1
- package/dist/flatmapvuer.css +1 -1
- package/dist/flatmapvuer.umd.js +950 -643
- package/dist/flatmapvuer.umd.js.map +1 -1
- package/dist/flatmapvuer.umd.min.js +3 -2
- package/dist/flatmapvuer.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FlatmapVuer.vue +12 -3
- package/src/services/flatmapQueries.js +122 -175
package/package.json
CHANGED
|
@@ -747,10 +747,18 @@ export default {
|
|
|
747
747
|
}
|
|
748
748
|
},
|
|
749
749
|
mapResize: function() {
|
|
750
|
-
|
|
751
|
-
this.mapImp
|
|
750
|
+
try {
|
|
751
|
+
if (this.mapImp) {
|
|
752
|
+
this.mapImp.resize();
|
|
753
|
+
this.showMinimap(this.displayMinimap);
|
|
754
|
+
if (this.mapImp._minimap) {
|
|
755
|
+
this.mapImp._minimap.resize();
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
this.computePathControlsMaximumHeight();
|
|
759
|
+
} catch {
|
|
760
|
+
console.error("Map resize error");
|
|
752
761
|
}
|
|
753
|
-
this.computePathControlsMaximumHeight();
|
|
754
762
|
},
|
|
755
763
|
onFlatmapReady: function(){
|
|
756
764
|
// onFlatmapReady is used for functions that need to run immediately after the flatmap is loaded
|
|
@@ -771,6 +779,7 @@ export default {
|
|
|
771
779
|
this.loading = false;
|
|
772
780
|
this.computePathControlsMaximumHeight();
|
|
773
781
|
this.drawerOpen = true;
|
|
782
|
+
this.mapResize();
|
|
774
783
|
this.$emit("ready", this);
|
|
775
784
|
},
|
|
776
785
|
showMinimap: function(flag) {
|
|
@@ -1,36 +1,28 @@
|
|
|
1
1
|
/* eslint-disable no-alert, no-console */
|
|
2
2
|
// remove duplicates by stringifying the objects
|
|
3
|
-
const removeDuplicates = function(arrayOfAnything){
|
|
4
|
-
return [...new Set(arrayOfAnything.map(e => JSON.stringify(e)))].map(e => JSON.parse(e))
|
|
3
|
+
const removeDuplicates = function (arrayOfAnything) {
|
|
4
|
+
return [...new Set(arrayOfAnything.map(e => JSON.stringify(e)))].map(e => JSON.parse(e))
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
const inArray = function(ar1, ar2){
|
|
7
|
+
const inArray = function (ar1, ar2) {
|
|
8
8
|
let as1 = JSON.stringify(ar1)
|
|
9
9
|
let as2 = JSON.stringify(ar2)
|
|
10
10
|
return as1.indexOf(as2) !== -1
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.uberons = uberons
|
|
25
|
-
this.createLabelLookup(uberons).then(lookUp=>{
|
|
26
|
-
this.lookUp = lookUp
|
|
27
|
-
})
|
|
28
|
-
})
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
createTooltipData = function (eventData) {
|
|
13
|
+
exports.FlatmapQueries = function(sparcApi, flatmapApi) {
|
|
14
|
+
this.sparcApi = sparcApi
|
|
15
|
+
this.flatmapApi = flatmapApi
|
|
16
|
+
this.destinations = []
|
|
17
|
+
this.origins = []
|
|
18
|
+
this.components = []
|
|
19
|
+
this.uberons = []
|
|
20
|
+
this.urls = []
|
|
21
|
+
this.controller = undefined
|
|
22
|
+
|
|
23
|
+
this.createTooltipData = (eventData) => {
|
|
32
24
|
let tooltipData = {
|
|
33
|
-
destinations: this.destinations,
|
|
25
|
+
destinations: this.destinations,
|
|
34
26
|
origins: this.origins,
|
|
35
27
|
components: this.components,
|
|
36
28
|
destinationsWithDatasets: this.destinationsWithDatasets,
|
|
@@ -38,43 +30,32 @@ export class FlatmapQueries {
|
|
|
38
30
|
componentsWithDatasets: this.componentsWithDatasets,
|
|
39
31
|
title: eventData.label,
|
|
40
32
|
featureId: eventData.resource,
|
|
41
|
-
hyperlinks: eventData.feature.hyperlinks ? eventData.feature.hyperlinks : this.urls.map(url=>({url: url, id: "pubmed"})),
|
|
33
|
+
hyperlinks: eventData.feature.hyperlinks ? eventData.feature.hyperlinks : this.urls.map(url => ({ url: url, id: "pubmed" })),
|
|
42
34
|
}
|
|
43
35
|
return tooltipData
|
|
44
36
|
}
|
|
45
37
|
|
|
46
|
-
getOrganCuries =
|
|
47
|
-
return new Promise(resolve=> {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
createComponentsLabelList = function(components, lookUp){
|
|
57
|
-
let labelList = []
|
|
58
|
-
components.forEach(n=>{
|
|
59
|
-
labelList.push(this.createLabelFromNeuralNode(n[0]), lookUp)
|
|
60
|
-
if (n.length === 2){
|
|
61
|
-
labelList.push(this.createLabelFromNeuralNode(n[1]), lookUp)
|
|
62
|
-
}
|
|
38
|
+
const getOrganCuries = () => {
|
|
39
|
+
return new Promise(resolve => {
|
|
40
|
+
fetch(`${this.sparcAPI}get-organ-curies/`)
|
|
41
|
+
.then(response => response.json())
|
|
42
|
+
.then(data => {
|
|
43
|
+
resolve(data.uberon.array)
|
|
44
|
+
})
|
|
63
45
|
})
|
|
64
|
-
return labelList
|
|
65
46
|
}
|
|
66
47
|
|
|
67
|
-
createLabelLookup =
|
|
68
|
-
return new Promise(resolve=> {
|
|
48
|
+
const createLabelLookup = (uberons) => {
|
|
49
|
+
return new Promise(resolve => {
|
|
69
50
|
let uberonMap = {}
|
|
70
|
-
const data = { sql:
|
|
51
|
+
const data = { sql: buildLabelSqlStatement(uberons) }
|
|
71
52
|
fetch(`${this.flatmapApi}knowledge/query/`, {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
53
|
+
method: 'POST',
|
|
54
|
+
headers: {
|
|
55
|
+
'Content-Type': 'application/json',
|
|
56
|
+
},
|
|
57
|
+
body: JSON.stringify(data),
|
|
58
|
+
})
|
|
78
59
|
.then(response => response.json())
|
|
79
60
|
.then(payload => {
|
|
80
61
|
const entity = payload.keys.indexOf("entity");
|
|
@@ -84,12 +65,20 @@ export class FlatmapQueries {
|
|
|
84
65
|
uberonMap[pair[entity]] = pair[label];
|
|
85
66
|
});
|
|
86
67
|
}
|
|
87
|
-
|
|
68
|
+
resolve(uberonMap)
|
|
88
69
|
})
|
|
89
70
|
})
|
|
90
71
|
}
|
|
91
72
|
|
|
92
|
-
|
|
73
|
+
|
|
74
|
+
getOrganCuries().then(uberons => {
|
|
75
|
+
this.uberons = uberons
|
|
76
|
+
createLabelLookup(uberons).then(lookUp => {
|
|
77
|
+
this.lookUp = lookUp
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
const buildConnectivitySqlStatement = (keastIds) =>{
|
|
93
82
|
let sql = 'select knowledge from knowledge where entity in ('
|
|
94
83
|
if (keastIds.length === 1) {
|
|
95
84
|
sql += `'${keastIds[0]}')`
|
|
@@ -100,7 +89,8 @@ export class FlatmapQueries {
|
|
|
100
89
|
}
|
|
101
90
|
return sql
|
|
102
91
|
}
|
|
103
|
-
|
|
92
|
+
|
|
93
|
+
const buildLabelSqlStatement = (uberons) => {
|
|
104
94
|
let sql = 'select entity, label from labels where entity in ('
|
|
105
95
|
if (uberons.length === 1) {
|
|
106
96
|
sql += `'${uberons[0]}')`
|
|
@@ -112,7 +102,7 @@ export class FlatmapQueries {
|
|
|
112
102
|
return sql
|
|
113
103
|
}
|
|
114
104
|
|
|
115
|
-
findAllIdsFromConnectivity =
|
|
105
|
+
const findAllIdsFromConnectivity = (connectivity) => {
|
|
116
106
|
let dnodes = connectivity.connectivity.flat() // get nodes from edgelist
|
|
117
107
|
let nodes = [...new Set(dnodes)] // remove duplicates
|
|
118
108
|
let found = []
|
|
@@ -126,71 +116,34 @@ export class FlatmapQueries {
|
|
|
126
116
|
return [... new Set(found.flat())]
|
|
127
117
|
}
|
|
128
118
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
let found = []
|
|
133
|
-
nodes.forEach(n => {
|
|
134
|
-
if (Array.isArray(n)) {
|
|
135
|
-
found.push(n.flat())
|
|
136
|
-
} else {
|
|
137
|
-
found.push(n)
|
|
138
|
-
}
|
|
139
|
-
})
|
|
140
|
-
return found.flat()
|
|
141
|
-
}
|
|
119
|
+
this.retrieveFlatmapKnowledgeForEvent = async (eventData) =>{
|
|
120
|
+
// check if there is an existing query
|
|
121
|
+
if (this.controller) this.controller.abort();
|
|
142
122
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
123
|
+
// set up the abort controller
|
|
124
|
+
this.controller = new AbortController();
|
|
125
|
+
const signal = this.controller.signal;
|
|
146
126
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return found
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
retrieveFlatmapKnowledgeForEvent = async function(eventData){
|
|
167
|
-
// check if there is an existing query
|
|
168
|
-
if (this.controller) this.controller.abort();
|
|
169
|
-
|
|
170
|
-
// set up the abort controller
|
|
171
|
-
this.controller = new AbortController();
|
|
172
|
-
const signal = this.controller.signal;
|
|
173
|
-
|
|
174
|
-
const keastIds = eventData.resource
|
|
175
|
-
this.destinations = []
|
|
176
|
-
this.origins = []
|
|
177
|
-
this.components = []
|
|
178
|
-
if (!keastIds || keastIds.length == 0) return
|
|
179
|
-
const data = { sql: this.buildConnectivitySqlStatement(keastIds)};
|
|
180
|
-
let prom1 = new Promise(resolve=>{
|
|
181
|
-
fetch(`${this.flatmapApi}knowledge/query/`, {
|
|
182
|
-
method: 'POST',
|
|
183
|
-
headers: {
|
|
184
|
-
'Content-Type': 'application/json',
|
|
185
|
-
},
|
|
186
|
-
body: JSON.stringify(data),
|
|
187
|
-
signal: signal
|
|
188
|
-
})
|
|
127
|
+
const keastIds = eventData.resource
|
|
128
|
+
this.destinations = []
|
|
129
|
+
this.origins = []
|
|
130
|
+
this.components = []
|
|
131
|
+
if (!keastIds || keastIds.length == 0) return
|
|
132
|
+
const data = { sql: buildConnectivitySqlStatement(keastIds) };
|
|
133
|
+
let prom1 = new Promise(resolve => {
|
|
134
|
+
fetch(`${this.flatmapApi}knowledge/query/`, {
|
|
135
|
+
method: 'POST',
|
|
136
|
+
headers: {
|
|
137
|
+
'Content-Type': 'application/json',
|
|
138
|
+
},
|
|
139
|
+
body: JSON.stringify(data),
|
|
140
|
+
signal: signal
|
|
141
|
+
})
|
|
189
142
|
.then(response => response.json())
|
|
190
143
|
.then(data => {
|
|
191
|
-
if(
|
|
144
|
+
if (connectivityExists(data)) {
|
|
192
145
|
let connectivity = JSON.parse(data.values[0][0])
|
|
193
|
-
|
|
146
|
+
processConnectivity(connectivity).then(() => {
|
|
194
147
|
resolve(true)
|
|
195
148
|
})
|
|
196
149
|
} else {
|
|
@@ -202,13 +155,13 @@ export class FlatmapQueries {
|
|
|
202
155
|
console.error('Error:', error);
|
|
203
156
|
resolve(false)
|
|
204
157
|
})
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
158
|
+
})
|
|
159
|
+
let prom2 = pubmedQueryOnIds(eventData)
|
|
160
|
+
return await Promise.all([prom1, prom2])
|
|
161
|
+
|
|
209
162
|
}
|
|
210
163
|
|
|
211
|
-
connectivityExists =
|
|
164
|
+
const connectivityExists = (data) => {
|
|
212
165
|
if (data.values && data.values.length > 0 && JSON.parse(data.values[0][0]).connectivity && JSON.parse(data.values[0][0]).connectivity.length > 0) {
|
|
213
166
|
return true
|
|
214
167
|
} else {
|
|
@@ -216,12 +169,12 @@ export class FlatmapQueries {
|
|
|
216
169
|
}
|
|
217
170
|
}
|
|
218
171
|
|
|
219
|
-
createLabelFromNeuralNode =
|
|
172
|
+
const createLabelFromNeuralNode = (node, lookUp) => {
|
|
220
173
|
let label = lookUp[node[0]]
|
|
221
|
-
if (node.length === 2 && node[1].length > 0){
|
|
222
|
-
node[1].forEach(n=>{
|
|
223
|
-
if (lookUp[n] == undefined){
|
|
224
|
-
label += `, ${n}`
|
|
174
|
+
if (node.length === 2 && node[1].length > 0) {
|
|
175
|
+
node[1].forEach(n => {
|
|
176
|
+
if (lookUp[n] == undefined) {
|
|
177
|
+
label += `, ${n}`
|
|
225
178
|
} else {
|
|
226
179
|
label += `, ${lookUp[n]}`
|
|
227
180
|
}
|
|
@@ -230,12 +183,12 @@ export class FlatmapQueries {
|
|
|
230
183
|
return label
|
|
231
184
|
}
|
|
232
185
|
|
|
233
|
-
flattenAndFindDatasets(components, axons, dendrites){
|
|
234
|
-
|
|
186
|
+
const flattenAndFindDatasets = (components, axons, dendrites) => {
|
|
187
|
+
|
|
235
188
|
// process the nodes for finding datasets (Note this is not critical to the tooltip, only for the 'search on components' button)
|
|
236
|
-
let componentsFlat =
|
|
237
|
-
let axonsFlat =
|
|
238
|
-
let dendritesFlat =
|
|
189
|
+
let componentsFlat = flattenConntectivity(components)
|
|
190
|
+
let axonsFlat = flattenConntectivity(axons)
|
|
191
|
+
let dendritesFlat = flattenConntectivity(dendrites)
|
|
239
192
|
|
|
240
193
|
// Filter for the anatomy which is annotated on datasets
|
|
241
194
|
this.destinationsWithDatasets = this.uberons.filter(ub => axonsFlat.indexOf(ub.id) !== -1)
|
|
@@ -243,36 +196,36 @@ export class FlatmapQueries {
|
|
|
243
196
|
this.componentsWithDatasets = this.uberons.filter(ub => componentsFlat.indexOf(ub.id) !== -1)
|
|
244
197
|
}
|
|
245
198
|
|
|
246
|
-
processConnectivity(connectivity){
|
|
247
|
-
return new Promise
|
|
199
|
+
const processConnectivity = (connectivity) => {
|
|
200
|
+
return new Promise(resolve => {
|
|
248
201
|
|
|
249
202
|
// Filter the origin and destinations from components
|
|
250
|
-
let components =
|
|
203
|
+
let components = findComponents(connectivity)
|
|
251
204
|
|
|
252
205
|
// Remove duplicates
|
|
253
206
|
let axons = removeDuplicates(connectivity.axons)
|
|
254
207
|
let dendrites = removeDuplicates(connectivity.dendrites)
|
|
255
208
|
|
|
256
209
|
// Create list of ids to get labels for
|
|
257
|
-
let conIds =
|
|
210
|
+
let conIds = findAllIdsFromConnectivity(connectivity)
|
|
258
211
|
|
|
259
212
|
// Create readable labels from the nodes. Setting this to 'this.origins' updates the display
|
|
260
|
-
|
|
261
|
-
this.destinations = axons.map(a=>
|
|
262
|
-
this.origins = dendrites.map(d=>
|
|
263
|
-
this.components = components.map(c=>
|
|
264
|
-
|
|
213
|
+
createLabelLookup(conIds).then(lookUp => {
|
|
214
|
+
this.destinations = axons.map(a => createLabelFromNeuralNode(a, lookUp))
|
|
215
|
+
this.origins = dendrites.map(d => createLabelFromNeuralNode(d, lookUp))
|
|
216
|
+
this.components = components.map(c => createLabelFromNeuralNode(c, lookUp))
|
|
217
|
+
flattenAndFindDatasets(components, axons, dendrites)
|
|
265
218
|
resolve(true)
|
|
266
219
|
})
|
|
267
220
|
})
|
|
268
221
|
}
|
|
269
222
|
|
|
270
|
-
flattenConntectivity(connectivity){
|
|
223
|
+
const flattenConntectivity = (connectivity) => {
|
|
271
224
|
let dnodes = connectivity.flat() // get nodes from edgelist
|
|
272
225
|
let nodes = [...new Set(dnodes)] // remove duplicates
|
|
273
226
|
let found = []
|
|
274
|
-
nodes.forEach(n=>{
|
|
275
|
-
if (Array.isArray(n)){
|
|
227
|
+
nodes.forEach(n => {
|
|
228
|
+
if (Array.isArray(n)) {
|
|
276
229
|
found.push(n.flat())
|
|
277
230
|
} else {
|
|
278
231
|
found.push(n)
|
|
@@ -281,22 +234,22 @@ export class FlatmapQueries {
|
|
|
281
234
|
return found.flat()
|
|
282
235
|
}
|
|
283
236
|
|
|
284
|
-
findComponents =
|
|
237
|
+
const findComponents = (connectivity) => {
|
|
285
238
|
let dnodes = connectivity.connectivity.flat() // get nodes from edgelist
|
|
286
239
|
let nodes = removeDuplicates(dnodes)
|
|
287
240
|
|
|
288
241
|
let found = []
|
|
289
242
|
let terminal = false
|
|
290
|
-
nodes.forEach(node=>{
|
|
243
|
+
nodes.forEach(node => {
|
|
291
244
|
terminal = false
|
|
292
245
|
// Check if the node is an destination or origin (note that they are labelled dendrite and axon as opposed to origin and destination)
|
|
293
|
-
if(inArray(connectivity.axons,node)){
|
|
246
|
+
if (inArray(connectivity.axons, node)) {
|
|
294
247
|
terminal = true
|
|
295
248
|
}
|
|
296
|
-
if(inArray(connectivity.dendrites, node)){
|
|
249
|
+
if (inArray(connectivity.dendrites, node)) {
|
|
297
250
|
terminal = true
|
|
298
251
|
}
|
|
299
|
-
if (!terminal){
|
|
252
|
+
if (!terminal) {
|
|
300
253
|
found.push(node)
|
|
301
254
|
}
|
|
302
255
|
})
|
|
@@ -304,11 +257,11 @@ export class FlatmapQueries {
|
|
|
304
257
|
return found
|
|
305
258
|
}
|
|
306
259
|
|
|
307
|
-
stripPMIDPrefix =
|
|
260
|
+
const stripPMIDPrefix = (pubmedId) => {
|
|
308
261
|
return pubmedId.split(':')[1]
|
|
309
262
|
}
|
|
310
263
|
|
|
311
|
-
buildPubmedSqlStatement =
|
|
264
|
+
const buildPubmedSqlStatement = (keastIds) => {
|
|
312
265
|
let sql = 'select distinct publication from publications where entity in ('
|
|
313
266
|
if (keastIds.length === 1) {
|
|
314
267
|
sql += `'${keastIds[0]}')`
|
|
@@ -320,12 +273,12 @@ export class FlatmapQueries {
|
|
|
320
273
|
return sql
|
|
321
274
|
}
|
|
322
275
|
|
|
323
|
-
buildPubmedSqlStatementForModels =
|
|
276
|
+
const buildPubmedSqlStatementForModels = (model) => {
|
|
324
277
|
return `select distinct publication from publications where entity = '${model}'`
|
|
325
278
|
}
|
|
326
279
|
|
|
327
|
-
flatmapQuery =
|
|
328
|
-
const data = { sql: sql}
|
|
280
|
+
const flatmapQuery = (sql) => {
|
|
281
|
+
const data = { sql: sql }
|
|
329
282
|
return fetch(`${this.flatmapApi}knowledge/query/`, {
|
|
330
283
|
method: 'POST',
|
|
331
284
|
headers: {
|
|
@@ -333,49 +286,43 @@ export class FlatmapQueries {
|
|
|
333
286
|
},
|
|
334
287
|
body: JSON.stringify(data),
|
|
335
288
|
})
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
289
|
+
.then(response => response.json())
|
|
290
|
+
.catch((error) => {
|
|
291
|
+
console.error('Error:', error)
|
|
292
|
+
})
|
|
340
293
|
}
|
|
341
294
|
|
|
342
|
-
pubmedQueryOnIds =
|
|
295
|
+
const pubmedQueryOnIds = (eventData) => {
|
|
343
296
|
const keastIds = eventData.resource
|
|
344
297
|
const source = eventData.feature.source
|
|
345
|
-
if(!keastIds || keastIds.length === 0) return
|
|
346
|
-
const sql =
|
|
347
|
-
return
|
|
298
|
+
if (!keastIds || keastIds.length === 0) return
|
|
299
|
+
const sql = buildPubmedSqlStatement(keastIds)
|
|
300
|
+
return flatmapQuery(sql).then(data => {
|
|
348
301
|
// Create pubmed url on paths if we have them
|
|
349
|
-
if (data.values.length > 0){
|
|
350
|
-
this.urls = [
|
|
302
|
+
if (data.values.length > 0) {
|
|
303
|
+
this.urls = [pubmedSearchUrl(data.values.map(id => stripPMIDPrefix(id[0])))]
|
|
351
304
|
return true
|
|
352
305
|
} else { // Create pubmed url on models
|
|
353
|
-
|
|
306
|
+
pubmedQueryOnModels(source).then(() => { return true })
|
|
354
307
|
}
|
|
355
308
|
})
|
|
356
309
|
}
|
|
357
310
|
|
|
358
|
-
pubmedQueryOnModels =
|
|
359
|
-
return
|
|
360
|
-
if (Array.isArray(data.values) && data.values.length > 0){
|
|
361
|
-
this.urls = [
|
|
311
|
+
const pubmedQueryOnModels = (source) => {
|
|
312
|
+
return flatmapQuery(buildPubmedSqlStatementForModels(source)).then(data => {
|
|
313
|
+
if (Array.isArray(data.values) && data.values.length > 0) {
|
|
314
|
+
this.urls = [pubmedSearchUrl(data.values.map(id => stripPMIDPrefix(id[0])))]
|
|
362
315
|
} else {
|
|
363
316
|
this.urls = [] // Clears the pubmed search button
|
|
364
|
-
}
|
|
317
|
+
}
|
|
365
318
|
return
|
|
366
319
|
})
|
|
367
320
|
}
|
|
368
321
|
|
|
369
|
-
pubmedSearchUrl =
|
|
322
|
+
const pubmedSearchUrl = (ids) => {
|
|
370
323
|
let url = 'https://pubmed.ncbi.nlm.nih.gov/?'
|
|
371
324
|
let params = new URLSearchParams()
|
|
372
325
|
params.append('term', ids)
|
|
373
326
|
return url + params.toString()
|
|
374
327
|
}
|
|
375
328
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
export default FlatmapQueries
|