Skip to content

Commit

Permalink
Merge branch 'main' into pathfinder-templates
Browse files Browse the repository at this point in the history
  • Loading branch information
colleenXu committed Mar 22, 2024
2 parents 8deeada + 8dc7158 commit f52c0f8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion data/templates/Drug-treats-Disease/Chem-treats-DoP.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"eA": {
"subject": "creativeQuerySubject",
"object": "creativeQueryObject",
"predicates": ["biolink:treats"]
"predicates": ["biolink:treats_or_applied_or_studied_to_treat"]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"eA": {
"subject": "creativeQuerySubject",
"object": "nA",
"predicates": ["biolink:treats"]
"predicates": ["biolink:treats_or_applied_or_studied_to_treat"]
},
"eB": {
"subject": "creativeQueryObject",
Expand Down
24 changes: 16 additions & 8 deletions src/edge_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export default class QueryEdgeManager {
return keep;
}

collectRecords(): void {
collectRecords(): boolean {
//go through edges and collect records organized by edge
let recordsByQEdgeID: RecordsByQEdgeID = {};
//all res merged
Expand Down Expand Up @@ -268,12 +268,10 @@ export default class QueryEdgeManager {
new LogEntry(
'WARNING',
null,
`qEdges ${JSON.stringify(brokenEdges)} ` + `resulted in (0) records. No complete paths can be formed.`,
`qEdges ${brokenEdges} resulted in (0) records. No complete paths can be formed.`,
).getLog(),
);
debug(
`(12) qEdges ${JSON.stringify(brokenEdges)} ` + `resulted in (0) records. No complete paths can be formed.`,
);
debug(`(12) qEdges ${brokenEdges} resulted in (0) records. No complete paths can be formed.`);
}
//Organized by edge: update query records
this._organizedRecords = recordsByQEdgeID;
Expand All @@ -289,8 +287,12 @@ export default class QueryEdgeManager {
// console.log(err);
// }
// });
debug(`(12) Collected (${this._records.length}) records!`);
this.logs.push(new LogEntry('DEBUG', null, `Edge manager collected (${this._records.length}) records!`).getLog());
if (!brokenChain) {
debug(`(12) Collected (${this._records.length}) records!`);
this.logs.push(new LogEntry('DEBUG', null, `Edge manager collected (${this._records.length}) records!`).getLog());
}

return !brokenChain;
}

updateEdgeRecords(currentQEdge: QEdge): void {
Expand Down Expand Up @@ -474,7 +476,13 @@ export default class QueryEdgeManager {
}
this._logSkippedQueries(unavailableAPIs);
// collect and organize records
this.collectRecords();
if (!this.collectRecords()) {
debug(`(X) Terminating...No complete paths.`);
this.logs.push(
new LogEntry('WARNING', null, `No complete paths could be formed. Your query terminates.`).getLog(),
);
return;
}
// dump records if set to do so
if (process.env.DUMP_RECORDS) {
await this.dumpRecords(this.getRecords());
Expand Down

0 comments on commit f52c0f8

Please sign in to comment.