diff --git a/.github/issue_template.md b/.github/issue_template.md new file mode 100644 index 00000000..cafd7d7e --- /dev/null +++ b/.github/issue_template.md @@ -0,0 +1,20 @@ + +## Description + + +## Steps to Reproduce + + +## Expected Behaviour + + +## Actual Behaviour + + +## Settings + +- OS: + +## Screenshots + + diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000..0e863f63 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,12 @@ +## Description +Describe the changes made and why they were made. + +## Related issues and discussion +#{Issue Number} + +## Screenshots, if any + +## Checklist +Please make sure these boxes are checked before submitting your pull request - thanks! + +- [ ] Run the tests diff --git a/.gitignore b/.gitignore index fa6345ea..e6e95e72 100644 --- a/.gitignore +++ b/.gitignore @@ -63,4 +63,7 @@ typings/ .env # next.js build output -.next \ No newline at end of file +.next + +# public directory +public/ \ No newline at end of file diff --git a/BUILD.md b/BUILD.md deleted file mode 100644 index 72951318..00000000 --- a/BUILD.md +++ /dev/null @@ -1,12 +0,0 @@ -## HOW TO BUILD - -``` bash -# Install the project dependencies -npm install - -# Run the tests -npm test - -# Use npm start to launch the gulp default tasks (CSS, JS, Vendor, Images, Json Configs, ...) + Run the server -npm start -``` \ No newline at end of file diff --git a/README.md b/README.md index 02f40927..81837bc4 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,28 @@ # InterMine Data Browser -

Build Status (Travis CI):
-

+

Build Status (Travis CI):
+

