diff --git a/bin/www b/bin/www index 443ee342..abf9b8fe 100644 --- a/bin/www +++ b/bin/www @@ -25,7 +25,7 @@ var server = http.createServer(app); * Listen on provided port, on all network interfaces. */ -server.listen(port, () => console.log(`Server Started: http://localhost:${port}`)); +server.listen(port, () => console.log(`Server started on http://localhost:${port}`)); server.on('error', onError); server.on('listening', onListening); diff --git a/package.json b/package.json index d6c6b238..83c2ba67 100644 --- a/package.json +++ b/package.json @@ -1,62 +1,62 @@ { - "title": "InterMine Data Brpwser", - "name": "intermine-data-browser", - "version": "1.1.0", - "description": "A web-based data browser for InterMine", - "homepage": "https://github.com/InterMine/InterMine-Data-Browser-Tool", - "bugs": { - "url": "https://github.com/InterMine/InterMine-Data-Browser-Tool/issues", - "email": "adrianrodriguezbazaga@gmail.com" - }, - "scripts": { - "start": "gulp & node ./bin/www", - "dev": "gulp && webpack --config webpack.config.js", - "test": "mocha --timeout 100000" - }, - "author": "Adrian Rodriguez-Bazaga", - "contributors": [ - "Yo Yehudi", - "Rachel Lyne", - "LarkhSingla", - "Divyanshu Mahajan", - "Ankit Kumar", - "Nikhil Vats", - "Himanshu Singh", - "Varun Bhandia", - "holloh", - "himanshuc3" - ], - "repository": { - "type": "git", - "url": "https://github.com/InterMine/InterMine-Data-Browser-Tool" - }, - "dependencies": { - "JSONStream": "^1.3.5", - "bootstrap": "^4.4.1", - "chart.js": "^2.9.3", - "cookie-parser": "~1.4.3", - "datatables.net-bs4": "1.10.16", - "debug": "~2.6.9", - "es6-promise": "^4.2.8", - "express": "^4.16.3", - "font-awesome": "4.7.0", - "gulp": "^4.0.2", - "gulp-clean-css": "^4.2.0", - "gulp-rename": "^1.2.2", - "gulp-sass": "^3.1.0", - "http-errors": "~1.6.2", - "imjs": "^3.15.1", - "jquery": "^3.4.1", - "jquery.easing": "^1.4.1", - "jsdom": "^11.11.0", - "morgan": "~1.9.0", - "open": "^7.0.2", - "pug": "^2.0.4" - }, - "devDependencies": { - "browser-sync": "^2.26.7", - "chai": "^4.1.2", - "chai-http": "^4.0.0", - "mocha": "^5.2.0" - } + "title": "InterMine Data Brpwser", + "name": "intermine-data-browser", + "version": "1.1.0", + "description": "A web-based data browser for InterMine", + "homepage": "https://github.com/InterMine/InterMine-Data-Browser-Tool", + "bugs": { + "url": "https://github.com/InterMine/InterMine-Data-Browser-Tool/issues", + "email": "adrianrodriguezbazaga@gmail.com" + }, + "scripts": { + "start": "gulp & node ./bin/www", + "dev": "gulp && webpack --config webpack.config.js", + "test": "mocha --timeout 100000" + }, + "author": "Adrian Rodriguez-Bazaga", + "contributors": [ + "Yo Yehudi", + "Rachel Lyne", + "LarkhSingla", + "Divyanshu Mahajan", + "Ankit Kumar", + "Nikhil Vats", + "Himanshu Singh", + "Varun Bhandia", + "holloh", + "himanshuc3" + ], + "repository": { + "type": "git", + "url": "https://github.com/InterMine/InterMine-Data-Browser-Tool" + }, + "dependencies": { + "JSONStream": "^1.3.5", + "bootstrap": "^4.4.1", + "chart.js": "^2.9.3", + "cookie-parser": "~1.4.3", + "datatables.net-bs4": "1.10.16", + "debug": "~2.6.9", + "es6-promise": "^4.2.8", + "express": "^4.16.3", + "font-awesome": "4.7.0", + "gulp": "^4.0.2", + "gulp-clean-css": "^4.2.0", + "gulp-rename": "^1.2.2", + "gulp-sass": "^3.1.0", + "http-errors": "~1.6.2", + "imjs": "^3.18.1", + "jquery": "^3.4.1", + "jquery.easing": "^1.4.1", + "jsdom": "^11.11.0", + "morgan": "~1.9.0", + "open": "^7.0.2", + "pug": "^2.0.4" + }, + "devDependencies": { + "browser-sync": "^2.26.7", + "chai": "^4.1.2", + "chai-http": "^4.0.0", + "mocha": "^5.2.0" + } } diff --git a/test/api-requests-test.js b/test/api-requests-test.js index 132c4df3..236c0b76 100644 --- a/test/api-requests-test.js +++ b/test/api-requests-test.js @@ -5,152 +5,39 @@ let chai = require('chai'); let chaiHttp = require('chai-http'); let server = require('../app'); let should = chai.should(); +let intermine = require('imjs'); chai.use(chaiHttp); -describe('Fetch', () => { - describe('/GET listing of ontology terms of HumanMine primary classes', () => { - it('it should GET the listing of ontology terms inside class Protein in HumanMine', (done) => { - chai.request(server) - .get('/fetch/ontologyterms/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Protein') - .end((err, res) => { - res.should.have.status(200); - res.body.results.should.be.a('array'); - res.body.results.length.should.be.at.least(1); - done(); - }); - }); - - it('it should GET the listing of ontology terms inside class Gene in HumanMine', (done) => { - chai.request(server) - .get('/fetch/ontologyterms/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene') - .end((err, res) => { - res.should.have.status(200); - res.body.results.should.be.a('array'); - res.body.results.length.should.be.at.least(1); - done(); - }); - }); - - it('it should GET the listing of dataset names inside class Protein in HumanMine', (done) => { - chai.request(server) - .get('/fetch/datasets/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Protein') - .end((err, res) => { - res.should.have.status(200); - res.body.results.should.be.a('array'); - res.body.results.length.should.be.at.least(1); - done(); - }); - }); - - it('it should GET the listing of dataset names inside class Gene in HumanMine', (done) => { - chai.request(server) - .get('/fetch/datasets/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene') - .end((err, res) => { - res.should.have.status(200); - res.body.results.should.be.a('array'); - res.body.results.length.should.be.at.least(1); - done(); - }); - }); - - it('it should GET the listing of pathway names inside class Protein in HumanMine', (done) => { - chai.request(server) - .get('/fetch/pathways/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Protein') - .end((err, res) => { - res.should.have.status(200); - res.body.results.should.be.a('array'); - res.body.results.length.should.be.at.least(1); - done(); - }); - }); - - it('it should GET the listing of pathway names inside class Gene in HumanMine', (done) => { - chai.request(server) - .get('/fetch/pathways/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene') - .end((err, res) => { - res.should.have.status(200); - res.body.results.should.be.a('array'); - res.body.results.length.should.be.at.least(1); - done(); - }); - }); - - it('it should GET the listing of protein domain names inside HumanMine', (done) => { - chai.request(server) - .get('/fetch/proteindomainname/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice') - .end((err, res) => { - res.should.have.status(200); - res.body.results.should.be.a('array'); - res.body.results.length.should.be.at.least(1); - done(); - }); - }); - - it('it should GET the listing of Participant 2 Gene symbols inside HumanMine', (done) => { - chai.request(server) - .get('/fetch/participant2genesymbols/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice') - .end((err, res) => { - res.should.have.status(200); - res.body.results.should.be.a('array'); - res.body.results.length.should.be.at.least(1); - done(); - }); - }); - - it('it should GET the listing of Diseases Names inside HumanMine', (done) => { - chai.request(server) - .get('/fetch/diseases/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene') - .end((err, res) => { - res.should.have.status(200); - res.body.results.should.be.a('array'); - res.body.results.length.should.be.at.least(1); - done(); - }); - }); - - it('it should GET the listing of Alleles types inside HumanMine', (done) => { - chai.request(server) - .get('/fetch/allelestype/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene') - .end((err, res) => { - res.should.have.status(200); - res.body.results.should.be.a('array'); - res.body.results.length.should.be.at.least(1); - done(); - }); - }); - - it('it should GET the listing of Alleles Clinical Significance inside HumanMine', (done) => { - chai.request(server) - .get('/fetch/clinicalsignificance/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene') - .end((err, res) => { - res.should.have.status(200); - res.body.results.should.be.a('array'); - res.body.results.length.should.be.at.least(1); - done(); - }); - }); +describe('API requests using imjs', () => { + describe('/Obtain pathway names in a given class should not be empty', () => { + it('it should get the pathway names inside class Gene in HumanMine', (done) => { + + var service = new intermine.Service({ + root: "https://www.humanmine.org/humanmine/service" + }); - it('it should GET the listing of Protein Atlas Expression Cell Types inside HumanMine', (done) => { - chai.request(server) - .get('/fetch/proteinatlascelltypes/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene') - .end((err, res) => { - res.should.have.status(200); - res.body.results.should.be.a('array'); - res.body.results.length.should.be.at.least(1); - done(); - }); - }); + var query = { + "from": "Gene", + "select": ["pathways.name", "primaryIdentifier"], + "model": { + "name": "genomic" + }, + "orderBy": [{ + "path": "pathways.name", + "direction": "ASC" + }] + }; + + var pathways = new intermine.Query(query, service), + pathwaysPath = [query.from, query.select[0]].join('.'); + pathways.summarize(pathwaysPath).then(function(pathwaySummary) { + //This returns the pathway name and the number of gene rows associated with the pathway + pathwaySummary.should.be.a('array'); + pathwaySummary.length.should.be.at.least(1); + done(); + }); - it('it should GET the listing of Protein Atlas Expression Tissue Names inside HumanMine', (done) => { - chai.request(server) - .get('/fetch/proteinatlastissuenames/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene') - .end((err, res) => { - res.should.have.status(200); - res.body.results.should.be.a('array'); - res.body.results.length.should.be.at.least(1); - done(); - }); }); }); }); \ No newline at end of file diff --git a/views/includes/js/core.pug b/views/includes/js/core.pug index dd5ecf51..a5b3e770 100644 --- a/views/includes/js/core.pug +++ b/views/includes/js/core.pug @@ -1,5 +1,5 @@ -script(src='https://cdn.rawgit.com/intermine/CDN/feb5bb77/js/intermine/imjs/3.15.0/im.min.js') script(src='http://cdn.intermine.org/js/intermine/im-tables/2.0.0-beta/imtables.js') +script(src='https://cdn.jsdelivr.net/gh/intermine/CDN@feb5bb77caa5f1f6c44bd15f4f132de385294c2c/js/intermine/imjs/3.15.0/im.min.js') script(src='vendor/chart.js/Chart.min.js') script(src='//code.jquery.com/jquery-1.11.1.min.js') script(src='https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.bundle.min.js')