Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tokebe committed Mar 7, 2024
2 parents 59f7c48 + 559de80 commit 4417bc1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/cache_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,9 @@ export default class CacheHandler {
resolve();
});
});
await redisClient.client.expireTimeout(redisID, process.env.REDIS_KEY_EXPIRE_TIME || 1800);
if (process.env.QEDGE_CACHE_TIME_S !== "0") {
await redisClient.client.expireTimeout(redisID, process.env.QEDGE_CACHE_TIME_S || 1800);
}
} catch (error) {
failedHashes.push(hash);
debug(
Expand Down
1 change: 0 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const EDGE_ATTRIBUTES_USED_IN_RECORD_HASH = [
//"NCIT:C61594",
// Multiomics BigGIM Drug-Response 2023-05-31: may later change?
'biolink:context_qualifier',
'biolink:primary_knowledge_source', // added 2024-01-17
// commenting it out since I haven't tested if it works for this KP or
// if it'll cause bugs when processing other KPs.
// It is only needed to differentiate records from some operations
Expand Down
26 changes: 19 additions & 7 deletions src/query_node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,31 @@ export default class QNode {
return [...combined];
}


intersectWithExpandedCuries(newCuries: ExpandedCuries): void {
const keep: { [mainID: string]: string[] } = {};

const existingSet = new Set();
for (const key in this.expanded_curie) {
for (const curie of this.expanded_curie[key]) {
existingSet.add(curie.toLowerCase());
}
}

// If a new entity has any alias intersection with an existing entity, keep it
Object.entries(newCuries).forEach(([newMainID, currentAliases]) => {
const someIntersection = Object.values(this.expanded_curie).some((existingAliases) => {
return currentAliases.some((currentAlias) =>
existingAliases.some((existingAlias) => currentAlias.toLowerCase() === existingAlias.toLowerCase()),
);
});
for (const [newMainID, currentAliases] of Object.entries(newCuries)) {
let someIntersection = false;
for (const curie of currentAliases) {
if (existingSet.has(curie.toLowerCase())) {
someIntersection = true;
break;
}
}

if (someIntersection) {
if (!keep[newMainID]) keep[newMainID] = currentAliases;
}
});
}

//save expanded curies (main + aliases)
this.expanded_curie = keep;
Expand Down

0 comments on commit 4417bc1

Please sign in to comment.