@abi-software/flatmapvuer 0.5.2 → 0.5.4-fccb-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/CHANGELOG.md +16 -1
- package/dist/flatmapvuer.common.js +5619 -861
- package/dist/flatmapvuer.common.js.map +1 -1
- package/dist/flatmapvuer.css +1 -1
- package/dist/flatmapvuer.umd.js +5619 -861
- package/dist/flatmapvuer.umd.js.map +1 -1
- package/dist/flatmapvuer.umd.min.js +2 -2
- package/dist/flatmapvuer.umd.min.js.map +1 -1
- package/package-lock.json +9 -9
- package/package.json +2 -2
- package/src/App.vue +2 -0
- package/src/components/FlatmapVuer.vue +110 -22
- package/src/components/SelectionsGroup.vue +2 -1
- package/src/components/Tooltip.vue +21 -4
- package/src/components/TreeControls.vue +232 -0
- package/src/services/flatmapQueries.js +45 -21
|
@@ -4,6 +4,34 @@ const removeDuplicates = function(arrayOfAnything){
|
|
|
4
4
|
return [...new Set(arrayOfAnything.map(e => JSON.stringify(e)))].map(e => JSON.parse(e))
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
const cachedLabels = {};
|
|
8
|
+
|
|
9
|
+
const findTaxonomyLabel = async function(flatmapAPI, taxonomy){
|
|
10
|
+
if (cachedLabels && cachedLabels.hasOwnProperty(taxonomy)) {
|
|
11
|
+
return cachedLabels[taxonomy];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return new Promise(resolve=>{
|
|
15
|
+
fetch(`${flatmapAPI}knowledge/label/${taxonomy}`, {
|
|
16
|
+
method: 'GET',
|
|
17
|
+
})
|
|
18
|
+
.then(response => response.json())
|
|
19
|
+
.then(data => {
|
|
20
|
+
let label = data.label;
|
|
21
|
+
if (label === "Mammalia") {
|
|
22
|
+
label = "Mammalia not otherwise specified";
|
|
23
|
+
}
|
|
24
|
+
cachedLabels[taxonomy] = label;
|
|
25
|
+
resolve(label);
|
|
26
|
+
})
|
|
27
|
+
.catch((error) => {
|
|
28
|
+
console.error('Error:', error);
|
|
29
|
+
cachedLabels[taxonomy] = taxonomy;
|
|
30
|
+
resolve(taxonomy);
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
7
35
|
const inArray = function(ar1, ar2){
|
|
8
36
|
let as1 = JSON.stringify(ar1)
|
|
9
37
|
let as2 = JSON.stringify(ar2)
|
|
@@ -12,8 +40,7 @@ const inArray = function(ar1, ar2){
|
|
|
12
40
|
|
|
13
41
|
let FlatmapQueries = function(){
|
|
14
42
|
|
|
15
|
-
this.initialise = function(
|
|
16
|
-
this.sparcAPI = sparcAPI
|
|
43
|
+
this.initialise = function(flatmapApi){
|
|
17
44
|
this.flatmapApi = flatmapApi
|
|
18
45
|
this.destinations = []
|
|
19
46
|
this.origins = []
|
|
@@ -21,21 +48,25 @@ let FlatmapQueries = function(){
|
|
|
21
48
|
this.uberons = []
|
|
22
49
|
this.urls = []
|
|
23
50
|
this.controller = undefined
|
|
24
|
-
this.
|
|
25
|
-
|
|
26
|
-
this.createLabelLookup(uberons).then(lookUp=>{
|
|
27
|
-
this.lookUp = lookUp
|
|
28
|
-
})
|
|
29
|
-
})
|
|
51
|
+
this.uberons = []
|
|
52
|
+
this.lookUp = []
|
|
30
53
|
}
|
|
31
54
|
|
|
32
|
-
this.createTooltipData = function (eventData) {
|
|
55
|
+
this.createTooltipData = async function (eventData) {
|
|
33
56
|
let hyperlinks = []
|
|
34
57
|
if (eventData.feature.hyperlinks && eventData.feature.hyperlinks.length > 0) {
|
|
35
58
|
hyperlinks = eventData.feature.hyperlinks
|
|
36
59
|
} else {
|
|
37
60
|
hyperlinks = this.urls.map(url=>({url: url, id: "pubmed"}))
|
|
38
61
|
}
|
|
62
|
+
let taxonomyLabel = undefined;
|
|
63
|
+
if (eventData.provenanceTaxonomy) {
|
|
64
|
+
taxonomyLabel = [];
|
|
65
|
+
for (let i = 0; eventData.provenanceTaxonomy.length > i; i++) {
|
|
66
|
+
taxonomyLabel.push(await findTaxonomyLabel(this.flatmapAPI, eventData.provenanceTaxonomy[i]))
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
39
70
|
let tooltipData = {
|
|
40
71
|
destinations: this.destinations,
|
|
41
72
|
origins: this.origins,
|
|
@@ -46,20 +77,12 @@ let FlatmapQueries = function(){
|
|
|
46
77
|
title: eventData.label,
|
|
47
78
|
featureId: eventData.resource,
|
|
48
79
|
hyperlinks: hyperlinks,
|
|
80
|
+
provenanceTaxonomy: eventData.provenanceTaxonomy,
|
|
81
|
+
provenanceTaxonomyLabel: taxonomyLabel
|
|
49
82
|
}
|
|
50
83
|
return tooltipData
|
|
51
84
|
}
|
|
52
85
|
|
|
53
|
-
this.getOrganCuries = function(){
|
|
54
|
-
return new Promise(resolve=> {
|
|
55
|
-
fetch(`${this.sparcAPI}get-organ-curies/`)
|
|
56
|
-
.then(response=>response.json())
|
|
57
|
-
.then(data=>{
|
|
58
|
-
resolve(data.uberon.array)
|
|
59
|
-
})
|
|
60
|
-
})
|
|
61
|
-
}
|
|
62
|
-
|
|
63
86
|
this.createComponentsLabelList = function(components, lookUp){
|
|
64
87
|
let labelList = []
|
|
65
88
|
components.forEach(n=>{
|
|
@@ -131,7 +154,8 @@ let FlatmapQueries = function(){
|
|
|
131
154
|
found.push(n)
|
|
132
155
|
}
|
|
133
156
|
})
|
|
134
|
-
|
|
157
|
+
this.uberons = [... new Set(found.flat())]
|
|
158
|
+
return this.uberons
|
|
135
159
|
}
|
|
136
160
|
|
|
137
161
|
this.flattenConntectivity = function (connectivity) {
|
|
@@ -385,4 +409,4 @@ let FlatmapQueries = function(){
|
|
|
385
409
|
}
|
|
386
410
|
}
|
|
387
411
|
|
|
388
|
-
export {FlatmapQueries}
|
|
412
|
+
export {FlatmapQueries, findTaxonomyLabel}
|