@abi-software/map-utilities 1.4.2-beta.0 → 1.4.2
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 +2157 -2148
- package/dist/map-utilities.umd.cjs +21 -21
- package/package.json +1 -1
- package/src/components/ConnectivityGraph/graph.js +56 -25
package/package.json
CHANGED
|
@@ -72,6 +72,7 @@ export class ConnectivityGraph extends EventTarget
|
|
|
72
72
|
somas = []
|
|
73
73
|
labelCache = new Map()
|
|
74
74
|
graphCanvas = null
|
|
75
|
+
hasPhenotypes = false
|
|
75
76
|
|
|
76
77
|
constructor(labelCache, graphCanvas)
|
|
77
78
|
{
|
|
@@ -83,23 +84,32 @@ export class ConnectivityGraph extends EventTarget
|
|
|
83
84
|
async addConnectivity(knowledge)
|
|
84
85
|
//=====================================================
|
|
85
86
|
{
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
87
|
+
if (knowledge && knowledge["node-phenotypes"]) {
|
|
88
|
+
const sourceKey = ["ilxtr:hasSomaLocatedIn"]
|
|
89
|
+
const destinationKey = ["ilxtr:hasAxonPresynapticElementIn", "ilxtr:hasAxonSensorySubcellularElementIn"]
|
|
90
|
+
|
|
91
|
+
const source = []
|
|
92
|
+
const destination = []
|
|
93
|
+
sourceKey.forEach((key)=>{
|
|
94
|
+
source.push(...knowledge["node-phenotypes"][key])
|
|
95
|
+
})
|
|
96
|
+
destinationKey.forEach((key)=>{
|
|
97
|
+
destination.push(...knowledge["node-phenotypes"][key])
|
|
98
|
+
})
|
|
99
|
+
const via = findComponents(knowledge, source, destination)
|
|
100
|
+
this.dendrites = source.map(node => JSON.stringify(node))
|
|
101
|
+
this.axons = destination.map(node => JSON.stringify(node))
|
|
102
|
+
if (via?.length) {
|
|
103
|
+
this.somas = via.map(node => JSON.stringify(node))
|
|
104
|
+
}
|
|
105
|
+
this.hasPhenotypes = true
|
|
106
|
+
} else {
|
|
107
|
+
this.axons = knowledge.axons.map(node => JSON.stringify(node))
|
|
108
|
+
this.dendrites = knowledge.dendrites.map(node => JSON.stringify(node))
|
|
109
|
+
if (knowledge.somas?.length) {
|
|
110
|
+
this.somas = knowledge.somas.map(node => JSON.stringify(node))
|
|
111
|
+
}
|
|
112
|
+
this.hasPhenotypes = false
|
|
103
113
|
}
|
|
104
114
|
if (knowledge.connectivity.length) {
|
|
105
115
|
for (const edge of knowledge.connectivity) {
|
|
@@ -208,9 +218,17 @@ export class ConnectivityGraph extends EventTarget
|
|
|
208
218
|
get roots()
|
|
209
219
|
//===================
|
|
210
220
|
{
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
221
|
+
if (this.hasPhenotypes) {
|
|
222
|
+
return [
|
|
223
|
+
...this.dendrites,
|
|
224
|
+
]
|
|
225
|
+
} else {
|
|
226
|
+
return [
|
|
227
|
+
...this.dendrites,
|
|
228
|
+
...this.somas
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
|
|
214
232
|
}
|
|
215
233
|
|
|
216
234
|
async graphNode(node)
|
|
@@ -229,12 +247,25 @@ export class ConnectivityGraph extends EventTarget
|
|
|
229
247
|
id,
|
|
230
248
|
label: label.join('\n')
|
|
231
249
|
}
|
|
232
|
-
if (this.
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
250
|
+
if (this.hasPhenotypes) {
|
|
251
|
+
if (this.axons.includes(id)) {
|
|
252
|
+
result['axon'] = true
|
|
253
|
+
} else if (this.dendrites.includes(id)) {
|
|
254
|
+
result['dendrite'] = true
|
|
255
|
+
} else {
|
|
256
|
+
result['somas'] = true
|
|
257
|
+
}
|
|
236
258
|
} else {
|
|
237
|
-
|
|
259
|
+
if (this.axons.includes(id)) {
|
|
260
|
+
if (this.dendrites.includes(id) || this.somas.includes(id)) {
|
|
261
|
+
result['somas'] = true
|
|
262
|
+
} else {
|
|
263
|
+
result['axon'] = true
|
|
264
|
+
}
|
|
265
|
+
} else if (this.dendrites.includes(id) || this.somas.includes(id)) {
|
|
266
|
+
result['dendrite'] = true
|
|
267
|
+
|
|
268
|
+
}
|
|
238
269
|
}
|
|
239
270
|
return result
|
|
240
271
|
}
|