@abi-software/map-utilities 1.6.1-beta.2 → 1.6.1-beta.3

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-utilities",
3
- "version": "1.6.1-beta.2",
3
+ "version": "1.6.1-beta.3",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -186,6 +186,31 @@ function extractFeatureIds(inputArray) {
186
186
  return result;
187
187
  }
188
188
 
189
+ // Neuron populations as forward or backward connections of a neuron population
190
+ async function queryForwardBackwardConnections(flatmapAPI, knowledgeSource, pathIds) {
191
+ const data = await competencyQuery({
192
+ flatmapAPI,
193
+ knowledgeSource,
194
+ queryId: 26,
195
+ parameters: [
196
+ {
197
+ column: 'path_id',
198
+ value: pathIds
199
+ },
200
+ ]
201
+ });
202
+ if (data?.results?.values) {
203
+ const paths = data.results.values.map((value) => {
204
+ // value => ["source_id", "base_path_id", "dest_path_id", "distance"]
205
+ // return dest_path_id
206
+ return value[2];
207
+ });
208
+ // remove duplicates
209
+ return [...new Set(paths)];
210
+ }
211
+ return [];
212
+ }
213
+
189
214
  // Neuron populations from origin to destination, via
190
215
  // Query 24: Neuron populations that have source, via, and destination nodes
191
216
  // Query 25: Neuron populations that have source, via, and destination locations
@@ -269,7 +294,11 @@ async function queryPathsByRoute({ flatmapAPI, knowledgeSource, origins, destina
269
294
  const paths = data?.results?.values?.map(value => value[1]) || [];
270
295
  const combined = [...new Set([...pathsF, ...paths])];
271
296
 
272
- return combined;
297
+ // Continue to forward and backward connections
298
+ const additionalPaths = await queryForwardBackwardConnections(flatmapAPI, knowledgeSource, combined);
299
+ const total = [...new Set([...combined, ...additionalPaths])];
300
+
301
+ return total;
273
302
  }
274
303
 
275
304
  export {
@@ -279,4 +308,5 @@ export {
279
308
  queryPathsByViaLocation,
280
309
  queryPathsByDestination,
281
310
  queryPathsByRoute,
311
+ queryForwardBackwardConnections,
282
312
  };
@@ -15,6 +15,7 @@ import {
15
15
  queryPathsByViaLocation,
16
16
  queryPathsByDestination,
17
17
  queryPathsByRoute,
18
+ queryForwardBackwardConnections,
18
19
  } from "./CompetencyQueries/CompetencyQueries.js";
19
20
  import {
20
21
  filterOrigins,
@@ -47,6 +48,7 @@ export {
47
48
  queryPathsByViaLocation,
48
49
  queryPathsByDestination,
49
50
  queryPathsByRoute,
51
+ queryForwardBackwardConnections,
50
52
  filterOrigins,
51
53
  filterDestinations,
52
54
  filterViaLocations,