From f17021c023fe479713077934fcbe4279069a3a1a Mon Sep 17 00:00:00 2001 From: tokebe <43009413+tokebe@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:54:42 -0400 Subject: [PATCH] fix: aux graph attributes --- src/inferred_mode/pathfinder.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/inferred_mode/pathfinder.ts b/src/inferred_mode/pathfinder.ts index 0d57f204..f366d256 100644 --- a/src/inferred_mode/pathfinder.ts +++ b/src/inferred_mode/pathfinder.ts @@ -7,6 +7,7 @@ import { TrapiQNode, TrapiAnalysis, QueryHandlerOptions, + TrapiAuxGraphCollection, } from '@biothings-explorer/types'; import InferredQueryHandler from './inferred_mode'; import { scaled_sigmoid, inverse_scaled_sigmoid } from '../results_assembly/score'; @@ -260,14 +261,14 @@ export default class PathfinderQueryHandler { .slice(0, this.CREATIVE_LIMIT); creativeResponse.description = `Query processed successfully, retrieved ${creativeResponse.message.results.length} results.`; - const finalNewAuxGraphs: { [id: string]: { edges: string[] } } = {}; + const finalNewAuxGraphs: TrapiAuxGraphCollection = {}; for (const res in creativeResponse.message.results) { for (const eb of Object.values(creativeResponse.message.results[res].analyses[0].edge_bindings)) { for (const edge of eb) { const auxGraph = creativeResponse.message.knowledge_graph.edges[edge.id].attributes.find( (attr) => attr.attribute_type_id === 'biolink:support_graphs', )?.value[0]; - finalNewAuxGraphs[auxGraph] = { edges: [] }; + finalNewAuxGraphs[auxGraph] = { edges: [], attributes: [] }; for (const ed of newAuxGraphs[auxGraph].edges) { const [st, en] = ed.split('\n'); finalNewAuxGraphs[auxGraph].edges.push.apply(