From 606e8b18d30b4e1038b96415f1559aa28bbf11ea Mon Sep 17 00:00:00 2001 From: tokebe <43009413+tokebe@users.noreply.github.com> Date: Fri, 2 Dec 2022 13:31:52 -0500 Subject: [PATCH] fix: simpler method using equivalentIDs semanticType --- src/query_node.js | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/query_node.js b/src/query_node.js index c0c7ec1d..c9fc3dff 100644 --- a/src/query_node.js +++ b/src/query_node.js @@ -194,20 +194,23 @@ module.exports = class QNode { }); return utils.getUnique(expanded_categories); } - let ancestors = new Set( - utils - .toArray(this.category) - .map((category) => utils.removeBioLinkPrefix(category)) - .reduce((arr, category) => [...arr, ...biolink.getAncestorClasses(category)], []) - .filter((category) => !utils.toArray(this.category).includes(`biolink:${category}`)), - ); - let categories = []; + // let ancestors = new Set( + // utils + // .toArray(this.category) + // .map((category) => utils.removeBioLinkPrefix(category)) + // .reduce((arr, category) => [...arr, ...biolink.getAncestorClasses(category)], []) + // .filter((category) => !utils.toArray(this.category).includes(`biolink:${category}`)), + // ); + let categories = utils.toArray(this.category).map((category) => utils.removeBioLinkPrefix(category)); Object.values(this.equivalentIDs).map((entities) => { entities.map((entity) => { - categories = [...categories, ...entity.semanticTypes.map((semantic) => utils.removeBioLinkPrefix(semantic))]; + categories = [...categories, entity.semanticType]; }); }); - return utils.getUnique(categories).filter(category => !ancestors.has(category)); + return utils.getUnique( + utils.getUnique(categories).reduce((arr, category) => [...arr, ...biolink.getDescendantClasses(category)], []), + ); + // .filter(category => !ancestors.has(category)); } getEntities() {