-The goal of this project, is to implement a faceted search tool to display the data from InterMine database, allowing the users to search easily within the different mines available around InterMine. without the requirement of having an extensive knowledge of the data model. +The goal of this project is to implement a faceted search tool to display the data from InterMine database, allowing the users to search easily within the different mines available around InterMine without the requirement of having an extensive knowledge of the data model. -For the project organization, please refer to [https://github.com/intermine](https://github.com/intermine) +For the project organization, please refer to [InterMine](https://github.com/intermine) -Please note that development is very early on and the project is not ready to use yet. +_Please note that the development is very early on and the project is not ready to use yet._ ## DEPLOYMENT -Try it out with the Heroku deployment (automatic deployment, may have some delay): [http://im-browser-prototype.herokuapp.com/](http://im-browser-prototype.herokuapp.com/) +Try it out with the Heroku deployment [here](http://im-browser-prototype.herokuapp.com/) (automatic deployment, may have some delay) -## DEPENDENCIES +## GETTING STARTED -Check [package.json](package.json) +Please visit [Getting Started](getting-started.md) -## BUILDING +## DEPENDENCIES -See [BUILD.md](BUILD.md) +Check [package.json file](package.json) ## DOCUMENTATION -Apart from the in-line comments in the code, documentation generated with documentation.js is available in [https://adrianbzg.github.io/InterMine-Data-Browser-Tool/](https://adrianbzg.github.io/InterMine-Data-Browser-Tool/). To update the documentation, the 'gulp documentation' is available. +Apart from the in-line comments in the code, documentation generated with _documentation.js_ can be accessed [here](https://adrianbzg.github.io/InterMine-Data-Browser-Tool/). To update the documentation, the 'gulp documentation' is available. ## REQUIRED ONTOLOGY CONCEPTS (PER MINE) FOR EACH FILTER @@ -40,18 +40,35 @@ Apart from the in-line comments in the code, documentation generated with docume | Interactions | interactions.participant2.symbol + interactions.details.type + interactions.details.dataSets.name | | Expression | atlasExpression.pValue + atlasExpression.tStatistic + atlasExpression.expression + atlasExpression.dataSets.name | -## CONTRIBUTING +## CONTRIBUTING GUIDELINES 1. Find a thing to fix/implement in [Issues](https://github.com/AdrianBZG/InterMine-Data-Browser-Tool/issues?direction=desc&sort=created&state=open) or come up with your own idea, [create a discussion issue](https://github.com/AdrianBZG/InterMine-Data-Browser-Tool/issues/new) for it and get a feedback. -2. [Fork the repo](https://help.github.com/articles/fork-a-repo) -3. Create your feature branch (`git checkout -b my-new-feature`) -4. Commit your changes (`git commit -am 'Add some feature'`) -5. Push to the branch (`git push origin my-new-feature`) -6. [Create new Pull Request](https://help.github.com/articles/using-pull-requests) + +2. [Fork](https://help.github.com/articles/fork-a-repo) the repository. + +3. Create your new feature branch. + + ``` bash + git checkout -b my-new-feature + ``` + +4. Commit your changes. + + ``` bash + git commit -am 'Add some feature + ``` + +5. Push to the newly created feature branch. + + ``` bash + git push origin my-new-feature + ``` + +6. Create a new [Pull Request](https://help.github.com/articles/using-pull-requests) ## CONTACT -You can contact the developers by opening an issue in this repo. +You can contact the developers by opening a new issue in this repository [here](https://github.com/AdrianBZG/InterMine-Data-Browser-Tool/issues/new). ## SCREENSHOTS diff --git a/app.js b/app.js index 2ff60d7a..7bf813cd 100644 --- a/app.js +++ b/app.js @@ -5,12 +5,6 @@ var cookieParser = require('cookie-parser'); var logger = require('morgan'); var indexRouter = require('./routes/index'); -var statisticsRouter = require('./routes/statistics'); -var fetchRouter = require('./routes/fetch'); - -var http = require('http'); -var https = require('https'); -var fs = require('fs'); var app = express(); @@ -25,8 +19,6 @@ app.use(cookieParser()); app.use(express.static(path.join(__dirname, 'public'))); app.use('/', indexRouter); // Home page router, to render the views -app.use('/statistics', statisticsRouter); // Statistics router, intended to be used as REST API -app.use('/fetch', fetchRouter); // Statistics router, intended to be used as REST API // Catch 404 and forward to error handler app.use(function(req, res, next) { diff --git a/bin/www b/bin/www index a198fc4b..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); +server.listen(port, () => console.log(`Server started on http://localhost:${port}`)); server.on('error', onError); server.on('listening', onListening); diff --git a/getting-started.md b/getting-started.md new file mode 100644 index 00000000..997e2a95 --- /dev/null +++ b/getting-started.md @@ -0,0 +1,59 @@ +# Getting Started with the InterMine Data Browser + +If you're setting up the Data Browser locally, perhaps to fix a bug or contribute a pull request, here's how you can do it. + +## Prerequisites + +A recent version of [node](https://nodejs.org/en/) and [npm](https://www.npmjs.com/) + +## Clone the repository to your host + +Head to the directory in your host machine where you want to clone/place the repository and then enter the following commands on your terminal window: + +``` bash +# Clone the repository +git clone https://github.com/intermine/InterMine-Data-Browser-Tool.git + +# Change present working directory +cd InterMine-Data-Browser-Tool +``` + +## Install dependencies + +In a console, run this command from the Data Browser root folder to install all the project dependencies: + +``` bash +npm install +``` + +## Run the tests + +To ensure that everything works correctly before or after some changes are made to the code base, run the tests from your console using the following command: + +``` bash +npm test +``` + +If all the test cases run without failing then it means that you are now ready to make a pull request or can proceed further to the next step. + +## Launch GulpJs Tasks and Start the Data Browser server + +The Data Browser always runs Gulp tasks first ([gulpfile.js](gulpfile.js)) to generate all the required files related to the client-side and then runs the server. The following command needs to be entered for the same: + +``` bash +# Launch the gulp default tasks (CSS, JS, Vendor, Images, Json Configs, ...) + Run the server +npm start +``` +If you visit [http://localhost:3000](http://localhost:3000) you should see your Data Browser running locally on your machine! + +## Launch GulpJs Tasks only + +You can run the Gulp tasks separately without running the server using the following command: + +``` bash +gulp +``` + +Once it is completed, you can see the generated files stored inside of `public/` folder. + +_More information on Gulp can be obtained [here](https://gulpjs.com/)._ \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index b43bf2fc..4d038911 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,140 +1,149 @@ var gulp = require('gulp'); var sass = require('gulp-sass'); -var header = require('gulp-header'); var cleanCSS = require('gulp-clean-css'); var rename = require("gulp-rename"); -var uglify = require('gulp-uglify'); -var pug = require('gulp-pug'); -var beautify = require('gulp-html-beautify'); var pkg = require('./package.json'); var browserSync = require('browser-sync').create(); var exec = require('child_process').exec; - +var open = require('open'); +var port = process.env.PORT || 3000; /** * Gulp task to copy third party libraries from /node_modules into /vendor */ -gulp.task('vendor', function() { - // Bootstrap - gulp.src([ - './node_modules/bootstrap/dist/**/*', - '!./node_modules/bootstrap/dist/css/bootstrap-grid*', - '!./node_modules/bootstrap/dist/css/bootstrap-reboot*' - ]) - .pipe(gulp.dest('./public/vendor/bootstrap')) - // ChartJS - gulp.src([ - './node_modules/chart.js/dist/*.js' - ]) - .pipe(gulp.dest('./public/vendor/chart.js')) - // Font Awesome - gulp.src([ - './node_modules/font-awesome/**/*', - '!./node_modules/font-awesome/{less,less/*}', - '!./node_modules/font-awesome/{scss,scss/*}', - '!./node_modules/font-awesome/.*', - '!./node_modules/font-awesome/*.{txt,json,md}' - ]) - .pipe(gulp.dest('./public/vendor/font-awesome')) - // jQuery - gulp.src([ - './node_modules/jquery/dist/*', - '!./node_modules/jquery/dist/core.js' - ]) - .pipe(gulp.dest('./public/vendor/jquery')) - // jQuery Easing - gulp.src([ - './node_modules/jquery.easing/*.js' - ]) - .pipe(gulp.dest('./public/vendor/jquery-easing')) - // InterMineJS - gulp.src([ - './node_modules/imjs/dist/*', - ]) - .pipe(gulp.dest('./public/vendor/imjs')) +gulp.task('vendor', function(done) { + // Bootstrap + gulp.src([ + './node_modules/bootstrap/dist/**/*', + '!./node_modules/bootstrap/dist/css/bootstrap-grid*', + '!./node_modules/bootstrap/dist/css/bootstrap-reboot*' + ]) + .pipe(gulp.dest('./public/vendor/bootstrap')) + // ChartJS + gulp.src([ + './node_modules/chart.js/dist/*.js' + ]) + .pipe(gulp.dest('./public/vendor/chart.js')) + // Font Awesome + gulp.src([ + './node_modules/font-awesome/**/*', + '!./node_modules/font-awesome/{less,less/*}', + '!./node_modules/font-awesome/{scss,scss/*}', + '!./node_modules/font-awesome/.*', + '!./node_modules/font-awesome/*.{txt,json,md}' + ]) + .pipe(gulp.dest('./public/vendor/font-awesome')) + // jQuery + gulp.src([ + './node_modules/jquery/dist/*', + '!./node_modules/jquery/dist/core.js' + ]) + .pipe(gulp.dest('./public/vendor/jquery')) + // jQuery Easing + gulp.src([ + './node_modules/jquery.easing/*.js' + ]) + .pipe(gulp.dest('./public/vendor/jquery-easing')) + // InterMineJS + gulp.src([ + './node_modules/imjs/dist/*', + ]) + .pipe(gulp.dest('./public/vendor/imjs')) + + // Signals completion of the task + done(); }); /** * Gulp task to move the images in the src folder to the public folder */ gulp.task('images', function() { - gulp.src([ - './src/img/*' - ]) - .pipe(gulp.dest('./public/img/')) + return gulp.src([ + './src/img/*' + ]) + .pipe(gulp.dest('./public/img/')) }); /** * Gulp task to move the JSON mine configs in the src folder to the public folder */ gulp.task('mine_configs', function() { - gulp.src([ - './src/mine_configs/*' - ]) - .pipe(gulp.dest('./public/mine_configs/')) + return gulp.src([ + './src/mine_configs/*' + ]) + .pipe(gulp.dest('./public/mine_configs/')) }); /** * Gulp task to compile SCSS */ gulp.task('css:compile', function() { - return gulp.src('./src/scss/**/*.scss') - .pipe(sass.sync({ - outputStyle: 'expanded' - }).on('error', sass.logError)) - .pipe(gulp.dest('./public/stylesheets')) + return gulp.src('./src/scss/**/*.scss') + .pipe(sass.sync({ + outputStyle: 'expanded' + }).on('error', sass.logError)) + .pipe(gulp.dest('./public/stylesheets')) }); /** * Gulp task to minify CSS */ -gulp.task('css:minify', ['css:compile'], function() { - return gulp.src([ - './src/css/*.css', - '!./src/css/*.min.css' - ]) - .pipe(cleanCSS()) - .pipe(rename({ - suffix: '.min' - })) - .pipe(gulp.dest('./public/stylesheets')) - .pipe(browserSync.stream()); +gulp.task('css:minify', function() { + return gulp.src([ + './src/css/*.css', + '!./src/css/*.min.css' + ]) + .pipe(cleanCSS()) + .pipe(rename({ + suffix: '.min' + })) + .pipe(gulp.dest('./public/stylesheets')) + .pipe(browserSync.stream()); }); /** * Gulp task for CSS */ -gulp.task('css', ['css:compile', 'css:minify']); +gulp.task('css', gulp.series('css:compile', 'css:minify')); /** * Gulp task to minify JavaScript */ gulp.task('js:minify', function() { - return gulp.src([ - './src/js/*.js', - '!./src/js/*.min.js' - ]) - //.pipe(uglify()) - .pipe(rename({ - suffix: '.min' - })) - .pipe(gulp.dest('./public/javascripts')) - .pipe(browserSync.stream()); + return gulp.src([ + './src/js/*.js', + '!./src/js/*.min.js' + ]) + //.pipe(uglify()) + .pipe(rename({ + suffix: '.min' + })) + .pipe(gulp.dest('./public/javascripts')) + .pipe(browserSync.stream()); }); /** * Gulp task for JS */ -gulp.task('js', ['js:minify']); +gulp.task('js', gulp.series('js:minify')); /** * Gulp task for launching the documentation on src/ files and save it as HTML in the docs folder */ -gulp.task('documentation', function (cb) { - exec('documentation build src/** -f html -o docs', function (err, stdout, stderr) { - }); +gulp.task('documentation', function(cb) { + exec('documentation build src/** -f html -o docs', function(err, stdout, stderr) {}); +}) + +/** + * Gulp task for launching browser with server url + */ +gulp.task('browser', function(cb) { + console.log("Launching Browser"); + open(`http://localhost:${port}`); + console.log("Browser Launched"); + return cb(); }) /** * Gulp default task: CSS + JS + Vendor + images */ -gulp.task('default', ['css', 'js', 'vendor', 'images', 'mine_configs']); +gulp.task('default', gulp.series(gulp.parallel('css', 'js', 'vendor', 'images', 'mine_configs'), 'browser')); diff --git a/package.json b/package.json index 5167a2fe..83c2ba67 100644 --- a/package.json +++ b/package.json @@ -1,56 +1,62 @@ { - "title": "InterMine Data Brpwser", - "name": "intermine-data-browser", - "version": "1.0.8", - "description": "A web-based data browser for InterMine", - "homepage": "https://github.com/AdrianBZG/InterMine-Data-Browser-Tool", - "bugs": { - "url": "https://github.com/AdrianBZG/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" - ], - "repository": { - "type": "git", - "url": "https://github.com/AdrianBZG/InterMine-Data-Browser-Tool" - }, - "dependencies": { - "bootstrap": "4.1.2", - "browser-sync": "2.23.6", - "chart.js": "2.7.1", - "cookie-parser": "~1.4.3", - "datatables.net-bs4": "1.10.16", - "debug": "~2.6.9", - "express": "^4.16.3", - "font-awesome": "4.7.0", - "gulp-clean-css": "3.9.2", - "gulp-header": "2.0.1", - "gulp-html-beautify": "^1.0.1", - "gulp-pug": "^3.3.0", - "gulp-rename": "^1.2.2", - "gulp-sass": "^3.1.0", - "gulp-uglify": "3.0.0", - "http-errors": "~1.6.2", - "jquery": "3.3.1", - "jquery.easing": "^1.4.1", - "jsdom": "^11.11.0", - "morgan": "~1.9.0", - "pug": "2.0.0-beta11", - "gulp": "^3.9.1", - "imjs": "^3.15.1" - }, - "devDependencies": { - "browser-sync": "2.23.6", - "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/public/img/favicon.ico b/public/img/favicon.ico deleted file mode 100644 index e5fa3ee0..00000000 Binary files a/public/img/favicon.ico and /dev/null differ diff --git a/public/img/intermine-logo.png b/public/img/intermine-logo.png deleted file mode 100644 index d729e394..00000000 Binary files a/public/img/intermine-logo.png and /dev/null differ diff --git a/public/javascripts/common.min.js b/public/javascripts/common.min.js deleted file mode 100644 index 494e0287..00000000 --- a/public/javascripts/common.min.js +++ /dev/null @@ -1,2060 +0,0 @@ -$(document).ready(function() { - initializeStartupConfiguration(); -}); - -/** - * This method initialies the global variables used for the filters, reads the JSON filters config - * and handles the default mine view. - */ -function initializeStartupConfiguration() { - window.imTableConstraint = { - "goAnnotation" : [], - "datasetName" : [], - "pathwayName" : [], - "proteinDomainName" : [], - "diseaseName" : [], - "organism" : [], - "savedList": null - }; // 0 = GO annotation, 1 = Dataset Name, 2 = Pathway Name, 3 = Protein Domain Name, 4 = Disease Name - - window.interminesHashMap = null; - window.locationFilter = null; - window.interactionsFilter = null; - window.clinVarFilter = null; - window.expressionFilter = null; - window.organismFilterLetters = ["A","B","C","D","E","F","G","H","I","J"]; - window.organismFilter = null; - window.organismColorsMap = {} - window.proteinLocalisationFilter = null; - window.currentClassViewFilter = null; - window.pieChartObject = null; - window.geneLengthChartObject = null; - - window.minesConfigs = null; - window.minesPreferredOrganisms = null; - - readTextFile("./mine_configs/mines_config.json", function(text) { - window.minesConfigs = JSON.parse(text); - }); - - readTextFile("./mine_configs/mines_preferred_organisms.json", function(text) { - window.minesPreferredOrganisms = JSON.parse(text); - }); - - // Initial mine service url (HumanMine), name and view - window.mineUrl = "httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice"; - window.selectedMineName = "HumanMine"; - if(!sessionStorage.getItem('currentClassView')) { - sessionStorage.setItem('currentClassView', 'Gene'); - } - - // Check if there is a saved mine in LocalStorage - if (typeof(Storage) !== "undefined") { - if (localStorage.getItem("selectedMineName") && localStorage.getItem("mineUrl")) { - window.mineUrl = localStorage.getItem("mineUrl"); - window.selectedMineName = localStorage.getItem("selectedMineName"); - } - } - - // Handle the API Keys manager buttons - $("#apiKeyManagerButton").click(function() { - // Update the key manager structures - initializeKeyManager(); - - // Show the window - $('#apiKeyManagerModal').appendTo("body").modal('show'); - }); - - $("#apiKeyManagerSaveButton").click(function() { - var newApiKeysObject = []; - - var anyError = false; // We will use this variable to check for errors - - // Iterate through the elements in the div containing the keys and update the LocalStorage object - $('#apiKeyManagerModalKeysDiv').children('div').each(function () { - var mineName = $(this).children("label").text(); - var mineAPIkey = $(this).children("input").val(); - - // Sanity check: if the API key is valid, we save it, otherwise, warn the user - if(mineAPIkey != "") { - $.ajax({ - url: findElementJSONarray(window.interminesHashMap, "mine", mineName).mineurl + '/user/whoami?token=' + mineAPIkey, - type: 'GET', - async: false, - success: function(data) { - newApiKeysObject.push({ "mine" : mineName, "apikey" : mineAPIkey }); - }, - error: function(e) { - anyError = true; - - // Show error - if ($("#invalidAPIkeyAlert").length == 0) { - $("#navbarResponsive").prepend("
×Error: API key provided for " + mineName + " is not a valid API key - please check you have entered it correctly.

"); - - $("#closeInvalidAPIkeyAlert").click(function() { - $("#invalidAPIkeyAlert").hide(); - }); - } else { - $("#invalidAPIkeyAlert").show(); - } - }.bind(this, anyError) // Bind to this environment, so local variable is accesible from inside - }); - } else { - newApiKeysObject.push({ "mine" : mineName, "apikey" : mineAPIkey }); - } - }).promise().done( function(){ - if(!anyError) { - // Save to Local Storage and reload - localStorage.setItem("api-keys", JSON.stringify(newApiKeysObject)); - location.reload(); - } - - // Hide the window - $('#apiKeyManagerModal').modal('toggle'); - }); - }); - - - $("#listManagerButton").click(function() { - initializeSavedLists(); - $("#listManagerModal").modal("show"); - }) - - $("#viewConstraintsButton").click(function() { - initializeConstraintsList(); - $("#constraintsModal").modal("show"); - }) - - // Handle the view manager buttons - $("#viewManagerButton").click(function() { - // Update the key manager structures - initializeViewManager(); - - // Show the window - $('#viewManagerModal').appendTo("body").modal('show'); - }); - - $("#resetAllButton").click(function() { - location.reload(); - }); - - // Update organism short name filter - updateOrganismsSidebarFilter(); - createSidebarEvents(); -} - -/** - * Method to initialize the constraint list from the IM table - */ - -function initializeConstraintsList() { - var tableConstraints = window.imTable.query.constraints; - if(tableConstraints.length > 0) { - var listHtml = ""; - for(var i = 0; i < tableConstraints.length; i++) { - if(tableConstraints[i].value) { - listHtml += "
  • " + tableConstraints[i].path + " " + tableConstraints[i].op + " " + tableConstraints[i].value + "
  • "; - } else { - listHtml += "
  • " + tableConstraints[i].path + " " + tableConstraints[i].op + " " + tableConstraints[i].values + "
  • "; - } - } - $('#constraintsModalList').html(listHtml); - } else { - $('#constraintsModalList').html("
    You haven't added any constraint.
    "); - } -} - -/** - * Method to initialize the saved lists based on the API Keys - */ - -function initializeSavedLists(){ - if(window.savedListsInitialized) return; - $.when(getSavedLists()).then(function(result) { - var formElement = ''; - var listElements = result.map(function(list) { - return "
  • " + list.title + "
  • " - }).join(''); - $('#savedLists').html(formElement + listElements); - document.getElementById('listManagerSaveButton').disabled = false; - document.getElementById('listManagerResetButton').disabled = false; - $('#saved-lists-filter').on('input', function(e){ - var data = $('#saved-lists-filter')[0].value.toLowerCase().trim(); - $(".saved-list-item").each(function(i, el) { - if(el.textContent.toLowerCase().indexOf(data) == -1) el.style.display = 'none'; - else el.style.display = 'block'; - }); - }); - $("#listManagerSaveButton").click(function() { - updateTableWithConstraints(); - $("#listManagerModal").modal("hide"); - }); - $("#listManagerResetButton").click(function() { - if(window.imTableConstraint['savedList']) { - window.imTableConstraint['savedList'] = null; - $('.saved-list-item').each(function(i, el_) { - el_.dataset.listConstraintActive = "false"; - el_.classList.remove('active'); - }); - $("#listManagerModal").modal("hide"); - updateTableWithConstraints(); - } - }); - $(".saved-list-item").each(function(i, el) { - el.addEventListener('click', function() { - if(el.dataset.listConstraintActive === "true") { - el.dataset.listConstraintActive = "false"; - el.classList.remove('active'); - window.imTableConstraint["savedList"] = null; - } - else { - $('.saved-list-item').each(function(i, el_) { - el_.dataset.listConstraintActive = "false"; - el_.classList.remove('active'); - }); - el.dataset.listConstraintActive = "true"; - el.classList.add('active'); - var listName = el.textContent; - window.imTableConstraint['savedList'] = listName; - } - }); - }); - window.savedListsInitialized = true; - }) -} - -/** - * Method to update the im-table with the filters selected in the sidebar - */ -function updateTableWithConstraints() { - while (window.imTable.query.constraints.length > 0) { - try { - window.imTable.query.removeConstraint(window.imTable.query.constraints[0]); - } catch (err) { - continue; - } - } - - // GO Annotation - if (window.imTableConstraint["goAnnotation"].length > 0) { - if (sessionStorage.getItem('currentClassView') == "Gene") { - window.imTable.query.addConstraint({ - "path": "goAnnotation.ontologyTerm.name", - "op": "ONE OF", - "values": window.imTableConstraint["goAnnotation"], - "code": "K" - }); - } else { - window.imTable.query.addConstraint({ - "path": "ontologyAnnotations.ontologyTerm.name", - "op": "ONE OF", - "values": window.imTableConstraint["goAnnotation"], - "code": "K" - }); - } - } - - // Dataset Name - if (window.imTableConstraint["datasetName"].length > 0) { - window.imTable.query.addConstraint({ - "path": "dataSets.name", - "op": "ONE OF", - "values": window.imTableConstraint["datasetName"], - "code": "L" - }); - } - - // Pathway Name - if (window.imTableConstraint["pathwayName"].length > 0) { - window.imTable.query.addConstraint({ - "path": "pathways.name", - "op": "ONE OF", - "values": window.imTableConstraint["pathwayName"], - "code": "M" - }); - } - - // Protein Domain Name - if (window.imTableConstraint["proteinDomainName"].length > 0) { - var filter = window.minesConfigs.filter(function(v){ - return v.mineName===window.selectedMineName; - })[0].customFilters.filter(function(v){ - return v.filterName==='Protein-Domain'; - }); - - var proteinDomainFilterQuery = filter[0].filterQuery[0]; - proteinDomainFilterQuery.values = window.imTableConstraint["proteinDomainName"]; - - if (sessionStorage.getItem('currentClassView') == "Gene") { - window.imTable.query.addConstraint(proteinDomainFilterQuery); - } - } - - // Organism - if (window.imTableConstraint["organism"].length > 0) { - var organismValues = window.imTableConstraint["organism"]; - - for(var i = 0; i < organismValues.length; i++) { - window.imTable.query.addConstraint({ - "path": "organism.shortName", - "op": "=", - "value": organismValues[i], - "code": window.organismFilterLetters[i] - }); - window.imTable.query.constraintLogic = window.tableConstraintLogic; - } - } - - // Disease Name - if (window.imTableConstraint["diseaseName"].length > 0) { - var filter = window.minesConfigs.filter(function(v){ - return v.mineName===window.selectedMineName; - })[0].customFilters.filter(function(v){ - return v.filterName==='Diseases'; - }); - - var diseasesFilterQuery = filter[0].filterQuery[0]; - diseasesFilterQuery.values = window.imTableConstraint["diseaseName"]; - - window.imTable.query.addConstraint(diseasesFilterQuery); - window.imTable.query.constraintLogic = window.tableConstraintLogic; - } - - // Phenotype Name - if (window.imTableConstraint["phenotypeName"] && window.imTableConstraint["phenotypeName"].length > 0) { - var filter = window.minesConfigs.filter(function(v){ - return v.mineName===window.selectedMineName; - })[0].customFilters.filter(function(v){ - return v.filterName==='Phenotype'; - }); - - var phenotypeDomainFilterQuery = filter[0].filterQuery[0]; - phenotypeDomainFilterQuery.values = window.imTableConstraint["phenotypeName"]; - - window.imTable.query.addConstraint(phenotypeDomainFilterQuery); - } - - // List Constraints - if(window.imTableConstraint['savedList']) { - window.imTable.query.addConstraint({ - "path": sessionStorage.getItem('currentClassView'), - "op": "IN", - "value": window.imTableConstraint["savedList"], - "code": "N" - }); - } - - window.imTable.query.constraintLogic = window.tableConstraintLogic; -} - - -function addViewManagerSelectOptions() { - // Add classes with preferredBagType tag for the current mine - var mineURL = escapeMineURL(window.mineUrl); - - if(mineURL.slice(-1) != "/") { - mineURL += "/"; - } - - mineURL += "model?format=json"; - var url = mineURL; - - $.when(getMineModel(url)).done(function(result) { - var mineClasses = JSON.parse(JSON.stringify(result.model.classes)); - var mineClassesArray = []; - for(var x in mineClasses) { - mineClassesArray.push(mineClasses[x]); - } - - var selectObject = document.getElementById('addViewDropDown'); - var op = ""; - var defaultViews = ['Gene','Protein']; - - for (var i = 0; i < mineClassesArray.length; i++) { - if(!defaultViews.includes(mineClassesArray[i].name)) { - op += ""; - } - } - selectObject.innerHTML = op; - }).fail(function(error){ - console.log("error", error); - }) -} - -/** - * Method to expand the dataset names filter, showing the remaining ones and adding the appropriate event handling to them - */ -function showMoreDatasetNames() { - $.when(getDatasetNamesInClass()).done(function(result) { - var availableDatasetNames = []; - - for (var i = 0; i < result.results.length; i++) { - if (result.results[i]["item"] != null) { - if (result.results[i]["item"] == "KEGG pathways data set" || result.results[i]["item"] == "HGNC identifiers" || result.results[i]["item"] == "BioGRID interaction data set" || result.results[i]["item"] == "IntAct interactions data set" || result.results[i]["item"] == "ClinVar data set" || result.results[i]["item"] == "OMIM diseases") { - continue; - } - availableDatasetNames.push({ - label: result.results[i]["item"] + " (" + result.results[i]["count"] + ")", - value: result.results[i]["item"] - }); - } - } - - var resultantElementsArray = []; - - for (var i = 0; i < availableDatasetNames.length; i++) { - resultantElementsArray.push(availableDatasetNames[i]["value"]); - } - - resultantElementsArray.sort(); - - // Remove first 3 elements (already in the sidebar) - if (resultantElementsArray.length < 4) return; - resultantElementsArray = resultantElementsArray.slice(3); - - var resultantElementsNumber = resultantElementsArray.length; - - for (var i = 0; i < resultantElementsNumber; i++) { - var datasetName = resultantElementsArray[i]; - //var datasetCount = "(" + result.results[i]["count"] + ")"; - $("#datasetsSelector").append( - '
    '); - - $('#' + datasetName.replace(/[^a-zA-Z0-9]/g, '')).change(function() { - if ($(this).is(":checked")) { - var checkboxValue = $(this).val(); - window.imTableConstraint["datasetName"].push(checkboxValue); - } else { - var checkboxValue = $(this).val(); - remove(window.imTableConstraint["datasetName"], checkboxValue); - } - updateTableWithConstraints(); - }); - } - }); -} - -/** - * Method to remove the current Custom filters in the sidebar - */ -function clearCustomFilters() { - $("#locationFilterLi").remove(); - $("#diseasesFilterLi").remove(); - $("#clinvarFilterLi").remove(); - $("#proteinLocalisationFilterLi").remove(); - $("#proteinDomainFilterLi").remove(); - $("#interactionsFilterLi").remove(); - $("#expressionFilterLi").remove(); - $("#datasetFilterLi").remove(); - $("#phenotypeFilterLi").remove(); - window.CustomFiltersAdded = false; -} - -function addCustomFilters() { - if (!window.CustomFiltersAdded) { - // Read the JSON config file - if (sessionStorage.getItem('currentClassView') == "Gene") { - var availableCustomFilters = window.minesConfigs.filter(function(v){ - return v.mineName===window.selectedMineName; - })[0].customFilters; - - var filter = null; - - // Location filter - filter = availableCustomFilters.filter(function(v){ - return v.filterName==='Location'; - }); - - if (filter.length > 0) { - $("#sidebarUl").append( - ''); - - $('#locationSearchButton').click(function() { - if (window.locationFilter) clearLocationConstraint(); - - var chromosomeInput = $('#locationChromosomeSearchInput').val(); - var startLocationInput = $('#locationStartSearchInput').val(); - var endLocationInput = $('#locationEndSearchInput').val(); - - if (!chromosomeInput) { - if ($("#locationFilterAlert").length == 0) { - $("#navbarResponsive").prepend("
    ×Please, specify a chromosome in the filter input field.

    "); - - $("#closeLocationFilterAlert").click(function() { - $("#locationFilterAlert").hide(); - }); - } else { - $("#locationFilterAlert").show(); - } - } - - if (!$.isNumeric(startLocationInput) || !$.isNumeric(endLocationInput)) { - if ($("#locationFilterAlert").length == 0) { - $("#navbarResponsive").prepend("
    ×Please, write a integer number in both the 'Start' and 'End' input fields.

    "); - - $("#closeLocationFilterAlert").click(function() { - $("#locationFilterAlert").hide(); - }); - } else { - $("#locationFilterAlert").show(); - } - - return; - - } - - if (parseInt(startLocationInput) > parseInt(endLocationInput)) { - if ($("#locationFilterAlert").length == 0) { - $("#navbarResponsive").prepend("
    ×The location start position must be less or equal to the end position.

    "); - - $("#closeLocationFilterAlert").click(function() { - $("#locationFilterAlert").hide(); - }); - } else { - $("#locationFilterAlert").show(); - } - - return; - } - - window.locationFilter = []; - - var filter = window.minesConfigs.filter(function(v){ - return v.mineName===window.selectedMineName; - })[0].customFilters.filter(function(v){ - return v.filterName==='Location'; - }); - - // Format the query - var filterQueryLocationsStart = filter[0].filterQuery[0]; - filterQueryLocationsStart.value = parseInt(startLocationInput); - var filterQueryLocationsEnd = filter[0].filterQuery[1]; - filterQueryLocationsEnd.value = parseInt(endLocationInput); - var filterQueryLocatedOn = filter[0].filterQuery[2]; - filterQueryLocatedOn.value = parseInt(chromosomeInput); - - // Add the constraints - window.imTable.query.addConstraint(filterQueryLocationsStart); - window.locationFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - - window.imTable.query.addConstraint(filterQueryLocationsEnd); - window.locationFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - - window.imTable.query.addConstraint(filterQueryLocatedOn); - window.locationFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - - window.imTable.query.constraintLogic = window.tableConstraintLogic; - }); - - $('#locationResetButton').click(function() { - if (window.locationFilter) clearLocationConstraint(); - $("#locationStartSearchInput").val(''); - $("#locationEndSearchInput").val(''); - $("#locationChromosomeSearchInput").val(''); - }); - } - - // Expression filter - filter = availableCustomFilters.filter(function(v){ - return v.filterName==='Expression'; - }); - - if (filter.length > 0) { - $("#sidebarUl").append( - ''); - - $('#expressionSearchButton').click(function() { - if (window.expressionFilter) clearExpressionFilterConstraint(); - - var expressionPvalue = $('#expressionPvalueSearchInput').val(); - var expressionTstatistic = $('#expressionTstatisticSearchInput').val(); - var expressionExpressionSelector = $('#expressionExpressionSelector').val(); - var expressionDatasetSelector = $('#expressionDatasetSelector').val(); - var expressionTissue = $('#expressionTissueSearchInput').val(); - - window.expressionFilter = []; - - var filter = window.minesConfigs.filter(function(v){ - return v.mineName===window.selectedMineName; - })[0].customFilters.filter(function(v){ - return v.filterName==='Expression'; - }); - - // Format the query - var filterQueryPvalue = filter[0].filterQuery[0]; - filterQueryPvalue.value = expressionPvalue; - var filterQueryTstatistic = filter[0].filterQuery[1]; - filterQueryTstatistic.value = expressionTstatistic; - var filterQueryExpression = filter[0].filterQuery[2]; - filterQueryExpression.value = expressionExpressionSelector; - var filterQueryDatasetName = filter[0].filterQuery[3]; - filterQueryDatasetName.value = expressionDatasetSelector; - var filterQueryTissueName = filter[0].filterQuery[4]; - filterQueryTissueName.value = expressionTissue; - - if(expressionDatasetSelector == "E-MTAB-62") { - if (expressionPvalue) { - window.imTable.query.addConstraint(filterQueryPvalue); - window.expressionFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - } - - if (expressionTstatistic) { - window.imTable.query.addConstraint(filterQueryTstatistic); - window.expressionFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - } - - window.imTable.query.addConstraint(filterQueryExpression); - window.expressionFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - - if (expressionDatasetSelector != "All") { - window.imTable.query.addConstraint(filterQueryDatasetName); - window.expressionFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - } - } else if(expressionDatasetSelector == "E-MTAB-513") { - filterQueryTissueName.value = expressionTissue; - filterQueryExpression.value = $('#expressionFPKMSearchInput').val(); - - // Tissue filter - window.imTable.query.addConstraint(filterQueryTissueName); - window.expressionFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - - // FPKM filter - window.imTable.query.addConstraint(filterQueryExpression); - window.expressionFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - } - - window.imTable.query.constraintLogic = window.tableConstraintLogic; - - }); - - $('#expressionResetButton').click(function() { - if (window.expressionFilter) clearExpressionFilterConstraint(); - $("#expressionTstatisticSearchInput").val(''); - $("#expressionPvalueSearchInput").val(''); - }); - } - - // Interactions filter - - filter = availableCustomFilters.filter(function(v){ - return v.filterName==='Interactions'; - }); - - if (filter.length > 0) { - $("#sidebarUl").append( - ''); - - $.when(getParticipant2SymbolsInClass()).done(function(result) { - - var availableParticipant2Symbol = []; - - for (var i = 0; i < result.results.length; i++) { - if (result.results[i]["item"] != null) { - availableParticipant2Symbol.push({ - label: result.results[i]["item"] + " (" + result.results[i]["count"] + ")", - value: result.results[i]["item"] - }); - } - } - - $("#interactionsParticipant2SearchInput").autocomplete({ - minLength: 3, - source: function(request, response) { - var results = $.ui.autocomplete.filter(availableParticipant2Symbol, request.term); - response(results.slice(0, 15)); - }, - select: function(event, ui) { - event.preventDefault(); - $("#interactionsParticipant2SearchInput").val(ui.item.value); - }, - focus: function(event, ui) { - event.preventDefault(); - $("#interactionsParticipant2SearchInput").val(ui.item.value); - } - }); - - }); - - $('#interactionsSearchButton').click(function() { - if (window.interactionsFilter) clearInteractionsConstraint(); - - var participant2Input = $('#interactionsParticipant2SearchInput').val(); - var interactionsTypeSel = $('#interactionsTypeSelector').val(); - var interactionsDatasetSel = $('#interactionsDatasetSelector').val(); - - window.interactionsFilter = []; - - var filter = window.minesConfigs.filter(function(v){ - return v.mineName===window.selectedMineName; - })[0].customFilters.filter(function(v){ - return v.filterName==='Interactions'; - }); - - // Format the query - var filterQueryParticipant2 = filter[0].filterQuery[0]; - filterQueryParticipant2.value = participant2Input; - var filterQueryTypeSel = filter[0].filterQuery[1]; - filterQueryTypeSel.value = interactionsTypeSel; - var filterQueryDatasetSel = filter[0].filterQuery[2]; - filterQueryDatasetSel.value = interactionsDatasetSel; - - // Add the constraints - if (participant2Input) { - window.imTable.query.addConstraint(filterQueryParticipant2); - window.interactionsFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - } - - if (interactionsTypeSel != "All") { - window.imTable.query.addConstraint(filterQueryTypeSel); - window.interactionsFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - } - - if (interactionsDatasetSel != "All") { - window.imTable.query.addConstraint(filterQueryDatasetSel); - window.interactionsFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - } - - window.imTable.query.constraintLogic = window.tableConstraintLogic; - - }); - - $('#interactionsResetButton').click(function() { - if (window.interactionsFilter) clearInteractionsConstraint(); - $("#interactionsParticipant2SearchInput").val(''); - }); - } - - // Diseases filter - filter = availableCustomFilters.filter(function(v){ - return v.filterName==='Diseases'; - }); - - if (filter.length > 0) { - $("#sidebarUl").append( - ''); - - $.when(getDiseasesNamesInClass()).done(function(result) { - - var availableDiseasesNames = []; - - for (var i = 0; i < result.results.length; i++) { - if (result.results[i]["item"] != null) { - availableDiseasesNames.push({ - label: result.results[i]["item"] + " (" + result.results[i]["count"] + ")", - value: result.results[i]["item"] - }); - } - } - - $("#diseasesSearchInput").autocomplete({ - minLength: 3, - source: function(request, response) { - var results = $.ui.autocomplete.filter(availableDiseasesNames, request.term); - response(results.slice(0, 15)); - }, - select: function(event, ui) { - event.preventDefault(); - $("#diseasesSearchInput").val(ui.item.value); - - // Filter the table - window.imTableConstraint["diseaseName"].push(ui.item.value); - updateTableWithConstraints(); - - var buttonId = ui.item.value.replace(/[^a-zA-Z0-9]/g, '') + "button"; - - $("#diseasesFilterList").append( - '
    '); - - $("#" + buttonId).click(function() { - remove(window.imTableConstraint["diseaseName"], ui.item.value); - updateTableWithConstraints(); - $("#" + ui.item.value.replace(/[^a-zA-Z0-9]/g, '')).remove(); - }); - }, - focus: function(event, ui) { - event.preventDefault(); - $("#diseasesSearchInput").val(ui.item.value); - } - }); - - }); - } - - // ClinVar filter - filter = availableCustomFilters.filter(function(v){ - return v.filterName==='CLINVAR'; - }); - - if (filter.length > 0) { - $("#sidebarUl").append( - ''); - - $.when(getAllelesClinicalSignifanceInClass()).done(function(result) { - - var availableData = []; - - for (var i = 0; i < result.results.length; i++) { - if (result.results[i]["item"] != null) { - availableData.push({ - label: result.results[i]["item"] + " (" + result.results[i]["count"] + ")", - value: result.results[i]["item"] - }); - } - } - - $("#clinvarClinicalSignificanceSearchInput").autocomplete({ - minLength: 2, - source: function(request, response) { - var results = $.ui.autocomplete.filter(availableData, request.term); - response(results.slice(0, 15)); - }, - select: function(event, ui) { - event.preventDefault(); - $("#clinvarClinicalSignificanceSearchInput").val(ui.item.value); - }, - focus: function(event, ui) { - event.preventDefault(); - $("#clinvarClinicalSignificanceSearchInput").val(ui.item.value); - } - }); - - }); - - $.when(getAllelesTypesInClass()).done(function(result) { - - var availableData = []; - - for (var i = 0; i < result.results.length; i++) { - if (result.results[i]["item"] != null) { - availableData.push({ - label: result.results[i]["item"] + " (" + result.results[i]["count"] + ")", - value: result.results[i]["item"] - }); - } - } - - $("#clinvarTypeSearchInput").autocomplete({ - minLength: 2, - source: function(request, response) { - var results = $.ui.autocomplete.filter(availableData, request.term); - response(results.slice(0, 15)); - }, - select: function(event, ui) { - event.preventDefault(); - $("#clinvarTypeSearchInput").val(ui.item.value); - }, - focus: function(event, ui) { - event.preventDefault(); - $("#clinvarTypeSearchInput").val(ui.item.value); - } - }); - - }); - - // Add the search button - $('#clinvarSearchButton').click(function() { - if (window.clinVarFilter) clearClinVarConstraint(); - - var clinVarSignificanceSel = $('#clinvarClinicalSignificanceSearchInput').val(); - var clinVarTypeSel = $('#clinvarTypeSearchInput').val(); - - if (!clinVarSignificanceSel || !clinVarTypeSel) { - if ($("#clinvarFilterAlert").length == 0) { - $("#navbarResponsive").prepend("
    ×Please, specify a clinical significante and type in the filter input field.

    "); - - $("#closeClinVarFilterAlert").click(function() { - $("#clinvarFilterAlert").hide(); - }); - } else { - $("#clinvarFilterAlert").show(); - } - return; - } - - window.clinVarFilter = []; - - var filter = window.minesConfigs.filter(function(v){ - return v.mineName===window.selectedMineName; - })[0].customFilters.filter(function(v){ - return v.filterName==='CLINVAR'; - }); - - // Format the query - var filterQueryTypeSel = filter[0].filterQuery[0]; - filterQueryTypeSel.value = clinVarTypeSel; - var filterQuerySignificanceSel = filter[0].filterQuery[1]; - filterQuerySignificanceSel = clinVarSignificanceSel; - - // Add the type constraint - window.imTable.query.addConstraint(filterQueryTypeSel); - window.clinVarFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - - // Add the significance constraint - window.imTable.query.addConstraint(filterQuerySignificanceSel); - window.clinVarFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - - window.imTable.query.constraintLogic = window.tableConstraintLogic; - }); - - // Add the reset button - $('#clinvarResetButton').click(function() { - if (window.clinVarFilter) clearClinVarConstraint(); - $("#clinvarClinicalSignificanceSearchInput").val(''); - $("#clinvarTypeSearchInput").val(''); - }); - } - - // Protein Localisation - filter = availableCustomFilters.filter(function(v){ - return v.filterName==='Protein-Localisation'; - }); - - if (filter.length > 0) { - $("#sidebarUl").append( - ''); - - $.when(getProteinAtlasExpressionCellTypesInClass()).done(function(result) { - - var availableData = []; - - for (var i = 0; i < result.results.length; i++) { - if (result.results[i]["item"] != null) { - availableData.push({ - label: result.results[i]["item"] + " (" + result.results[i]["count"] + ")", - value: result.results[i]["item"] - }); - } - } - - $("#proteinLocalisationCellTypeSearchInput").autocomplete({ - minLength: 2, - source: function(request, response) { - var results = $.ui.autocomplete.filter(availableData, request.term); - response(results.slice(0, 15)); - }, - select: function(event, ui) { - event.preventDefault(); - $("#proteinLocalisationCellTypeSearchInput").val(ui.item.value); - }, - focus: function(event, ui) { - event.preventDefault(); - $("#proteinLocalisationCellTypeSearchInput").val(ui.item.value); - } - }); - - }); - - $.when(getProteinAtlasExpressionTissueNamesInClass()).done(function(result) { - - var availableData = []; - - for (var i = 0; i < result.results.length; i++) { - if (result.results[i]["item"] != null) { - availableData.push({ - label: result.results[i]["item"] + " (" + result.results[i]["count"] + ")", - value: result.results[i]["item"] - }); - } - } - - $("#proteinLocalisationTissueSearchInput").autocomplete({ - minLength: 2, - source: function(request, response) { - var results = $.ui.autocomplete.filter(availableData, request.term); - response(results.slice(0, 15)); - }, - select: function(event, ui) { - event.preventDefault(); - $("#proteinLocalisationTissueSearchInput").val(ui.item.value); - }, - focus: function(event, ui) { - event.preventDefault(); - $("#proteinLocalisationTissueSearchInput").val(ui.item.value); - } - }); - - }); - - $('#proteinLocalisationSearchButton').click(function() { - if (window.proteinLocalisationFilter) clearProteinLocalisationFilterConstraint(); - - var proteinLocalisationCellTypeSearchInput = $('#proteinLocalisationCellTypeSearchInput').val(); - var proteinLocalisationExpressionTypeSelector = $('#proteinLocalisationExpressionTypeSelector').val(); - var proteinLocalisationLevelSelector = $('#proteinLocalisationLevelSelector').val(); - var proteinLocalisationTissueSearchInput = $('#proteinLocalisationTissueSearchInput').val(); - var proteinLocalisationReliabilitySelector = $('#proteinLocalisationRealibilitySelector').val(); - - window.proteinLocalisationFilter = []; - - var filter = window.minesConfigs.filter(function(v){ - return v.mineName===window.selectedMineName; - })[0].customFilters.filter(function(v){ - return v.filterName==='Protein-Localisation'; - }); - - // Format the query - var filterQueryCellType = filter[0].filterQuery[0]; - filterQueryCellType.value = proteinLocalisationCellTypeSearchInput; - var filterQueryTissue = filter[0].filterQuery[1]; - filterQueryTissue.value = proteinLocalisationTissueSearchInput; - var filterQueryExpressionType = filter[0].filterQuery[2]; - filterQueryExpressionType.value = proteinLocalisationExpressionTypeSelector; - var filterQueryLevel = filter[0].filterQuery[3]; - filterQueryLevel.value = proteinLocalisationLevelSelector; - var filterQueryReliability = filter[0].filterQuery[4]; - filterQueryReliability.value = proteinLocalisationReliabilitySelector; - - // Add the constraints - if (proteinLocalisationCellTypeSearchInput) { - window.imTable.query.addConstraint(filterQueryCellType); - window.proteinLocalisationFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - } - - if (proteinLocalisationTissueSearchInput) { - window.imTable.query.addConstraint(filterQueryTissue); - window.proteinLocalisationFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - } - - if (proteinLocalisationExpressionTypeSelector != "All") { - window.imTable.query.addConstraint(filterQueryExpressionType); - window.proteinLocalisationFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - } - - if (proteinLocalisationLevelSelector != "All") { - window.imTable.query.addConstraint(filterQueryLevel); - window.proteinLocalisationFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - } - - if (proteinLocalisationReliabilitySelector != "All") { - window.imTable.query.addConstraint(filterQueryReliability); - window.proteinLocalisationFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - } - - window.imTable.query.constraintLogic = window.tableConstraintLogic; - }); - - $('#proteinLocalisationResetButton').click(function() { - if (window.proteinLocalisationFilter) clearProteinLocalisationFilterConstraint(); - $("#proteinLocalisationCellTypeSearchInput").val(''); - $("#proteinLocalisationTissueSearchInput").val(''); - }); - } - - // Protein domain filter - filter = availableCustomFilters.filter(function(v){ - return v.filterName==='Protein-Domain'; - }); - - if (filter.length > 0) { - $("#sidebarUl").append( - ''); - - $.when(getProteinDomainNamesInClass()).done(function(result) { - - var availableProteinDomainNames = []; - - for (var i = 0; i < result.results.length; i++) { - if (result.results[i]["item"] != null) { - availableProteinDomainNames.push({ - label: result.results[i]["item"] + " (" + result.results[i]["count"] + ")", - value: result.results[i]["item"] - }); - } - } - - $("#proteinDomainNameSearchInput").autocomplete({ - minLength: 3, - source: function(request, response) { - var results = $.ui.autocomplete.filter(availableProteinDomainNames, request.term); - response(results.slice(0, 15)); - }, - select: function(event, ui) { - event.preventDefault(); - $("#proteinDomainNameSearchInput").val(ui.item.value); - - // Filter the table - window.imTableConstraint["proteinDomainName"].push(ui.item.value); - updateTableWithConstraints(); - - var buttonId = ui.item.value.replace(/[^a-zA-Z0-9]/g, '') + "button"; - - $("#proteinDomainNameFilterList").append( - '
    '); - - $("#" + buttonId).click(function() { - remove(window.imTableConstraint["proteinDomainName"], ui.item.value); - updateTableWithConstraints(); - $("#" + ui.item.value.replace(/[^a-zA-Z0-9]/g, '')).remove(); - }); - }, - focus: function(event, ui) { - event.preventDefault(); - $("#proteinDomainNameSearchInput").val(ui.item.value); - } - }); - - }); - } - - //Phenotype Filter - filter = availableCustomFilters.filter(function(v){ - return v.filterName==='Phenotype'; - }); - - - if (filter.length > 0) { - window.imTableConstraint.phenotypeName = []; - $("#sidebarUl").append( - ''); - try { - $.when(getPhenotypeNames()).done(function(result) { - - var availablePhenotypeNames = []; - - for (var i = 0; i < result.results.length; i++) { - if (result.results[i]["item"] != null) { - availablePhenotypeNames.push({ - label: result.results[i]["item"] + " (" + result.results[i]["count"] + ")", - value: result.results[i]["item"] - }); - } - } - - $("#phenotypeNameSearchInput").autocomplete({ - minLength: 3, - source: function(request, response) { - var results = $.ui.autocomplete.filter(availablePhenotypeNames, request.term); - response(results.slice(0, 15)); - }, - select: function(event, ui) { - event.preventDefault(); - $("#phenotypeNameSearchInput").val(ui.item.value); - - // Filter the table - window.imTableConstraint["phenotypeName"].push(ui.item.value); - updateTableWithConstraints(); - - var buttonId = ui.item.value.replace(/[^a-zA-Z0-9]/g, '') + "button"; - - $("#phenotypeFilterList").append( - '
    '); - - $("#" + buttonId).click(function() { - remove(window.imTableConstraint["phenotypeName"], ui.item.value); - updateTableWithConstraints(); - $("#" + ui.item.value.replace(/[^a-zA-Z0-9]/g, '')).remove(); - }); - }, - focus: function(event, ui) { - event.preventDefault(); - $("#phenotypeNameSearchInput").val(ui.item.value); - } - }); - - }); - } catch (err) { - $("#phenotypeNameFilterLi").remove(); - console.log(err); - } - } - - createDatasetFilter(); // Dataset filter should be the last one - - window.CustomFiltersAdded = true; - } else { - createDatasetFilter(); // Dataset filter should be the last one - } - } -} - -/** - * Method that updates the entries in the organisms filter - * @param {string} results: the organism query results from the InterMine server - */ -function updateOrganismsSidebarFilter() { - - $.when(getItemsInClass([])).done(function(result) { - // First remove the li elements - $('#organismshortnamelist').parent().find('li').remove(); - - var colorsData = getColorsArray(result[0].response['results'].length); - - var resultantElements = result[0].response['results'].length; - - var minePreferredOrganisms = window.minesPreferredOrganisms.filter(function(v){ - return v.mineName===window.selectedMineName; - })[0]; - - countPreferredOrganismsAdded = 0; - if(minePreferredOrganisms != null) { - minePreferredOrganisms = minePreferredOrganisms.preferredOrganisms; - - // Fill the organism short name dropdown with the preferred organisms, if any - if(minePreferredOrganisms && minePreferredOrganisms.length > 0) { - colorsData = getColorsArray(minePreferredOrganisms.length); - for (var i = 0; i < resultantElements; i++) { - var organismName = result[0].response['results'][i]['item']; - var organismCount = "(" + result[0].response['results'][i]['count'] + ")"; - if(minePreferredOrganisms.includes(organismName)) { - $("#organismshortnamelist").append('
  • ' + organismName + '

    ' + organismCount + '

  • '); - - // Add to the organisms colors dict - window.organismColorsMap[organismName] = colorsData[countPreferredOrganismsAdded]; - - countPreferredOrganismsAdded++; - if(countPreferredOrganismsAdded == 10) break; - } - } - } - } - - // At most 10 elements - resultantElements = Math.max(0, Math.min(resultantElements, 10) - countPreferredOrganismsAdded); - - // Fill the organism short name dropdown with top 10 organisms according to count - for (var i = 0; i < resultantElements; i++) { - var organismName = result[0].response['results'][i]['item']; - var organismCount = "(" + result[0].response['results'][i]['count'] + ")"; - if(minePreferredOrganisms != null) { - if(!minePreferredOrganisms.includes(organismName)) { - $("#organismshortnamelist").append('
  • ' + organismName + '

    ' + organismCount + '

  • '); - // Add to the organisms colors dict - window.organismColorsMap[organismName] = colorsData[countPreferredOrganismsAdded+i]; - } - } else { - $("#organismshortnamelist").append('
  • ' + organismName + '

    ' + organismCount + '

  • '); - // Add to the organisms colors dict - window.organismColorsMap[organismName] = colorsData[countPreferredOrganismsAdded+i]; - } - } - }); -} - -/** - * Method updates the pie chart based on the organisms present - * in the current query - * @param {string} results: the organism query results from the InterMine server - */ -function updatePieChart(result, pieChartID) { - - // Update pie - if (window.pieChartObject) { - window.pieChartObject.destroy(); - } - - var ctx = document.getElementById(pieChartID); - - var countData = []; - var labelsData = []; - - var minePreferredOrganisms = window.minesPreferredOrganisms.filter(function(v){ - return v.mineName===window.selectedMineName; - })[0]; - - countPreferredOrganismsAdded = 0; - var colorsData = []; - var currentQueryOrganisms = []; - - if(minePreferredOrganisms != null) { - minePreferredOrganisms = minePreferredOrganisms.preferredOrganisms; - - // Fill the organism short name dropdown with the preferred organisms, if any - if(minePreferredOrganisms && minePreferredOrganisms.length > 0) { - colorsData = []; - - for (var i = 0; i < result[0].response['results'].length; i++) { - var organismName = result[0].response['results'][i]['item']; - if(minePreferredOrganisms.includes(organismName)) { - countData.push(result[0].response['results'][i]['count']); - labelsData.push(result[0].response['results'][i]['item'] + " (" + result[0].response['results'][i]['count'] + ")"); - colorsData.push(window.organismColorsMap[organismName]); - - currentQueryOrganisms.push(organismName); - - countPreferredOrganismsAdded++; - if(countPreferredOrganismsAdded == 10) break; - } - } - } - } - - // At most 10 elements - resultantElements = Math.max(0, Math.min(result[0].response['results'].length, 10) - countPreferredOrganismsAdded); - - for (var i = 0; i < resultantElements; i++) { - var organismName = result[0].response['results'][i]['item']; - if(minePreferredOrganisms != null) { - if(!minePreferredOrganisms.includes(organismName)) { - countData.push(result[0].response['results'][i]['count']); - labelsData.push(result[0].response['results'][i]['item'] + " (" + result[0].response['results'][i]['count'] + ")"); - colorsData.push(window.organismColorsMap[organismName]); - currentQueryOrganisms.push(organismName); - } - } else { - countData.push(result[0].response['results'][i]['count']); - labelsData.push(result[0].response['results'][i]['item'] + " (" + result[0].response['results'][i]['count'] + ")"); - colorsData.push(window.organismColorsMap[organismName]); - currentQueryOrganisms.push(organismName); - } - } - - // Count number of unique elements - var seen = {}; - currentQueryOrganisms = currentQueryOrganisms.filter(function(item) { - return seen.hasOwnProperty(item) ? false : (seen[item] = true); - }); - - if(currentQueryOrganisms.length != Object.keys(window.organismColorsMap).length) { - // Remove the checked class from the elements in the sidebar filter - $('.checked').each(function(i, obj) { - $(obj).removeClass("checked"); - $(obj).addClass("unchecked"); - }); - - // Add the checked class in the sidebar to the correct ones selected in the pie chart - $('.unchecked').each(function(i, obj) { - organismShortname = $(obj).find("a p").filter(".float-md-left").toArray()[0].innerHTML; - if(currentQueryOrganisms.includes(organismShortname)) { - $(obj).removeClass("unchecked"); - $(obj).addClass("checked"); - } - }); - } else { - $('.checked').each(function(i, obj) { - $(obj).removeClass("checked"); - $(obj).addClass("unchecked"); - }); - } - - var plotTitle = "Number of results for " + sessionStorage.getItem('currentClassView') + " by organism"; - - // Plot - var pieOptions = { - responsive: true, - maintainAspectRatio: false, - elements: { - center: { - text: '90%', - color: '#FF6384', // Default is #000000 - fontStyle: 'Arial', // Default is Arial - sidePadding: 20 // Default is 20 (as a percentage) - } - }, - legend: { - display: true, - position: 'top', - onClick: function(e) { - e.stopPropagation(); - } - }, - hover: { - mode: 'nearest', - intersect: true, - }, - title: { - display: true, - text: plotTitle, - position: 'bottom' - }, - tooltips: { - callbacks: { - label: function(tooltipItem, data) { - return data.labels[tooltipItem.index]; - } - }, - custom: function(tooltip) { - if (!tooltip.opacity) { - document.getElementById(pieChartID).style.cursor = 'default'; - return; - } - } - }, - onClick: function(evt, elements) { - if (elements.length) { - var index = elements[0]._index; - - selectedSegment = window.pieChartObject.data.labels[index].split("(")[0].trim(); - - // Clean organism filters - if(window.organismFilter) clearOrganismConstraint(); - window.imTableConstraint["organism"] = []; - - // Set the organism filter according to selected pie chart segment - window.imTableConstraint["organism"].push(selectedSegment); - - // Remove the checked class from the elements in the sidebar filter - $('.checked').each(function(i, obj) { - $(obj).removeClass("checked"); - $(obj).addClass("unchecked"); - }); - - // Add the checked class in the sidebar to the correct ones selected in the pie chart - $('.unchecked').each(function(i, obj) { - organismShortname = $(obj).find("a p").filter(".float-md-left").toArray()[0].innerHTML; - if(window.imTableConstraint["organism"].includes(organismShortname)) { - $(obj).removeClass("unchecked"); - $(obj).addClass("checked"); - } - }); - - updateTableWithConstraints(); - } - - //window.pieChartObject.update(); - } - }; - - window.pieChartObject = new Chart(ctx, { - type: 'pie', - data: { - labels: labelsData, - datasets: [{ - data: countData, - backgroundColor: colorsData, - }], - }, - options: pieOptions - }); -} - -function createGoAnnotationFilter() { - try { - $.when(getOntologyTermsInClass()).done(function(result) { - - var availableGoTerms = []; - - for (var i = 0; i < result.results.length; i++) { - if (result.results[i]["item"] != null) { - availableGoTerms.push({ - label: result.results[i]["item"] + " (" + result.results[i]["count"] + ")", - value: result.results[i]["item"] - }); - } - } - - $("#goAnnotationSearchInput").autocomplete({ - minLength: 3, - source: function(request, response) { - var results = $.ui.autocomplete.filter(availableGoTerms, request.term); - response(results.slice(0, 15)); - }, - updater: function(item) { - return item; - }, - select: function(event, ui) { - event.preventDefault(); - $("#goAnnotationSearchInput").val(ui.item.value); - - window.imTableConstraint["goAnnotation"].push(ui.item.value); - updateTableWithConstraints(); - - var buttonId = ui.item.value.replace(/[^a-zA-Z0-9]/g, '') + "button"; - - $("#goAnnotationFilterList").append( - '
    '); - - $("#" + buttonId).click(function() { - remove(window.imTableConstraint["goAnnotation"], ui.item.value); - updateTableWithConstraints(); - $("#" + ui.item.value.replace(/[^a-zA-Z0-9]/g, '')).remove(); - }); - }, - focus: function(event, ui) { - event.preventDefault(); - $("#goAnnotationSearchInput").val(ui.item.value); - } - }); - - }); - } catch (err) { - $("#goAnnotationFilterLi").remove(); - console.log(err); - } -} - -function createDatasetFilter() { - try { - if ($("#datasetFilterLi").length == 0) { - $("#sidebarUl").append( - ''); - } - - $.when(getDatasetNamesInClass()).done(function(result) { - if (!window.datasetNamesLoaded) { - var availableDatasetNames = []; - - for (var i = 0; i < result.results.length; i++) { - if (result.results[i]["item"] != null) { - if (result.results[i]["item"] == "KEGG pathways data set" || result.results[i]["item"] == "HGNC identifiers" || result.results[i]["item"] == "BioGRID interaction data set" || result.results[i]["item"] == "IntAct interactions data set" || result.results[i]["item"] == "ClinVar data set" || result.results[i]["item"] == "OMIM diseases") { - continue; - } - availableDatasetNames.push({ - label: result.results[i]["item"] + " (" + result.results[i]["count"] + ")", - value: result.results[i]["item"] - }); - } - } - - // First remove the form-check elements - $('#datasetsSelector').empty(); - - var resultantElementsNumber = result.results.length; - var resultantElementsArray = []; - - for (var i = 0; i < availableDatasetNames.length; i++) { - resultantElementsArray.push(availableDatasetNames[i]["value"]); - } - - resultantElementsArray.sort(); - - // At most, 3 elements, which are ordered (top 3) - if (resultantElementsNumber > 3) { - resultantElementsNumber = 3; - } - - // Fill the organism short name dropdown with top 5 organisms according to count - for (var i = 0; i < resultantElementsNumber; i++) { - var datasetName = resultantElementsArray[i]; - //var datasetCount = "(" + result.results[i]["count"] + ")"; - $("#datasetsSelector").append( - '
    '); - - $('#' + datasetName.replace(/[^a-zA-Z0-9]/g, '')).change(function() { - if ($(this).is(":checked")) { - var checkboxValue = $(this).val(); - window.imTableConstraint["datasetName"].push(checkboxValue); - } else { - var checkboxValue = $(this).val(); - remove(window.imTableConstraint["datasetName"], checkboxValue); - } - updateTableWithConstraints(); - }); - } - - window.datasetNamesLoaded = true; - } - - }); - } catch (err) { - $("#datasetFilterLi").remove(); - console.log(err); - } -} - -function createPathwaysNameFilter() { - try { - $.when(getPathwayNamesInClass()).done(function(result) { - - var availablePathwayNames = []; - - for (var i = 0; i < result.results.length; i++) { - if (result.results[i]["item"] != null) { - availablePathwayNames.push({ - label: result.results[i]["item"] + " (" + result.results[i]["count"] + ")", - value: result.results[i]["item"] - }); - } - } - - $("#pathwayNameSearchInput").autocomplete({ - minLength: 3, - source: function(request, response) { - var results = $.ui.autocomplete.filter(availablePathwayNames, request.term); - response(results.slice(0, 15)); - }, - select: function(event, ui) { - event.preventDefault(); - $("#pathwayNameSearchInput").val(ui.item.value); - - // Filter the table - window.imTableConstraint["pathwayName"].push(ui.item.value); - updateTableWithConstraints(); - - var buttonId = ui.item.value.replace(/[^a-zA-Z0-9]/g, '') + "button"; - - $("#pathwayFilterList").append( - '
    '); - - $("#" + buttonId).click(function() { - remove(window.imTableConstraint["pathwayName"], ui.item.value); - updateTableWithConstraints(); - $("#" + ui.item.value.replace(/[^a-zA-Z0-9]/g, '')).remove(); - }); - }, - focus: function(event, ui) { - event.preventDefault(); - $("#pathwayNameSearchInput").val(ui.item.value); - } - }); - - }); - } catch (err) { - $("#pathwayNameFilterLi").remove(); - console.log(err); - } -} - -/** - * Method to add the default filters for all mines - */ -function addDefaultFilters() { - createPathwaysNameFilter(); - createGoAnnotationFilter(); -} - -/** - * Method to fill the mine selector and add the proper event handling - */ -function fillMineSelector() { - if ($('#mineSelector option').length == 0) { - var windowUrl = new URL(window.location.href); - - $.when(getIntermines()).done(function(result) { - //$('#mineSelector').find('option').remove().end().append('').val('httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice'); - - // Need to store current mine to append it at the end, or there are some problems with selector events - var currentMineNameTemp; - var currentMineUrlTemp; - for (var i = 0; i < result.instances.length; i++) { - if (result.instances[i].url.startsWith("https")) continue; - - // Temporarily skiping mines with missing concepts for the default filters - if (result.instances[i].name == "GrapeMine" || result.instances[i].name == "RepetDB" || result.instances[i].name == "Wheat3BMine" || result.instances[i].name == "WormMine" || result.instances[i].name == "XenMine" || result.instances[i].name == "PlanMine") continue; - - // Mines giving error when querying the API or not responding - if (result.instances[i].name == "ModMine" || result.instances[i].name == "MitoMiner") continue; - - var mineUrl = result.instances[i].url; - - // Check for mines not requiring to format the URL - if (mineUrl[mineUrl.length - 1] == "/") { - mineUrl += "service"; - } else { - mineUrl += "/service"; - } - - mineUrl = formatMineURL(mineUrl); - - if(result.instances[i].name === window.selectedMineName) { - currentMineNameTemp = result.instances[i].name; - currentMineUrlTemp = mineUrl; - } else { - $('#mineSelector').append('').val(mineUrl); - } - - // In case that the user gave a mine to be rendered, set it here - if (windowUrl.searchParams.get("givenMine") && result.instances[i].name == windowUrl.searchParams.get("givenMine")) { - window.mineUrl = mineUrl; - window.selectedMineName = result.instances[i].name; - sessionStorage.setItem('currentClassView', 'Gene'); - - // Update the imTable - clearCustomFilters(); - updateElements(window.imTable.history.currentQuery.constraints, "PieChart"); - updateGeneLengthChart(window.imTable.history.currentQuery.constraints, "GeneLengthChart"); - } - - } - - $('#mineSelector').append('').val(mineUrl); - $("#mineSelector option[value='" + currentMineUrlTemp + "']").attr("selected","selected"); - - // Event handling - $("#mineSelector").change(function(e) { - // Sanity check - - if(!e.eventPhase) return false; - - var sanity = true; - var selectedOption = $("#mineSelector option:selected").text(); - var selectedOptionUrl = $(this).val(); - - $.ajax({ - 'url': escapeMineURL(selectedOptionUrl), - data: {}, - async: false, - error: function(xhr, status) { - // Check for error and cancel mine switching if an error appeared - - // Server or Client errors - if ((xhr.status >= 500 && xhr.status <= 511) || (xhr.status >= 400 && xhr.status <= 431)) { - // Show error - if ($("#unavailableMineAlert").length == 0) { - $("#navbarResponsive").prepend("
    ×Sorry, it looks like the " + selectedOption + " server is having problems right now. You can try coming back later, or try browsing a different mine using the mine selector in the top-left corner.

    "); - - $("#closeUnavailableMineAlert").click(function() { - $("#unavailableMineAlert").hide(); - }); - } else { - $("#unavailableMineAlert").show(); -} - - // Handle error - sanity = false; - e.preventDefault(); - e.stopPropagation(); - e.stopImmediatePropagation(); - return false; - } - } - }); - - if (sanity) { - // Update settings - window.mineUrl = selectedOptionUrl; - window.selectedMineName = selectedOption; - sessionStorage.setItem('currentClassView', 'Gene'); - window.datasetNamesLoaded = false; - window.CustomFiltersAdded = false; - - // Update LocalStorage if its available - if (typeof(Storage) !== "undefined") { - localStorage.setItem("mineUrl", window.mineUrl); - localStorage.setItem("selectedMineName", window.selectedMineName); - } - - location.reload(); - } - }); - - // And now fire change event for the dropdown - $('#mineSelector').trigger('change'); - - }); - } -} - -/** - * Method to handle the Custom filters available in the current selected mine - */ -function handleCustomFilters() { - if (!window.CustomFiltersAdded) { - var mineData = window.minesConfigs.filter(function(v){ - return v.mineName===window.selectedMineName; - }); - - if (mineData.length > 0) { - addCustomFilters(); - setDynamicExpressionDatasetSelectorEvents(); - window.CustomFiltersAdded = true; - } else { - // Dataset filter should be the last one - createDatasetFilter(); - } - } -} - -function setDynamicExpressionDatasetSelectorEvents() { - $('body').on('change','#expressionDatasetSelector',function(){ - var selectedDataset = $('#expressionDatasetSelector').val(); - - if(selectedDataset == "E-MTAB-513") { - $("#expressionExpressionSelector").hide(); - $("#expressionPvalueSearchInput").hide(); - $("#expressionTstatisticSearchInput").hide(); - $("#expressionTissueSearchInput").show(); - $("#expressionFPKMSearchInput").show(); - } else { - $("#expressionExpressionSelector").show(); - $("#expressionPvalueSearchInput").show(); - $("#expressionTstatisticSearchInput").show(); - $("#expressionTissueSearchInput").hide(); - $("#expressionFPKMSearchInput").hide(); - } - }); -} - -/** - * Method updates the piechart and sidebar elements according to the received constraints - * @param {string} constraints: the new constraints that the im-table is using - * @param {string} pieChartID: the div id of the pie chart, in order to update it - */ -function updateElements(constraints, pieChartID) { - fillMineSelector(); - addDefaultFilters(); - handleCustomFilters(); - initializeKeyManager(); - initializeViewManager(); - addViewManagerSelectOptions(); - - $.when(getItemsInClass(constraints)).done(function(result) { - createSidebarEvents(); - updatePieChart(result, pieChartID); - }); -} - -/** - * Method that initializes and manages the key manager keys using LocalStorage and - * fills the Key Manager modal accordingly - */ -function initializeKeyManager() { - // Check if LocalStorage is available - if (typeof(Storage) !== "undefined") { - window.interminesHashMap = []; - $.when(getIntermines()).done(function(result) { - // First get the mines - for (var i = 0; i < result.instances.length; i++) { - if (result.instances[i].url.startsWith("https")) continue; - - // Temporarily skiping mines with missing concepts for the default filters - if (result.instances[i].name == "GrapeMine" || result.instances[i].name == "RepetDB" || result.instances[i].name == "Wheat3BMine" || result.instances[i].name == "WormMine" || result.instances[i].name == "XenMine" || result.instances[i].name == "PlanMine") continue; - - // Mines giving error when querying the API or not responding - if (result.instances[i].name == "ModMine" || result.instances[i].name == "MitoMiner") continue; - - var mineName = result.instances[i].name; - - var mineUrl = result.instances[i].url; - - // Check for mines not requiring to format the URL - if (mineUrl[mineUrl.length - 1] == "/") { - mineUrl += "service"; - } else { - mineUrl += "/service"; - } - - window.interminesHashMap.push({ "mine" : mineName, "mineurl" : mineUrl, "apikey" : "Paste your API key here" }); - } - - // Now check that the API keys in LocalStorage are up-to-date - if (localStorage.getItem("api-keys")) { - // Maybe there is a new mine since last update, so let's check - var currentApiKeysObject = JSON.parse(localStorage.getItem("api-keys")); - for (var i = 0; i < window.interminesHashMap.length; i++) { - if(!findElementJSONarray(currentApiKeysObject, "mine", window.interminesHashMap[i].mine)) { - currentApiKeysObject.push({ "mine" : window.interminesHashMap[i].mine, "apikey" : "Paste your API key here" }); - } - } - localStorage.setItem("api-keys", JSON.stringify(currentApiKeysObject)); - } else { - localStorage.setItem("api-keys", JSON.stringify(window.interminesHashMap)); - } - - // Finally, feed the API manager modal - $("#apiKeyManagerModalKeysDiv").html(""); - var uptodateAPIkeysArray = JSON.parse(localStorage.getItem("api-keys")); - for (var i = 0; i < uptodateAPIkeysArray.length; i++) { - var htmlToAdd = '
    '; - - if(uptodateAPIkeysArray[i].apikey != "Paste your API key here" && uptodateAPIkeysArray[i].apikey != "") { - htmlToAdd += '
    '; - } else { - htmlToAdd += ''; - } - - $("#apiKeyManagerModalKeysDiv").append(htmlToAdd); - } - }); - } -} - -/** - * Method that initializes and manages the view manager using LocalStorage and - * fills the view manager modal accordingly - */ -function initializeViewManager() { - // First check if LocalStorage is available - if (typeof(Storage) !== "undefined") { - // Is the view manager object in Local Storage? - var currentViewManagerObject; - if (!localStorage.getItem("view-manager")) { - localStorage.setItem("view-manager", "[]"); - } - - currentViewManagerObject = JSON.parse(localStorage.getItem("view-manager")); - - - // Handle the current views display - var currentMineViewManagerSettings; - - $("#viewManagerModalCurrentViewsDiv").html(""); - - if(findElementJSONarray(currentViewManagerObject, "mine", window.selectedMineName)) { - currentMineViewManagerSettings = findElementJSONarray(currentViewManagerObject, "mine", window.selectedMineName); - if(currentMineViewManagerSettings.viewNames) { - var currentMineAndViewSettingsValues = currentMineViewManagerSettings.viewNames.split(","); - for (var i = 0; i < currentMineAndViewSettingsValues.length; i++) { - // Add the HTML - var htmlToAdd = '
    '; - htmlToAdd += '
    '; - $("#viewManagerModalCurrentViewsDiv").append(htmlToAdd); - - // Now handle the remove button - $("#viewManager" + currentMineAndViewSettingsValues[i] + "RemoveButton").click(function() { - // Get view name from the label - var labelViewName = $(this).closest("div").find("label").text(); - - // Get the current view config - var currentMineSettings = findElementJSONarray(JSON.parse(localStorage.getItem("view-manager")), "mine", window.selectedMineName); - - // Remove the correct one - var newViewConfig = currentMineSettings.viewNames.split(","); - remove(newViewConfig, labelViewName); - newViewConfig = newViewConfig.join(","); - - // Update in structure - currentMineSettings.viewNames = newViewConfig; - - // Update in Local Storage - localStorage.setItem("view-manager", JSON.stringify([currentMineSettings])); - - // Remove from list - $("#viewManager" + labelViewName + "Div").remove(); - - // Remove from main view - $("#" + labelViewName + "Button").remove(); - - // Is list now empty? - if(currentMineSettings.viewNames.split(",")[0] === "") { - $("#viewManagerModalCurrentViewsDiv").html("You have not added any custom view for this mine."); - } - }); - } - } else { - $("#viewManagerModalCurrentViewsDiv").html("You have not added any custom view for this mine."); - } - } else { - $("#viewManagerModalCurrentViewsDiv").html("You have not added any custom view for this mine."); - } - - // Handle the add buton - $("#viewManagerAddViewButton").click(function() { - var e = document.getElementById("addViewDropDown"); - var inputViewName = e.options[e.selectedIndex].value; - - currentMineViewManagerSettings = findElementJSONarray(currentViewManagerObject, "mine", window.selectedMineName) - - if(!currentMineViewManagerSettings) { - currentViewManagerObject.push({ "mine" : window.selectedMineName, "viewNames" : "" }); - currentMineViewManagerSettings = findElementJSONarray(currentViewManagerObject, "mine", window.selectedMineName) - } - - var currentViewConfig = currentMineViewManagerSettings.viewNames.split(","); - if(inputViewName != "Gene" && inputViewName != "Protein" && !currentViewConfig.includes(inputViewName)) { - currentViewConfig.push(inputViewName); - - if(currentViewConfig[0] === "") { - currentMineViewManagerSettings.viewNames = currentViewConfig[1]; - } else { - currentMineViewManagerSettings.viewNames = currentViewConfig.join(","); - } - - // Save in LS and reload - localStorage.setItem("view-manager", JSON.stringify([currentMineViewManagerSettings])); - location.reload(); - } - }); - } -} - -/** - * Method that updates the gene length chart - * @param {string} geneLengthChartID: the div id of the gene length chart, in order to update it - */ -function updateGeneLengthChart(constraints, geneLengthChartID) { - $.when(getGeneLengthsInClass(constraints)).done(function(result) { - if (window.geneLengthChartObject) { - window.geneLengthChartObject.destroy(); - } - - var ctx = document.getElementById(geneLengthChartID); - - var countData = []; - var labelsData = []; - var onHoverLabel = []; - var colorsData = Array(result['results'].length).fill("#337ab7"); - - // Statistical values - var uniqueValues = result['uniqueValues']; - var minimumValue = result['results'][0]['min']; - var maximumValue = result['results'][0]['max']; - var averageValue = parseFloat(result['results'][0]['average']).toFixed(3); - var elementsPerBucket = (maximumValue - minimumValue) / (result['results'][0].buckets); - var stdevValue = parseFloat(result['results'][0]['stdev']).toFixed(3); - var chartTitle = "Distribution of " + uniqueValues + " Gene Lengths"; - var chartSubTitle = "Min: " + minimumValue + ". Max: " + maximumValue + ". Avg: " + averageValue + ". Stdev: " + stdevValue; - - for (var i = 0; i < result['results'].length - 1; i++) { - // Lower and upper limits for each bucket - var lowerLimit = Math.round(minimumValue + (elementsPerBucket * i)); - var upperLimit = Math.round(minimumValue + (elementsPerBucket * (i+1))); - countData.push(Math.log2(result['results'][i]['count']) + 1); - labelsData.push(lowerLimit + " to " + upperLimit); - onHoverLabel.push(lowerLimit + " to " + upperLimit + ": " + result['results'][i]['count'] + " values"); - } - - // Plot - var barChartOptions = { - responsive: true, - maintainAspectRatio: false, - //Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value - scaleBeginAtZero : true, - elements: { - center: { - text: '90%', - color: '#FF6384', // Default is #000000 - fontStyle: 'Arial', // Default is Arial - sidePadding: 20 // Default is 20 (as a percentage) - } - }, - legend: { - display: false, - position: 'top', - onClick: function(e) { - e.stopPropagation(); - } - }, - hover: { - mode: 'nearest', - intersect: true, - }, - title: { - display: true, - text: [chartTitle, chartSubTitle], - position: 'bottom' - }, - scales: { - xAxes: [{ - ticks: { - beginAtZero: false, - autoSkip: false, - maxRotation: 90, - minRotation: 90 - } - }], - yAxes: [{ - ticks: { - beginAtZero: true, - min: 0, - display: false - } - }] - }, - tooltips: { - callbacks: { - label: function(tooltipItem, data) { - return onHoverLabel[tooltipItem.index]; - } - }, - custom: function(tooltip) { - if (!tooltip.opacity) { - document.getElementById(geneLengthChartID).style.cursor = 'default'; - return; - } - } - } - }; - - window.geneLengthChartObject = new Chart(ctx, { - type: 'bar', - data: { - labels: labelsData, - datasets: [{ - data: countData, - backgroundColor: colorsData, - }], - }, - options: barChartOptions - }); - }); -} diff --git a/public/javascripts/main-view.min.js b/public/javascripts/main-view.min.js deleted file mode 100644 index 63a63daa..00000000 --- a/public/javascripts/main-view.min.js +++ /dev/null @@ -1,278 +0,0 @@ -$(document).ready(function() { - - if(!sessionStorage.getItem('currentClassView')) { - sessionStorage.setItem('currentClassView', 'Gene'); - } - - var currentClassView = sessionStorage.getItem('currentClassView'); - - checkForHTTPS(); - initializeViewButtons(); - handleResponsiveness(); - handleCurrentClassFilter(currentClassView); - - window.tableConstraintLogic = "(A OR B OR C OR D OR E OR F OR G OR H OR I OR J) AND (K) AND (L) AND (M) AND (N) AND (O) AND (P) AND (Q) AND (R) AND (O AND S) AND (T AND U AND V) AND (Y AND Z AND W AND X)"; - - document.title = currentClassView + " in HumanMine"; - $("#proteinsButton").removeClass("btn-primary").addClass("btn-default"); - $("#genesButton").removeClass("btn-default").addClass("btn-primary"); - var mineUrl = window.mineUrl.replace(/COLON/g, ":").replace(/SLASH/g, "/"); - - // Remove Graphs box if class is not currently Gene or Protein (issue #39) - if(!["Gene", "Protein"].includes(currentClassView)) { - $("#graphsBoxBody").hide(); - } - - // Instantiate the im-table with all the data available in Gene from HumanMine - var selector = '#dataTable'; - var service = { - root: mineUrl, - token: getSessionToken() - }; - var query = { - constraintLogic: window.tableConstraintLogic, - select: ['*'], - //select: ['*','goAnnotation.ontologyTerm.name','pathways.name'], - from: currentClassView - }; - - imtables.configure({ - TableCell: { - PreviewTrigger: 'click' - } - }); - - imtables.configure('TableResults.CacheFactor', 20); - - var imtable = imtables.loadDash( - selector, { - "start": 0, - "size": 25 - }, { - service: service, - query: query - } - ).then( - function(table) { - table.children.table.on("rendered", function(changeDetail) { - document.title = sessionStorage.getItem('currentClassView') + " in " + window.selectedMineName; - updateElements(table.history.currentQuery.constraints, "PieChart"); - updateGeneLengthChart(table.history.currentQuery.constraints, "GeneLengthChart"); - }); - - window.imTable = table.children.table; - }, - function(error) { - console.error('Could not load table', error); - } - ); -}); - -/** - * Method that dynamically adds a IN, NOT IN and LOOKUP filter based on the current class to the left sidebar - * @param {string} currentClassView: the current class being viewed - */ -function handleCurrentClassFilter(currentClassView) { - // Add the element to the sidebar - $("#sidebarUl").prepend( - ''); - - // Handle the events - $('#' + currentClassView + 'SearchButton').click(function() { - if (window.currentClassViewFilter) clearCurrentClassViewConstraint(); - - var currentClassViewInput = $('#' + currentClassView + 'SearchInput').val(); - var currentClassViewSearchType = $('#' + currentClassView + 'SearchTypeSelector').val(); - - window.currentClassViewFilter = []; - - // Any input given? - if(currentClassViewInput) { - // LOOKUP, IN or NOTIN ? - if(currentClassViewSearchType === "LOOKUP") { - window.imTable.query.addConstraint({ - "path": currentClassView, - "op": "LOOKUP", - "value": currentClassViewInput, - "extraValue": "" - }); - - window.currentClassViewFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - } - - if(currentClassViewSearchType === "IN") { - window.imTable.query.addConstraint({ - "path": currentClassView, - "op": "IN", - "value": currentClassViewInput - }); - - window.currentClassViewFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - } - - if(currentClassViewSearchType === "NOTIN") { - window.imTable.query.addConstraint({ - "path": currentClassView, - "op": "NOT IN", - "value": currentClassViewInput - }); - - window.currentClassViewFilter.push(window.imTable.query.constraints[window.imTable.query.constraints.length - 1]); - } - } - }); - - $('#' + currentClassView + 'ResetButton').click(function() { - if (window.currentClassViewFilter) clearCurrentClassViewConstraint(); - $("#" + currentClassView + "SearchInput").val(''); - }); -} - -/** - * This method initializes the default view buttons and adds others depending on the mine and user-specific configuration - */ -function initializeViewButtons() { - var currentClassView = sessionStorage.getItem('currentClassView'); - var defaultViews = ['Gene','Protein']; - - // Add default views - for (var i = 0; i < defaultViews.length; i++) { - if(currentClassView === defaultViews[i]) { - $("#headerButtons").append( - ''); - } else { - $("#headerButtons").append( - ''); - } - - $('#' + defaultViews[i] + 'Button').click(function(event) { - sessionStorage.setItem('currentClassView', String(this.id).split('Button')[0]); - location.reload(); - }); - } - - // Add classes with preferredBagType tag for the current mine - var mineURL = escapeMineURL(window.mineUrl); - - if(mineURL.slice(-1) != "/") { - mineURL += "/"; - } - - mineURL += "model?format=json"; - - $.when(getMineModel(mineURL)).done(function(result) { - var mineClasses = JSON.parse(JSON.stringify(result.model.classes)); - var mineClassesArray = []; - for(var x in mineClasses){ - mineClassesArray.push(mineClasses[x]); - } - - for (var i = 0; i < mineClassesArray.length; i++) { - if(mineClassesArray[i].tags.includes("im:preferredBagType") && !defaultViews.includes(mineClassesArray[i].name)) { - if(currentClassView === mineClassesArray[i].name) { - $("#headerButtons").append( - ''); - } else { - $("#headerButtons").append( - ''); - } - - $('#' + mineClassesArray[i].name + 'Button').click(function(event) { - sessionStorage.setItem('currentClassView', String(this.id).split('Button')[0]); - location.reload(); - }); - } - } - }); - - // Add custom views - if (!localStorage.getItem("view-manager")) { - localStorage.setItem("view-manager", "[]"); - } - - var currentViewManagerObject = JSON.parse(localStorage.getItem("view-manager")); - if(findElementJSONarray(currentViewManagerObject, "mine", window.selectedMineName)) { - var currentMineViewManagerSettings = findElementJSONarray(currentViewManagerObject, "mine", window.selectedMineName); - if(currentMineViewManagerSettings.viewNames) { - var currentMineAndViewSettingsValues = currentMineViewManagerSettings.viewNames.split(","); - for (var i = 0; i < currentMineAndViewSettingsValues.length; i++) { - // Add the HTML - if(currentClassView === currentMineAndViewSettingsValues[i]) { - $("#headerButtons").append( - ''); - } else { - $("#headerButtons").append( - ''); - } - - $('#' + currentMineAndViewSettingsValues[i] + 'Button').click(function(event) { - sessionStorage.setItem('currentClassView', String(this.id).split('Button')[0]); - location.reload(); - }); - } - } - } -} - -/** - * This method checks if there has been any window resize event to change the navbar padding accordingly - */ -function handleResponsiveness() { - var width = $(window).width(); - - // Initial sizing - if (width < 992) { - var navbarHeight = $("#navbarResponsive").height(); - if (width < 770) { - $("body.fixed-nav").css("padding-top", navbarHeight + 75); - } else { - $("body.fixed-nav").css("padding-top", navbarHeight + 56); - } - } else { - $("body.fixed-nav").css("padding-top", "56px"); - } - - // Event handling - $(window).on('resize', function() { - if ($(this).width() != width) { - width = $(this).width(); - // Regular device - if (width < 992) { - var navbarHeight = $("#navbarResponsive").height(); - if (width < 770) { - $("body.fixed-nav").css("padding-top", navbarHeight + 75); - } else { - $("body.fixed-nav").css("padding-top", navbarHeight + 56); - } - } - // Small device - else { - $("body.fixed-nav").css("padding-top", "56px"); - } - } - }); -} - -/** - * This method removes any constraint that has been applied to the current class view filter - */ -function clearCurrentClassViewConstraint() { - for(var i = 0; i < window.currentClassViewFilter.length; i++) { - try { - window.imTable.query.removeConstraint(window.currentClassViewFilter[i]); - } - catch(err) { - continue; - } - } - window.currentClassViewFilter = null; -} - -/** - * This method checks if the user is using HTTPS protocol to access the browser in order to show an informative warning - */ -function checkForHTTPS() { - if (window.location.protocol.includes("https")) { - $("#navbarResponsive").prepend("
    You are currently viewing the HTTPS website. Due to security limitations, we are unable to show results from HTTP-only InterMines. You may be able to see more results if you reload this site via HTTP, and/or allow unsafe scripts to run.

    "); - } -} diff --git a/public/javascripts/piechart-events.min.js b/public/javascripts/piechart-events.min.js deleted file mode 100644 index ce69f4a1..00000000 --- a/public/javascripts/piechart-events.min.js +++ /dev/null @@ -1 +0,0 @@ -function formatChartClickedSegmentAsConstraintForFilter(r){var t=[[],[]];return t[0].push({path:"organism.shortName",op:"=",value:r.trim(),code:"A"}),t[1].push("A"),1 1) { - result[1] = result[1].join(" or "); - } else { - result[1] = result[1].join(""); - } - - return result; -} - -/** - * This method adds the event handling to the sidebar - */ -function createSidebarEvents() { - $('#organismshortnamelist li').click(function() { - if ($(this).hasClass("checked")) { - $(this).removeClass("checked"); - $(this).addClass("unchecked"); - } else { - $(this).addClass("checked"); - $(this).removeClass("unchecked"); - } - - var selectedOrganismsArray = $('.checked a p').filter(".float-md-left").toArray(); - - if(selectedOrganismsArray.length > 0) { - if(window.organismFilter) clearOrganismConstraint(); - - window.imTableConstraint["organism"] = []; - - for(var i = 0; i < selectedOrganismsArray.length; i++) { - window.imTableConstraint["organism"].push(selectedOrganismsArray[i].innerHTML); - } - } else { - window.imTableConstraint["organism"] = [] - if(window.organismFilter) clearOrganismConstraint(); - } - - updateTableWithConstraints(); - }); - - $('#btnDatasetViewMore').click(function() { - if (!window.showingMoreDatasets) { - window.showingMoreDatasets = true; - showMoreDatasetNames(); - $('#btnDatasetViewMore').remove(); - } - }); -} - -/** - * This method removes any constraint that has been applied to the Protein Localisation filter - */ -function clearProteinLocalisationFilterConstraint() { - for(var i = 0; i < window.proteinLocalisationFilter.length; i++) { - try { - window.imTable.query.removeConstraint(window.proteinLocalisationFilter[i]); - } - catch(err) { - continue; - } - } - window.expressionFilter = null; -} - -/** - * This method removes any constraint that has been applied to the Expression filter - */ -function clearExpressionFilterConstraint() { - for(var i = 0; i < window.expressionFilter.length; i++) { - try { - window.imTable.query.removeConstraint(window.expressionFilter[i]); - } - catch(err) { - continue; - } - } - window.expressionFilter = null; -} - -/** - * This method removes any constraint that has been applied to the Locations filter - */ -function clearLocationConstraint() { - for(var i = 0; i < window.locationFilter.length; i++) { - try { - window.imTable.query.removeConstraint(window.locationFilter[i]); - } - catch(err) { - continue; - } - } - window.locationFilter = null; -} - -/** - * This method removes any constraint that has been applied to the Interactions filter - */ -function clearInteractionsConstraint() { - for(var i = 0; i < window.interactionsFilter.length; i++) { - try { - window.imTable.query.removeConstraint(window.interactionsFilter[i]); - } - catch(err) { - continue; - } - } - window.interactionsFilter = null; -} - -/** - * This method removes any constraint that has been applied to the Organism filter - */ -function clearOrganismConstraint() { - for(var i = 0; i < window.organismFilter.length; i++) { - try { - window.imTable.query.removeConstraint(window.organismFilter[i]); - } - catch(err) { - continue; - } - } - window.organismFilter = null; -} - -/** - * This method removes any constraint that has been applied to the ClinVar filter - */ -function clearClinVarConstraint() { - for(var i = 0; i < window.clinVarFilter.length; i++) { - try { - window.imTable.query.removeConstraint(window.clinVarFilter[i]); - } - catch(err) { - continue; - } - } - window.clinVarFilter = null; -} - -/** - * This method adds a dataset constraint to the im-table. - * @param {string} input the dataset name to be added as a filter - */ -function addDatasetConstraint(datasetName) { - // Filter by the selected dataset name - window.imTable.query.addConstraint({ - "path": "dataSets.name", - "op": "==", - "value": datasetName, - "code": datasetName.replace(/ /g, '') - }); -} \ No newline at end of file diff --git a/public/javascripts/utils.min.js b/public/javascripts/utils.min.js deleted file mode 100644 index 2a42f1c0..00000000 --- a/public/javascripts/utils.min.js +++ /dev/null @@ -1,107 +0,0 @@ -function findElementJSONarray(arr, propName, propValue) { - for (var i=0; i < arr.length; i++) - if (arr[i][propName] == propValue) - return arr[i]; -} - -/** - * Method that escapes a mine URL (to not valid URL format) - * @param {string} mineURL: the mine URL - * @returns {string} the escapped mine URL - */ -function formatMineURL(mineURL) { - return mineURL.replace(/:/g, "COLON").replace(/\//g, "SLASH"); -} - -/** - * Method that escapes a mine URL (to valid URL format) - * @param {string} mineURL: the mine URL - * @returns {string} the formatted mine URL - */ -function escapeMineURL(mineURL) { - return mineURL.replace(/COLON/g, ":").replace(/SLASH/g, "/"); -} - -/** - * Method to read a json file from a given location - */ -function readTextFile(file, callback) { - var rawFile = new XMLHttpRequest(); - rawFile.overrideMimeType("application/json"); - rawFile.open("GET", file, true); - rawFile.onreadystatechange = function() { - if (rawFile.readyState === 4 && rawFile.status == "200") { - callback(rawFile.responseText); - } - } - rawFile.send(null); -} - -/** - * Auxiliary function to remove an element from an array - */ -function remove(arr, what) { - var found = arr.indexOf(what); - - while (found !== -1) { - arr.splice(found, 1); - found = arr.indexOf(what); - } -} - -/** - * Auxiliary function to flatten an array - * @param {array} arr: the array to be flattened - * @returns {array} the flattened array - */ -function flatten(arr) { - return arr.reduce(function(flat, toFlatten) { - return flat.concat(Array.isArray(toFlatten) ? flatten(toFlatten) : toFlatten); - }, []); -} - -/** - * This method is used to get an array of hexadecimal colors, following the rainbow pattern, with the given size (useful for plots) - * @param {number} input the size of the array of colors - * @returns {array} an array of hexadecimal colors with the specific size, following a rainbow pattern - */ -function getColorsArray(size) { - var rainbow = [ - "#fbb735", "#e98931", "#eb403b", "#b32E37", "#6c2a6a", - "#5c4399", "#274389", "#1f5ea8", "#227FB0", "#2ab0c5", - "#39c0b3", '#b3cae5', '#dbdde4', '#e4e3e4', '#f7ddbb', '#efcab2', - '#bccacc', '#c7d8d6', '#d9ebe0', '#ebf9e3', '#f4f8d0', - '#5e7fb1', '#dce8f7', '#eff1f4', '#fce1a8', '#f7ec86', - '#8fb8ee', '#cbe2f4', '#dbe5eb', '#f9d3b8', '#e0b2a3', - '#a2e0f9', '#cef5fc', '#eafaeb', '#fefcd3', '#fdf4ba', - '#6bafd2', '#a4c8dc', '#d6cbca', '#eabc96', '#db8876', - '#b4ced8', '#d7e5d4', '#e2e8c9', '#f1e5b9', '#edd7ac', - '#29153e', '#657489', '#bfb6aa', '#ead79d', '#f2ebda', - '#20202f', '#273550', '#416081', '#adacb2', '#eac3a2', - '#555351', '#555351', '#8d7b6c', '#cc9d7a', '#fff9aa', - '#171c33', '#525f83', '#848896', '#bb9d78', '#f6e183', - '#ffe3c8', '#efad9e', '#c79797', '#a78a92', '#857d8d', - '#6f749e', '#9a8daf', '#d0a8b9', '#f8bbb1', '#fde6b1', - '#536a97', '#8087ad', '#bca391', '#bd968a', '#a38b8a', - '#325176', '#7b9ea7', '#9baf93', '#dbaf81', '#fbdf73', - '#727288', '#8e889b', '#d3c2bd', '#f9d89a', '#f8c785', - '#506e90', '#7695aa', '#a7bdb8', '#e2e2b8', '#fdf998', - '#634b5f', '#868080', '#b7b29b', '#dfd6a4', '#e9f3a2', - '#7e74b2', '#b3a2c2', '#e2cdbe', '#f6cf97', '#f4a77a', - '#34a4ca', '#59d7dd', '#a8f2f0', '#d0f8ef', '#d6f6e1', - '#7696cd', '#8fb2e4', '#b0cff0', '#d7e5ec', '#dee0e7', - '#8dd6c3', '#c5e5e2', '#eafaeb', '#f9f7ca', '#fceea1', - '#4e72c7', '#6d9ed7', '#a4c8d5', '#b4d9e1', '#c4d9d6', - '#47565f', '#5b625a', '#947461', '#f98056', '#f7ec86', - '#95b3bf', '#c6cdd3', '#e5d8d9', '#f1e1d9', '#f3e1cd', - '#4c86ab', '#95a5bc', '#bfcdc9', '#dcd6c9', '#edd9c7', - '#0f124a', '#1b2360', '#515b80', '#758391', '#e5e3b0', - '#889db6', '#a5b8ce', '#c1cfdd', '#dee1e4', '#d5d1cf', - '#74bddb', '#a8d1eb', '#cddbf5', '#e4e6fb', '#f6f4f8', - '#a7d3cb', '#bcc1c4', '#e5cab3', '#fee6c5', '#fdecd0', - '#325571', '#8e9fa4', '#decab2', '#f2d580', '#ffa642', - '#c5d4d7', '#d6b98d', '#c99262', '#8c5962', '#43577e' - ]; - - return rainbow; -} \ No newline at end of file diff --git a/public/mine_configs/mines_config.json b/public/mine_configs/mines_config.json deleted file mode 100644 index 601bd092..00000000 --- a/public/mine_configs/mines_config.json +++ /dev/null @@ -1,108 +0,0 @@ -[ - { - "mineName": "HumanMine", - "customFilters": [ - { - "filterQuery": [{ - "path": "alleles.type", - "op": "==", - "value": "AAA", - "code": "O" - }, - { - "path": "alleles.clinicalSignificance", - "op": "==", - "value": "BBB", - "code": "S" - } - ], - "filterName": "CLINVAR" - }, - { - "filterQuery": [{ - "path": "diseases.name", - "op": "ONE OF", - "values": "AAA", - "code": "P" - } - ], - "filterName": "Diseases" - }, - { - "filterQuery": [{ - "path": "proteins.proteinDomainRegions.proteinDomain.name", - "op": "ONE OF", - "values": "AAA", - "code": "Q" - } - ], - "filterName": "Protein-Domain" - }, - { - "filterQuery": [{ - "path": "interactions.participant2.symbol", - "op": "==", - "value": "AAA", - "code": "T" - }, - { - "path": "interactions.details.type", - "op": "==", - "value": "BBB", - "code": "U" - }, - { - "path": "interactions.details.dataSets.name", - "op": "==", - "value": "CCC", - "code": "V" - } - ], - "filterName": "Interactions" - }, - { - "filterQuery": [{ - "path": "atlasExpression.pValue", - "op": ">=", - "value": "AAA", - "code": "W" - }, - { - "path": "atlasExpression.tStatistic", - "op": ">=", - "value": "BBB", - "code": "X" - }, - { - "path": "atlasExpression.expression", - "op": ">=", - "value": "CCC", - "code": "Y" - }, - { - "path": "atlasExpression.dataSets.name", - "op": "==", - "value": "DDD", - "code": "Z" - }, - { - "path": "atlasExpression.condition", - "op": "==", - "value": "BBB", - "code": "X" - } - ], - "filterName": "Expression" - }, - { - "filterQuery": [{ - "path": "diseases.hpoAnnotations.hpoTerm.name", - "op": "ONE OF", - "values": "AAA", - "code": "R" - }], - "filterName": "Phenotype" - } - ] - } -] \ No newline at end of file diff --git a/public/mine_configs/mines_preferred_organisms.json b/public/mine_configs/mines_preferred_organisms.json deleted file mode 100644 index ab122643..00000000 --- a/public/mine_configs/mines_preferred_organisms.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - { - "mineName": "FlyMine", - "preferredOrganisms": ["D. persimilis", "D. sechellia", "D. yakuba", "D. ananassae", "D. grimshawi", "D. simulans", "D. virilis", "D. erecta", "D. rerio", "D. melanogaster", "D. pseudoobscura", "D. willistoni", "D. mojavensis"] - } -] \ No newline at end of file diff --git a/public/stylesheets/data-browser-style-main.css b/public/stylesheets/data-browser-style-main.css deleted file mode 100644 index ec2bf2f7..00000000 --- a/public/stylesheets/data-browser-style-main.css +++ /dev/null @@ -1,706 +0,0 @@ -/* The alert message box */ -.alert { - background-color: #f44336; - /* Red */ - color: white; - position: absolute; - top: 100px; - left: 50%; - margin-left: -300px; - width: 600px; - transform: translateY(-50%); - z-index: 1000; -} - -/* The close button */ -.closebtn { - margin-left: 15px; - color: white; - font-weight: bold; - float: right; - font-size: 22px; - line-height: 20px; - cursor: pointer; - transition: 0.3s; -} - -/* When moving the mouse over the close button */ -.closebtn:hover { - color: black; -} - -.ui-autocomplete { - position: absolute; - top: 100%; - left: 0; - z-index: 1000; - display: none; - float: left; - min-width: 160px; - padding: 5px 0; - margin: 2px 0 0; - list-style: none; - font-size: 14px; - text-align: left; - background-color: #ffffff; - border: 1px solid #cccccc; - border: 1px solid rgba(0, 0, 0, 0.15); - border-radius: 4px; - -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); - box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); - background-clip: padding-box; -} - -.centeredSelect { - display: block; - margin: 0 auto; -} - -.ui-autocomplete > li > div { - display: block; - padding: 3px 20px; - clear: both; - font-weight: normal; - line-height: 1.42857143; - color: #333333; - white-space: nowrap; -} - -.ui-state-hover, -.ui-state-active, -.ui-state-focus { - text-decoration: none; - color: #262626; - background-color: #f5f5f5; - cursor: pointer; -} - -.ui-helper-hidden-accessible { - border: 0; - clip: rect(0 0 0 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; -} - -html { - position: relative; - min-height: 100%; -} - -body { - overflow-x: hidden; -} - -body.sticky-footer { - margin-bottom: 56px; -} - -body.sticky-footer .content-wrapper { - min-height: calc(100vh - 56px - 56px); -} - -.checked { - background-color: #a4eafc; -} - -body.fixed-nav { - padding-top: 56px; -} - -@media screen and (max-width: 991px) { - body.fixed-nav { - padding-top: calc(56px * 8.5); - } -} - -.content-wrapper { - min-height: calc(100vh - 56px); - padding-top: 1rem; -} - -.scroll-to-top { - position: fixed; - right: 15px; - bottom: 3px; - display: none; - width: 50px; - height: 50px; - text-align: center; - color: white; - background: rgba(52, 58, 64, 0.5); - line-height: 45px; -} - -.scroll-to-top:focus, .scroll-to-top:hover { - color: white; -} - -.scroll-to-top:hover { - background: #343a40; -} - -.scroll-to-top i { - font-weight: 800; -} - -.ui-state-active a, -.ui-state-active a:link, -.ui-state-active a:visited { - color: #ffffff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); - background-color: #006dcc; - *background-color: #0044cc; - background-image: -moz-linear-gradient(top, #0088cc, #0044cc); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); - background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); - background-image: -o-linear-gradient(top, #0088cc, #0044cc); - background-image: linear-gradient(to bottom, #0088cc, #0044cc); - background-repeat: repeat-x; -} - -.ui-widget-content .ui-state-active { - color: #ffffff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); - background-color: #006dcc; - *background-color: #0044cc; - background-image: -moz-linear-gradient(top, #0088cc, #0044cc); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); - background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); - background-image: -o-linear-gradient(top, #0088cc, #0044cc); - background-image: linear-gradient(to bottom, #0088cc, #0044cc); - background-repeat: repeat-x; -} - -#clearFilterButton { - background-color: #c1c1c1; -} - -#sidebarSeparator { - width: 100%; - background-color: rgba(0, 0, 0, 0); - border-radius: 0px; -} - -.im-empty-apology .alert .btn { - display: none; -} - -.im-join-manager-button .btn { - display: none; -} - -.im-filter-dialogue-button .btn { - display: none; -} - -.im-column-manager-button .btn { - display: none; -} - -.im-history .btn { - display: none; -} - -.imtables .dropdown-menu { - min-width: 360px; -} - -.imtables .dropdown-toggle::after { - display: none; -} - -.aligned_form { - display: flex; - flex-flow: column wrap; - align-content: flex-start; - height: 75px; -} - -.container { - /* Flex Properties */ - display: flex; - flex-wrap: wrap; - flex-direction: column; - align-items: center; -} - -.apiKeyElement { - display: flex; - align-items: center; -} - -label { - width: 200px; -} - -button { - padding: 5px; -} - -#graphsBoxBody { - display: flex; - flex-wrap: wrap; - flex-direction: row; - align-items: center; -} - -@media (max-width: 991px) { - #graphsBoxBody { - display: flex; - flex-wrap: wrap; - flex-direction: column; - align-items: center; - } -} - -.viewManagerElement { - display: flex; - align-items: center; - padding: 5px; -} - -select, button { - vertical-align: top; -} - -.saved-list-item { - overflow-x: auto; - cursor: pointer; -} - -#listManagerSaveButton { - margin-right: 5px; -} - -#listManagerResetButton { - margin-right: 5px; - background-color: #6c757d; - color: white; -} - -input, select { - width: 100%; -} - -.smaller { - font-size: 0.7rem; -} - -.o-hidden { - overflow: hidden !important; -} - -.z-0 { - z-index: 0; -} - -.z-1 { - z-index: 1; -} - -#mainNav .navbar-collapse { - overflow: auto; -} - -#mainNav .navbar-collapse .navbar-nav .nav-item .nav-link { - cursor: pointer; -} - -#mainNav .navbar-collapse .navbar-sidenav .nav-link-collapse:after { - float: right; - content: '\f107'; - font-family: 'FontAwesome'; -} - -#mainNav .navbar-collapse .navbar-sidenav .nav-link-collapse.collapsed:after { - content: '\f105'; -} - -#mainNav .navbar-collapse .navbar-sidenav .sidenav-second-level, -#mainNav .navbar-collapse .navbar-sidenav .sidenav-third-level { - padding-left: 0; -} - -#mainNav .navbar-collapse .navbar-sidenav .sidenav-second-level > li > a, -#mainNav .navbar-collapse .navbar-sidenav .sidenav-third-level > li > a { - display: block; - padding: 0.5em 0; -} - -#mainNav .navbar-collapse .navbar-sidenav .sidenav-second-level > li > a:focus, #mainNav .navbar-collapse .navbar-sidenav .sidenav-second-level > li > a:hover, -#mainNav .navbar-collapse .navbar-sidenav .sidenav-third-level > li > a:focus, -#mainNav .navbar-collapse .navbar-sidenav .sidenav-third-level > li > a:hover { - text-decoration: none; -} - -#mainNav .navbar-collapse .navbar-sidenav .sidenav-second-level > li > a { - padding-left: 1em; -} - -#mainNav .navbar-collapse .navbar-sidenav .sidenav-third-level > li > a { - padding-left: 2em; -} - -#mainNav .navbar-collapse .sidenav-toggler { - display: none; -} - -#mainNav .navbar-collapse .navbar-nav > .nav-item.dropdown > .nav-link { - position: relative; - min-width: 45px; -} - -#mainNav .navbar-collapse .navbar-nav > .nav-item.dropdown > .nav-link:after { - float: right; - width: auto; - content: '\f105'; - border: none; - font-family: 'FontAwesome'; -} - -#mainNav .navbar-collapse .navbar-nav > .nav-item.dropdown > .nav-link .indicator { - position: absolute; - top: 5px; - left: 21px; - font-size: 10px; -} - -#mainNav .navbar-collapse .navbar-nav > .nav-item.dropdown.show > .nav-link:after { - content: '\f107'; -} - -#mainNav .navbar-collapse .navbar-nav > .nav-item.dropdown .dropdown-menu > .dropdown-item > .dropdown-message { - overflow: hidden; - max-width: none; - text-overflow: ellipsis; -} - -@media (min-width: 992px) { - #mainNav .navbar-brand { - width: 225px; - } - #mainNav .navbar-collapse { - overflow: visible; - max-height: none; - } - #mainNav .navbar-collapse .navbar-sidenav { - position: absolute; - top: 0; - left: 0; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; - margin-top: 56px; - } - #mainNav .navbar-collapse .navbar-sidenav > .nav-item { - width: 225px; - padding: 0; - } - #mainNav .navbar-collapse .navbar-sidenav > .nav-item > .nav-link { - padding: 1em; - } - #mainNav .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level, - #mainNav .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level { - padding-left: 0; - list-style: none; - } - #mainNav .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li, - #mainNav .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li { - width: 225px; - } - #mainNav .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a, - #mainNav .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a { - padding: 1em; - } - #mainNav .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a { - padding-left: 2.75em; - } - #mainNav .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a { - padding-left: 3.75em; - } - #mainNav .navbar-collapse .navbar-nav > .nav-item.dropdown > .nav-link { - min-width: 0; - } - #mainNav .navbar-collapse .navbar-nav > .nav-item.dropdown > .nav-link:after { - width: 24px; - text-align: center; - } - #mainNav .navbar-collapse .navbar-nav > .nav-item.dropdown .dropdown-menu > .dropdown-item > .dropdown-message { - max-width: 300px; - } -} - -#mainNav.fixed-top .sidenav-toggler { - display: none; -} - -@media (min-width: 992px) { - #mainNav.fixed-top .navbar-sidenav { - height: calc(100vh - 56px); - } - #mainNav.fixed-top .sidenav-toggler { - position: absolute; - top: 0; - left: 0; - display: flex; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; - margin-top: calc(100vh - 56px); - } - #mainNav.fixed-top .sidenav-toggler > .nav-item { - width: 225px; - padding: 0; - } - #mainNav.fixed-top .sidenav-toggler > .nav-item > .nav-link { - padding: 1em; - } -} - -#mainNav.fixed-top.navbar-dark .sidenav-toggler { - background-color: #fd7e14; -} - -#mainNav.fixed-top.navbar-dark .sidenav-toggler a i { - color: #fd7e14; -} - -#mainNav.fixed-top.navbar-light .sidenav-toggler { - background-color: #fd7e14; -} - -#mainNav.fixed-top.navbar-light .sidenav-toggler a i { - color: rgba(0, 0, 0, 0.5); -} - -.btn-space { - margin-right: 5px; -} - -body.sidenav-toggled #mainNav.fixed-top .sidenav-toggler { - overflow-x: hidden; - width: 55px; -} - -body.sidenav-toggled #mainNav.fixed-top .sidenav-toggler .nav-item, -body.sidenav-toggled #mainNav.fixed-top .sidenav-toggler .nav-link { - width: 55px !important; -} - -body.sidenav-toggled #mainNav.fixed-top #sidenavToggler i { - -webkit-transform: scaleX(-1); - -moz-transform: scaleX(-1); - -o-transform: scaleX(-1); - transform: scaleX(-1); - filter: FlipH; - -ms-filter: 'FlipH'; -} - -.content-wrapper { - overflow-x: hidden; - background: white; -} - -@media (min-width: 992px) { - .content-wrapper { - margin-left: 225px; - } -} - -#sidenavToggler i { - font-weight: 800; -} - -.navbar-sidenav-tooltip.show { - display: none; -} - -@media (min-width: 992px) { - body.sidenav-toggled .content-wrapper { - margin-left: 55px; - } -} - -body.sidenav-toggled .navbar-sidenav { - width: 55px; -} - -body.sidenav-toggled .navbar-sidenav .nav-link-text { - display: none; -} - -body.sidenav-toggled .navbar-sidenav .nav-item, -body.sidenav-toggled .navbar-sidenav .nav-link { - width: 55px !important; -} - -body.sidenav-toggled .navbar-sidenav .nav-item:after, -body.sidenav-toggled .navbar-sidenav .nav-link:after { - display: none; -} - -body.sidenav-toggled .navbar-sidenav .nav-item { - white-space: nowrap; -} - -body.sidenav-toggled .navbar-sidenav-tooltip.show { - display: flex; -} - -#mainNav.navbar-dark .navbar-collapse .navbar-sidenav .nav-link-collapse:after { - color: #e9ecef; -} - -#mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item > .nav-link { - color: #e9ecef; -} - -#mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item > .nav-link:hover { - color: #e9ecef; -} - -#mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a, -#mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a { - color: #e9ecef; -} - -#mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a:focus, #mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a:hover, -#mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a:focus, -#mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a:hover { - color: #e9ecef; -} - -#mainNav.navbar-dark .navbar-collapse .navbar-nav > .nav-item.dropdown > .nav-link:after { - color: #e9ecef; -} - -@media (min-width: 992px) { - #mainNav.navbar-dark .navbar-collapse .navbar-sidenav { - background: #e9ecef; - } - #mainNav.navbar-dark .navbar-collapse .navbar-sidenav li.active a { - color: white !important; - background-color: #e9ecef; - } - #mainNav.navbar-dark .navbar-collapse .navbar-sidenav li.active a:focus, #mainNav.navbar-dark .navbar-collapse .navbar-sidenav li.active a:hover { - color: white; - } - #mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level, - #mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level { - background: #e9ecef; - } -} - -#mainNav.navbar-light .navbar-collapse .navbar-sidenav .nav-link-collapse:after { - color: rgba(0, 0, 0, 0.5); -} - -#mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item > .nav-link { - color: rgba(0, 0, 0, 0.9); -} - -#mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item > .nav-link:hover { - color: rgba(0, 0, 0, 0.4); -} - -#mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a, -#mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a { - color: rgba(0, 0, 0, 0.9); -} - -#mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a:focus, #mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a:hover, -#mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a:focus, -#mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a:hover { - color: rgba(0, 0, 0, 0.4); -} - -#mainNav.navbar-light .navbar-collapse .navbar-nav > .nav-item.dropdown > .nav-link:after { - color: rgba(253, 126, 20, 0.5); -} - -@media (min-width: 992px) { - #mainNav.navbar-light .navbar-collapse .navbar-sidenav { - background: #e9ecef; - } - #mainNav.navbar-light .navbar-collapse .navbar-sidenav li.active a { - color: #e9ecef !important; - background-color: #e9ecef; - } - #mainNav.navbar-light .navbar-collapse .navbar-sidenav li.active a:focus, #mainNav.navbar-light .navbar-collapse .navbar-sidenav li.active a:hover { - color: #e9ecef; - } - #mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level, - #mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level { - background: #e9ecef; - } -} - -#mainNav.navbar-orange .navbar-collapse .navbar-sidenav .nav-link-collapse:after { - color: rgba(0, 0, 0, 0.5); -} - -#mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item > .nav-link { - color: rgba(0, 0, 0, 0.5); -} - -#mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item > .nav-link:hover { - color: rgba(0, 0, 0, 0.7); -} - -#mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a, -#mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a { - color: rgba(0, 0, 0, 0.5); -} - -#mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a:focus, #mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a:hover, -#mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a:focus, -#mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a:hover { - color: rgba(0, 0, 0, 0.7); -} - -#mainNav.navbar-orange .navbar-collapse .navbar-nav > .nav-item.dropdown > .nav-link:after { - color: rgba(0, 0, 0, 0.5); -} - -@media (min-width: 992px) { - #mainNav.navbar-orange .navbar-collapse .navbar-sidenav { - background: #e9ecef; - } - #mainNav.navbar-orange .navbar-collapse .navbar-sidenav li.active a { - color: #e9ecef !important; - background-color: #e9ecef; - } - #mainNav.navbar-orange .navbar-collapse .navbar-sidenav li.active a:focus, #mainNav.navbar-orange .navbar-collapse .navbar-sidenav li.active a:hover { - color: #e9ecef; - } - #mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level, - #mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level { - background: #e9ecef; - } -} - -footer.sticky-footer { - position: absolute; - right: 0; - bottom: 0; - width: 100%; - height: 56px; - background-color: #e9ecef; - line-height: 55px; -} - -@media (min-width: 992px) { - footer.sticky-footer { - width: calc(100% - 225px); - } -} - -@media (min-width: 992px) { - body.sidenav-toggled footer.sticky-footer { - width: calc(100% - 55px); - } -} diff --git a/public/stylesheets/hmb-style-main.css b/public/stylesheets/hmb-style-main.css deleted file mode 100644 index 7da2a1c4..00000000 --- a/public/stylesheets/hmb-style-main.css +++ /dev/null @@ -1,795 +0,0 @@ -/* The alert message box */ -.alert { - background-color: #f44336; - /* Red */ - color: white; - position: absolute; - top: 100px; - left: 50%; - margin-left: -300px; - width: 600px; - transform: translateY(-50%); - z-index: 1000; -} - -/* The close button */ -.closebtn { - margin-left: 15px; - color: white; - font-weight: bold; - float: right; - font-size: 22px; - line-height: 20px; - cursor: pointer; - transition: 0.3s; -} - -/* When moving the mouse over the close button */ -.closebtn:hover { - color: black; -} - -.ui-autocomplete { - position: absolute; - top: 100%; - left: 0; - z-index: 1000; - display: none; - float: left; - min-width: 160px; - padding: 5px 0; - margin: 2px 0 0; - list-style: none; - font-size: 14px; - text-align: left; - background-color: #ffffff; - border: 1px solid #cccccc; - border: 1px solid rgba(0, 0, 0, 0.15); - border-radius: 4px; - -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); - box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175); - background-clip: padding-box; -} - -.ui-autocomplete > li > div { - display: block; - padding: 3px 20px; - clear: both; - font-weight: normal; - line-height: 1.42857143; - color: #333333; - white-space: nowrap; -} - -.ui-state-hover, -.ui-state-active, -.ui-state-focus { - text-decoration: none; - color: #262626; - background-color: #f5f5f5; - cursor: pointer; -} - -.ui-helper-hidden-accessible { - border: 0; - clip: rect(0 0 0 0); - height: 1px; - margin: -1px; - overflow: hidden; - padding: 0; - position: absolute; - width: 1px; -} - -html { - position: relative; - min-height: 100%; -} - -body { - overflow-x: hidden; -} - -body.sticky-footer { - margin-bottom: 56px; -} - -body.sticky-footer .content-wrapper { - min-height: calc(100vh - 56px - 56px); -} - -.checked { - background-color: #a4eafc; -} - -body.fixed-nav { - padding-top: 56px; -} - -@media screen and (max-width: 991px) { - body.fixed-nav { - padding-top: calc(56px * 8.5); - } -} - -.content-wrapper { - min-height: calc(100vh - 56px); - padding-top: 1rem; -} - -.scroll-to-top { - position: fixed; - right: 15px; - bottom: 3px; - display: none; - width: 50px; - height: 50px; - text-align: center; - color: white; - background: rgba(52, 58, 64, 0.5); - line-height: 45px; -} - -.scroll-to-top:focus, .scroll-to-top:hover { - color: white; -} - -.scroll-to-top:hover { - background: #343a40; -} - -.scroll-to-top i { - font-weight: 800; -} - -.ui-state-active a, -.ui-state-active a:link, -.ui-state-active a:visited { - color: #ffffff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); - background-color: #006dcc; - *background-color: #0044cc; - background-image: -moz-linear-gradient(top, #0088cc, #0044cc); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); - background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); - background-image: -o-linear-gradient(top, #0088cc, #0044cc); - background-image: linear-gradient(to bottom, #0088cc, #0044cc); - background-repeat: repeat-x; -} - -.ui-widget-content .ui-state-active { - color: #ffffff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); - background-color: #006dcc; - *background-color: #0044cc; - background-image: -moz-linear-gradient(top, #0088cc, #0044cc); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); - background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); - background-image: -o-linear-gradient(top, #0088cc, #0044cc); - background-image: linear-gradient(to bottom, #0088cc, #0044cc); - background-repeat: repeat-x; -} - -#clearFilterButton { - background-color: #c1c1c1; -} - -#sidebarSeparator { - width: 100%; - background-color: rgba(0, 0, 0, 0); - border-radius: 0px; -} - -.im-empty-apology .alert .btn { - display: none; -} - -.im-join-manager-button .btn { - display: none; -} - -.im-filter-dialogue-button .btn { - display: none; -} - -.im-column-manager-button .btn { - display: none; -} - -.im-history .btn { - display: none; -} - -.imtables .dropdown-menu { - min-width: 360px; -} - -.imtables .dropdown-toggle::after { - display: none; -} - -.aligned_form { - display: flex; - flex-flow: column wrap; - align-content: flex-start; - height: 75px; -} - -.container { - /* Flex Properties */ - display: flex; - flex-wrap: wrap; - flex-direction: column; - align-items: center; -} - -.apiKeyElement { - display: flex; - align-items: center; -} - -label { - width: 200px; -} - -button { - padding: 5px; -} - -#graphsBoxBody { - display: flex; - flex-wrap: wrap; - flex-direction: row; - align-items: center; -} - -@media (max-width: 991px) { - #graphsBoxBody { - display: flex; - flex-wrap: wrap; - flex-direction: column; - align-items: center; - } -} - -.smaller { - font-size: 0.7rem; -} - -.o-hidden { - overflow: hidden !important; -} - -.z-0 { - z-index: 0; -} - -.z-1 { - z-index: 1; -} - -#mainNav .navbar-collapse { - overflow: auto; -} - -#mainNav .navbar-collapse .navbar-nav .nav-item .nav-link { - cursor: pointer; -} - -#mainNav .navbar-collapse .navbar-sidenav .nav-link-collapse:after { - float: right; - content: '\f107'; - font-family: 'FontAwesome'; -} - -#mainNav .navbar-collapse .navbar-sidenav .nav-link-collapse.collapsed:after { - content: '\f105'; -} - -#mainNav .navbar-collapse .navbar-sidenav .sidenav-second-level, -#mainNav .navbar-collapse .navbar-sidenav .sidenav-third-level { - padding-left: 0; -} - -#mainNav .navbar-collapse .navbar-sidenav .sidenav-second-level > li > a, -#mainNav .navbar-collapse .navbar-sidenav .sidenav-third-level > li > a { - display: block; - padding: 0.5em 0; -} - -#mainNav .navbar-collapse .navbar-sidenav .sidenav-second-level > li > a:focus, #mainNav .navbar-collapse .navbar-sidenav .sidenav-second-level > li > a:hover, -#mainNav .navbar-collapse .navbar-sidenav .sidenav-third-level > li > a:focus, -#mainNav .navbar-collapse .navbar-sidenav .sidenav-third-level > li > a:hover { - text-decoration: none; -} - -#mainNav .navbar-collapse .navbar-sidenav .sidenav-second-level > li > a { - padding-left: 1em; -} - -#mainNav .navbar-collapse .navbar-sidenav .sidenav-third-level > li > a { - padding-left: 2em; -} - -#mainNav .navbar-collapse .sidenav-toggler { - display: none; -} - -#mainNav .navbar-collapse .navbar-nav > .nav-item.dropdown > .nav-link { - position: relative; - min-width: 45px; -} - -#mainNav .navbar-collapse .navbar-nav > .nav-item.dropdown > .nav-link:after { - float: right; - width: auto; - content: '\f105'; - border: none; - font-family: 'FontAwesome'; -} - -#mainNav .navbar-collapse .navbar-nav > .nav-item.dropdown > .nav-link .indicator { - position: absolute; - top: 5px; - left: 21px; - font-size: 10px; -} - -#mainNav .navbar-collapse .navbar-nav > .nav-item.dropdown.show > .nav-link:after { - content: '\f107'; -} - -#mainNav .navbar-collapse .navbar-nav > .nav-item.dropdown .dropdown-menu > .dropdown-item > .dropdown-message { - overflow: hidden; - max-width: none; - text-overflow: ellipsis; -} - -@media (min-width: 992px) { - #mainNav .navbar-brand { - width: 225px; - } - #mainNav .navbar-collapse { - overflow: visible; - max-height: none; - } - #mainNav .navbar-collapse .navbar-sidenav { - position: absolute; - top: 0; - left: 0; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; - margin-top: 56px; - } - #mainNav .navbar-collapse .navbar-sidenav > .nav-item { - width: 225px; - padding: 0; - } - #mainNav .navbar-collapse .navbar-sidenav > .nav-item > .nav-link { - padding: 1em; - } - #mainNav .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level, - #mainNav .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level { - padding-left: 0; - list-style: none; - } - #mainNav .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li, - #mainNav .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li { - width: 225px; - } - #mainNav .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a, - #mainNav .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a { - padding: 1em; - } - #mainNav .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a { - padding-left: 2.75em; - } - #mainNav .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a { - padding-left: 3.75em; - } - #mainNav .navbar-collapse .navbar-nav > .nav-item.dropdown > .nav-link { - min-width: 0; - } - #mainNav .navbar-collapse .navbar-nav > .nav-item.dropdown > .nav-link:after { - width: 24px; - text-align: center; - } - #mainNav .navbar-collapse .navbar-nav > .nav-item.dropdown .dropdown-menu > .dropdown-item > .dropdown-message { - max-width: 300px; - } -} - -#mainNav.fixed-top .sidenav-toggler { - display: none; -} - -@media (min-width: 992px) { - #mainNav.fixed-top .navbar-sidenav { - height: calc(100vh - 56px); - } - #mainNav.fixed-top .sidenav-toggler { - position: absolute; - top: 0; - left: 0; - display: flex; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; - margin-top: calc(100vh - 56px); - } - #mainNav.fixed-top .sidenav-toggler > .nav-item { - width: 225px; - padding: 0; - } - #mainNav.fixed-top .sidenav-toggler > .nav-item > .nav-link { - padding: 1em; - } -} - -#mainNav.fixed-top.navbar-dark .sidenav-toggler { - background-color: #fd7e14; -} - -#mainNav.fixed-top.navbar-dark .sidenav-toggler a i { - color: #fd7e14; -} - -#mainNav.fixed-top.navbar-light .sidenav-toggler { - background-color: #fd7e14; -} - -#mainNav.fixed-top.navbar-light .sidenav-toggler a i { - color: rgba(0, 0, 0, 0.5); -} - -.btn-space { - margin-right: 5px; -} - -body.sidenav-toggled #mainNav.fixed-top .sidenav-toggler { - overflow-x: hidden; - width: 55px; -} - -body.sidenav-toggled #mainNav.fixed-top .sidenav-toggler .nav-item, -body.sidenav-toggled #mainNav.fixed-top .sidenav-toggler .nav-link { - width: 55px !important; -} - -body.sidenav-toggled #mainNav.fixed-top #sidenavToggler i { - -webkit-transform: scaleX(-1); - -moz-transform: scaleX(-1); - -o-transform: scaleX(-1); - transform: scaleX(-1); - filter: FlipH; - -ms-filter: 'FlipH'; -} - -#mainNav.static-top .sidenav-toggler { - display: none; -} - -@media (min-width: 992px) { - #mainNav.static-top .sidenav-toggler { - display: flex; - } -} - -body.sidenav-toggled #mainNav.static-top #sidenavToggler i { - -webkit-transform: scaleX(-1); - -moz-transform: scaleX(-1); - -o-transform: scaleX(-1); - transform: scaleX(-1); - filter: FlipH; - -ms-filter: 'FlipH'; -} - -.content-wrapper { - overflow-x: hidden; - background: white; -} - -@media (min-width: 992px) { - .content-wrapper { - margin-left: 225px; - } -} - -#sidenavToggler i { - font-weight: 800; -} - -.navbar-sidenav-tooltip.show { - display: none; -} - -@media (min-width: 992px) { - body.sidenav-toggled .content-wrapper { - margin-left: 55px; - } -} - -body.sidenav-toggled .navbar-sidenav { - width: 55px; -} - -body.sidenav-toggled .navbar-sidenav .nav-link-text { - display: none; -} - -body.sidenav-toggled .navbar-sidenav .nav-item, -body.sidenav-toggled .navbar-sidenav .nav-link { - width: 55px !important; -} - -body.sidenav-toggled .navbar-sidenav .nav-item:after, -body.sidenav-toggled .navbar-sidenav .nav-link:after { - display: none; -} - -body.sidenav-toggled .navbar-sidenav .nav-item { - white-space: nowrap; -} - -body.sidenav-toggled .navbar-sidenav-tooltip.show { - display: flex; -} - -#mainNav.navbar-dark .navbar-collapse .navbar-sidenav .nav-link-collapse:after { - color: #e9ecef; -} - -#mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item > .nav-link { - color: #e9ecef; -} - -#mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item > .nav-link:hover { - color: #e9ecef; -} - -#mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a, -#mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a { - color: #e9ecef; -} - -#mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a:focus, #mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a:hover, -#mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a:focus, -#mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a:hover { - color: #e9ecef; -} - -#mainNav.navbar-dark .navbar-collapse .navbar-nav > .nav-item.dropdown > .nav-link:after { - color: #e9ecef; -} - -@media (min-width: 992px) { - #mainNav.navbar-dark .navbar-collapse .navbar-sidenav { - background: #e9ecef; - } - #mainNav.navbar-dark .navbar-collapse .navbar-sidenav li.active a { - color: white !important; - background-color: #e9ecef; - } - #mainNav.navbar-dark .navbar-collapse .navbar-sidenav li.active a:focus, #mainNav.navbar-dark .navbar-collapse .navbar-sidenav li.active a:hover { - color: white; - } - #mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level, - #mainNav.navbar-dark .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level { - background: #e9ecef; - } -} - -#mainNav.navbar-light .navbar-collapse .navbar-sidenav .nav-link-collapse:after { - color: rgba(0, 0, 0, 0.5); -} - -#mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item > .nav-link { - color: rgba(0, 0, 0, 0.9); -} - -#mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item > .nav-link:hover { - color: rgba(0, 0, 0, 0.4); -} - -#mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a, -#mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a { - color: rgba(0, 0, 0, 0.9); -} - -#mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a:focus, #mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a:hover, -#mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a:focus, -#mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a:hover { - color: rgba(0, 0, 0, 0.4); -} - -#mainNav.navbar-light .navbar-collapse .navbar-nav > .nav-item.dropdown > .nav-link:after { - color: rgba(253, 126, 20, 0.5); -} - -@media (min-width: 992px) { - #mainNav.navbar-light .navbar-collapse .navbar-sidenav { - background: #e9ecef; - } - #mainNav.navbar-light .navbar-collapse .navbar-sidenav li.active a { - color: #e9ecef !important; - background-color: #e9ecef; - } - #mainNav.navbar-light .navbar-collapse .navbar-sidenav li.active a:focus, #mainNav.navbar-light .navbar-collapse .navbar-sidenav li.active a:hover { - color: #e9ecef; - } - #mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level, - #mainNav.navbar-light .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level { - background: #e9ecef; - } -} - -#mainNav.navbar-orange .navbar-collapse .navbar-sidenav .nav-link-collapse:after { - color: rgba(0, 0, 0, 0.5); -} - -#mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item > .nav-link { - color: rgba(0, 0, 0, 0.5); -} - -#mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item > .nav-link:hover { - color: rgba(0, 0, 0, 0.7); -} - -#mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a, -#mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a { - color: rgba(0, 0, 0, 0.5); -} - -#mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a:focus, #mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level > li > a:hover, -#mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a:focus, -#mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level > li > a:hover { - color: rgba(0, 0, 0, 0.7); -} - -#mainNav.navbar-orange .navbar-collapse .navbar-nav > .nav-item.dropdown > .nav-link:after { - color: rgba(0, 0, 0, 0.5); -} - -@media (min-width: 992px) { - #mainNav.navbar-orange .navbar-collapse .navbar-sidenav { - background: #e9ecef; - } - #mainNav.navbar-orange .navbar-collapse .navbar-sidenav li.active a { - color: #e9ecef !important; - background-color: #e9ecef; - } - #mainNav.navbar-orange .navbar-collapse .navbar-sidenav li.active a:focus, #mainNav.navbar-orange .navbar-collapse .navbar-sidenav li.active a:hover { - color: #e9ecef; - } - #mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item .sidenav-second-level, - #mainNav.navbar-orange .navbar-collapse .navbar-sidenav > .nav-item .sidenav-third-level { - background: #e9ecef; - } -} - -.card-body-icon { - position: absolute; - z-index: 0; - top: -25px; - right: -25px; - font-size: 5rem; - -webkit-transform: rotate(15deg); - -ms-transform: rotate(15deg); - transform: rotate(15deg); -} - -@media (min-width: 576px) { - .card-columns { - column-count: 1; - } -} - -@media (min-width: 768px) { - .card-columns { - column-count: 2; - } -} - -@media (min-width: 1200px) { - .card-columns { - column-count: 2; - } -} - -.card-login { - max-width: 25rem; -} - -.card-register { - max-width: 40rem; -} - -footer.sticky-footer { - position: absolute; - right: 0; - bottom: 0; - width: 100%; - height: 56px; - background-color: #e9ecef; - line-height: 55px; -} - -@media (min-width: 992px) { - footer.sticky-footer { - width: calc(100% - 225px); - } -} - -@media (min-width: 992px) { - body.sidenav-toggled footer.sticky-footer { - width: calc(100% - 55px); - } -} - -/* Center the loader */ -#loader { - position: absolute; - left: 50%; - top: 40%; - z-index: 1; - width: 150px; - height: 150px; - margin: -75px 0 0 -75px; - border: 16px solid #f3f3f3; - border-radius: 50%; - border-top: 16px solid #3498db; - width: 120px; - height: 120px; - -webkit-animation: spin 2s linear infinite; - animation: spin 2s linear infinite; -} - -@-webkit-keyframes spin { - 0% { - -webkit-transform: rotate(0deg); - } - 100% { - -webkit-transform: rotate(360deg); - } -} - -@keyframes spin { - 0% { - transform: rotate(0deg); - } - 100% { - transform: rotate(360deg); - } -} - -/* Add animation to "page content" */ -.animate-bottom { - position: relative; - -webkit-animation-name: animatebottom; - -webkit-animation-duration: 1s; - animation-name: animatebottom; - animation-duration: 1s; -} - -@-webkit-keyframes animatebottom { - from { - bottom: -100px; - opacity: 0; - } - to { - bottom: 0px; - opacity: 1; - } -} - -@keyframes animatebottom { - from { - bottom: -100px; - opacity: 0; - } - to { - bottom: 0; - opacity: 1; - } -} diff --git a/public/stylesheets/hmb-style-main.min.css b/public/stylesheets/hmb-style-main.min.css deleted file mode 100644 index bc0179e5..00000000 --- a/public/stylesheets/hmb-style-main.min.css +++ /dev/null @@ -1 +0,0 @@ -html{position:relative;min-height:100%}body{overflow-x:hidden}body.sticky-footer{margin-bottom:56px}body.sticky-footer .content-wrapper{min-height:calc(100vh - 56px - 56px)}body.fixed-nav{padding-top:56px}.content-wrapper{min-height:calc(100vh);padding-top:1rem}.scroll-to-top{position:fixed;right:15px;bottom:3px;display:none;width:50px;height:50px;text-align:center;color:#fff;background:rgba(52,58,64,.5);line-height:45px}.scroll-to-top:focus,.scroll-to-top:hover{color:#fff}.scroll-to-top:hover{background:#343a40}.scroll-to-top i{font-weight:800}.smaller{font-size:.7rem}.o-hidden{overflow:hidden!important}.z-0{z-index:0}.z-1{z-index:1}#mainNav .navbar-collapse{overflow:auto;max-height:75vh}#mainNav .navbar-collapse .navbar-nav .nav-item .nav-link{cursor:pointer}#mainNav .navbar-collapse .navbar-sidenav .nav-link-collapse:after{float:right;content:'\f107';font-family:FontAwesome}#mainNav .navbar-collapse .navbar-sidenav .nav-link-collapse.collapsed:after{content:'\f105'}#mainNav .navbar-collapse .navbar-sidenav .sidenav-second-level,#mainNav .navbar-collapse .navbar-sidenav .sidenav-third-level{padding-left:0}#mainNav .navbar-collapse .navbar-sidenav .sidenav-second-level>li>a,#mainNav .navbar-collapse .navbar-sidenav .sidenav-third-level>li>a{display:block;padding:.5em 0}#mainNav .navbar-collapse .navbar-sidenav .sidenav-second-level>li>a:focus,#mainNav .navbar-collapse .navbar-sidenav .sidenav-second-level>li>a:hover,#mainNav .navbar-collapse .navbar-sidenav .sidenav-third-level>li>a:focus,#mainNav .navbar-collapse .navbar-sidenav .sidenav-third-level>li>a:hover{text-decoration:none}#mainNav .navbar-collapse .navbar-sidenav .sidenav-second-level>li>a{padding-left:1em}#mainNav .navbar-collapse .navbar-sidenav .sidenav-third-level>li>a{padding-left:2em}#mainNav .navbar-collapse .sidenav-toggler{display:none}#mainNav .navbar-collapse .navbar-nav>.nav-item.dropdown>.nav-link{position:relative;min-width:45px}#mainNav .navbar-collapse .navbar-nav>.nav-item.dropdown>.nav-link:after{float:right;width:auto;content:'\f105';border:none;font-family:FontAwesome}#mainNav .navbar-collapse .navbar-nav>.nav-item.dropdown>.nav-link .indicator{position:absolute;top:5px;left:21px;font-size:10px}#mainNav .navbar-collapse .navbar-nav>.nav-item.dropdown.show>.nav-link:after{content:'\f107'}#mainNav .navbar-collapse .navbar-nav>.nav-item.dropdown .dropdown-menu>.dropdown-item>.dropdown-message{overflow:hidden;max-width:none;text-overflow:ellipsis}@media (min-width:992px){#mainNav .navbar-brand{width:250px}#mainNav .navbar-collapse{overflow:visible;max-height:none}#mainNav .navbar-collapse .navbar-sidenav{position:absolute;top:0;left:0;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;margin-top:56px}#mainNav .navbar-collapse .navbar-sidenav>.nav-item{width:250px;padding:0}#mainNav .navbar-collapse .navbar-sidenav>.nav-item>.nav-link{padding:1em}#mainNav .navbar-collapse .navbar-sidenav>.nav-item .sidenav-second-level,#mainNav .navbar-collapse .navbar-sidenav>.nav-item .sidenav-third-level{padding-left:0;list-style:none}#mainNav .navbar-collapse .navbar-sidenav>.nav-item .sidenav-second-level>li,#mainNav .navbar-collapse .navbar-sidenav>.nav-item .sidenav-third-level>li{width:250px}#mainNav .navbar-collapse .navbar-sidenav>.nav-item .sidenav-second-level>li>a,#mainNav .navbar-collapse .navbar-sidenav>.nav-item .sidenav-third-level>li>a{padding:1em}#mainNav .navbar-collapse .navbar-sidenav>.nav-item .sidenav-second-level>li>a{padding-left:2.75em}#mainNav .navbar-collapse .navbar-sidenav>.nav-item .sidenav-third-level>li>a{padding-left:3.75em}#mainNav .navbar-collapse .navbar-nav>.nav-item.dropdown>.nav-link{min-width:0}#mainNav .navbar-collapse .navbar-nav>.nav-item.dropdown>.nav-link:after{width:24px;text-align:center}#mainNav .navbar-collapse .navbar-nav>.nav-item.dropdown .dropdown-menu>.dropdown-item>.dropdown-message{max-width:300px}}#mainNav.fixed-top .sidenav-toggler{display:none}@media (min-width:992px){#mainNav.fixed-top .navbar-sidenav{height:calc(100vh)}#mainNav.fixed-top .sidenav-toggler{position:absolute;top:0;left:0;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;margin-top:calc(100vh - 56px)}#mainNav.fixed-top .sidenav-toggler>.nav-item{width:250px;padding:0}#mainNav.fixed-top .sidenav-toggler>.nav-item>.nav-link{padding:1em}}#mainNav.fixed-top.navbar-dark .sidenav-toggler{background-color:#fd7e14}#mainNav.fixed-top.navbar-dark .sidenav-toggler a i{color:#fd7e14}#mainNav.fixed-top.navbar-light .sidenav-toggler{background-color:#fd7e14}#mainNav.fixed-top.navbar-light .sidenav-toggler a i{color:rgba(0,0,0,.5)}body.sidenav-toggled #mainNav.fixed-top .sidenav-toggler{overflow-x:hidden;width:55px}body.sidenav-toggled #mainNav.fixed-top .sidenav-toggler .nav-item,body.sidenav-toggled #mainNav.fixed-top .sidenav-toggler .nav-link{width:55px!important}body.sidenav-toggled #mainNav.fixed-top #sidenavToggler i{-webkit-transform:scaleX(-1);-moz-transform:scaleX(-1);-o-transform:scaleX(-1);transform:scaleX(-1);filter:FlipH;-ms-filter:FlipH}#mainNav.static-top .sidenav-toggler{display:none}@media (min-width:992px){#mainNav.static-top .sidenav-toggler{display:flex}}body.sidenav-toggled #mainNav.static-top #sidenavToggler i{-webkit-transform:scaleX(-1);-moz-transform:scaleX(-1);-o-transform:scaleX(-1);transform:scaleX(-1);filter:FlipH;-ms-filter:FlipH}.content-wrapper{overflow-x:hidden;background:#fff}@media (min-width:992px){.content-wrapper{margin-left:250px}}#sidenavToggler i{font-weight:800}.navbar-sidenav-tooltip.show{display:none}@media (min-width:992px){body.sidenav-toggled .content-wrapper{margin-left:55px}}body.sidenav-toggled .navbar-sidenav{width:55px}body.sidenav-toggled .navbar-sidenav .nav-link-text{display:none}body.sidenav-toggled .navbar-sidenav .nav-item,body.sidenav-toggled .navbar-sidenav .nav-link{width:55px!important}body.sidenav-toggled .navbar-sidenav .nav-item:after,body.sidenav-toggled .navbar-sidenav .nav-link:after{display:none}body.sidenav-toggled .navbar-sidenav .nav-item{white-space:nowrap}body.sidenav-toggled .navbar-sidenav-tooltip.show{display:flex}#mainNav.navbar-dark .navbar-collapse .navbar-sidenav .nav-link-collapse:after{color:#e9ecef}#mainNav.navbar-dark .navbar-collapse .navbar-sidenav>.nav-item>.nav-link{color:#e9ecef}#mainNav.navbar-dark .navbar-collapse .navbar-sidenav>.nav-item>.nav-link:hover{color:#e9ecef}#mainNav.navbar-dark .navbar-collapse .navbar-sidenav>.nav-item .sidenav-second-level>li>a,#mainNav.navbar-dark .navbar-collapse .navbar-sidenav>.nav-item .sidenav-third-level>li>a{color:#e9ecef}#mainNav.navbar-dark .navbar-collapse .navbar-sidenav>.nav-item .sidenav-second-level>li>a:focus,#mainNav.navbar-dark .navbar-collapse .navbar-sidenav>.nav-item .sidenav-second-level>li>a:hover,#mainNav.navbar-dark .navbar-collapse .navbar-sidenav>.nav-item .sidenav-third-level>li>a:focus,#mainNav.navbar-dark .navbar-collapse .navbar-sidenav>.nav-item .sidenav-third-level>li>a:hover{color:#e9ecef}#mainNav.navbar-dark .navbar-collapse .navbar-nav>.nav-item.dropdown>.nav-link:after{color:#e9ecef}@media (min-width:992px){#mainNav.navbar-dark .navbar-collapse .navbar-sidenav{background:#e9ecef}#mainNav.navbar-dark .navbar-collapse .navbar-sidenav li.active a{color:#fff!important;background-color:#e9ecef}#mainNav.navbar-dark .navbar-collapse .navbar-sidenav li.active a:focus,#mainNav.navbar-dark .navbar-collapse .navbar-sidenav li.active a:hover{color:#fff}#mainNav.navbar-dark .navbar-collapse .navbar-sidenav>.nav-item .sidenav-second-level,#mainNav.navbar-dark .navbar-collapse .navbar-sidenav>.nav-item .sidenav-third-level{background:#e9ecef}}#mainNav.navbar-light .navbar-collapse .navbar-sidenav .nav-link-collapse:after{color:rgba(0,0,0,.5)}#mainNav.navbar-light .navbar-collapse .navbar-sidenav>.nav-item>.nav-link{color:rgba(0,0,0,.9)}#mainNav.navbar-light .navbar-collapse .navbar-sidenav>.nav-item>.nav-link:hover{color:rgba(0,0,0,.4)}#mainNav.navbar-light .navbar-collapse .navbar-sidenav>.nav-item .sidenav-second-level>li>a,#mainNav.navbar-light .navbar-collapse .navbar-sidenav>.nav-item .sidenav-third-level>li>a{color:rgba(0,0,0,.9)}#mainNav.navbar-light .navbar-collapse .navbar-sidenav>.nav-item .sidenav-second-level>li>a:focus,#mainNav.navbar-light .navbar-collapse .navbar-sidenav>.nav-item .sidenav-second-level>li>a:hover,#mainNav.navbar-light .navbar-collapse .navbar-sidenav>.nav-item .sidenav-third-level>li>a:focus,#mainNav.navbar-light .navbar-collapse .navbar-sidenav>.nav-item .sidenav-third-level>li>a:hover{color:rgba(0,0,0,.4)}#mainNav.navbar-light .navbar-collapse .navbar-nav>.nav-item.dropdown>.nav-link:after{color:rgba(253,126,20,.5)}@media (min-width:992px){#mainNav.navbar-light .navbar-collapse .navbar-sidenav{background:#e9ecef}#mainNav.navbar-light .navbar-collapse .navbar-sidenav li.active a{color:#e9ecef!important;background-color:#e9ecef}#mainNav.navbar-light .navbar-collapse .navbar-sidenav li.active a:focus,#mainNav.navbar-light .navbar-collapse .navbar-sidenav li.active a:hover{color:#e9ecef}#mainNav.navbar-light .navbar-collapse .navbar-sidenav>.nav-item .sidenav-second-level,#mainNav.navbar-light .navbar-collapse .navbar-sidenav>.nav-item .sidenav-third-level{background:#e9ecef}}#mainNav.navbar-orange .navbar-collapse .navbar-sidenav .nav-link-collapse:after{color:rgba(0,0,0,.5)}#mainNav.navbar-orange .navbar-collapse .navbar-sidenav>.nav-item>.nav-link{color:rgba(0,0,0,.5)}#mainNav.navbar-orange .navbar-collapse .navbar-sidenav>.nav-item>.nav-link:hover{color:rgba(0,0,0,.7)}#mainNav.navbar-orange .navbar-collapse .navbar-sidenav>.nav-item .sidenav-second-level>li>a,#mainNav.navbar-orange .navbar-collapse .navbar-sidenav>.nav-item .sidenav-third-level>li>a{color:rgba(0,0,0,.5)}#mainNav.navbar-orange .navbar-collapse .navbar-sidenav>.nav-item .sidenav-second-level>li>a:focus,#mainNav.navbar-orange .navbar-collapse .navbar-sidenav>.nav-item .sidenav-second-level>li>a:hover,#mainNav.navbar-orange .navbar-collapse .navbar-sidenav>.nav-item .sidenav-third-level>li>a:focus,#mainNav.navbar-orange .navbar-collapse .navbar-sidenav>.nav-item .sidenav-third-level>li>a:hover{color:rgba(0,0,0,.7)}#mainNav.navbar-orange .navbar-collapse .navbar-nav>.nav-item.dropdown>.nav-link:after{color:rgba(0,0,0,.5)}@media (min-width:992px){#mainNav.navbar-orange .navbar-collapse .navbar-sidenav{background:#e9ecef}#mainNav.navbar-orange .navbar-collapse .navbar-sidenav li.active a{color:#e9ecef!important;background-color:#e9ecef}#mainNav.navbar-orange .navbar-collapse .navbar-sidenav li.active a:focus,#mainNav.navbar-orange .navbar-collapse .navbar-sidenav li.active a:hover{color:#e9ecef}#mainNav.navbar-orange .navbar-collapse .navbar-sidenav>.nav-item .sidenav-second-level,#mainNav.navbar-orange .navbar-collapse .navbar-sidenav>.nav-item .sidenav-third-level{background:#e9ecef}}.card-body-icon{position:absolute;z-index:0;top:-25px;right:-25px;font-size:5rem;-webkit-transform:rotate(15deg);-ms-transform:rotate(15deg);transform:rotate(15deg)}@media (min-width:576px){.card-columns{column-count:1}}@media (min-width:768px){.card-columns{column-count:2}}@media (min-width:1200px){.card-columns{column-count:2}}.card-login{max-width:25rem}.card-register{max-width:40rem}footer.sticky-footer{position:absolute;right:0;bottom:0;width:100%;height:56px;background-color:#e9ecef;line-height:55px}@media (min-width:992px){footer.sticky-footer{width:calc(100% - 250px)}}@media (min-width:992px){body.sidenav-toggled footer.sticky-footer{width:calc(100% - 55px)}}#loader{position:absolute;left:50%;top:40%;z-index:1;width:150px;height:150px;margin:-75px 0 0 -75px;border:16px solid #f3f3f3;border-radius:50%;border-top:16px solid #3498db;width:120px;height:120px;-webkit-animation:spin 2s linear infinite;animation:spin 2s linear infinite}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0)}100%{-webkit-transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}.animate-bottom{position:relative;-webkit-animation-name:animatebottom;-webkit-animation-duration:1s;animation-name:animatebottom;animation-duration:1s}@-webkit-keyframes animatebottom{from{bottom:-100px;opacity:0}to{bottom:0;opacity:1}}@keyframes animatebottom{from{bottom:-100px;opacity:0}to{bottom:0;opacity:1}}.badge{display:inline}#accordion .glyphicon{margin-right:0}.panel-collapse>.list-group .list-group-item:first-child{border-top-right-radius:0;border-top-left-radius:0}.panel-collapse>.list-group .list-group-item{border-width:1px 0}.panel-collapse>.list-group{margin-bottom:0}.panel-collapse .list-group-item{border-radius:0}.panel-collapse .list-group .list-group{margin:0;margin-top:30px}.panel-collapse .list-group-item li.list-group-item{margin:0 0;border-top:1px solid #ddd!important;border-bottom:0;padding-left:0}.panel-collapse .list-group-item li.list-group-item:last-child{padding-bottom:0}.panel-collapse div.list-group div.list-group{margin:0}.panel-collapse div.list-group .list-group a.list-group-item{border-top:1px solid #ddd!important;border-bottom:0;padding-left:0}.panel-collapse .list-group-item li.list-group-item{border-top:1px solid #ddd!important}.checkbox{padding-left:20px}.checkbox label{display:inline-block;vertical-align:middle;position:relative;padding-left:5px}.checkbox label::before{content:"";display:inline-block;position:absolute;width:17px;height:17px;left:0;margin-left:-20px;border:1px solid #ccc;border-radius:3px;background-color:#fff;-webkit-transition:border .15s ease-in-out,color .15s ease-in-out;-o-transition:border .15s ease-in-out,color .15s ease-in-out;transition:border .15s ease-in-out,color .15s ease-in-out}.checkbox label::after{display:inline-block;position:absolute;width:16px;height:16px;left:0;top:0;margin-left:-20px;padding-left:3px;padding-top:1px;font-size:11px;color:#555}.checkbox input[type=checkbox]{opacity:0;z-index:1}.checkbox input[type=checkbox]:focus+label::before{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.checkbox input[type=checkbox]:checked+label::after{font-family:FontAwesome;content:"\f00c"}.checkbox input[type=checkbox]:disabled+label{opacity:.65}.checkbox input[type=checkbox]:disabled+label::before{background-color:#eee;cursor:not-allowed}.checkbox.checkbox-circle label::before{border-radius:50%}.checkbox.checkbox-inline{margin-top:0}.checkbox-primary input[type=checkbox]:checked+label::before{background-color:#428bca;border-color:#428bca}.checkbox-primary input[type=checkbox]:checked+label::after{color:#fff}.checkbox-danger input[type=checkbox]:checked+label::before{background-color:#d9534f;border-color:#d9534f}.checkbox-danger input[type=checkbox]:checked+label::after{color:#fff}.checkbox-info input[type=checkbox]:checked+label::before{background-color:#5bc0de;border-color:#5bc0de}.checkbox-info input[type=checkbox]:checked+label::after{color:#fff}.checkbox-warning input[type=checkbox]:checked+label::before{background-color:#f0ad4e;border-color:#f0ad4e}.checkbox-warning input[type=checkbox]:checked+label::after{color:#fff}.checkbox-success input[type=checkbox]:checked+label::before{background-color:#5cb85c;border-color:#5cb85c}.checkbox-success input[type=checkbox]:checked+label::after{color:#fff}.radio{padding-left:20px}.radio label{display:inline-block;vertical-align:middle;position:relative;padding-left:5px}.radio label::before{content:"";display:inline-block;position:absolute;width:17px;height:17px;left:0;margin-left:-20px;border:1px solid #ccc;border-radius:50%;background-color:#fff;-webkit-transition:border .15s ease-in-out;-o-transition:border .15s ease-in-out;transition:border .15s ease-in-out}.radio label::after{display:inline-block;position:absolute;content:" ";width:11px;height:11px;left:3px;top:3px;margin-left:-20px;border-radius:50%;background-color:#555;-webkit-transform:scale(0,0);-ms-transform:scale(0,0);-o-transform:scale(0,0);transform:scale(0,0);-webkit-transition:-webkit-transform .1s cubic-bezier(.8,-.33,.2,1.33);-moz-transition:-moz-transform .1s cubic-bezier(.8,-.33,.2,1.33);-o-transition:-o-transform .1s cubic-bezier(.8,-.33,.2,1.33);transition:transform .1s cubic-bezier(.8,-.33,.2,1.33)}.radio input[type=radio]{opacity:0;z-index:1}.radio input[type=radio]:focus+label::before{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.radio input[type=radio]:checked+label::after{-webkit-transform:scale(1,1);-ms-transform:scale(1,1);-o-transform:scale(1,1);transform:scale(1,1)}.radio input[type=radio]:disabled+label{opacity:.65}.radio input[type=radio]:disabled+label::before{cursor:not-allowed}.radio.radio-inline{margin-top:0}.radio-primary input[type=radio]+label::after{background-color:#428bca}.radio-primary input[type=radio]:checked+label::before{border-color:#428bca}.radio-primary input[type=radio]:checked+label::after{background-color:#428bca}.radio-danger input[type=radio]+label::after{background-color:#d9534f}.radio-danger input[type=radio]:checked+label::before{border-color:#d9534f}.radio-danger input[type=radio]:checked+label::after{background-color:#d9534f}.radio-info input[type=radio]+label::after{background-color:#5bc0de}.radio-info input[type=radio]:checked+label::before{border-color:#5bc0de}.radio-info input[type=radio]:checked+label::after{background-color:#5bc0de}.radio-warning input[type=radio]+label::after{background-color:#f0ad4e}.radio-warning input[type=radio]:checked+label::before{border-color:#f0ad4e}.radio-warning input[type=radio]:checked+label::after{background-color:#f0ad4e}.radio-success input[type=radio]+label::after{background-color:#5cb85c}.radio-success input[type=radio]:checked+label::before{border-color:#5cb85c}.radio-success input[type=radio]:checked+label::after{background-color:#5cb85c}.saved-list-item{overflow-x:scroll} \ No newline at end of file diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css deleted file mode 100644 index 9453385b..00000000 --- a/public/stylesheets/style.css +++ /dev/null @@ -1,8 +0,0 @@ -body { - padding: 50px; - font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; -} - -a { - color: #00B7FF; -} diff --git a/routes/fetch.js b/routes/fetch.js deleted file mode 100644 index 33c17b11..00000000 --- a/routes/fetch.js +++ /dev/null @@ -1,430 +0,0 @@ -var express = require('express'); -var imjs = require('imjs'); -var request = require('request'); -var router = express.Router(); -var jsdom = require("jsdom"); -const { - JSDOM -} = jsdom; -const { - document -} = (new JSDOM('')).window; -global.document = document; -global.window = document.defaultView; -var $ = require('jquery'); - -/** - * Method that formats a mine URL - * @param {string} mineURL: the mine URL -* @returns {string} the formatted mine URL - */ -function formatMineURL(mineURL) { - return mineURL.replace(/COLON/g, ":").replace(/SLASH/g, "/"); -} - -/** - * GET Pathway Names from HumanMine inside a class (parameter) - */ -router.get('/pathways/:mineUrl/:classname', function(req, res, next) { - var className = req.params.classname; - var mineUrl = formatMineURL(req.params.mineUrl); - - if (className != "Protein" && className != "Gene") { - res.status(500).send('You need to specify a valid class: Protein, Gene'); - } - - var service = new imjs.Service({ - root: mineUrl - }); - - var query = { - "from": className, - "select": ["pathways.name", "primaryIdentifier"], - "model": { - "name": "genomic" - }, - "orderBy": [{ - "path": "pathways.name", - "direction": "ASC" - }] - }; - - var pathways = new imjs.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 - res.json(pathwaySummary); - }); -}); - -/** - * GET Protein Atlas Expression Tissue Names from HumanMine inside a class (parameter) - */ -router.get('/proteinatlastissuenames/:mineUrl/:classname', function(req, res, next) { - var className = req.params.classname; - var mineUrl = formatMineURL(req.params.mineUrl); - - if (className != "Protein" && className != "Gene") { - res.status(500).send('You need to specify a valid class: Protein, Gene'); - } - - var service = new imjs.Service({ - root: mineUrl - }); - - var query = { - "from": className, - "select": ["proteinAtlasExpression.tissue.name", "primaryIdentifier"], - "model": { - "name": "genomic" - }, - "orderBy": [{ - "path": "proteinAtlasExpression.tissue.name", - "direction": "ASC" - }] - }; - - var theQuery = new imjs.Query(query, service), - queryPath = [query.from, query.select[0]].join('.'); - theQuery.summarize(queryPath).then(function(querySummary) { - res.json(querySummary); - }); -}); - -/** - * GET Protein Atlas Expression Cell Types from HumanMine inside a class (parameter) - */ -router.get('/proteinatlascelltypes/:mineUrl/:classname', function(req, res, next) { - var className = req.params.classname; - var mineUrl = formatMineURL(req.params.mineUrl); - - if (className != "Protein" && className != "Gene") { - res.status(500).send('You need to specify a valid class: Protein, Gene'); - } - - var service = new imjs.Service({ - root: mineUrl - }); - - var query = { - "from": className, - "select": ["proteinAtlasExpression.cellType", "primaryIdentifier"], - "model": { - "name": "genomic" - }, - "orderBy": [{ - "path": "proteinAtlasExpression.cellType", - "direction": "ASC" - }] - }; - - var theQuery = new imjs.Query(query, service), - queryPath = [query.from, query.select[0]].join('.'); - theQuery.summarize(queryPath).then(function(querySummary) { - res.json(querySummary); - }); -}); - -/** - * GET Clinical Significance values from HumanMine inside a class (parameter) - */ -router.get('/clinicalsignificance/:mineUrl/:classname', function(req, res, next) { - var className = req.params.classname; - var mineUrl = formatMineURL(req.params.mineUrl); - - if (className != "Protein" && className != "Gene") { - res.status(500).send('You need to specify a valid class: Protein, Gene'); - } - - var service = new imjs.Service({ - root: mineUrl - }); - - var query = { - "from": className, - "select": ["alleles.clinicalSignificance", "primaryIdentifier"], - "model": { - "name": "genomic" - }, - "orderBy": [{ - "path": "alleles.clinicalSignificance", - "direction": "ASC" - }] - }; - - var theQuery = new imjs.Query(query, service), - queryPath = [query.from, query.select[0]].join('.'); - theQuery.summarize(queryPath).then(function(querySummary) { - //This returns the pathway name and the number of gene rows associated with the pathway - res.json(querySummary); - }); -}); - -/** - * GET Alleles Type values from HumanMine inside a class (parameter) - */ -router.get('/allelestype/:mineUrl/:classname', function(req, res, next) { - var className = req.params.classname; - var mineUrl = formatMineURL(req.params.mineUrl); - - if (className != "Protein" && className != "Gene") { - res.status(500).send('You need to specify a valid class: Protein, Gene'); - } - - var service = new imjs.Service({ - root: mineUrl - }); - - var query = { - "from": className, - "select": ["alleles.type", "primaryIdentifier"], - "model": { - "name": "genomic" - }, - "orderBy": [{ - "path": "alleles.type", - "direction": "ASC" - }] - }; - - var theQuery = new imjs.Query(query, service), - queryPath = [query.from, query.select[0]].join('.'); - theQuery.summarize(queryPath).then(function(querySummary) { - //This returns the pathway name and the number of gene rows associated with the pathway - res.json(querySummary); - }); -}); - -/** - * GET Diseases Names from HumanMine inside a class (parameter) - */ -router.get('/diseases/:mineUrl/:classname', function(req, res, next) { - var className = req.params.classname; - var mineUrl = formatMineURL(req.params.mineUrl); - - if (className != "Protein" && className != "Gene") { - res.status(500).send('You need to specify a valid class: Protein, Gene'); - } - - var service = new imjs.Service({ - root: mineUrl - }); - - var query = { - "from": className, - "select": ["diseases.name", "primaryIdentifier"], - "model": { - "name": "genomic" - }, - "orderBy": [{ - "path": "diseases.name", - "direction": "ASC" - }] - }; - - var diseases = new imjs.Query(query, service), - diseasesPath = [query.from, query.select[0]].join('.'); - diseases.summarize(diseasesPath).then(function(diseasesSummary) { - //This returns the pathway name and the number of gene rows associated with the pathway - res.json(diseasesSummary); - }); -}); - -/** - * GET Datasets Names from HumanMine inside a class (parameter) - */ -router.get('/datasets/:mineUrl/:classname', function(req, res, next) { - var className = req.params.classname; - var mineUrl = formatMineURL(req.params.mineUrl); - - if (className != "Protein" && className != "Gene") { - res.status(500).send('You need to specify a valid class: Protein, Gene'); - } - - var service = new imjs.Service({ - root: mineUrl - }); - - var query = { - "from": className, - "select": ["dataSets.name", "primaryIdentifier"], - "model": { - "name": "genomic" - }, - "orderBy": [{ - "path": "dataSets.name", - "direction": "ASC" - }] - }; - - var datasets = new imjs.Query(query, service), - datasetsPath = [query.from, query.select[0]].join('.'); - datasets.summarize(datasetsPath).then(function(datasetSummary) { - res.json(datasetSummary); - }); -}); - -/** - * GET Ontology Terms from HumanMine inside a class (parameter) - */ -router.get('/ontologyterms/:mineUrl/:classname', function(req, res, next) { - var className = req.params.classname; - var mineUrl = formatMineURL(req.params.mineUrl); - - if (className != "Protein" && className != "Gene") { - res.status(500).send('You need to specify a valid class: Protein, Gene'); - } - - var service = new imjs.Service({ - root: mineUrl - }); - - if (className == "Gene") { - var query = { - "from": className, - "select": ["goAnnotation.ontologyTerm.name", "primaryIdentifier"], - "model": { - "name": "genomic" - }, - "orderBy": [{ - "path": "goAnnotation.ontologyTerm.name", - "direction": "ASC" - }] - }; - - var goterms = new imjs.Query(query, service), - gotermsPath = [query.from, query.select[0]].join('.'); - goterms.summarize(gotermsPath).then(function(gotermSummary) { - res.json(gotermSummary); - }); - - } - - if (className == "Protein") { - var query = { - "from": className, - "select": ["ontologyAnnotations.ontologyTerm.name", "primaryIdentifier"], - "model": { - "name": "genomic" - }, - "orderBy": [{ - "path": "ontologyAnnotations.ontologyTerm.name", - "direction": "ASC" - }] - }; - - var goterms = new imjs.Query(query, service), - gotermsPath = [query.from, query.select[0]].join('.'); - goterms.summarize(gotermsPath).then(function(gotermSummary) { - res.json(gotermSummary); - }); - } -}); - -/** - * GET Protein Domain Name from HumanMine - */ -router.get('/proteindomainname/:mineUrl', function(req, res, next) { - var mineUrl = formatMineURL(req.params.mineUrl); - - var service = new imjs.Service({ - root: mineUrl - }); - - - var query = { - "from": "Gene", - "select": ["proteins.proteinDomainRegions.proteinDomain.name", "primaryIdentifier"], - "model": { - "name": "genomic" - }, - "orderBy": [{ - "path": "proteins.proteinDomainRegions.proteinDomain.name", - "direction": "ASC" - }] - }; - - var protdomname = new imjs.Query(query, service), - protdomnamePath = [query.from, query.select[0]].join('.'); - protdomname.summarize(protdomnamePath).then(function(protdomnameSummary) { - res.json(protdomnameSummary); - }); - - -}); - -/** - * GET Interaction Participant 2 Gene Symbol from HumanMine - */ -router.get('/participant2genesymbols/:mineUrl', function(req, res, next) { - var mineUrl = formatMineURL(req.params.mineUrl); - - var service = new imjs.Service({ - root: mineUrl - }); - - var query = { - "from": "Gene", - "select": ["interactions.participant2.symbol"], - "model": { - "name": "genomic" - }, - "orderBy": [{ - "path": "interactions.participant2.symbol", - "direction": "ASC" - }] - }; - - var part2genesymbol = new imjs.Query(query, service), - part2genesymbolPath = [query.from, query.select[0]].join('.'); - part2genesymbol.summarize(part2genesymbolPath).then(function(part2genesymbolSummary) { - res.json(part2genesymbolSummary); - }); - - -}); - -/** - * GET Phenotype Names from HumanMine inside a class (parameter) - */ -router.get('/phenotypes/:mineUrl', function(req, res, next) { - var mineUrl = formatMineURL(req.params.mineUrl); - - var service = new imjs.Service({ - root: mineUrl - }); - - var query = { - "from": "Gene" , - "select": [ - "diseases.hpoAnnotations.hpoTerm.name", - "primaryIdentifier" - ], - "model": { - "name": "genomic" - }, - "orderBy": [{ - "path": "symbol", - "direction": "ASC" - }] - }; - - var pathways = new imjs.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 - res.json(pathwaySummary); - }); -}); - -router.post('/lists/:mineUrl', function(req, res, next) { - const mineUrl = formatMineURL(req.params.mineUrl); - const { apiKey } = req.body; - const token = apiKey || null; - var service = new imjs.Service({ - root: mineUrl, - token - }); - service.fetchLists().then(lists => res.json(lists)); -}); -module.exports = router; \ No newline at end of file diff --git a/routes/statistics.js b/routes/statistics.js deleted file mode 100644 index 38959fb9..00000000 --- a/routes/statistics.js +++ /dev/null @@ -1,257 +0,0 @@ -var express = require('express'); -var imjs = require('imjs'); -var request = require('request'); -var router = express.Router(); - -/** - * GET endpoint to retrieve the count of items per class in HumanMine. - */ -router.get('/count/primary/:mineUrl', function(req, res, next) { - var mineUrl = req.params.mineUrl.replace(/COLON/g, ":").replace(/SLASH/g, "/"); - - var result = [] - - var service = new imjs.Service({ - root: mineUrl - }); - - var query = { - "from": 'Gene', - "select": ['primaryIdentifier'] - }; - - service.count(query).then(function(response) { - result.push({ - "name": "Gene", - "count": response - }); - var query = { - "from": 'Protein', - "select": ['primaryIdentifier'] - }; - service.count(query).then(function(response) { - result.push({ - "name": "Protein", - "count": response - }); - res.json(result); - }) - - }) -}); - -/** - * POST count of items inside a class (parameter) using custom constraints in HumanMine - */ -router.post('/count/items/:mineUrl/:classname', function(req, res, next) { - var constraints = req.body; - var className = req.params.classname; - var mineUrl = req.params.mineUrl.replace(/COLON/g, ":").replace(/SLASH/g, "/"); - - if (className != "Protein" && className != "Gene") { - res.status(500).send('You need to specify a valid class: Protein, Gene'); - } - - var result = [] - - var service = new imjs.Service({ - root: mineUrl - }); - - if (className == "Gene") { - var query = { - "constraintLogic": "(A OR B OR C OR D OR E OR F OR G OR H OR I OR J) AND (K) AND (L) AND (M) AND (N) AND (O) AND (P) AND (Q) AND (R) AND (O AND S) AND (T AND U AND V) AND (W AND X AND Y AND Z)", - "from": 'Gene', - "select": ['primaryIdentifier'], - "model": { - 'name': 'genomic' - }, - "where": constraints - }; - - var q = new imjs.Query(query, service); - - q.summarize("Gene.organism.shortName", 50) - .then(function(response) { - result.push({ - "itemName": "Organism short name", - "response": response - }); - res.json(result); - }).catch(function(error) { - console.log('error'); - console.log(error.message); - }); - - } - - if (className == "Protein") { - var query = { - "constraintLogic": "(A OR B OR C OR D OR E OR F OR G OR H OR I OR J) AND (K) AND (L) AND (M) AND (N) AND (O) AND (P) AND (Q) AND (R) AND (O AND S) AND (T AND U AND V) AND (W AND X AND Y AND Z)", - "from": 'Protein', - "select": ['primaryIdentifier'], - "model": { - 'name': 'genomic' - }, - "where": constraints - }; - - var q = new imjs.Query(query, service); - - q.summarize("Protein.organism.shortName", 10) - .then(function(response) { - result.push({ - "itemName": "Organism short name", - "response": response - }); - res.json(result); - }).catch(function(error) { - console.log('error'); - console.log(error.message); - }); - } - -}); - -/** - * POST Gene Lengths summaries from a mine inside a class (parameter) using custom constraints - */ -router.post('/genelength/:mineUrl/:classname', function(req, res, next) { - var constraints = req.body; - var className = req.params.classname; - var mineUrl = req.params.mineUrl.replace(/COLON/g, ":").replace(/SLASH/g, "/"); - - if (className != "Protein" && className != "Gene") { - res.status(500).send('You need to specify a valid class: Protein, Gene'); - } - - var service = new imjs.Service({ - root: mineUrl - }); - - var query = { - "constraintLogic": "(A OR B OR C OR D OR E OR F OR G OR H OR I OR J) AND (K) AND (L) AND (M) AND (N) AND (O) AND (P) AND (Q) AND (R) AND (O AND S) AND (T AND U AND V) AND (W AND X AND Y AND Z)", - "from": className, - "select": ["length", "primaryIdentifier"], - "model": { - "name": "genomic" - }, - "where": constraints, - "orderBy": [{ - "path": "length", - "direction": "ASC" - }] - }; - - var genelengths = new imjs.Query(query, service), - genelengthsPath = [query.from, query.select[0]].join('.'); - genelengths.summarize(genelengthsPath).then(function(genelengthsSummary) { - //This returns the gene length and the number of gene rows associated with the gene length - res.json(genelengthsSummary); - }); -}); - -/** - * GET Gene Lengths summaries from a mine inside a class (parameter) - */ -router.get('/genelength/:mineUrl/:classname', function(req, res, next) { - var className = req.params.classname; - var mineUrl = req.params.mineUrl.replace(/COLON/g, ":").replace(/SLASH/g, "/"); - - if (className != "Protein" && className != "Gene") { - res.status(500).send('You need to specify a valid class: Protein, Gene'); - } - - var service = new imjs.Service({ - root: mineUrl - }); - - var query = { - "from": className, - "select": ["length", "primaryIdentifier"], - "model": { - "name": "genomic" - }, - "orderBy": [{ - "path": "length", - "direction": "ASC" - }] - }; - - var genelengths = new imjs.Query(query, service), - genelengthsPath = [query.from, query.select[0]].join('.'); - genelengths.summarize(genelengthsPath).then(function(genelengthsSummary) { - //This returns the gene length and the number of gene rows associated with the gene length - res.json(genelengthsSummary); - }); -}); - -/** - * GET count of items inside a class (parameter) in HumanMine - */ -router.get('/count/items/:mineUrl/:classname', function(req, res, next) { - var className = req.params.classname; - var mineUrl = req.params.mineUrl.replace(/COLON/g, ":").replace(/SLASH/g, "/"); - - if (className != "Protein" && className != "Gene") { - res.status(500).send('You need to specify a valid class: Protein, Gene'); - } - - var result = [] - - var service = new imjs.Service({ - root: mineUrl - }); - - if (className == "Gene") { - var query = { - "from": 'Gene', - "select": ['primaryIdentifier'], - "model": { - 'name': 'genomic' - } - }; - - var q = new imjs.Query(query, service); - - q.summarize("Gene.organism.shortName", 10) - .then(function(response) { - result.push({ - "itemName": "Organism short name", - "response": response - }); - res.json(result); - }).catch(function(error) { - console.log('error'); - console.log(error.message); - }); - - } - - if (className == "Protein") { - var query = { - "from": 'Protein', - "select": ['primaryIdentifier'], - "model": { - 'name': 'genomic' - } - }; - - var q = new imjs.Query(query, service); - - q.summarize("Protein.organism.shortName", 10) - .then(function(response) { - result.push({ - "itemName": "Organism short name", - "response": response - }); - res.json(result); - }).catch(function(error) { - console.log('error'); - console.log(error.message); - }); - } - -}); - -module.exports = router; \ No newline at end of file diff --git a/src/css/hmb-style-main.css b/src/css/hmb-style-main.css index 941b5b01..b30849bd 100644 --- a/src/css/hmb-style-main.css +++ b/src/css/hmb-style-main.css @@ -143,13 +143,23 @@ body.fixed-nav { text-overflow: ellipsis; } +#headerButtons { + display: flex; + flex-wrap: nowrap; + margin: 5px; +} + @media (min-width: 992px) { - #mainNav .navbar-brand { - width: 250px; + #mainNav { + display: flex; + justify-content: space-between; } #mainNav .navbar-collapse { overflow: visible; max-height: none; + position: fixed; + top: 0; + left: 0; } #mainNav .navbar-collapse .navbar-sidenav { position: absolute; @@ -158,7 +168,7 @@ body.fixed-nav { -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; - margin-top: 56px; + margin-top: 63px; } #mainNav .navbar-collapse .navbar-sidenav > .nav-item { width: 250px; @@ -404,6 +414,7 @@ body.sidenav-toggled .navbar-sidenav-tooltip.show { @media (min-width: 992px) { #mainNav.navbar-light .navbar-collapse .navbar-sidenav { background: #e9ecef; + min-height: calc(100vh - 61px); } #mainNav.navbar-light .navbar-collapse .navbar-sidenav li.active a { color: #e9ecef !important; diff --git a/src/js/api-requests.js b/src/js/api-requests.js new file mode 100644 index 00000000..7c8d9bf8 --- /dev/null +++ b/src/js/api-requests.js @@ -0,0 +1,603 @@ +/** + * Method to get the different intermines names and URLs from the registry + * @returns {array} an array with the server response containing the different intermines with their URLs + */ +function getIntermines() { + return $.ajax({ + url: 'https://registry.intermine.org/service/instances?mines=%27prod%27', + type: 'GET', + error: function(e) { + console.log(e); + }, + success: function(data) {} + }) +} + +// Methods from old /fetch route + + +/** + * Method to get the different pathway names inside a class in order to feed the typeahead + * @returns {array} an array with the server response containing the different pathway names + */ +function getPathwayNamesInClass(className, constraints) { + return new Promise((resolve, reject) => { + if (className != "Protein" && className != "Gene") { + reject('You need to specify a valid class: Protein, Gene'); + } + + var service = new imjs.Service({ + root: escapeMineURL(window.mineUrl) + }); + + var query = { + "from": className, + "select": ["pathways.name", "primaryIdentifier"], + "model": { + "name": "genomic" + }, + "orderBy": [{ + "path": "pathways.name", + "direction": "ASC" + }] + }; + + var pathways = new imjs.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 + resolve(pathwaySummary); + }); + }) +} + +/** + * Method to get the different ontology terms inside a class in order to feed the typeahead + * @returns {array} an array with the server response containing the different ontology terms + */ +function getOntologyTermsInClass(className, constraints) { + return new Promise((resolve, reject) => { + if (className != "Protein" && className != "Gene") { + reject('You need to specify a valid class: Protein, Gene'); + } + + var service = new imjs.Service({ + root: escapeMineURL(window.mineUrl) + }); + + if (className == "Gene") { + var query = { + "from": className, + "select": ["goAnnotation.ontologyTerm.name", "primaryIdentifier"], + "model": { + "name": "genomic" + }, + "orderBy": [{ + "path": "goAnnotation.ontologyTerm.name", + "direction": "ASC" + }] + }; + + var goterms = new imjs.Query(query, service), + gotermsPath = [query.from, query.select[0]].join('.'); + goterms.summarize(gotermsPath).then(function(gotermSummary) { + resolve(gotermSummary); + }); + + } + + if (className == "Protein") { + var query = { + "from": className, + "select": ["ontologyAnnotations.ontologyTerm.name", "primaryIdentifier"], + "model": { + "name": "genomic" + }, + "orderBy": [{ + "path": "ontologyAnnotations.ontologyTerm.name", + "direction": "ASC" + }] + }; + + var goterms = new imjs.Query(query, service), + gotermsPath = [query.from, query.select[0]].join('.'); + goterms.summarize(gotermsPath).then(function(gotermSummary) { + resolve(gotermSummary); + }); + } + }) +} + +/** + * Method to get the different alleles clinical significance inside a class in order to feed the typeahead + * @returns {array} an array with the server response containing the different alleles clinical significances + */ +function getAllelesClinicalSignifanceInClass(className, constraints) { + return new Promise((resolve, reject) => { + if (className != "Protein" && className != "Gene") { + reject('You need to specify a valid class: Protein, Gene'); + } + + var service = new imjs.Service({ + root: escapeMineURL(window.mineUrl) + }); + + var query = { + "from": className, + "select": ["alleles.clinicalSignificance", "primaryIdentifier"], + "model": { + "name": "genomic" + }, + "orderBy": [{ + "path": "alleles.clinicalSignificance", + "direction": "ASC" + }] + }; + + var theQuery = new imjs.Query(query, service), + queryPath = [query.from, query.select[0]].join('.'); + theQuery.summarize(queryPath).then(function(querySummary) { + //This returns the pathway name and the number of gene rows associated with the pathway + resolve(querySummary); + }); + }) +} + +/** + * Method to get the different protein atlas expression cell types inside a class in order to feed the typeahead + * @returns {array} an array with the server response containing the different protein atlas expression cell types + */ +function getProteinAtlasExpressionCellTypesInClass(className, constraints) { + return new Promise((resolve, reject) => { + if (className != "Protein" && className != "Gene") { + reject('You need to specify a valid class: Protein, Gene'); + } + + var service = new imjs.Service({ + root: escapeMineURL(window.mineUrl) + }); + + var query = { + "from": className, + "select": ["proteinAtlasExpression.cellType", "primaryIdentifier"], + "model": { + "name": "genomic" + }, + "orderBy": [{ + "path": "proteinAtlasExpression.cellType", + "direction": "ASC" + }] + }; + + var theQuery = new imjs.Query(query, service), + queryPath = [query.from, query.select[0]].join('.'); + theQuery.summarize(queryPath).then(function(querySummary) { + resolve(querySummary); + }); + }) +} + +/** + * Method to get the different protein atlas expression tissue names inside a class in order to feed the typeahead + * @returns {array} an array with the server response containing the different protein atlas expression tissue names + */ +function getProteinAtlasExpressionTissueNamesInClass(className, constraints) { + return new Promise((resolve, reject) => { + if (className != "Protein" && className != "Gene") { + reject('You need to specify a valid class: Protein, Gene'); + } + + var service = new imjs.Service({ + root: escapeMineURL(window.mineUrl) + }); + + var query = { + "from": className, + "select": ["proteinAtlasExpression.tissue.name", "primaryIdentifier"], + "model": { + "name": "genomic" + }, + "orderBy": [{ + "path": "proteinAtlasExpression.tissue.name", + "direction": "ASC" + }] + }; + + var theQuery = new imjs.Query(query, service), + queryPath = [query.from, query.select[0]].join('.'); + theQuery.summarize(queryPath).then(function(querySummary) { + resolve(querySummary); + }); + }) +} + +/** + * Method to get the different alleles types inside a class in order to feed the typeahead + * @returns {array} an array with the server response containing the different alleles types + */ +function getAllelesTypesInClass(className, constraints) { + return new Promise((resolve, reject) => { + if (className != "Protein" && className != "Gene") { + reject('You need to specify a valid class: Protein, Gene'); + } + + var service = new imjs.Service({ + root: escapeMineURL(window.mineUrl) + }); + + var query = { + "from": className, + "select": ["alleles.type", "primaryIdentifier"], + "model": { + "name": "genomic" + }, + "orderBy": [{ + "path": "alleles.type", + "direction": "ASC" + }] + }; + + var theQuery = new imjs.Query(query, service), + queryPath = [query.from, query.select[0]].join('.'); + theQuery.summarize(queryPath).then(function(querySummary) { + //This returns the pathway name and the number of gene rows associated with the pathway + resolve(querySummary); + }); + }) +} + +/** + * Method to get the different dataset names inside a class in order to feed the typeahead + * @returns {array} an array with the server response containing the different dataset names + */ +function getDatasetNamesInClass(className, constraints) { + return new Promise((resolve, reject) => { + if (className != "Protein" && className != "Gene") { + reject('You need to specify a valid class: Protein, Gene'); + } + + var service = new imjs.Service({ + root: escapeMineURL(window.mineUrl) + }); + + var query = { + "from": className, + "select": ["dataSets.name", "primaryIdentifier"], + "model": { + "name": "genomic" + }, + "orderBy": [{ + "path": "dataSets.name", + "direction": "ASC" + }] + }; + + var datasets = new imjs.Query(query, service), + datasetsPath = [query.from, query.select[0]].join('.'); + datasets.summarize(datasetsPath).then(function(datasetSummary) { + resolve(datasetSummary); + }); + }) +} + +/** + * Method to get the different diseases names inside a class in order to feed the typeahead + * @returns {array} an array with the server response containing the different diseases names + */ +function getDiseasesNamesInClass(className, constraints) { + return new Promise((resolve, reject) => { + if (className != "Protein" && className != "Gene") { + reject('You need to specify a valid class: Protein, Gene'); + } + + var service = new imjs.Service({ + root: escapeMineURL(window.mineUrl) + }); + + var query = { + "from": className, + "select": ["diseases.name", "primaryIdentifier"], + "model": { + "name": "genomic" + }, + "orderBy": [{ + "path": "diseases.name", + "direction": "ASC" + }] + }; + + var diseases = new imjs.Query(query, service), + diseasesPath = [query.from, query.select[0]].join('.'); + diseases.summarize(diseasesPath).then(function(diseasesSummary) { + resolve(diseasesSummary); + }); + }) +} + +/** + * Method to get the different protein domain names inside a class in order to feed the typeahead + * @returns {array} an array with the server response containing the different protein domain names + */ +function getProteinDomainNamesInClass(className, constraints) { + return new Promise((resolve, reject) => { + var service = new imjs.Service({ + root: escapeMineURL(window.mineUrl) + }); + + var query = { + "from": "Gene", + "select": ["proteins.proteinDomainRegions.proteinDomain.name", "primaryIdentifier"], + "model": { + "name": "genomic" + }, + "orderBy": [{ + "path": "proteins.proteinDomainRegions.proteinDomain.name", + "direction": "ASC" + }] + }; + + var protdomname = new imjs.Query(query, service), + protdomnamePath = [query.from, query.select[0]].join('.'); + protdomname.summarize(protdomnamePath).then(function(protdomnameSummary) { + resolve(protdomnameSummary); + }); + }) +} + +/** + * Method to get the different Participant 2 gene symbols in order to feed the typeahead + * @returns {array} an array with the server response containing the different participant 2 gene symbols in Interactions + */ +function getParticipant2SymbolsInClass(className, constraints) { + return new Promise((resolve, reject) => { + var service = new imjs.Service({ + root: escapeMineURL(window.mineUrl) + }); + + var query = { + "from": "Gene", + "select": ["interactions.participant2.symbol"], + "model": { + "name": "genomic" + }, + "orderBy": [{ + "path": "interactions.participant2.symbol", + "direction": "ASC" + }] + }; + + var part2genesymbol = new imjs.Query(query, service), + part2genesymbolPath = [query.from, query.select[0]].join('.'); + part2genesymbol.summarize(part2genesymbolPath).then(function(part2genesymbolSummary) { + resolve(part2genesymbolSummary); + }); + }) +} + +function getPhenotypeNames(className, constraints) { + return new Promise((resolve, reject) => { + var service = new imjs.Service({ + root: escapeMineURL(window.mineUrl) + }); + + var query = { + "from": "Gene" , + "select": [ + "diseases.hpoAnnotations.hpoTerm.name", + "primaryIdentifier" + ], + "model": { + "name": "genomic" + }, + "orderBy": [{ + "path": "symbol", + "direction": "ASC" + }] + }; + + var pathways = new imjs.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 + resolve(pathwaySummary); + }); + }) +} + +/** + * Method to get the summary of gene length inside a class (in buckets) in order to feed the bar graph + * @param {array} constraints: the constraints for the endpoint call + * @returns {array} an array with the server response containing the summaries + */ +function getSavedLists() { + var hm = window.interminesHashMap; + var apiKey; + for(var i = 0; i < hm.length; ++i) { + var mineData = hm[i]; + if(window.formatMineURL(mineData.mineurl) === window.mineUrl) { + var apiKeyArray = JSON.parse(localStorage.getItem('api-keys')); + for(var j = 0; j < apiKeyArray.length; ++j) { + if(mineData.mine === apiKeyArray[j].mine) { + apiKey = apiKeyArray[j].apikey; + break; + } + } + } + } + + + return new Promise((resolve, reject) => { + const token = apiKey || null; + var service = new imjs.Service({ + root: escapeMineURL(window.mineUrl), + token + }); + service.fetchLists().then(lists => resolve(lists)); + }) +} + +// + +/** +* Method that returns a valid session API key for the current mine +*/ +function getSessionToken() { + + // Check if the user has a session token in Local Storage, for this mine + if (typeof(Storage) !== "undefined") { + if (localStorage.getItem("api-keys")) { + var apiKeysObject = JSON.parse(localStorage.getItem("api-keys")); + if(findElementJSONarray(apiKeysObject, "mine", window.selectedMineName)) { + var apiKeyForThisMine = findElementJSONarray(apiKeysObject, "mine", window.selectedMineName)["apikey"]; + if(apiKeyForThisMine && apiKeyForThisMine != "" && apiKeyForThisMine != "Paste your API key here") { + // Change the added/not added API key icon + $("#APIKeyIconNotAdded").hide(); + $("#APIKeyIconAdded").show(); + return apiKeyForThisMine; + } + } + } + } + + // Otherwise get a public one from the session route + var tokenUrl = escapeMineURL(window.mineUrl); + var tokenKey = ""; + + if(tokenUrl.slice(-1) == "/") { + tokenUrl += "session"; + } else { + tokenUrl += "/session"; + } + + // Get token + $.ajax({ + 'url': tokenUrl, + data: {}, + async: false, + error: function(xhr, status) {}, + success: function(data) { + tokenKey = data.token; + } + }); + + return tokenKey; +} + +/** + * Method to get the model of a mine given its query service + * @returns {array} an array with the server response with the mine model + */ +function getMineModel(serviceUrl) { + return $.ajax({ + url: serviceUrl, + type: 'GET', + contentType: "application/json; charset=utf-8", + dataType: "json", + error: function(e) { + console.log(e); + }, + success: function(data) {} + }) +} + +/** + * Method to get the summary of gene length inside a class (in buckets) in order to feed the bar graph + * @param {array} constraints: the constraints for the endpoint call + * @returns {array} an array with the server response containing the summaries + */ +function getGeneLengthsInClass(className, constraints) { + return new Promise((resolve, reject) => { + var service = new imjs.Service({ + root: escapeMineURL(window.mineUrl) + }); + + var query = { + "constraintLogic": "(A OR B OR C OR D OR E OR F OR G OR H OR I OR J) AND (K) AND (L) AND (M) AND (N) AND (O) AND (P) AND (Q) AND (R) AND (O AND S) AND (T AND U AND V) AND (W AND X AND Y AND Z)", + "from": className, + "select": ["length", "primaryIdentifier"], + "model": { + "name": "genomic" + }, + "where": constraints, + "orderBy": [{ + "path": "length", + "direction": "ASC" + }] + }; + + var genelengths = new imjs.Query(query, service), + genelengthsPath = [query.from, query.select[0]].join('.'); + genelengths.summarize(genelengthsPath).then(function(genelengthsSummary) { + //This returns the gene length and the number of gene rows associated with the gene length + resolve(genelengthsSummary); + }).catch(function(error) { + reject(error.message); + }); + }); +} + +/** + * Method to get the different items inside a class (count per organism) in order to feed the sidebar + * @param {array} constraints: the constraints for the endpoint call + * @returns {array} an array with the server response containing the different items in a class + */ +function getItemsInClass(className, constraints) { + return new Promise((resolve, reject) => { + var result = []; + + var service = new imjs.Service({ + root: escapeMineURL(window.mineUrl) + }); + + if (className == "Gene") { + var query = { + "constraintLogic": "(A OR B OR C OR D OR E OR F OR G OR H OR I OR J) AND (K) AND (L) AND (M) AND (N) AND (O) AND (P) AND (Q) AND (R) AND (O AND S) AND (T AND U AND V) AND (W AND X AND Y AND Z)", + "from": 'Gene', + "select": ['primaryIdentifier'], + "model": { + 'name': 'genomic' + }, + "where": constraints + }; + + var q = new imjs.Query(query, service); + + q.summarize("Gene.organism.shortName", 50) + .then(function(response) { + result.push({ + "itemName": "Organism short name", + "response": response + }); + resolve(result); + }).catch(function(error) { + reject(error.message); + }); + + } + + if (className == "Protein") { + var query = { + "constraintLogic": "(A OR B OR C OR D OR E OR F OR G OR H OR I OR J) AND (K) AND (L) AND (M) AND (N) AND (O) AND (P) AND (Q) AND (R) AND (O AND S) AND (T AND U AND V) AND (W AND X AND Y AND Z)", + "from": 'Protein', + "select": ['primaryIdentifier'], + "model": { + 'name': 'genomic' + }, + "where": constraints + }; + + var q = new imjs.Query(query, service); + + q.summarize("Protein.organism.shortName", 10) + .then(function(response) { + result.push({ + "itemName": "Organism short name", + "response": response + }); + resolve(result); + }).catch(function(error) { + reject(error.message); + }); + } + }) +} \ No newline at end of file diff --git a/src/js/common.js b/src/js/common.js index 494e0287..1832e0ed 100644 --- a/src/js/common.js +++ b/src/js/common.js @@ -42,7 +42,7 @@ function initializeStartupConfiguration() { }); // Initial mine service url (HumanMine), name and view - window.mineUrl = "httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice"; + window.mineUrl = "httpsCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice"; window.selectedMineName = "HumanMine"; if(!sessionStorage.getItem('currentClassView')) { sessionStorage.setItem('currentClassView', 'Gene'); @@ -139,7 +139,11 @@ function initializeStartupConfiguration() { }); // Update organism short name filter - updateOrganismsSidebarFilter(); + try { + updateOrganismsSidebarFilter(); + } catch (err) { + console.log("There was an error updating the organism sidebar filter: ", err); + } createSidebarEvents(); } @@ -170,7 +174,7 @@ function initializeConstraintsList() { function initializeSavedLists(){ if(window.savedListsInitialized) return; - $.when(getSavedLists()).then(function(result) { + getSavedLists().then(function(result) { var formElement = ''; var listElements = result.map(function(list) { return "
  • " + list.title + "
  • " @@ -385,7 +389,7 @@ function addViewManagerSelectOptions() { * Method to expand the dataset names filter, showing the remaining ones and adding the appropriate event handling to them */ function showMoreDatasetNames() { - $.when(getDatasetNamesInClass()).done(function(result) { + getDatasetNamesInClass(sessionStorage.getItem('currentClassView'), []).then(function(result) { var availableDatasetNames = []; for (var i = 0; i < result.results.length; i++) { @@ -644,7 +648,7 @@ function addCustomFilters() { $("#sidebarUl").append( ''); - $.when(getParticipant2SymbolsInClass()).done(function(result) { + getParticipant2SymbolsInClass(sessionStorage.getItem('currentClassView'), []).then(function(result) { var availableParticipant2Symbol = []; @@ -733,7 +737,7 @@ function addCustomFilters() { $("#sidebarUl").append( ''); - $.when(getDiseasesNamesInClass()).done(function(result) { + getDiseasesNamesInClass(sessionStorage.getItem('currentClassView'), []).then(function(result) { var availableDiseasesNames = []; @@ -789,7 +793,7 @@ function addCustomFilters() { $("#sidebarUl").append( ''); - $.when(getAllelesClinicalSignifanceInClass()).done(function(result) { + getAllelesClinicalSignifanceInClass(sessionStorage.getItem('currentClassView'), []).then(function(result) { var availableData = []; @@ -820,7 +824,7 @@ function addCustomFilters() { }); - $.when(getAllelesTypesInClass()).done(function(result) { + getAllelesTypesInClass(sessionStorage.getItem('currentClassView'), []).then(function(result) { var availableData = []; @@ -913,7 +917,7 @@ function addCustomFilters() { $("#sidebarUl").append( ''); - $.when(getProteinAtlasExpressionCellTypesInClass()).done(function(result) { + getProteinAtlasExpressionCellTypesInClass(sessionStorage.getItem('currentClassView'), []).then(function(result) { var availableData = []; @@ -944,7 +948,7 @@ function addCustomFilters() { }); - $.when(getProteinAtlasExpressionTissueNamesInClass()).done(function(result) { + getProteinAtlasExpressionTissueNamesInClass(sessionStorage.getItem('currentClassView'), []).then(function(result) { var availableData = []; @@ -1049,7 +1053,7 @@ function addCustomFilters() { $("#sidebarUl").append( ''); - $.when(getProteinDomainNamesInClass()).done(function(result) { + getProteinDomainNamesInClass(sessionStorage.getItem('currentClassView'), []).then(function(result) { var availableProteinDomainNames = []; @@ -1107,7 +1111,7 @@ function addCustomFilters() { $("#sidebarUl").append( ''); try { - $.when(getPhenotypeNames()).done(function(result) { + getPhenotypeNames(sessionStorage.getItem('currentClassView'), []).then(function(result) { var availablePhenotypeNames = []; @@ -1172,8 +1176,9 @@ function addCustomFilters() { * @param {string} results: the organism query results from the InterMine server */ function updateOrganismsSidebarFilter() { + var className = sessionStorage.getItem('currentClassView'); - $.when(getItemsInClass([])).done(function(result) { + getItemsInClass(className, []).then(function(result) { // First remove the li elements $('#organismshortnamelist').parent().find('li').remove(); @@ -1236,7 +1241,6 @@ function updateOrganismsSidebarFilter() { * @param {string} results: the organism query results from the InterMine server */ function updatePieChart(result, pieChartID) { - // Update pie if (window.pieChartObject) { window.pieChartObject.destroy(); @@ -1419,7 +1423,7 @@ function updatePieChart(result, pieChartID) { function createGoAnnotationFilter() { try { - $.when(getOntologyTermsInClass()).done(function(result) { + getOntologyTermsInClass(sessionStorage.getItem('currentClassView'), []).then(function(result) { var availableGoTerms = []; @@ -1479,7 +1483,7 @@ function createDatasetFilter() { ''); } - $.when(getDatasetNamesInClass()).done(function(result) { + getDatasetNamesInClass(sessionStorage.getItem('currentClassView'), []).then(function(result) { if (!window.datasetNamesLoaded) { var availableDatasetNames = []; @@ -1543,7 +1547,7 @@ function createDatasetFilter() { function createPathwaysNameFilter() { try { - $.when(getPathwayNamesInClass()).done(function(result) { + getPathwayNamesInClass(sessionStorage.getItem('currentClassView'), []).then(function(result) { var availablePathwayNames = []; @@ -1616,13 +1620,13 @@ function fillMineSelector() { var currentMineNameTemp; var currentMineUrlTemp; for (var i = 0; i < result.instances.length; i++) { - if (result.instances[i].url.startsWith("https")) continue; + //if (result.instances[i].url.startsWith("https")) continue; // Temporarily skiping mines with missing concepts for the default filters - if (result.instances[i].name == "GrapeMine" || result.instances[i].name == "RepetDB" || result.instances[i].name == "Wheat3BMine" || result.instances[i].name == "WormMine" || result.instances[i].name == "XenMine" || result.instances[i].name == "PlanMine") continue; + //if (result.instances[i].name == "GrapeMine" || result.instances[i].name == "RepetDB" || result.instances[i].name == "Wheat3BMine" || result.instances[i].name == "WormMine" || result.instances[i].name == "XenMine" || result.instances[i].name == "PlanMine") continue; // Mines giving error when querying the API or not responding - if (result.instances[i].name == "ModMine" || result.instances[i].name == "MitoMiner") continue; + //if (result.instances[i].name == "ModMine" || result.instances[i].name == "MitoMiner") continue; var mineUrl = result.instances[i].url; @@ -1777,10 +1781,14 @@ function updateElements(constraints, pieChartID) { initializeViewManager(); addViewManagerSelectOptions(); - $.when(getItemsInClass(constraints)).done(function(result) { - createSidebarEvents(); - updatePieChart(result, pieChartID); - }); + try { + getItemsInClass(sessionStorage.getItem('currentClassView'), constraints).then(function(result) { + createSidebarEvents(); + updatePieChart(result, pieChartID); + }); + } catch (err) { + console.log("There was an error updating the elements", err); + } } /** @@ -1794,13 +1802,13 @@ function initializeKeyManager() { $.when(getIntermines()).done(function(result) { // First get the mines for (var i = 0; i < result.instances.length; i++) { - if (result.instances[i].url.startsWith("https")) continue; + //if (result.instances[i].url.startsWith("https")) continue; // Temporarily skiping mines with missing concepts for the default filters - if (result.instances[i].name == "GrapeMine" || result.instances[i].name == "RepetDB" || result.instances[i].name == "Wheat3BMine" || result.instances[i].name == "WormMine" || result.instances[i].name == "XenMine" || result.instances[i].name == "PlanMine") continue; + //if (result.instances[i].name == "GrapeMine" || result.instances[i].name == "RepetDB" || result.instances[i].name == "Wheat3BMine" || result.instances[i].name == "WormMine" || result.instances[i].name == "XenMine" || result.instances[i].name == "PlanMine") continue; // Mines giving error when querying the API or not responding - if (result.instances[i].name == "ModMine" || result.instances[i].name == "MitoMiner") continue; + //if (result.instances[i].name == "ModMine" || result.instances[i].name == "MitoMiner") continue; var mineName = result.instances[i].name; @@ -1952,7 +1960,7 @@ function initializeViewManager() { * @param {string} geneLengthChartID: the div id of the gene length chart, in order to update it */ function updateGeneLengthChart(constraints, geneLengthChartID) { - $.when(getGeneLengthsInClass(constraints)).done(function(result) { + getGeneLengthsInClass(sessionStorage.getItem('currentClassView'), constraints).then(function(result) { if (window.geneLengthChartObject) { window.geneLengthChartObject.destroy(); } @@ -2057,4 +2065,4 @@ function updateGeneLengthChart(constraints, geneLengthChartID) { options: barChartOptions }); }); -} +} \ No newline at end of file diff --git a/src/js/request-handler.js b/src/js/request-handler.js deleted file mode 100644 index 111aacf1..00000000 --- a/src/js/request-handler.js +++ /dev/null @@ -1,309 +0,0 @@ -/** - * Method to get the different intermines names and URLs from the registry - * @returns {array} an array with the server response containing the different intermines with their URLs - */ -function getIntermines() { - return $.ajax({ - url: 'http://registry.intermine.org/service/instances?mines=%27prod%27', - type: 'GET', - error: function(e) { - console.log(e); - }, - success: function(data) {} - }) -} - -/** - * Method to get the different ontology terms inside a class in order to feed the typeahead - * @returns {array} an array with the server response containing the different ontology terms - */ -function getOntologyTermsInClass() { - return $.ajax({ - url: '/fetch/ontologyterms/' + window.mineUrl + '/' + sessionStorage.getItem('currentClassView'), - type: 'GET', - error: function(e) { - console.log(e); - }, - success: function(data) {} - }) -} - -/** - * Method to get the different alleles clinical significance inside a class in order to feed the typeahead - * @returns {array} an array with the server response containing the different alleles clinical significances - */ -function getAllelesClinicalSignifanceInClass() { - return $.ajax({ - url: '/fetch/clinicalsignificance/' + window.mineUrl + '/' + sessionStorage.getItem('currentClassView'), - type: 'GET', - error: function(e) { - console.log(e); - }, - success: function(data) {} - }) -} - -/** - * Method to get the different protein atlas expression cell types inside a class in order to feed the typeahead - * @returns {array} an array with the server response containing the different protein atlas expression cell types - */ -function getProteinAtlasExpressionCellTypesInClass() { - return $.ajax({ - url: '/fetch/proteinatlascelltypes/' + window.mineUrl + '/' + sessionStorage.getItem('currentClassView'), - type: 'GET', - error: function(e) { - console.log(e); - }, - success: function(data) {} - }) -} - -/** - * Method to get the different protein atlas expression tissue names inside a class in order to feed the typeahead - * @returns {array} an array with the server response containing the different protein atlas expression tissue names - */ -function getProteinAtlasExpressionTissueNamesInClass() { - return $.ajax({ - url: '/fetch/proteinatlastissuenames/' + window.mineUrl + '/' + sessionStorage.getItem('currentClassView'), - type: 'GET', - error: function(e) { - console.log(e); - }, - success: function(data) {} - }) -} - -/** - * Method to get the different alleles types inside a class in order to feed the typeahead - * @returns {array} an array with the server response containing the different alleles types - */ -function getAllelesTypesInClass() { - return $.ajax({ - url: '/fetch/allelestype/' + window.mineUrl + '/' + sessionStorage.getItem('currentClassView'), - type: 'GET', - error: function(e) { - console.log(e); - }, - success: function(data) {} - }) -} - -/** - * Method to get the different dataset names inside a class in order to feed the typeahead - * @returns {array} an array with the server response containing the different dataset names - */ -function getDatasetNamesInClass() { - return $.ajax({ - url: '/fetch/datasets/' + window.mineUrl + '/' + sessionStorage.getItem('currentClassView'), - type: 'GET', - error: function(e) { - console.log(e); - }, - success: function(data) {} - }) -} - -/** - * Method to get the different pathway names inside a class in order to feed the typeahead - * @returns {array} an array with the server response containing the different pathway names - */ -function getPathwayNamesInClass() { - return $.ajax({ - url: '/fetch/pathways/' + window.mineUrl + '/' + sessionStorage.getItem('currentClassView'), - type: 'GET', - error: function(e) { - console.log('Error'); - }, - success: function(data) {} - }) -} - -/** - * Method to get the different diseases names inside a class in order to feed the typeahead - * @returns {array} an array with the server response containing the different diseases names - */ -function getDiseasesNamesInClass() { - return $.ajax({ - url: '/fetch/diseases/' + window.mineUrl + '/' + sessionStorage.getItem('currentClassView'), - type: 'GET', - error: function(e) { - console.log(e); - }, - success: function(data) {} - }) -} - -/** - * Method to get the different protein domain names inside a class in order to feed the typeahead - * @returns {array} an array with the server response containing the different protein domain names - */ -function getProteinDomainNamesInClass() { - return $.ajax({ - url: '/fetch/proteindomainname/' + window.mineUrl, - type: 'GET', - error: function(e) { - console.log(e); - }, - success: function(data) {} - }) -} - -/** - * Method to get the different Participant 2 gene symbols in order to feed the typeahead - * @returns {array} an array with the server response containing the different participant 2 gene symbols in Interactions - */ -function getParticipant2SymbolsInClass() { - return $.ajax({ - url: '/fetch/participant2genesymbols/' + window.mineUrl, - type: 'GET', - error: function(e) { - console.log(e); - }, - success: function(data) {} - }) -} - -/** -* Method that returns a valid session API key for the current mine -*/ -function getSessionToken() { - - // Check if the user has a session token in Local Storage, for this mine - if (typeof(Storage) !== "undefined") { - if (localStorage.getItem("api-keys")) { - var apiKeysObject = JSON.parse(localStorage.getItem("api-keys")); - if(findElementJSONarray(apiKeysObject, "mine", window.selectedMineName)) { - var apiKeyForThisMine = findElementJSONarray(apiKeysObject, "mine", window.selectedMineName)["apikey"]; - if(apiKeyForThisMine && apiKeyForThisMine != "" && apiKeyForThisMine != "Paste your API key here") { - // Change the added/not added API key icon - $("#APIKeyIconNotAdded").hide(); - $("#APIKeyIconAdded").show(); - return apiKeyForThisMine; - } - } - } - } - - // Otherwise get a public one from the session route - var tokenUrl = escapeMineURL(window.mineUrl); - var tokenKey = ""; - - if(tokenUrl.slice(-1) == "/") { - tokenUrl += "session"; - } else { - tokenUrl += "/session"; - } - - // Get token - $.ajax({ - 'url': tokenUrl, - data: {}, - async: false, - error: function(xhr, status) {}, - success: function(data) { - tokenKey = data.token; - } - }); - - return tokenKey; -} - -/** - * Method to get the model of a mine given its query service - * @returns {array} an array with the server response with the mine model - */ -function getMineModel(serviceUrl) { - return $.ajax({ - url: serviceUrl, - type: 'GET', - contentType: "application/json; charset=utf-8", - dataType: "json", - error: function(e) { - console.log(e); - }, - success: function(data) {} - }) -} - -/** - * Method to get the different items inside a class (count per organism) in order to feed the sidebar - * @param {array} constraints: the constraints for the endpoint call - * @returns {array} an array with the server response containing the different items in a class - */ -function getItemsInClass(constraints) { - return $.ajax({ - url: '/statistics/count/items/' + window.mineUrl + '/' + sessionStorage.getItem('currentClassView'), - type: 'POST', - data: JSON.stringify(constraints), - contentType: "application/json; charset=utf-8", - dataType: "json", - error: function(e) { - console.log(e); - }, - success: function(data) {} - }) -} - -/** - * Method to get the summary of gene length inside a class (in buckets) in order to feed the bar graph - * @param {array} constraints: the constraints for the endpoint call - * @returns {array} an array with the server response containing the summaries - */ -function getGeneLengthsInClass(constraints) { - return $.ajax({ - url: '/statistics/genelength/' + window.mineUrl + '/' + sessionStorage.getItem('currentClassView'), - type: 'POST', - data: JSON.stringify(constraints), - contentType: "application/json; charset=utf-8", - dataType: "json", - error: function(e) { - console.log(e); - }, - success: function(data) {} - }) -} - -function getPhenotypeNames() { - return $.ajax({ - url: '/fetch/phenotypes/' + window.mineUrl, - type: 'GET', - error: function(e) { - console.log(e); - }, - success: function(data) {} - }) -} - -/** - * Method to get the summary of gene length inside a class (in buckets) in order to feed the bar graph - * @param {array} constraints: the constraints for the endpoint call - * @returns {array} an array with the server response containing the summaries - */ -function getSavedLists() { - var hm = window.interminesHashMap; - var apiKey; - for(var i = 0; i < hm.length; ++i) { - var mineData = hm[i]; - if(window.formatMineURL(mineData.mineurl) === window.mineUrl) { - var apiKeyArray = JSON.parse(localStorage.getItem('api-keys')); - for(var j = 0; j < apiKeyArray.length; ++j) { - if(mineData.mine === apiKeyArray[j].mine) { - apiKey = apiKeyArray[j].apikey; - break; - } - } - } - } - - return $.ajax({ - url: '/fetch/lists/' + window.mineUrl, - type: 'POST', - body: JSON.stringify({ - token: apiKey - }), - error: function(e){ - console.log(e); - }, - success: function(data) {} - }); -} diff --git a/src/scss/_footer.scss b/src/scss/_footer.scss index c0a4469a..2cfeba75 100644 --- a/src/scss/_footer.scss +++ b/src/scss/_footer.scss @@ -8,7 +8,9 @@ footer.sticky-footer { background-color: $gray-200; - line-height: 55px; + display: flex; + align-items: center; + justify-content: center; @media (min-width: 992px) { width: calc(100% - #{$sidenav-base-width}); } diff --git a/src/scss/_global.scss b/src/scss/_global.scss index b7e0d138..24015064 100644 --- a/src/scss/_global.scss +++ b/src/scss/_global.scss @@ -109,10 +109,8 @@ body.sticky-footer { } body.fixed-nav { - padding-top: $navbar-base-height; - @media screen and (max-width: 991px) { - padding-top: calc(#{$navbar-base-height} * 8.5); - } + padding-top: 0 !important; + background: #e9ecef; } .content-wrapper { @@ -235,6 +233,11 @@ button{ align-items: center; } +.options { + display: flex; + flex-wrap: nowrap; +} + @media (max-width: 991px) { #graphsBoxBody { display: flex; @@ -242,6 +245,10 @@ button{ flex-direction: column; align-items: center; } + + .options { + flex-wrap: wrap; + } } .viewManagerElement { diff --git a/src/scss/_variables.scss b/src/scss/_variables.scss index 53de75ab..a037a504 100644 --- a/src/scss/_variables.scss +++ b/src/scss/_variables.scss @@ -25,10 +25,10 @@ $cyan: #17a2b8 !default; // Spacing Variables // Change below variable if the height of the navbar changes -$navbar-base-height: 56px; +$navbar-base-height: 64px; // Change below variable to change the width of the sidenav $sidenav-base-width: 225px; // Change below variable to change the width of the sidenav when collapsed $sidenav-collapsed-width: 55px; // Change below variable to change the height of the sticky footer -$sticky-footer-height: 56px; \ No newline at end of file +$sticky-footer-height: 65px; \ No newline at end of file diff --git a/src/scss/navbar/_navbar_fixed.scss b/src/scss/navbar/_navbar_fixed.scss index 94450f98..12213e25 100644 --- a/src/scss/navbar/_navbar_fixed.scss +++ b/src/scss/navbar/_navbar_fixed.scss @@ -50,7 +50,7 @@ } .btn-space { - margin-right: 5px; + margin: 5px; } body.sidenav-toggled { diff --git a/src/scss/navbar/_navbar_global.scss b/src/scss/navbar/_navbar_global.scss index 93f4c3b8..d1e90b8d 100644 --- a/src/scss/navbar/_navbar_global.scss +++ b/src/scss/navbar/_navbar_global.scss @@ -1,142 +1,126 @@ #mainNav { - .navbar-collapse { - overflow: auto; - - .navbar-nav { - .nav-item { - .nav-link { - cursor: pointer; + .navbar-collapse { + overflow: auto; + .navbar-nav { + .nav-item { + .nav-link { + cursor: pointer; + } + } } - } - } - .navbar-sidenav { - .nav-link-collapse:after { - float: right; - - content: '\f107'; - - font-family: 'FontAwesome'; - } - .nav-link-collapse.collapsed:after { - content: '\f105'; - } - .sidenav-second-level, - .sidenav-third-level { - padding-left: 0; - > li > a { - display: block; - - padding: 0.5em 0; - &:focus, - &:hover { - text-decoration: none; - } + .navbar-sidenav { + .nav-link-collapse:after { + float: right; + content: '\f107'; + font-family: 'FontAwesome'; + } + .nav-link-collapse.collapsed:after { + content: '\f105'; + } + .sidenav-second-level, + .sidenav-third-level { + padding-left: 0; + >li>a { + display: block; + padding: 0.5em 0; + &:focus, + &:hover { + text-decoration: none; + } + } + } + .sidenav-second-level>li>a { + padding-left: 1em; + } + .sidenav-third-level>li>a { + padding-left: 2em; + } } - } - .sidenav-second-level > li > a { - padding-left: 1em; - } - .sidenav-third-level > li > a { - padding-left: 2em; - } - } - .sidenav-toggler { - display: none; - } - .navbar-nav > .nav-item.dropdown { - > .nav-link { - position: relative; - - min-width: 45px; - &:after { - float: right; - - width: auto; - - content: '\f105'; - - border: none; - - font-family: 'FontAwesome'; + .sidenav-toggler { + display: none; } - .indicator { - position: absolute; - top: 5px; - left: 21px; - font-size: 10px; + .navbar-nav>.nav-item.dropdown { + >.nav-link { + position: relative; + min-width: 45px; + &:after { + float: right; + width: auto; + content: '\f105'; + border: none; + font-family: 'FontAwesome'; + } + .indicator { + position: absolute; + top: 5px; + left: 21px; + font-size: 10px; + } + } + &.show>.nav-link:after { + content: '\f107'; + } + .dropdown-menu>.dropdown-item>.dropdown-message { + overflow: hidden; + max-width: none; + text-overflow: ellipsis; + } } - } - &.show > .nav-link:after { - content: '\f107'; - } - .dropdown-menu > .dropdown-item > .dropdown-message { - overflow: hidden; - - max-width: none; - - text-overflow: ellipsis; - } } - } - @media (min-width: 992px) { - .navbar-brand { - width: $sidenav-base-width; + @media (min-width: 1085px) { + .navbar-sidenav { + margin-top: $navbar-base-height !important; + } } - .navbar-collapse { - overflow: visible; - - max-height: none; - .navbar-sidenav { - position: absolute; - top: 0; - left: 0; - - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; - - margin-top: $navbar-base-height; - - > .nav-item { - width: $sidenav-base-width; - padding: 0; - > .nav-link { - padding: 1em; - } - .sidenav-second-level, - .sidenav-third-level { - padding-left: 0; - - list-style: none; - - > li { - width: $sidenav-base-width; - > a { - padding: 1em; - } + @media (min-width: 992px) { + .navbar-collapse { + overflow: visible; + max-height: none; + .navbar-sidenav { + position: absolute; + top: 0; + left: 0; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; + margin-top: 112px; + >.nav-item { + width: $sidenav-base-width; + padding: 0; + >.nav-link { + padding: 1em; + } + .sidenav-second-level, + .sidenav-third-level { + padding-left: 0; + list-style: none; + >li { + width: $sidenav-base-width; + >a { + padding: 1em; + } + } + } + .sidenav-second-level>li>a { + padding-left: 2.75em; + } + .sidenav-third-level>li>a { + padding-left: 3.75em; + } + } + } + .navbar-nav>.nav-item.dropdown { + >.nav-link { + min-width: 0; + &:after { + width: 24px; + text-align: center; + } + } + .dropdown-menu>.dropdown-item>.dropdown-message { + max-width: 300px; + } } - } - .sidenav-second-level > li > a { - padding-left: 2.75em; - } - .sidenav-third-level > li > a { - padding-left: 3.75em; - } - } - } - .navbar-nav > .nav-item.dropdown { - > .nav-link { - min-width: 0; - &:after { - width: 24px; - - text-align: center; - } - } - .dropdown-menu > .dropdown-item > .dropdown-message { - max-width: 300px; } - } } - } -} +} \ No newline at end of file diff --git a/test/api-requests-test.js b/test/api-requests-test.js new file mode 100644 index 00000000..236c0b76 --- /dev/null +++ b/test/api-requests-test.js @@ -0,0 +1,43 @@ +//During the test the env variable is set to test +process.env.NODE_ENV = 'test'; + +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('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" + }); + + 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(); + }); + + }); + }); +}); \ No newline at end of file diff --git a/test/fetch.js b/test/fetch.js deleted file mode 100644 index 132c4df3..00000000 --- a/test/fetch.js +++ /dev/null @@ -1,156 +0,0 @@ -//During the test the env variable is set to test -process.env.NODE_ENV = 'test'; - -let chai = require('chai'); -let chaiHttp = require('chai-http'); -let server = require('../app'); -let should = chai.should(); - -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(); - }); - }); - - 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(); - }); - }); - - 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/test/statistics.js b/test/statistics.js deleted file mode 100644 index 764b796b..00000000 --- a/test/statistics.js +++ /dev/null @@ -1,64 +0,0 @@ -//During the test the env variable is set to test -process.env.NODE_ENV = 'test'; - -let chai = require('chai'); -let chaiHttp = require('chai-http'); -let server = require('../app'); -let should = chai.should(); - -chai.use(chaiHttp); - -describe('Statistics', () => { - describe('/GET count of HumanMine primary classes', () => { - it('it should GET the count of HumanMine primary classes', (done) => { - chai.request(server) - .get('/statistics/count/primary/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice') - .end((err, res) => { - res.should.have.status(200); - res.body.should.be.a('array'); - res.body.length.should.equal(2); - res.body[0]["name"].should.equal("Gene") - res.body[0]["count"].should.be.at.least(0); - res.body[1]["name"].should.equal("Protein") - res.body[1]["count"].should.be.at.least(0); - done(); - }); - }); - - it('it should GET the count of items inside class Protein in HumanMine', (done) => { - chai.request(server) - .get('/statistics/count/items/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Protein') - .end((err, res) => { - res.should.have.status(200); - res.body.should.be.a('array'); - res.body.length.should.equal(1); - res.body[0]["itemName"].should.equal("Organism short name") - should.exist(res.body[0]["response"]); - done(); - }); - }); - - it('it should GET the count of items inside class Gene in HumanMine', (done) => { - chai.request(server) - .get('/statistics/count/items/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene') - .end((err, res) => { - res.should.have.status(200); - res.body.should.be.a('array'); - res.body.length.should.equal(1); - res.body[0]["itemName"].should.equal("Organism short name") - should.exist(res.body[0]["response"]); - done(); - }); - }); - - it('it should GET the summaries of Gene Lengths inside class Gene in HumanMine', (done) => { - chai.request(server) - .get('/statistics/genelength/httpCOLONSLASHSLASHwww.humanmine.orgSLASHhumanmineSLASHservice/Gene') - .end((err, res) => { - res.should.have.status(200); - done(); - }); - }); - }); - -}); \ No newline at end of file diff --git a/views/includes/footer.pug b/views/includes/footer.pug index d10caea9..af445daa 100644 --- a/views/includes/footer.pug +++ b/views/includes/footer.pug @@ -1,11 +1,9 @@ footer.sticky-footer - .container - .text-center - a(href='https://github.com/AdrianBZG/InterMine-Data-Browser-Tool' target='_blank' alt='Go to the GitHub repository') - i.fa.fa-fw.fa-github - small - | InterMine Data Browser @ GSoC 2018. By - a(href='http://www.linkedin.com/in/adrianbazaga' target='_blank') Adrián Rodríguez-Bazaga - |, - a(href='http://intermine.org/' target='_blank') InterMine - | & University of Cambridge + .text-center + a(href='https://github.com/AdrianBZG/InterMine-Data-Browser-Tool' target='_blank' alt='Go to the GitHub repository') + i.fa.fa-fw.fa-github + | InterMine Data Browser @ GSoC 2018. By + a(href='http://www.linkedin.com/in/adrianbazaga' target='_blank') Adrián Rodríguez-Bazaga + |, + a(href='http://intermine.org/' target='_blank') InterMine + | & University of Cambridge 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') diff --git a/views/includes/js/custom.pug b/views/includes/js/custom.pug index e5368404..9db010e2 100644 --- a/views/includes/js/custom.pug +++ b/views/includes/js/custom.pug @@ -1,4 +1,4 @@ // Custom scripts for all pages script(src='javascripts/utils.min.js') script(src='javascripts/common.min.js') -script(src='javascripts/request-handler.min.js') +script(src='javascripts/api-requests.min.js') diff --git a/views/includes/navbar.pug b/views/includes/navbar.pug index 7b2a06fd..7c659346 100755 --- a/views/includes/navbar.pug +++ b/views/includes/navbar.pug @@ -1,35 +1,36 @@ // Navigation -nav#mainNav.navbar.navbar-expand-lg.navbar-light.bg-light.fixed-top - a.navbar-brand(href='/') - img(src="/img/intermine-logo.png" style="width: 24px; height: 25px;") - select#mineSelector.form-control(style="width: 180px; position: fixed; top: 10px; left: 75px;" data-toggle="tooltip" title="Select an InterMine") +nav#mainNav.navbar.navbar-light + div(style="display: flex; align-items: center; margin: 0 5px;") + a.navbar-brand(href='/') + img(src="/img/intermine-logo.png" style="width: 24px; height: 25px;") + select#mineSelector.form-control(style="min-width: 180px; width: 10vw;" data-toggle="tooltip" title="Select an InterMine") - div#headerButtons.col-md-6.text-center + div#headerButtons - button.btn.btn-primary(id="APIKeyIconBlock" style="position: fixed; top: 10px; right: 578px; background-color: transparent; border-color: transparent;") - i.fa.fa-user-times(id="APIKeyIconNotAdded", style="color: #000000;" data-toggle="tooltip" title="You haven't added an API key for this mine and some functionality may be unavailable.") - i.fa.fa-user(id="APIKeyIconAdded", style="color: #000000; display:none;" data-toggle="tooltip" title="You have added an API key for this mine.") - - button.btn.btn-primary(id="resetAllButton" style="position: fixed; top: 10px; right: 484px; background-color: #868e96; border-color: #868e96;" data-toggle="tooltip" title="Reset all the filters") - i.fa.fa-recycle(style="margin-right: 5px;") - span.nav-link-text - | Reset - button.btn.btn-primary(id="viewConstraintsButton" style="position: fixed; top: 10px; right: 352px; background-color: #2439d8; border-color: #2439d8;" data-toggle="tooltip" title="See the current constraints") - i.fa.fa-adjust(style="margin-right: 5px;") - span.nav-link-text - | Constraints - button.btn.btn-primary(id="viewManagerButton" style="position: fixed; top: 10px; right: 236px; background-color: #2439d8; border-color: #2439d8;" data-toggle="tooltip" title="Open the views manager") - i.fa.fa-eye(style="margin-right: 5px;") - span.nav-link-text - | Add view - button.btn.btn-primary(id="apiKeyManagerButton" style="position: fixed; top: 10px; right: 96px; background-color: #2439d8; border-color: #2439d8;" data-toggle="tooltip" title="Open the API Key manager") - i.fa.fa-key(style="margin-right: 5px;") - span.nav-link-text - | Add API key - button.btn.btn-primary(id="listManagerButton" style="position: fixed; top: 10px; right: 11px; background-color: #2439d8; border-color: #2439d8;" data-toggle="tooltip" title="Lists") - i.fa.fa-list(style="margin-right: 5px;") - span.nav-link-text - | Lists + div.options + button.btn.btn-primary(id="APIKeyIconBlock" style="background-color: #c0d848; border-color: transparent; margin: 5px;") + i.fa.fa-user-times(id="APIKeyIconNotAdded", style="color: #fff;" data-toggle="tooltip" title="You haven't added an API key for this mine and some functionality may be unavailable.") + i.fa.fa-user(id="APIKeyIconAdded", style="color: #fff; display:none;" data-toggle="tooltip" title="You have added an API key for this mine.") + button.btn.btn-primary(id="resetAllButton" style="background-color: #868e96; border-color: #868e96; margin: 5px;" data-toggle="tooltip" title="Reset all the filters") + i.fa.fa-recycle(style="margin-right: 5px;") + span.nav-link-text + | Reset + button.btn.btn-primary(id="viewConstraintsButton" style="background-color: #2439d8; border-color: #2439d8; margin: 5px;" data-toggle="tooltip" title="See the current constraints") + i.fa.fa-adjust(style="margin-right: 5px;") + span.nav-link-text + | Constraints + button.btn.btn-primary(id="viewManagerButton" style="background-color: #2439d8; border-color: #2439d8; margin: 5px;" data-toggle="tooltip" title="Open the views manager") + i.fa.fa-eye(style="margin-right: 5px;") + span.nav-link-text + | Add view + button.btn.btn-primary(id="apiKeyManagerButton" style="background-color: #2439d8; border-color: #2439d8; margin: 5px;" data-toggle="tooltip" title="Open the API Key manager") + i.fa.fa-key(style="margin-right: 5px;") + span.nav-link-text + | Add API key + button.btn.btn-primary(id="listManagerButton" style="background-color: #2439d8; border-color: #2439d8; margin: 5px;" data-toggle="tooltip" title="Lists") + i.fa.fa-list(style="margin-right: 5px;") + span.nav-link-text + | Lists #navbarResponsive.navbar-collapse ul#sidebarUl.navbar-nav.navbar-sidenav.list-group.panel(style="overflow: auto;") diff --git a/views/main-view.pug b/views/main-view.pug index 7b819f57..7522a24c 100644 --- a/views/main-view.pug +++ b/views/main-view.pug @@ -11,7 +11,7 @@ html(lang='en') include includes/css/core.pug include includes/css/custom.pug - body#page-top.fixed-nav.sticky-footer.bg-dark + body#page-top.fixed-nav.sticky-footer include includes/navbar.pug .content-wrapper.row .container-fluid @@ -41,5 +41,4 @@ html(lang='en') // Custom scripts for this page script(src='javascripts/main-view.min.js') - script(src='javascripts/sidebar-events.min.js') - script(src='javascripts/piechart-events.min.js') \ No newline at end of file + script(src='javascripts/sidebar-events.min.js') \ No newline at end of file