@abi-software/flatmapvuer 1.4.4 → 1.5.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.js +3910 -3856
- package/dist/flatmapvuer.umd.cjs +2 -2
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/FlatmapVuer.vue +6 -6
- package/src/services/flatmapQueries.js +133 -14
package/package.json
CHANGED
|
@@ -2246,12 +2246,12 @@ export default {
|
|
|
2246
2246
|
identifier = { uuid: state.uuid }
|
|
2247
2247
|
} else if (state.entry) {
|
|
2248
2248
|
identifier.taxon = state.entry
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2249
|
+
}
|
|
2250
|
+
if (state.biologicalSex) {
|
|
2251
|
+
identifier['biologicalSex'] = state.biologicalSex;
|
|
2252
|
+
} else if (identifier.taxon === 'NCBITaxon:9606') {
|
|
2253
|
+
//For backward compatibility
|
|
2254
|
+
identifier['biologicalSex'] = 'PATO:0000384';
|
|
2255
2255
|
}
|
|
2256
2256
|
} else {
|
|
2257
2257
|
// Set the bioloicalSex now if map is not resumed from
|
|
@@ -393,6 +393,122 @@ let FlatmapQueries = function () {
|
|
|
393
393
|
this.stripPMIDPrefix = function (pubmedId) {
|
|
394
394
|
return pubmedId.split(':')[1]
|
|
395
395
|
}
|
|
396
|
+
|
|
397
|
+
this.getPMID = function(idsList) {
|
|
398
|
+
return new Promise((resolve) => {
|
|
399
|
+
if (idsList.length > 0) {
|
|
400
|
+
//Muliple term search does not work well,
|
|
401
|
+
//DOIs term get splitted unexpectedly
|
|
402
|
+
//
|
|
403
|
+
const promises = []
|
|
404
|
+
const results = []
|
|
405
|
+
idsList.forEach((id) => {
|
|
406
|
+
const wrapped = '"' + id + '"'
|
|
407
|
+
const params = new URLSearchParams({
|
|
408
|
+
db: 'pubmed',
|
|
409
|
+
term: wrapped,
|
|
410
|
+
format: 'json'
|
|
411
|
+
})
|
|
412
|
+
const promise = fetch(`https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?${params}`, {
|
|
413
|
+
method: 'GET',
|
|
414
|
+
})
|
|
415
|
+
.then((response) => response.json())
|
|
416
|
+
.then((data) => {
|
|
417
|
+
const newIds = data.esearchresult ? data.esearchresult.idlist : []
|
|
418
|
+
results.push(...newIds)
|
|
419
|
+
})
|
|
420
|
+
promises.push(promise)
|
|
421
|
+
})
|
|
422
|
+
|
|
423
|
+
Promise.all(promises).then(() => {
|
|
424
|
+
resolve(results)
|
|
425
|
+
}).catch(() => {
|
|
426
|
+
resolve(results)
|
|
427
|
+
})
|
|
428
|
+
} else {
|
|
429
|
+
resolve([])
|
|
430
|
+
}
|
|
431
|
+
})
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
this.convertPublicationIds = function (ids) {
|
|
435
|
+
return new Promise((resolve) => {
|
|
436
|
+
const pmids = []
|
|
437
|
+
const toBeConverted = []
|
|
438
|
+
ids.forEach((id) => {
|
|
439
|
+
if (id.type === "pmid") {
|
|
440
|
+
pmids.push(id.id)
|
|
441
|
+
} else if (id.type === "doi" || id.type === "pmc") {
|
|
442
|
+
toBeConverted.push(id.id)
|
|
443
|
+
}
|
|
444
|
+
})
|
|
445
|
+
this.getPMID(toBeConverted).then((idList) => {
|
|
446
|
+
pmids.push(...idList)
|
|
447
|
+
resolve(pmids)
|
|
448
|
+
})
|
|
449
|
+
.catch(() => {
|
|
450
|
+
resolve(pmids)
|
|
451
|
+
})
|
|
452
|
+
})
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
this.extractPublicationIdFromURLString = function (urlStr) {
|
|
456
|
+
if (!urlStr) return
|
|
457
|
+
|
|
458
|
+
const str = decodeURIComponent(urlStr)
|
|
459
|
+
|
|
460
|
+
let term = {id: '', type: ''}
|
|
461
|
+
|
|
462
|
+
const names = [
|
|
463
|
+
'doi.org/',
|
|
464
|
+
'nih.gov/pubmed/',
|
|
465
|
+
'pmc/articles/',
|
|
466
|
+
'pubmed.ncbi.nlm.nih.gov/',
|
|
467
|
+
]
|
|
468
|
+
|
|
469
|
+
names.forEach((name) => {
|
|
470
|
+
const lastIndex = str.lastIndexOf(name)
|
|
471
|
+
if (lastIndex !== -1) {
|
|
472
|
+
term.id = str.slice(lastIndex + name.length)
|
|
473
|
+
if (name === 'doi.org/') {
|
|
474
|
+
term.type = "doi"
|
|
475
|
+
} else if (name === 'pmc/articles/') {
|
|
476
|
+
term.type = "pmc"
|
|
477
|
+
} else {
|
|
478
|
+
term.type = "pmid"
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
})
|
|
482
|
+
|
|
483
|
+
//Backward compatability with doi: and PMID:
|
|
484
|
+
if (term.id === '') {
|
|
485
|
+
if (urlStr.includes("doi:")) {
|
|
486
|
+
term.id = this.stripPMIDPrefix(urlStr)
|
|
487
|
+
term.type = "doi"
|
|
488
|
+
} else if (urlStr.includes("PMID:")) {
|
|
489
|
+
term.id = this.stripPMIDPrefix(urlStr)
|
|
490
|
+
term.type = "pmid"
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
if (term.id.endsWith('/')) {
|
|
495
|
+
term.id = term.id.slice(0, -1)
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
return term
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
this.getURLsForPubMed = function (data) {
|
|
502
|
+
return new Promise((resolve) => {
|
|
503
|
+
const ids = data.values.map((id) => this.extractPublicationIdFromURLString(id[0]))
|
|
504
|
+
this.convertPublicationIds(ids).then((pmids) => {
|
|
505
|
+
if (pmids.length > 0) {
|
|
506
|
+
const transformedIDs = pmids.join()
|
|
507
|
+
resolve([this.pubmedSearchUrl(transformedIDs)])
|
|
508
|
+
}
|
|
509
|
+
})
|
|
510
|
+
})
|
|
511
|
+
}
|
|
396
512
|
|
|
397
513
|
this.buildPubmedSqlStatement = function (keastIds) {
|
|
398
514
|
let sql = 'select distinct publication from publications where entity in ('
|
|
@@ -434,12 +550,14 @@ let FlatmapQueries = function () {
|
|
|
434
550
|
this.flatmapQuery(sql).then((data) => {
|
|
435
551
|
// Create pubmed url on paths if we have them
|
|
436
552
|
if (data.values.length > 0) {
|
|
437
|
-
|
|
438
|
-
this.
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
553
|
+
this.getURLsForPubMed(data).then((urls) => {
|
|
554
|
+
this.urls = urls
|
|
555
|
+
resolve(true)
|
|
556
|
+
})
|
|
557
|
+
.catch(() => {
|
|
558
|
+
this.urls = []
|
|
559
|
+
resolve(false)
|
|
560
|
+
})
|
|
443
561
|
} else {
|
|
444
562
|
// Create pubmed url on models
|
|
445
563
|
this.pubmedQueryOnModels(source).then((result) => {
|
|
@@ -455,12 +573,14 @@ let FlatmapQueries = function () {
|
|
|
455
573
|
this.buildPubmedSqlStatementForModels(source)
|
|
456
574
|
).then((data) => {
|
|
457
575
|
if (Array.isArray(data.values) && data.values.length > 0) {
|
|
458
|
-
this.urls
|
|
459
|
-
this.
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
576
|
+
this.getURLsForPubMed(data).then((urls) => {
|
|
577
|
+
this.urls = urls
|
|
578
|
+
return true
|
|
579
|
+
})
|
|
580
|
+
.catch(() => {
|
|
581
|
+
this.urls = []
|
|
582
|
+
return false
|
|
583
|
+
})
|
|
464
584
|
} else {
|
|
465
585
|
this.urls = [] // Clears the pubmed search button
|
|
466
586
|
}
|
|
@@ -471,8 +591,7 @@ let FlatmapQueries = function () {
|
|
|
471
591
|
this.pubmedSearchUrl = function (ids) {
|
|
472
592
|
let url = 'https://pubmed.ncbi.nlm.nih.gov/?'
|
|
473
593
|
let params = new URLSearchParams()
|
|
474
|
-
|
|
475
|
-
params.append('term', decodedIDs);
|
|
594
|
+
params.append('term', ids)
|
|
476
595
|
return url + params.toString()
|
|
477
596
|
}
|
|
478
597
|
}
|