Skip to content

Commit

Permalink
Merge pull request #1162 from PathwayCommons/v0.23.0
Browse files Browse the repository at this point in the history
V0.23.0
  • Loading branch information
jvwong authored Apr 3, 2023
2 parents 449ddda + 6c247f7 commit e10d418
Show file tree
Hide file tree
Showing 40 changed files with 285,572 additions and 234 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/**/*
build/*
build/*
src/server/routes/api/document/p-limit.js
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ Demo:

Sharing:

- `DOCUMENT_IMAGE_CACHE_SIZE` : number of images to cache in memory
- `DOCUMENT_IMAGE_PLL_LIMIT` : max number of images to be generated in parallel (expensive)
- `DOCUMENT_IMAGE_WIDTH` : tweet card image width
- `DOCUMENT_IMAGE_HEIGHT` : tweet card image height
- `DOCUMENT_IMAGE_PADDING` : padding around tweet card image (prevents twitter cropping issues)
Expand Down
216 changes: 216 additions & 0 deletions neo4j-test/add-nodes-edges.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
import { expect } from 'chai';
import { initDriver, closeDriver } from '../src/neo4j/neo4j-driver.js';
import { addEdge, addNode, getInteractions, getNeighbouringNodes, neighbourhood } from '../src/neo4j/neo4j-functions';
import { deleteAllNodesAndEdges, getGeneName, getNumNodes, getNumEdges, getEdge } from '../src/neo4j/test-functions.js';

describe('02. Tests for addNode, addEdge and seachByGeneId', function () {

before('Should create a driver instance and connect to server', async function () {
await initDriver();
});

after('Close driver', async function () {
await closeDriver();
});

beforeEach('Delete nodes and edges', async function () {
await deleteAllNodesAndEdges();
});

it('Make one node', async function () {
expect(await getNumNodes()).to.equal(0);
await addNode('ncbigene:5597', 'MAPK6');
expect(await getGeneName('ncbigene:5597')).to.equal('MAPK6');
expect(await getNumNodes()).to.equal(1);
});

it('Make an edge between the two nodes', async function () {
expect(await getNumEdges()).equal(0);
await addNode('ncbigene:207', 'AKT');
await addNode('ncbigene:5597', 'MAPK6');
await addEdge('01ef22cc-2a8e-46d4-9060-6bf1c273869b',
'phosphorylation',
[],
'ncbigene:5597',
'ncbigene:207',
'',
'',
'a896d611-affe-4b45-a5e1-9bc560ffceab',
'10.1126/sciadv.abi6439',
'34767444',
'MAPK6-AKT signaling promotes tumor growth and resistance to mTOR kinase blockade.');
expect(await getNumEdges()).to.equal(1);
let edge = await getEdge('01ef22cc-2a8e-46d4-9060-6bf1c273869b');
expect(edge.type).to.equal('INTERACTION');
expect(edge.properties.type).to.equal('phosphorylation');
expect(edge.properties.sourceId).to.equal('ncbigene:5597');
expect(edge.properties.targetId).to.equal('ncbigene:207');
expect(edge.properties.sourceComplex).to.equal('');
expect(edge.properties.targetComplex).to.equal('');
expect(edge.properties.component).to.deep.equal([]);
expect(edge.properties.xref).to.equal('a896d611-affe-4b45-a5e1-9bc560ffceab');
expect(edge.properties.doi).to.equal('10.1126/sciadv.abi6439');
expect(edge.properties.pmid).to.equal('34767444');
expect(edge.properties.articleTitle).to.equal('MAPK6-AKT signaling promotes tumor growth and resistance to mTOR kinase blockade.');
});

it('Making a duplicate node fails', async function () {
await addNode('ncbigene:207', 'AKT');
await addNode('ncbigene:5597', 'MAPK6');
expect(await getNumNodes()).to.equal(2);
await addNode('ncbigene:5597', 'MAPK6');
await addNode('ncbigene:5597', 'This is a dummy name');
expect(await getNumNodes()).to.equal(2);
expect(await getGeneName('ncbigene:5597')).to.equal('MAPK6');
});

it('Making a duplicate edge fails', async function () {
await addNode('ncbigene:207', 'AKT');
await addNode('ncbigene:5597', 'MAPK6');
await addEdge('01ef22cc-2a8e-46d4-9060-6bf1c273869b',
'phosphorylation',
[],
'ncbigene:5597',
'ncbigene:207',
'',
'',
'a896d611-affe-4b45-a5e1-9bc560ffceab',
'10.1126/sciadv.abi6439',
'34767444',
'MAPK6-AKT signaling promotes tumor growth and resistance to mTOR kinase blockade.');
expect(await getNumEdges()).equal(1);
await addEdge('01ef22cc-2a8e-46d4-9060-6bf1c273869b',
'phosphorylation',
[],
'ncbigene:5597',
'ncbigene:207',
'',
'',
'a896d611-affe-4b45-a5e1-9bc560ffceab',
'10.1126/sciadv.abi6439',
'34767444',
'MAPK6-AKT signaling promotes tumor growth and resistance to mTOR kinase blockade.');
await addEdge('01ef22cc-2a8e-46d4-9060-6bf1c273869b',
'This is a dummy type',
[],
'nc7',
'ncbigene:207',
'',
'',
'a896d611-affe-4b45-a5e1-9bc560ffceab',
'10.1126/sciadv.abi6439',
'3444',
'MAPK6-AKT signaling ');
expect(await getNumEdges()).equal(1);
let edge = await getEdge('01ef22cc-2a8e-46d4-9060-6bf1c273869b');
expect(edge.type).to.equal('INTERACTION');
expect(edge.properties.type).to.equal('phosphorylation');
expect(edge.properties.sourceId).to.equal('ncbigene:5597');
expect(edge.properties.targetId).to.equal('ncbigene:207');
expect(edge.properties.sourceComplex).to.equal('');
expect(edge.properties.targetComplex).to.equal('');
expect(edge.properties.component).to.deep.equal([]);
expect(edge.properties.xref).to.equal('a896d611-affe-4b45-a5e1-9bc560ffceab');
expect(edge.properties.doi).to.equal('10.1126/sciadv.abi6439');
expect(edge.properties.pmid).to.equal('34767444');
expect(edge.properties.articleTitle).to.equal('MAPK6-AKT signaling promotes tumor growth and resistance to mTOR kinase blockade.');
});

it('Ensure searchGeneById works as expected for MAPK6', async function () {
await addNode('ncbigene:207', 'AKT');
await addNode('ncbigene:5597', 'MAPK6');
await addEdge('01ef22cc-2a8e-46d4-9060-6bf1c273869b',
'phosphorylation',
[],
'ncbigene:5597',
'ncbigene:207',
'',
'',
'a896d611-affe-4b45-a5e1-9bc560ffceab',
'10.1126/sciadv.abi6439',
'34767444',
'MAPK6-AKT signaling promotes tumor growth and resistance to mTOR kinase blockade.');

let mapk6Relationships = await getInteractions('ncbigene:5597');

expect(mapk6Relationships.length).to.equal(1);
expect(mapk6Relationships[0].type).to.equal('phosphorylation');
expect(mapk6Relationships[0].sourceId).to.equal('ncbigene:5597');
expect(mapk6Relationships[0].targetId).to.equal('ncbigene:207');
expect(mapk6Relationships[0].sourceComplex).to.equal('');
expect(mapk6Relationships[0].targetComplex).to.equal('');
expect(mapk6Relationships[0].component).to.deep.equal([]);
expect(mapk6Relationships[0].xref).to.equal('a896d611-affe-4b45-a5e1-9bc560ffceab');
expect(mapk6Relationships[0].doi).to.equal('10.1126/sciadv.abi6439');
expect(mapk6Relationships[0].pmid).to.equal('34767444');
expect(mapk6Relationships[0].articleTitle).to.equal('MAPK6-AKT signaling promotes tumor growth and resistance to mTOR kinase blockade.');

let mapk6NeighbouringNodes = await getNeighbouringNodes('ncbigene:5597');

expect(mapk6NeighbouringNodes.length).to.equal(1);
expect(mapk6NeighbouringNodes[0].id).to.equal('ncbigene:207');
expect(mapk6NeighbouringNodes[0].name).to.equal('AKT');
});

it('Ensure searchGeneById works as expected for AKT', async function () {
await addNode('ncbigene:207', 'AKT');
await addNode('ncbigene:5597', 'MAPK6');
await addEdge('01ef22cc-2a8e-46d4-9060-6bf1c273869b',
'phosphorylation',
[],
'ncbigene:5597',
'ncbigene:207',
'',
'',
'a896d611-affe-4b45-a5e1-9bc560ffceab',
'10.1126/sciadv.abi6439',
'34767444',
'MAPK6-AKT signaling promotes tumor growth and resistance to mTOR kinase blockade.');

let aktRelationships = await getInteractions('ncbigene:207');

expect(aktRelationships.length).to.equal(1);
expect(aktRelationships[0].type).to.equal('phosphorylation');
expect(aktRelationships[0].sourceId).to.equal('ncbigene:5597');
expect(aktRelationships[0].targetId).to.equal('ncbigene:207');
expect(aktRelationships[0].sourceComplex).to.equal('');
expect(aktRelationships[0].targetComplex).to.equal('');
expect(aktRelationships[0].component).to.deep.equal([]);
expect(aktRelationships[0].xref).to.equal('a896d611-affe-4b45-a5e1-9bc560ffceab');
expect(aktRelationships[0].doi).to.equal('10.1126/sciadv.abi6439');
expect(aktRelationships[0].pmid).to.equal('34767444');
expect(aktRelationships[0].articleTitle).to.equal('MAPK6-AKT signaling promotes tumor growth and resistance to mTOR kinase blockade.');

let aktNeighbouringNodes = await getNeighbouringNodes('ncbigene:207');

expect(aktNeighbouringNodes.length).to.equal(1);
expect(aktNeighbouringNodes[0].id).to.equal('ncbigene:5597');
expect(aktNeighbouringNodes[0].name).to.equal('MAPK6');
});

it('Search for a molecule in an empty database yields null', async function () {
expect(await neighbourhood('ncbigene:207')).to.be.null;
expect(await getInteractions('ncbigene:207')).to.be.null;
expect(await getNeighbouringNodes('ncbigene:207')).to.be.null;
});

it('Search for a non-existing molecule in a non-empty database yields null', async function () {
await addNode('ncbigene:207', 'AKT');
await addNode('ncbigene:5597', 'MAPK6');
await addEdge('01ef22cc-2a8e-46d4-9060-6bf1c273869b',
'phosphorylation',
[],
'ncbigene:5597',
'ncbigene:207',
'',
'',
'a896d611-affe-4b45-a5e1-9bc560ffceab',
'10.1126/sciadv.abi6439',
'34767444',
'MAPK6-AKT signaling promotes tumor growth and resistance to mTOR kinase blockade.');

expect(await neighbourhood('ncbigene:217')).to.be.null;
expect(await getInteractions('ncbigene:217')).to.be.null;
expect(await getNeighbouringNodes('ncbigene:217')).to.be.null;
});
});
1 change: 0 additions & 1 deletion neo4j-test/connect-neo4j.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import neo4j from 'neo4j-driver';
import { closeDriver, getDriver, initDriver } from '../src/neo4j/neo4j-driver.js';

describe('01. Initiate Driver', () => {

it('initDriver Should initialize and return a driver', () => {
const driver = initDriver();
expect(driver).an.instanceof(neo4j.Driver);
Expand Down
Loading

0 comments on commit e10d418

Please sign in to comment.