@abi-software/map-utilities 1.7.5 → 1.7.7-demo.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/package.json
CHANGED
|
@@ -83,25 +83,59 @@ async function competencyQuery(options) {
|
|
|
83
83
|
// Neuron populations that share at least one edge with another neuron population [query id => 23]
|
|
84
84
|
async function queryAllConnectedPaths(flatmapAPI, knowledgeSource, featureId) {
|
|
85
85
|
const featureIds = Array.isArray(featureId) ? featureId : [featureId];
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
{
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
86
|
+
// Split into paths (ilxtr:) and features (non-ilxtr:)
|
|
87
|
+
const pathIds = featureIds.filter(id => id.startsWith('ilxtr:'));
|
|
88
|
+
const locationIds = featureIds.filter(id => !id.startsWith('ilxtr:'));
|
|
89
|
+
|
|
90
|
+
const promises = [];
|
|
91
|
+
|
|
92
|
+
// Query for path IDs (query 23)
|
|
93
|
+
if (pathIds.length > 0) {
|
|
94
|
+
promises.push(
|
|
95
|
+
competencyQuery({
|
|
96
|
+
flatmapAPI: flatmapAPI,
|
|
97
|
+
knowledgeSource: knowledgeSource,
|
|
98
|
+
queryId: 23,
|
|
99
|
+
parameters: [
|
|
100
|
+
{
|
|
101
|
+
column: 'path_id',
|
|
102
|
+
value: pathIds
|
|
103
|
+
},
|
|
104
|
+
]
|
|
105
|
+
})
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Query for feature/location IDs (query 1)
|
|
110
|
+
if (locationIds.length > 0) {
|
|
111
|
+
promises.push(
|
|
112
|
+
competencyQuery({
|
|
113
|
+
flatmapAPI: flatmapAPI,
|
|
114
|
+
knowledgeSource: knowledgeSource,
|
|
115
|
+
queryId: 1,
|
|
116
|
+
parameters: [
|
|
117
|
+
{
|
|
118
|
+
column: 'feature_id',
|
|
119
|
+
value: locationIds
|
|
120
|
+
},
|
|
121
|
+
]
|
|
122
|
+
})
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Execute queries in parallel
|
|
127
|
+
const results = await Promise.all(promises);
|
|
128
|
+
|
|
129
|
+
// Combine all paths from both queries
|
|
130
|
+
let allPaths = [...pathIds]; // Include original path IDs
|
|
131
|
+
|
|
132
|
+
results.forEach((data) => {
|
|
133
|
+
// value => [ 'source_id', 'path_id', 'axon_terminal']
|
|
134
|
+
const paths = data?.results?.values?.map(value => value[1]) || [];
|
|
135
|
+
allPaths.push(...paths);
|
|
100
136
|
});
|
|
101
137
|
|
|
102
|
-
|
|
103
|
-
const paths = data?.results?.values?.map(value => value[1]) || [];
|
|
104
|
-
const combined = [...new Set([...originalPaths, ...paths])];
|
|
138
|
+
const combined = [...new Set(allPaths)];
|
|
105
139
|
|
|
106
140
|
// Continue to forward and backward connections
|
|
107
141
|
let additionalPaths = [];
|
|
@@ -323,16 +323,22 @@ async function getFlatmapFilterOptions (flatmapAPI, mapImp, providedKnowledge, p
|
|
|
323
323
|
if (mapKnowledgeObj && mapKnowledgeObj.connectivity && mapKnowledgeObj['node-phenotypes']) {
|
|
324
324
|
const mapConnectivity = mapKnowledgeObj.connectivity;
|
|
325
325
|
const mapNodePhenotypes = mapKnowledgeObj['node-phenotypes'];
|
|
326
|
-
|
|
327
|
-
|
|
326
|
+
|
|
327
|
+
// Create a new object with only the necessary properties to avoid mutation
|
|
328
|
+
const filteredNodePhenotypes = {};
|
|
328
329
|
for (let key in knowledge['node-phenotypes']) {
|
|
329
330
|
if (mapNodePhenotypes[key]) {
|
|
330
331
|
// take only map node-phenotypes
|
|
331
|
-
|
|
332
|
+
filteredNodePhenotypes[key] = [...mapNodePhenotypes[key]];
|
|
332
333
|
}
|
|
333
334
|
}
|
|
334
|
-
|
|
335
|
-
|
|
335
|
+
|
|
336
|
+
// Build new object with filtered data instead of deep cloning
|
|
337
|
+
flatmapKnowledge.push({
|
|
338
|
+
...knowledge,
|
|
339
|
+
connectivity: [...mapConnectivity],
|
|
340
|
+
'node-phenotypes': filteredNodePhenotypes
|
|
341
|
+
});
|
|
336
342
|
}
|
|
337
343
|
}
|
|
338
344
|
}
|