Skip to content

Commit

Permalink
Merge branch 'main' into fix-drug-chemical
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinxin90 authored Mar 23, 2021
2 parents febae20 + e3929aa commit d258b0d
Show file tree
Hide file tree
Showing 17 changed files with 870 additions and 257 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.0.0](https://github.com/kevinxin90/bte_trapi_query_graph_handler/compare/v0.7.0...v1.0.0) (2021-03-23)

### Features

* :sparkles: support query graph with explain type of query ([2d767fd](https://github.com/kevinxin90/bte_trapi_query_graph_handler/commit/2d767fd67d04c8956e3d55c2438def12b79ec104))

## [0.8.0](https://github.com/kevinxin90/bte_trapi_query_graph_handler/compare/v0.7.0...v0.8.0) (2021-03-23)


Expand Down
24 changes: 13 additions & 11 deletions __test__/integration/BatchEdgeQueryHandler.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const QNode = require("../../src/query_node");
const QEdge = require("../../src/query_edge");
const QExeEdge = require("../../src/query_execution_edge")
const BatchEdgeQueryHandler = require("../../src/batch_edge_query");
const meta_kg = require("@biothings-explorer/smartapi-kg");

Expand All @@ -8,17 +9,18 @@ describe("Testing BatchEdgeQueryHandler Module", () => {
kg.constructMetaKGSync();

describe("Testing query function", () => {
test("test with one query edge", async () => {
let gene_node1 = new QNode("n1", { category: "Gene", id: "NCBIGENE:1017" });
let chemical_node1 = new QNode("n3", { category: "ChemicalSubstance" });
const edge1 = new QEdge("e01", { subject: gene_node1, object: chemical_node1 });
const batchHandler = new BatchEdgeQueryHandler(kg);
batchHandler.setEdges([edge1]);
expect(chemical_node1.hasEquivalentIDs()).toEqual(false);
const res = await batchHandler.query([edge1]);
expect(res.length).toBeGreaterThan(1);
expect(chemical_node1.hasEquivalentIDs()).toEqual(true);
})
// test("test with one query edge", async () => {
// let gene_node1 = new QNode("n1", { category: "Gene", id: "NCBIGENE:1017" });
// let chemical_node1 = new QNode("n3", { category: "ChemicalSubstance" });
// const edge1 = new QEdge("e01", { subject: gene_node1, object: chemical_node1 });
// const exeEdge1 = new QExeEdge(edge1, false, undefined);
// const batchHandler = new BatchEdgeQueryHandler(kg);
// batchHandler.setEdges([edge1]);
// expect(chemical_node1.hasEquivalentIDs()).toEqual(false);
// const res = await batchHandler.query([edge1]);
// expect(res.length).toBeGreaterThan(1);
// expect(chemical_node1.hasEquivalentIDs()).toEqual(true);
// })

test("test subscribe and unsubscribe function", () => {
const batchHandler = new BatchEdgeQueryHandler(kg);
Expand Down
118 changes: 0 additions & 118 deletions __test__/integration/NodeUpdateHandler.test.js

This file was deleted.

33 changes: 0 additions & 33 deletions __test__/integration/QEdge2BTEEdgeHandler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,37 +82,4 @@ describe("Testing NodeUpdateHandler Module", () => {
})
})

describe("Testing setEquivalentIDs function", () => {
test("test edge with one curie input should be annotated", async () => {
const node = new QNode("n1", { category: "Gene", id: "NCBIGene:1017" });
const edge = new QEdge("e01", { subject: node, object: chemical_node1 });
const nodeUpdater = new NodeUpdateHandler([edge]);
expect(node.hasEquivalentIDs()).toBeFalsy();
const res = await nodeUpdater.setEquivalentIDs([edge]);
expect(node.hasEquivalentIDs()).toBeTruthy();
})

test("test edge with multiple curie input should be annotated", async () => {
const node = new QNode("n1", { category: "Gene", id: ["NCBIGene:1017", "NCBIGene:1018"] });
const edge = new QEdge("e01", { subject: node, object: chemical_node1 });
const nodeUpdater = new NodeUpdateHandler([edge]);
expect(node.hasEquivalentIDs()).toBeFalsy();
const res = await nodeUpdater.setEquivalentIDs([edge]);
expect(node.hasEquivalentIDs()).toBeTruthy();
expect(node.getEquivalentIDs()).toHaveProperty("NCBIGene:1017");
expect(node.getEquivalentIDs()).toHaveProperty("NCBIGene:1018");
})

test("test edge with one curie input on object end return an array of one", async () => {
const node = new QNode("n1", { category: "Gene", id: "NCBIGene:1017" });
const edge = new QEdge("e01", { object: node, subject: chemical_node1 });
const nodeUpdater = new NodeUpdateHandler([edge]);
expect(node.hasEquivalentIDs()).toBeFalsy();
const res = await nodeUpdater.setEquivalentIDs([edge]);
expect(node.hasEquivalentIDs()).toBeTruthy();
expect(node.getEquivalentIDs()).toHaveProperty("NCBIGene:1017");
expect(chemical_node1.hasEquivalentIDs()).toBeFalsy();
})

})
})
Loading

0 comments on commit d258b0d

Please sign in to comment.