@abi-software/map-utilities 1.4.1-beta.0 → 1.4.2-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/map-utilities.js +2617 -2607
- package/dist/map-utilities.umd.cjs +55 -55
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/ConnectivityGraph/graph.js +59 -13
- package/src/components/Tooltip/AnnotationPopup.vue +8 -21
package/package.json
CHANGED
|
@@ -25,6 +25,43 @@ import cytoscape from 'cytoscape'
|
|
|
25
25
|
|
|
26
26
|
//==============================================================================
|
|
27
27
|
|
|
28
|
+
const inArray = function (ar1, ar2) {
|
|
29
|
+
if (!ar1 || !ar2) return false
|
|
30
|
+
let as1 = JSON.stringify(ar1)
|
|
31
|
+
let as2 = JSON.stringify(ar2)
|
|
32
|
+
return as1.indexOf(as2) !== -1
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const removeDuplicates = function (arrayOfAnything) {
|
|
36
|
+
if (!arrayOfAnything) return []
|
|
37
|
+
return [...new Set(arrayOfAnything.map((e) => JSON.stringify(e)))].map((e) =>
|
|
38
|
+
JSON.parse(e)
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const findComponents = function (knowledge, axons, dendrites) {
|
|
43
|
+
let dnodes = knowledge.connectivity.flat() // get nodes from edgelist
|
|
44
|
+
let nodes = removeDuplicates(dnodes)
|
|
45
|
+
|
|
46
|
+
let found = []
|
|
47
|
+
let terminal = false
|
|
48
|
+
nodes.forEach((node) => {
|
|
49
|
+
terminal = false
|
|
50
|
+
// Check if the node is an destination or origin (note that they are labelled dendrite and axon as opposed to origin and destination)
|
|
51
|
+
if (inArray(axons, node)) {
|
|
52
|
+
terminal = true
|
|
53
|
+
}
|
|
54
|
+
if (inArray(dendrites, node)) {
|
|
55
|
+
terminal = true
|
|
56
|
+
}
|
|
57
|
+
if (!terminal) {
|
|
58
|
+
found.push(node)
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
return found
|
|
63
|
+
}
|
|
64
|
+
|
|
28
65
|
export class ConnectivityGraph extends EventTarget
|
|
29
66
|
{
|
|
30
67
|
cyg = null
|
|
@@ -46,10 +83,23 @@ export class ConnectivityGraph extends EventTarget
|
|
|
46
83
|
async addConnectivity(knowledge)
|
|
47
84
|
//=====================================================
|
|
48
85
|
{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
86
|
+
const sourceKey = ["ilxtr:hasSomaLocatedIn"]
|
|
87
|
+
const destinationKey = ["ilxtr:hasAxonPresynapticElementIn", "ilxtr:hasAxonSensorySubcellularElementIn"]
|
|
88
|
+
|
|
89
|
+
const source = []
|
|
90
|
+
const destination = []
|
|
91
|
+
sourceKey.forEach((key)=>{
|
|
92
|
+
source.push(...knowledge["node-phenotypes"][key])
|
|
93
|
+
})
|
|
94
|
+
destinationKey.forEach((key)=>{
|
|
95
|
+
destination.push(...knowledge["node-phenotypes"][key])
|
|
96
|
+
})
|
|
97
|
+
const via = findComponents(knowledge, source, destination)
|
|
98
|
+
|
|
99
|
+
this.dendrites = source.map(node => JSON.stringify(node))
|
|
100
|
+
this.axons = destination.map(node => JSON.stringify(node))
|
|
101
|
+
if (via?.length) {
|
|
102
|
+
this.somas = via.map(node => JSON.stringify(node))
|
|
53
103
|
}
|
|
54
104
|
if (knowledge.connectivity.length) {
|
|
55
105
|
for (const edge of knowledge.connectivity) {
|
|
@@ -160,7 +210,6 @@ export class ConnectivityGraph extends EventTarget
|
|
|
160
210
|
{
|
|
161
211
|
return [
|
|
162
212
|
...this.dendrites,
|
|
163
|
-
...this.somas
|
|
164
213
|
]
|
|
165
214
|
}
|
|
166
215
|
|
|
@@ -181,14 +230,11 @@ export class ConnectivityGraph extends EventTarget
|
|
|
181
230
|
label: label.join('\n')
|
|
182
231
|
}
|
|
183
232
|
if (this.axons.includes(id)) {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
} else {
|
|
187
|
-
result['axon'] = true
|
|
188
|
-
}
|
|
189
|
-
} else if (this.dendrites.includes(id) || this.somas.includes(id)) {
|
|
233
|
+
result['axon'] = true
|
|
234
|
+
} else if (this.dendrites.includes(id)) {
|
|
190
235
|
result['dendrite'] = true
|
|
191
|
-
|
|
236
|
+
} else {
|
|
237
|
+
result['somas'] = true
|
|
192
238
|
}
|
|
193
239
|
return result
|
|
194
240
|
}
|
|
@@ -241,7 +287,7 @@ const GRAPH_STYLE = [
|
|
|
241
287
|
}
|
|
242
288
|
},
|
|
243
289
|
{
|
|
244
|
-
'selector': 'node[
|
|
290
|
+
'selector': 'node[somas]',
|
|
245
291
|
'style': {
|
|
246
292
|
// 'background-color': 'gray',
|
|
247
293
|
'shape': 'round-rectangle',
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
<strong class="sub-title">Previous submissions:</strong>
|
|
42
42
|
</el-row>
|
|
43
43
|
<div class="entry" v-for="(sub, index) in prevSubs" :key="index">
|
|
44
|
-
<el-row class="dialog-text"
|
|
44
|
+
<el-row class="dialog-text">
|
|
45
45
|
<strong>{{ formatTime(sub.created) }}</strong>
|
|
46
46
|
{{ sub.creator.name }}
|
|
47
47
|
</el-row>
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
</div>
|
|
66
66
|
</template>
|
|
67
67
|
</template>
|
|
68
|
-
<template v-if="authenticated
|
|
68
|
+
<template v-if="authenticated">
|
|
69
69
|
<template v-if="isEditable">
|
|
70
70
|
<el-row class="dialog-spacer"></el-row>
|
|
71
71
|
<el-row v-if="!editing">
|
|
@@ -217,9 +217,6 @@ export default {
|
|
|
217
217
|
updatedCopyContent: function () {
|
|
218
218
|
return this.getUpdateCopyContent();
|
|
219
219
|
},
|
|
220
|
-
offlineAnnotate: function () {
|
|
221
|
-
return this.annotationEntry["offline"];
|
|
222
|
-
},
|
|
223
220
|
},
|
|
224
221
|
methods: {
|
|
225
222
|
processEvidences: function(sub) {
|
|
@@ -265,15 +262,7 @@ export default {
|
|
|
265
262
|
return new Date(dateString).toLocaleDateString(undefined, options);
|
|
266
263
|
},
|
|
267
264
|
updatePrevSubmissions: function () {
|
|
268
|
-
if (this.
|
|
269
|
-
const offlineAnnotation = JSON.parse(sessionStorage.getItem('offline-annotation')) || [];
|
|
270
|
-
this.prevSubs = offlineAnnotation.filter((offline) => {
|
|
271
|
-
return (
|
|
272
|
-
offline.resource === this.annotationEntry.resourceId &&
|
|
273
|
-
offline.item.id === this.annotationEntry.featureId
|
|
274
|
-
)
|
|
275
|
-
});
|
|
276
|
-
} else if (this.$annotator && this.authenticated) {
|
|
265
|
+
if (this.$annotator && this.authenticated) {
|
|
277
266
|
if (
|
|
278
267
|
this.annotationEntry["resourceId"] &&
|
|
279
268
|
this.annotationEntry["featureId"]
|
|
@@ -353,6 +342,7 @@ export default {
|
|
|
353
342
|
this.$annotator
|
|
354
343
|
?.addAnnotation(this.userApiKey, userAnnotation)
|
|
355
344
|
.then(() => {
|
|
345
|
+
this.$emit("annotation", userAnnotation);
|
|
356
346
|
this.errorMessage = "";
|
|
357
347
|
this.resetSubmission();
|
|
358
348
|
this.updatePrevSubmissions();
|
|
@@ -361,7 +351,6 @@ export default {
|
|
|
361
351
|
this.errorMessage =
|
|
362
352
|
"There is a problem with the submission, please try again later";
|
|
363
353
|
});
|
|
364
|
-
this.$emit("annotation", userAnnotation);
|
|
365
354
|
}
|
|
366
355
|
}
|
|
367
356
|
},
|
|
@@ -407,11 +396,9 @@ export default {
|
|
|
407
396
|
if (this.prevSubs.length) {
|
|
408
397
|
let annotationContent = '<div><strong>Annotations:</strong></div>\n<br>';
|
|
409
398
|
this.prevSubs.map((sub, index) => {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
annotationContent += `<div><strong>Email:</strong>${sub.creator.email}</div>\n<br>`;
|
|
414
|
-
}
|
|
399
|
+
annotationContent += `<div><strong>Created:</strong>${this.formatTime(sub.created)}</div>\n<br>`;
|
|
400
|
+
annotationContent += `<div><strong>Creator:</strong>${sub.creator.name}</div>\n<br>`;
|
|
401
|
+
annotationContent += `<div><strong>Email:</strong>${sub.creator.email}</div>\n<br>`;
|
|
415
402
|
if (sub.body.evidence.length) {
|
|
416
403
|
let evidenceContent = '';
|
|
417
404
|
sub.body.evidence.forEach((evi, index) => {
|
|
@@ -446,10 +433,10 @@ export default {
|
|
|
446
433
|
this.creator = userData;
|
|
447
434
|
if (!userData.orcid) this.creator.orcid = "0000-0000-0000-0000";
|
|
448
435
|
this.authenticated = true;
|
|
436
|
+
this.updatePrevSubmissions();
|
|
449
437
|
} else {
|
|
450
438
|
this.errorMessage = "";
|
|
451
439
|
}
|
|
452
|
-
this.updatePrevSubmissions();
|
|
453
440
|
});
|
|
454
441
|
},
|
|
455
442
|
};
|