From cffdd4e3d28e899728addf00c4dc864cf26b96d6 Mon Sep 17 00:00:00 2001 From: bfrgoncalves Date: Mon, 10 Sep 2018 16:48:36 +0100 Subject: [PATCH 1/9] fix code style issues --- app/api.py | 4 +- app/resources/jobs/jobs.py | 23 ----------- app/resources/postgres/projects.py | 4 +- app/resources/postgres/reports.py | 4 +- app/resources/postgres/workflows.py | 2 +- .../controllers/dashboard_controller.js | 40 +++++++++---------- app/static/controllers/menu.js | 28 ++++++------- job_processing/phyloviz_functions.py | 5 +-- 8 files changed, 40 insertions(+), 70 deletions(-) diff --git a/app/api.py b/app/api.py index cfbf134c..a419516e 100644 --- a/app/api.py +++ b/app/api.py @@ -39,7 +39,7 @@ NGSOnto_ProcessListPipelineResource, NGSOnto_ProcessResource, \ NGSOnto_ProcessJobID, NGSOnto_ProcessOutputResource from resources.jobs.jobs import Job_queue, Job_results, Job_Result_Download, \ - Job_classify_chewbbaca, Job_Result_Download_click, Job_Reports, \ + Job_Result_Download_click, Job_Reports, \ NextflowLogs, Job_Report_Download_click, FlowcraftInspect from resources.phyloviz.phyloviz import PHYLOViZResource, TreeResource, \ TreeUserResource, PHYLOViZJobResource, getProfilesResource, \ @@ -151,8 +151,6 @@ api.add_resource(NextflowLogs, '/api/v1.0/jobs/logs/nextflow/') api.add_resource(FlowcraftInspect, '/api/v1.0/jobs/inspect/') -api.add_resource(Job_classify_chewbbaca, '/api/v1.0/jobs/classify/') - ################################# PHYLOVIZ REQUESTS ########################### api.add_resource(PHYLOViZResource, '/api/v1.0/phyloviz/') diff --git a/app/resources/jobs/jobs.py b/app/resources/jobs/jobs.py index 77059b4b..a2907056 100644 --- a/app/resources/jobs/jobs.py +++ b/app/resources/jobs/jobs.py @@ -611,29 +611,6 @@ def get(self): return report.report_data -# Load job results and classify it -class Job_classify_chewbbaca(Resource): - """ - Class to classify chewbbaca - """ - - def get(self): - """Classify profile - - Classify a profile by giving its job_id - - (DEPRECATED) - - Returns - ------- - - """ - - args = job_classify_chewbbaca_post_parser.parse_args() - database_processor.classify_profile(args.job_id, - args.database_to_include) - - # Load job results to display on graphical interface class Job_Result_Download(Resource): diff --git a/app/resources/postgres/projects.py b/app/resources/postgres/projects.py index a6e43197..daf810e0 100644 --- a/app/resources/postgres/projects.py +++ b/app/resources/postgres/projects.py @@ -249,13 +249,13 @@ def post(self): name=args.name, timestamp=datetime.datetime.utcnow()) if not project: - abort(404, message="An error as occurried when uploading the data" - .format(id)) + abort(404, message="An error as occurried when uploading the data") try: db.session.add(project) db.session.commit() except Exception as e: + print e abort(409, message="Project name already exists.") return project, 201 diff --git a/app/resources/postgres/reports.py b/app/resources/postgres/reports.py index ca8f53f5..6231b53f 100644 --- a/app/resources/postgres/reports.py +++ b/app/resources/postgres/reports.py @@ -408,9 +408,7 @@ def post(self): name=args.report_name, description=args.report_description) if not combined_report: - abort(404, - message="An error as occurried when uploading the data" - .format(id)) + abort(404, message="An error as occurried when uploading the data") reports_to_send.append( {'name': combined_report.name, diff --git a/app/resources/postgres/workflows.py b/app/resources/postgres/workflows.py index 7fdc1de5..d29a094e 100644 --- a/app/resources/postgres/workflows.py +++ b/app/resources/postgres/workflows.py @@ -100,7 +100,7 @@ def get(self, id): workflows = db.session.query(Workflow).filter(Workflow.id == id).first() if not workflows: - abort(404, message="No workflows are available".format(id)) + abort(404, message="No workflows are available") return workflows, 200 diff --git a/app/static/controllers/dashboard_controller.js b/app/static/controllers/dashboard_controller.js index 42666247..ca22a109 100644 --- a/app/static/controllers/dashboard_controller.js +++ b/app/static/controllers/dashboard_controller.js @@ -2,27 +2,6 @@ innuendoApp.controller("dashboardCtrl", ($scope, $rootScope, $http) => { let pg_requests = Requests("", "", http); - $scope.loadDashboard = () => { - performChecks(); - }; - - $scope.performChecks = () => { - performChecks(); - }; - - $scope.changeState = () => { - pg_requests.change_state((response) => { - - if (response.data == "true") { - $("#lockButton").html('') - } - else { - $("#lockButton").html('') - } - }); - }; - - const performChecks = () => { pg_requests.check_ldap((response) => { @@ -93,4 +72,23 @@ innuendoApp.controller("dashboardCtrl", ($scope, $rootScope, $http) => { }; + $scope.loadDashboard = () => { + performChecks(); + }; + + $scope.performChecks = () => { + performChecks(); + }; + + $scope.changeState = () => { + pg_requests.change_state((response) => { + + if (response.data == "true") { + $("#lockButton").html('') + } + else { + $("#lockButton").html('') + } + }); + }; }); \ No newline at end of file diff --git a/app/static/controllers/menu.js b/app/static/controllers/menu.js index dd00ea8e..0cd1c261 100644 --- a/app/static/controllers/menu.js +++ b/app/static/controllers/menu.js @@ -3,32 +3,32 @@ * Function to load information for the sidebar */ $(document).ready( () => { - var trigger = $('.hamburger'), - overlay = $('.overlay'), - isClosed = false; - - trigger.click( () => { - hamburger_cross(); - }); - const hamburger_cross = () => { if (isClosed === true) { overlay.hide(); - trigger.removeClass('is-open'); - trigger.addClass('is-closed'); + trigger.removeClass("is-open"); + trigger.addClass("is-closed"); isClosed = false; } else { overlay.show(); - trigger.removeClass('is-closed'); - trigger.addClass('is-open'); + trigger.removeClass("is-closed"); + trigger.addClass("is-open"); isClosed = true; } - } + }; + + var trigger = $(".hamburger"), + overlay = $(".overlay"), + isClosed = false; + + trigger.click( () => { + hamburger_cross(); + }); $('[data-toggle="offcanvas"]').click( () => { - $('#wrapper').toggleClass('toggled'); + $('#wrapper').toggleClass("toggled"); }); }); \ No newline at end of file diff --git a/job_processing/phyloviz_functions.py b/job_processing/phyloviz_functions.py index 6436222d..21eaa46d 100644 --- a/job_processing/phyloviz_functions.py +++ b/job_processing/phyloviz_functions.py @@ -4,7 +4,7 @@ import string import json from app.models.models import Ecoli, Yersinia, Campylobacter, Salmonella, \ - Core_Schemas, Report, Strain, Tree, Project, projects_strains + Report, Strain, Tree, Project, projects_strains import subprocess import datetime @@ -456,8 +456,7 @@ def send_to_phyloviz(job_ids, dataset_name, dataset_description, timestamp=datetime.datetime.utcnow(), species_id=species_id, phyloviz_user=phyloviz_user) if not tree_entry: - abort(404, message="An error as occurried when uploading the data" - .format(id)) + abort(404, message="An error as occurried when uploading the data.") db.session.add(tree_entry) db.session.commit() From 01b79cd9521334a4aab5f435ab75bcc1b1b9db16 Mon Sep 17 00:00:00 2001 From: bfrgoncalves Date: Mon, 10 Sep 2018 17:20:53 +0100 Subject: [PATCH 2/9] fix code style issues --- app/app_configuration.py | 8 +- app/models/models.py | 16 +--- app/resources/jobs/checks.py | 10 ++- app/resources/ngs_onto/ngs_onto_processes.py | 5 -- app/resources/ngs_onto/ngs_onto_projects.py | 2 +- app/resources/ngs_onto/ngs_onto_strains.py | 2 +- app/resources/ngs_onto/ngs_onto_users.py | 4 +- app/resources/ngs_onto/ngs_onto_workflows.py | 2 +- app/resources/postgres/messages.py | 3 +- app/resources/postgres/processes.py | 7 +- app/resources/postgres/protocols.py | 6 +- app/resources/postgres/species.py | 4 +- app/resources/postgres/strains.py | 2 +- app/resources/postgres/users.py | 10 +-- app/static/controllers/menu.js | 8 +- app/views.py | 9 +- build_files/build_allegro.py | 2 +- core_vs_accessory_plot.py | 95 -------------------- job_processing/database_functions.py | 6 +- manage.py | 8 +- 20 files changed, 39 insertions(+), 170 deletions(-) delete mode 100644 core_vs_accessory_plot.py diff --git a/app/app_configuration.py b/app/app_configuration.py index 8b5ece0e..4d13738b 100644 --- a/app/app_configuration.py +++ b/app/app_configuration.py @@ -10,16 +10,14 @@ from flask import request, after_this_request, redirect, current_app from flask_security.utils import do_flash, get_message, get_url from flask_security.signals import password_changed -from config import obo,localNSpace,dcterms, SFTP_HOST, LOGIN_METHOD, \ +from config import localNSpace,dcterms, SFTP_HOST, LOGIN_METHOD, \ LOGIN_USERNAME, LOGIN_GID, LOGIN_HOMEDIR, LOGIN_PASSWORD, LOGIN_EMAIL, \ ALL_SPECIES from franz.openrdf.vocabulary.rdf import RDF -''' -App configuration: +'''App configuration: - Set of functions to be applied before the first app request and an - handle override for the flask-login post function -''' + handle override for the flask-login post function''' # Executes before the first request is processed. diff --git a/app/models/models.py b/app/models/models.py index 4b04e64c..8a4dbf87 100644 --- a/app/models/models.py +++ b/app/models/models.py @@ -3,13 +3,11 @@ from app import db from flask_security import UserMixin, RoleMixin from sqlalchemy.dialects.postgresql import ARRAY, JSON -from config import LDAP_PROVIDER_URL, baseDN, LDAP_ADMIN_NAME, LDAP_ADMIN_PASS +from config import LDAP_PROVIDER_URL, baseDN, LDAP_ADMIN_PASS from passlib.hash import ldap_md5 -''' -Models: - - Defines every model to be used on the postgres database -''' +'''Models: + - Defines every model to be used on the postgres database''' # Secondary role table roles_users = db.Table('roles_users', @@ -129,14 +127,6 @@ def try_login(email, password): except Exception as e: return False - #conn.unbind() - - '''try: - conn.simple_bind_s("cn=" + LDAP_ADMIN_NAME + "," + baseDN, LDAP_ADMIN_PASS) - except Exception as e: - print e - return False''' - search_filter = "uid="+email entry = "" result = conn.search_s(baseDN, ldap.SCOPE_SUBTREE, search_filter) diff --git a/app/resources/jobs/checks.py b/app/resources/jobs/checks.py index 4c2da26f..6cf58d45 100644 --- a/app/resources/jobs/checks.py +++ b/app/resources/jobs/checks.py @@ -1,5 +1,5 @@ from app import db -from flask_restful import Api, Resource, reqparse, abort, fields, marshal_with +from flask_restful import Api, Resource, reqparse, abort, marshal_with from config import JOBS_ROOT, LDAP_PROVIDER_URL, phyloviz_root import ldap from app.models.models import Ecoli, Project, Platform @@ -8,7 +8,7 @@ from flask_security import current_user # Imports for allegrograph check -from config import AG_HOST, AG_PORT, AG_REPOSITORY, AG_USER, AG_PASSWORD +from config import AG_HOST, AG_PORT, AG_USER, AG_PASSWORD from franz.openrdf.sail.allegrographserver import AllegroGraphServer @@ -31,8 +31,9 @@ def get(self): try: project = db.session.query(Project).first() - + print project except Exception as e: + print e return False return True @@ -44,8 +45,9 @@ def get(self): try: project = db.session.query(Ecoli).first() - + print project except Exception as e: + print e return False return True diff --git a/app/resources/ngs_onto/ngs_onto_processes.py b/app/resources/ngs_onto/ngs_onto_processes.py index 4ef4af39..e4181c76 100644 --- a/app/resources/ngs_onto/ngs_onto_processes.py +++ b/app/resources/ngs_onto/ngs_onto_processes.py @@ -299,11 +299,6 @@ def post(self, id, id2): pprocid = args.parent_process_id rpipid = args.real_pipeline_id - parentProcessURI = dbconAg.createURI( - namespace=localNSpace+"projects/", - localname=str(ppropid)+"/pipelines/" + - str(ppipid)+"/processes/"+str(pprocid)) - if ppipid == rpipid: for proc_json in procJsonResult: if int(proc_json["StrIndex"].replace('"', '')) > int(pprocid): diff --git a/app/resources/ngs_onto/ngs_onto_projects.py b/app/resources/ngs_onto/ngs_onto_projects.py index 1316eba6..16cac4e3 100644 --- a/app/resources/ngs_onto/ngs_onto_projects.py +++ b/app/resources/ngs_onto/ngs_onto_projects.py @@ -2,7 +2,7 @@ from flask_restful import Api, Resource, reqparse, abort, fields, marshal_with from app.utils.queryParse2Json import parseAgraphStatementsRes from flask_security import current_user, login_required, roles_required -from config import obo,localNSpace,protocolsTypes,processTypes,processMessages +from config import obo,localNSpace, processTypes,processMessages from franz.openrdf.vocabulary.rdf import RDF diff --git a/app/resources/ngs_onto/ngs_onto_strains.py b/app/resources/ngs_onto/ngs_onto_strains.py index ef78c530..ab1029e8 100644 --- a/app/resources/ngs_onto/ngs_onto_strains.py +++ b/app/resources/ngs_onto/ngs_onto_strains.py @@ -1,7 +1,7 @@ from app import dbconAg from flask_restful import Api, Resource, reqparse, abort, fields, marshal_with from app.utils.queryParse2Json import parseAgraphStatementsRes -from flask_security import current_user, login_required, roles_required +from flask_security import login_required, roles_required from config import obo,localNSpace,protocolsTypes,processTypes,processMessages from franz.openrdf.vocabulary.rdf import RDF diff --git a/app/resources/ngs_onto/ngs_onto_users.py b/app/resources/ngs_onto/ngs_onto_users.py index 745e1fa9..57ab7990 100644 --- a/app/resources/ngs_onto/ngs_onto_users.py +++ b/app/resources/ngs_onto/ngs_onto_users.py @@ -1,7 +1,7 @@ from app import dbconAg,dedicateddbconAg from flask_restful import Api, Resource, reqparse, abort, fields, marshal_with -from flask_security import current_user, login_required -from config import obo,localNSpace,dcterms +from flask_security import login_required +from config import localNSpace,dcterms from franz.openrdf.vocabulary.rdf import RDF from app.utils.queryParse2Json import parseAgraphStatementsRes diff --git a/app/resources/ngs_onto/ngs_onto_workflows.py b/app/resources/ngs_onto/ngs_onto_workflows.py index 3c3d5681..94d83749 100644 --- a/app/resources/ngs_onto/ngs_onto_workflows.py +++ b/app/resources/ngs_onto/ngs_onto_workflows.py @@ -1,5 +1,5 @@ from app import dbconAg -from flask_restful import Api, Resource, reqparse, abort, fields, marshal_with +from flask_restful import Resource, reqparse, abort, fields, marshal_with from app.utils.queryParse2Json import parseAgraphStatementsRes,parseAgraphQueryRes from config import obo,localNSpace,protocolsTypes,processTypes,processMessages from franz.openrdf.vocabulary.rdf import RDF diff --git a/app/resources/postgres/messages.py b/app/resources/postgres/messages.py index f44083e8..00ddd3e9 100644 --- a/app/resources/postgres/messages.py +++ b/app/resources/postgres/messages.py @@ -1,7 +1,7 @@ from app import db, mail from app.models.models import Message, User from flask_restful import Api, Resource, reqparse, abort, fields, marshal_with -from flask_security import current_user, login_required, roles_required +from flask_security import current_user, login_required from sqlalchemy import desc import datetime @@ -245,6 +245,7 @@ def post(self): mail.send(msg) except Exception as e: + print e return False return True diff --git a/app/resources/postgres/processes.py b/app/resources/postgres/processes.py index e460d702..6d9c9830 100644 --- a/app/resources/postgres/processes.py +++ b/app/resources/postgres/processes.py @@ -6,12 +6,9 @@ ############################################ NOT BEING USED #################### -""" -Processes are being defined in the ngsonto resources +"""Processes are being defined in the ngsonto resources -DEPRECATED - -""" +DEPRECATED""" # Defining post arguments parser process_post_parser = reqparse.RequestParser() diff --git a/app/resources/postgres/protocols.py b/app/resources/postgres/protocols.py index 00721227..f66a85f0 100644 --- a/app/resources/postgres/protocols.py +++ b/app/resources/postgres/protocols.py @@ -1,5 +1,5 @@ from app import db -from flask_restful import Api, Resource, reqparse, abort, fields, \ +from flask_restful import Resource, reqparse, abort, fields, \ marshal_with # filters data according to some fields import json @@ -19,9 +19,7 @@ protocol_post_parser.add_argument('version', dest='version', type=str, required=True, help="Protocol version") -""" -STEPS -> Parameters which define the protocol -""" +"""STEPS -> Parameters which define the protocol""" # Defining get arguments parser protocol_get_parser = reqparse.RequestParser() diff --git a/app/resources/postgres/species.py b/app/resources/postgres/species.py index 01742771..d5a02a72 100644 --- a/app/resources/postgres/species.py +++ b/app/resources/postgres/species.py @@ -1,8 +1,8 @@ from app import db -from flask_restful import Api, Resource, reqparse, abort, fields, marshal_with +from flask_restful import Resource, reqparse, abort, fields, marshal_with from app.models.models import Specie, Campylobacter, Ecoli, Salmonella, Yersinia -from flask_security import current_user, login_required, roles_required +from flask_security import current_user, login_required # Defining post arguments parser specie_post_parser = reqparse.RequestParser() diff --git a/app/resources/postgres/strains.py b/app/resources/postgres/strains.py index 7eed6868..b119a88f 100644 --- a/app/resources/postgres/strains.py +++ b/app/resources/postgres/strains.py @@ -1,6 +1,6 @@ from app import db from flask_restful import Api, Resource, reqparse, abort, fields, marshal_with #filters data according to some fields -from flask import jsonify, request +from flask import request import json from app.models.models import Strain, Project, Ecoli, Yersinia, Salmonella, \ diff --git a/app/resources/postgres/users.py b/app/resources/postgres/users.py index 4cad8b16..dd4c4499 100644 --- a/app/resources/postgres/users.py +++ b/app/resources/postgres/users.py @@ -8,7 +8,7 @@ import subprocess import glob from config import LOGIN_METHOD, LOGIN_USERNAME, LOGIN_GID, LOGIN_HOMEDIR, \ - LOGIN_PASSWORD, LOGIN_EMAIL + LOGIN_PASSWORD user_fields = { 'id': fields.Integer, @@ -185,9 +185,6 @@ def get(self): project_id = args.project_id instStorage = "/".join(current_user.homedir.split("/")[0:-2]) + "/" - '''if instStorage == "/": - instStorage = "/".join(current_user.homedir.split("/")[0:-1]) + "/" - ''' project_dir = os.path.join(current_user.homedir, "jobs", project_id+"-*") @@ -218,10 +215,5 @@ def get(self): stdout=subprocess.PIPE, stderr=subprocess.PIPE) out4, err = proc.communicate() - #print out1 - #print out2 - #print out3 - #print out4 - return {"u_quota": out1, "i_quota": out2, "f_space": out4, "p_space": str(out3)} diff --git a/app/static/controllers/menu.js b/app/static/controllers/menu.js index 0cd1c261..fcc1c348 100644 --- a/app/static/controllers/menu.js +++ b/app/static/controllers/menu.js @@ -4,6 +4,10 @@ */ $(document).ready( () => { + let trigger = $(".hamburger"), + overlay = $(".overlay"), + isClosed = false; + const hamburger_cross = () => { if (isClosed === true) { @@ -19,10 +23,6 @@ $(document).ready( () => { } }; - var trigger = $(".hamburger"), - overlay = $(".overlay"), - isClosed = false; - trigger.click( () => { hamburger_cross(); }); diff --git a/app/views.py b/app/views.py index 7753f1b8..25cc3eff 100644 --- a/app/views.py +++ b/app/views.py @@ -1,16 +1,13 @@ from flask import render_template, flash, redirect, session, url_for, request, g from flask_security import login_required, current_user, utils, roles_required import json -from app import app, db +from app import app from config import FILES_ENTRY_POINT, ADMIN_GID, REPORTS_URL, \ NEXTFLOW_TAGS, INSPECT_ROUTE -from app.models.models import Platform -''' -Views: - - Define the index route of the application -''' +'''Views: + - Define the index route of the application''' def getID(current_user): diff --git a/build_files/build_allegro.py b/build_files/build_allegro.py index 8dffad5a..f36b35a0 100644 --- a/build_files/build_allegro.py +++ b/build_files/build_allegro.py @@ -1,4 +1,4 @@ -from config import AG_HOST, AG_PORT, AG_REPOSITORY, AG_USER, AG_PASSWORD +from config import AG_HOST, AG_PORT, AG_USER, AG_PASSWORD from franz.openrdf.sail.allegrographserver import AllegroGraphServer from franz.openrdf.repository.repository import Repository from franz.openrdf.rio.rdfformat import RDFFormat diff --git a/core_vs_accessory_plot.py b/core_vs_accessory_plot.py deleted file mode 100644 index 9f4ffcd9..00000000 --- a/core_vs_accessory_plot.py +++ /dev/null @@ -1,95 +0,0 @@ -from app import db -from app.models.models import Ecoli, Yersinia, Campylobacter, Salmonella -import argparse - -''' -This program plots the differences between nodes using the core genome against the distance using the accessory genome -''' - -database_corespondence = {"ecoli": Ecoli, "yersinia": Yersinia, "campylobacter": Campylobacter, "salmonella": Salmonella} - -def main(): - parser = argparse.ArgumentParser(description="This program plots the differences between nodes using the core genome against the distance using the accessory genome") - parser.add_argument('-d', nargs='?', type=str, help='database to use', required=True) - parser.add_argument('-g', nargs='?', type=str, help='list of genes to remove from wg', required=True) - - args = parser.parse_args() - strain_core_object, strain_wg_object = get_profiles_object(args.d, args.g) - core_distances, accesory_distances = compute_distances(strain_core_object, strain_wg_object) - print core_distances - plot_distances(core_distances, accesory_distances) - - -def get_profiles_object(database_to_use, genes_to_remove_file_path): - - results = db.session.query(database_corespondence[database_to_use]).all() - - FilesToRemove = [] - strain_wg_object = [] - strain_core_object = [] - - with open(genes_to_remove_file_path) as f: - for File in f: - File = File.rstrip('\n') - File = File.rstrip('\r') - File = (File.split('\t'))[0] - FilesToRemove.append(File) - - count_strains = -1 - - for strain in results: - print "Searching strain " + strain.name - - strain_wg_object.append([]) - strain_core_object.append([]) - count_strains += 1 - - allelic_profile = strain.allelic_profile - - for removable in FilesToRemove: - if not hasattr(strain_core_object[count_strains], removable): - strain_core_object[count_strains].append(allelic_profile[removable]) - - for key, val in allelic_profile.iteritems(): - strain_core_object[count_strains].append(val) - - - return strain_core_object, strain_wg_object - - -def compute_distances(strain_core_object, strain_wg_object): - - rows_core = [] - rows_wg = [] - - def differences(a, b): - if len(a) != len(b): - raise ValueError("Lists of different length.") - return sum(i != j for i, j in zip(a, b)) - - for strain_1 in range(0, len(strain_core_object)): - print "RUNNING strain " + str(strain_1) - columns_core = [] - columns_wg = [] - - for strain_2 in range(strain_1 + 1, len(strain_core_object)): - count_diff_core = 0 - count_diff_wg = 0 - number_of_differences_core = differences(strain_core_object[strain_1], strain_core_object[strain_2]) - number_of_differences_wg = differences(strain_wg_object[strain_1], strain_wg_object[strain_2]) - columns_core.append(count_diff_core) - columns_wg.append(count_diff_wg) - - rows_core.append(columns_core) - rows_wg.append(columns_wg) - - return rows_core, rows_wg - - -def plot_distances(core_distances, accesory_distances): - - return 200 - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/job_processing/database_functions.py b/job_processing/database_functions.py index 99aec0cb..791e77bc 100644 --- a/job_processing/database_functions.py +++ b/job_processing/database_functions.py @@ -1,8 +1,7 @@ from app import db import random import string -from app.models.models import Ecoli, Yersinia, Campylobacter, Salmonella, \ - Core_Schemas, Report +from app.models.models import Ecoli, Yersinia, Campylobacter, Salmonella import fast_mlst_functions import datetime import subprocess @@ -63,7 +62,6 @@ def get_profiles(strain_ids, database_name, get_json): wg_profle_path = "./chewbbaca_database_profiles/query_files/" + \ file_name + "_wg.tab" - to_replace = allele_classes_to_ignore firstTime = True strain_ids = strain_ids.split(",") profiles = [[], []] @@ -185,7 +183,6 @@ def classify_profile(allcall_results, database_name, sample, job_id, schemaVersi core_profile = [] wg_profile = [] count_core = 0 - count_entrou = 0 for i, header in enumerate(headers): strain_allele_profile[header] = profile[i] @@ -408,6 +405,7 @@ def classify_profile(allcall_results, database_name, sample, job_id, schemaVersi db.session.commit() except Exception as e: + print e print "ERRO" print "ADDED TO DB..." diff --git a/manage.py b/manage.py index 3fde6a05..28278603 100755 --- a/manage.py +++ b/manage.py @@ -1,18 +1,14 @@ #!flask/bin/python -import os from flask.ext.script import Manager from flask.ext.migrate import Migrate, MigrateCommand from app import app, db -''' -Loads the Flask db Manager to deal with database migrations and upgrades. +'''Loads the Flask db Manager to deal with database migrations and upgrades. Version control ./manage db init --multidb ./manage db migrate -./manage db upgrade - -''' +./manage db upgrade''' migrate = Migrate(app, db) manager = Manager(app) From 5a5e65ed6b98db943e1dafeaec48e7458819df6c Mon Sep 17 00:00:00 2001 From: bfrgoncalves Date: Tue, 11 Sep 2018 10:24:49 +0100 Subject: [PATCH 3/9] test app start on windows --- app/static/controllers/main_controller.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/static/controllers/main_controller.js b/app/static/controllers/main_controller.js index 431d2001..0310d04a 100644 --- a/app/static/controllers/main_controller.js +++ b/app/static/controllers/main_controller.js @@ -303,6 +303,8 @@ const checkAuthentication = () => { const startApp = () => { + console.log("Starting app"); + const initIntervals = () => { setInterval(() => { From f19a656d4e7acadb3c36d30b2e5538fe14d4554b Mon Sep 17 00:00:00 2001 From: bfrgoncalves Date: Tue, 11 Sep 2018 10:31:22 +0100 Subject: [PATCH 4/9] test app start on windows --- app/static/controllers/main_controller.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/static/controllers/main_controller.js b/app/static/controllers/main_controller.js index 0310d04a..b166727b 100644 --- a/app/static/controllers/main_controller.js +++ b/app/static/controllers/main_controller.js @@ -329,6 +329,8 @@ const startApp = () => { document.addEventListener("onOverview", initIntervals); + console.log($('#overviewLink')); + $('#overviewLink').trigger('click'); $("#send_mail").off("click").on("click", () => { From b50069fa5a397e5ed0f6ccc2a7ec6e00f1c41ad5 Mon Sep 17 00:00:00 2001 From: bfrgoncalves Date: Tue, 11 Sep 2018 10:35:07 +0100 Subject: [PATCH 5/9] test app start on windows --- app/static/controllers/main_controller.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/static/controllers/main_controller.js b/app/static/controllers/main_controller.js index b166727b..5e125287 100644 --- a/app/static/controllers/main_controller.js +++ b/app/static/controllers/main_controller.js @@ -329,10 +329,6 @@ const startApp = () => { document.addEventListener("onOverview", initIntervals); - console.log($('#overviewLink')); - - $('#overviewLink').trigger('click'); - $("#send_mail").off("click").on("click", () => { pg_requests.get_user_mails((response) => { @@ -379,7 +375,7 @@ const startApp = () => { CURRENT_TABLE_ROWS_SELECTED, CURRENT_TABLE_ROW_ANALYSIS_SELECTED, PROJECT_STATUS]); tclick(); - }) + }); $("#sidebar-wrapper ul li").not('.navbar ul .drop, .dropdiv ul li') .on("click", function () { @@ -398,6 +394,8 @@ const startApp = () => { CURRENT_JOB_ID, CURRENT_PROJECT_NAME_ID, CURRENT_TABLE_ROWS_SELECTED, CURRENT_TABLE_ROW_ANALYSIS_SELECTED, PROJECT_STATUS]); tclick(); - }) + }); + + $('#overviewLink').trigger('click'); }; From f3d1f523517a372893e733a80dd65a8460c83bab Mon Sep 17 00:00:00 2001 From: bfrgoncalves Date: Tue, 11 Sep 2018 10:38:17 +0100 Subject: [PATCH 6/9] fix app start on windows --- app/static/controllers/main_controller.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/static/controllers/main_controller.js b/app/static/controllers/main_controller.js index 5e125287..2dc5d283 100644 --- a/app/static/controllers/main_controller.js +++ b/app/static/controllers/main_controller.js @@ -397,5 +397,6 @@ const startApp = () => { }); $('#overviewLink').trigger('click'); + $('#overviewLink').trigger('click'); }; From 0b3737bf199917a269be719f396505c4d678a7de Mon Sep 17 00:00:00 2001 From: bfrgoncalves Date: Tue, 11 Sep 2018 10:46:03 +0100 Subject: [PATCH 7/9] fix app start on windows --- app/static/controllers/main_controller.js | 95 ++++++++++++----------- 1 file changed, 49 insertions(+), 46 deletions(-) diff --git a/app/static/controllers/main_controller.js b/app/static/controllers/main_controller.js index 2dc5d283..51b06ea4 100644 --- a/app/static/controllers/main_controller.js +++ b/app/static/controllers/main_controller.js @@ -329,56 +329,49 @@ const startApp = () => { document.addEventListener("onOverview", initIntervals); - $("#send_mail").off("click").on("click", () => { + setTimeout(() => { - pg_requests.get_user_mails((response) => { + $('#overviewLink').trigger('click'); - let pg_requests = Requests("", "", http); + $("#send_mail").off("click").on("click", () => { - if (response.data.length > 0) { - let options = ""; - for (const x of response.data) { - options += ""; - } - $("#recipients").empty().append(options); - } + pg_requests.get_user_mails((response) => { - $('.selectpicker').selectpicker('refresh'); + let pg_requests = Requests("", "", http); - }); + if (response.data.length > 0) { + let options = ""; + for (const x of response.data) { + options += ""; + } + $("#recipients").empty().append(options); + } - $("#newMailModal").modal("show"); + $('.selectpicker').selectpicker('refresh'); + }); - }); + $("#newMailModal").modal("show"); - $("#viewAllMessages").off("click").on("click", () => { - $("#messages_button").trigger("click"); - $("#button_ham_navbar").trigger("click"); - }); + }); - $('#offcanvasleft').click(function () { - $('.row-offcanvas-left').toggleClass('active'); - }); + $("#viewAllMessages").off("click").on("click", () => { + $("#messages_button").trigger("click"); + $("#button_ham_navbar").trigger("click"); - $('.nav-a').click(function () { - $('.row-offcanvas-left').toggleClass('active'); - }); + }); - $(".dropdiv ul li").on("click", function () { - PREVIOUS_PAGE_ARRAY.push([current_scope_template, CURRENT_PROJECT_ID, - CURRENT_JOB_MINE, CURRENT_PROJECT, CURRENT_SPECIES_ID, - CURRENT_SPECIES_NAME, CURRENT_USER_NAME, CURRENT_JOBS_ROOT, - CURRENT_JOB_ID, CURRENT_PROJECT_NAME_ID, - CURRENT_TABLE_ROWS_SELECTED, CURRENT_TABLE_ROW_ANALYSIS_SELECTED, - PROJECT_STATUS]); - tclick(); - }); + $('#offcanvasleft').click(function () { + $('.row-offcanvas-left').toggleClass('active'); + }); + + $('.nav-a').click(function () { + $('.row-offcanvas-left').toggleClass('active'); + }); - $("#sidebar-wrapper ul li").not('.navbar ul .drop, .dropdiv ul li') - .on("click", function () { + $(".dropdiv ul li").on("click", function () { PREVIOUS_PAGE_ARRAY.push([current_scope_template, CURRENT_PROJECT_ID, CURRENT_JOB_MINE, CURRENT_PROJECT, CURRENT_SPECIES_ID, CURRENT_SPECIES_NAME, CURRENT_USER_NAME, CURRENT_JOBS_ROOT, @@ -387,16 +380,26 @@ const startApp = () => { PROJECT_STATUS]); tclick(); }); - $(".nav-list li").not('.dropdiv ul li').on("click", function () { - PREVIOUS_PAGE_ARRAY.push([current_scope_template, CURRENT_PROJECT_ID, - CURRENT_JOB_MINE, CURRENT_PROJECT, CURRENT_SPECIES_ID, - CURRENT_SPECIES_NAME, CURRENT_USER_NAME, CURRENT_JOBS_ROOT, - CURRENT_JOB_ID, CURRENT_PROJECT_NAME_ID, CURRENT_TABLE_ROWS_SELECTED, - CURRENT_TABLE_ROW_ANALYSIS_SELECTED, PROJECT_STATUS]); - tclick(); - }); - $('#overviewLink').trigger('click'); - $('#overviewLink').trigger('click'); + $("#sidebar-wrapper ul li").not('.navbar ul .drop, .dropdiv ul li') + .on("click", function () { + PREVIOUS_PAGE_ARRAY.push([current_scope_template, CURRENT_PROJECT_ID, + CURRENT_JOB_MINE, CURRENT_PROJECT, CURRENT_SPECIES_ID, + CURRENT_SPECIES_NAME, CURRENT_USER_NAME, CURRENT_JOBS_ROOT, + CURRENT_JOB_ID, CURRENT_PROJECT_NAME_ID, + CURRENT_TABLE_ROWS_SELECTED, CURRENT_TABLE_ROW_ANALYSIS_SELECTED, + PROJECT_STATUS]); + tclick(); + }); + $(".nav-list li").not('.dropdiv ul li').on("click", function () { + PREVIOUS_PAGE_ARRAY.push([current_scope_template, CURRENT_PROJECT_ID, + CURRENT_JOB_MINE, CURRENT_PROJECT, CURRENT_SPECIES_ID, + CURRENT_SPECIES_NAME, CURRENT_USER_NAME, CURRENT_JOBS_ROOT, + CURRENT_JOB_ID, CURRENT_PROJECT_NAME_ID, CURRENT_TABLE_ROWS_SELECTED, + CURRENT_TABLE_ROW_ANALYSIS_SELECTED, PROJECT_STATUS]); + tclick(); + }); + + }, 500); }; From d7101c897919ecf8550a17211f71f18cbe602dec Mon Sep 17 00:00:00 2001 From: bfrgoncalves Date: Tue, 11 Sep 2018 11:48:02 +0100 Subject: [PATCH 8/9] fix code style issues --- app/__init__.py | 4 +- .../file_resources/file_resources.py | 12 +- app/resources/jobs/jobs.py | 2 +- app/resources/ngs_onto/ngs_onto_pipelines.py | 2 +- app/resources/ngs_onto/ngs_onto_protocols.py | 2 +- app/resources/ngs_onto/ngs_onto_workflows.py | 2 +- app/resources/phyloviz/phyloviz.py | 2 +- app/resources/postgres/projects.py | 8 +- app/resources/postgres/reports.py | 2 +- app/resources/postgres/users.py | 2 +- app/resources/postgres/workflows.py | 4 +- .../controllers/js_objects/protocols.js | 1 - app/static/controllers/requests/requests.js | 2719 +++++++++-------- job_processing/database_functions.py | 6 +- job_processing/phyloviz_functions.py | 5 +- 15 files changed, 1384 insertions(+), 1389 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index c16429c4..3f9139e6 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -29,7 +29,6 @@ - app_configuration (before first request and override login post of the flask-login package to deal with ldap) ''' - # Setup app app = Flask(__name__) # Reads the config file located at ../ @@ -48,7 +47,6 @@ def simple(env, resp): # SET THE REDIS QUEUE q = Queue(connection=conn) - from app.models.models import User, Role user_datastore = SQLAlchemyUserDatastore(db, User, Role) @@ -60,7 +58,7 @@ def simple(env, resp): # setup agraph server = AllegroGraphServer(AG_HOST, AG_PORT, AG_USER, AG_PASSWORD) catalog = server.openCatalog() - + myRepository = catalog.getRepository(AG_REPOSITORY, Repository.OPEN) myRepository.initialize() dbconAg = myRepository.getConnection() diff --git a/app/resources/file_resources/file_resources.py b/app/resources/file_resources/file_resources.py index 0641bbce..08a8ceb2 100644 --- a/app/resources/file_resources/file_resources.py +++ b/app/resources/file_resources/file_resources.py @@ -1,13 +1,11 @@ -from flask_restful import Api, Resource, reqparse, abort, fields, marshal_with -from flask import jsonify, send_file +from flask_restful import Resource, reqparse +from flask import send_file -from flask_security import current_user, login_required, roles_required, auth_token_required +from flask_security import login_required import os -''' -File resources: - - Get template for strain batch submission -''' +'''File resources: + - Get template for strain batch submission''' class TemplateResource(Resource): diff --git a/app/resources/jobs/jobs.py b/app/resources/jobs/jobs.py index a2907056..d746e3f9 100644 --- a/app/resources/jobs/jobs.py +++ b/app/resources/jobs/jobs.py @@ -5,7 +5,7 @@ from flask_security import current_user, login_required, roles_required, auth_token_required import datetime from config import CURRENT_ROOT, JOBS_ROOT, OUTPUT_URL, USER_STORAGES -from config import obo,localNSpace,protocolsTypes,processTypes,processMessages +from config import obo,localNSpace from franz.openrdf.query.query import QueryLanguage from app.models.models import Protocol from app.models.models import Strain diff --git a/app/resources/ngs_onto/ngs_onto_pipelines.py b/app/resources/ngs_onto/ngs_onto_pipelines.py index 3ad7fee3..75b49e45 100644 --- a/app/resources/ngs_onto/ngs_onto_pipelines.py +++ b/app/resources/ngs_onto/ngs_onto_pipelines.py @@ -1,6 +1,6 @@ from app import dbconAg from flask_restful import Api, Resource, reqparse, abort, fields, marshal_with -from flask_security import current_user, login_required +from flask_security import login_required from app.utils.queryParse2Json import parseAgraphStatementsRes from config import obo,localNSpace,protocolsTypes,processTypes,processMessages diff --git a/app/resources/ngs_onto/ngs_onto_protocols.py b/app/resources/ngs_onto/ngs_onto_protocols.py index 11fb73ea..238c8bb7 100644 --- a/app/resources/ngs_onto/ngs_onto_protocols.py +++ b/app/resources/ngs_onto/ngs_onto_protocols.py @@ -1,5 +1,5 @@ from app import dbconAg -from flask_restful import Api, Resource, reqparse, abort, fields, marshal_with +from flask_restful import Resource, reqparse, abort, fields from flask_security import current_user, login_required from app.utils.queryParse2Json import parseAgraphQueryRes from config import obo,localNSpace,protocolsTypes,processTypes,processMessages diff --git a/app/resources/ngs_onto/ngs_onto_workflows.py b/app/resources/ngs_onto/ngs_onto_workflows.py index 94d83749..51d17e1e 100644 --- a/app/resources/ngs_onto/ngs_onto_workflows.py +++ b/app/resources/ngs_onto/ngs_onto_workflows.py @@ -1,5 +1,5 @@ from app import dbconAg -from flask_restful import Resource, reqparse, abort, fields, marshal_with +from flask_restful import Resource, reqparse, fields from app.utils.queryParse2Json import parseAgraphStatementsRes,parseAgraphQueryRes from config import obo,localNSpace,protocolsTypes,processTypes,processMessages from franz.openrdf.vocabulary.rdf import RDF diff --git a/app/resources/phyloviz/phyloviz.py b/app/resources/phyloviz/phyloviz.py index d195e109..560618e5 100644 --- a/app/resources/phyloviz/phyloviz.py +++ b/app/resources/phyloviz/phyloviz.py @@ -2,7 +2,7 @@ from flask_restful import Api, Resource, reqparse, abort, fields, marshal_with from flask_security import current_user, login_required, roles_required, \ auth_token_required -from config import CURRENT_ROOT, JOBS_ROOT, phyloviz_root +from config import JOBS_ROOT, phyloviz_root from app.models.models import Tree import requests import os diff --git a/app/resources/postgres/projects.py b/app/resources/postgres/projects.py index daf810e0..fa8cc274 100644 --- a/app/resources/postgres/projects.py +++ b/app/resources/postgres/projects.py @@ -1,10 +1,10 @@ from app import db -from flask_restful import Api, Resource, reqparse, abort, fields, \ - marshal_with #filters data according to some fields +# filters data according to some fields +from flask_restful import Resource, reqparse, abort, fields, \ + marshal_with from app.models.models import Project, User -from flask_security import current_user, login_required, roles_required, \ - auth_token_required +from flask_security import current_user, login_required, roles_required import datetime import random import string diff --git a/app/resources/postgres/reports.py b/app/resources/postgres/reports.py index 6231b53f..f16266e6 100644 --- a/app/resources/postgres/reports.py +++ b/app/resources/postgres/reports.py @@ -3,7 +3,7 @@ from flask import jsonify, request, send_file from app.models.models import Report, Combined_Reports -from flask_security import current_user, login_required, roles_required +from flask_security import current_user, login_required import datetime import zipfile import string diff --git a/app/resources/postgres/users.py b/app/resources/postgres/users.py index dd4c4499..31b22bea 100644 --- a/app/resources/postgres/users.py +++ b/app/resources/postgres/users.py @@ -8,7 +8,7 @@ import subprocess import glob from config import LOGIN_METHOD, LOGIN_USERNAME, LOGIN_GID, LOGIN_HOMEDIR, \ - LOGIN_PASSWORD + LOGIN_PASSWORD user_fields = { 'id': fields.Integer, diff --git a/app/resources/postgres/workflows.py b/app/resources/postgres/workflows.py index d29a094e..c0a76fc6 100644 --- a/app/resources/postgres/workflows.py +++ b/app/resources/postgres/workflows.py @@ -1,7 +1,7 @@ from app import db -from flask_restful import Api, Resource, reqparse, abort, fields, marshal_with +from flask_restful import Resource, reqparse, abort, fields, marshal_with from app.models.models import Workflow, Protocol -from flask_security import current_user, login_required, roles_required +from flask_security import current_user, login_required import datetime import requests import json diff --git a/app/static/controllers/js_objects/protocols.js b/app/static/controllers/js_objects/protocols.js index 1fa98307..d5f55b54 100644 --- a/app/static/controllers/js_objects/protocols.js +++ b/app/static/controllers/js_objects/protocols.js @@ -118,7 +118,6 @@ const Protocol_List = ($http) => { //Send the protocol to the database pg_requests.create_protocol(protocol_object, (response) => { - console.log(response); if (response.status === 201) { let new_protocol_id = response.data.id; diff --git a/app/static/controllers/requests/requests.js b/app/static/controllers/requests/requests.js index 4564d054..2cc8ac55 100644 --- a/app/static/controllers/requests/requests.js +++ b/app/static/controllers/requests/requests.js @@ -1,1365 +1,1368 @@ const Requests = (CURRENT_PROJECT_ID, CURRENT_PROJECT, $http) => { - return { - - //////////// Perform checks /////////////////////////////////////////// - - check_ldap: (callback) => { - const req = { - url: "api/v1.0/checks/ldap", - method:"GET" - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - check_db_general: (callback) => { - const req = { - url:"api/v1.0/checks/db/general", - method:"GET" - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - check_db_mlst: (callback) => { - const req = { - url:"api/v1.0/checks/db/mlst", - method:"GET" - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - check_allegro: (callback) => { - const req = { - url:"api/v1.0/checks/allegro", - method:"GET" - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - check_authentication: (callback) => { - const req = { - url:"api/v1.0/checks/authentication", - method:"GET", - params: { - userId: CURRENT_USER_ID - } - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - check_controller: (callback) => { - const req = { - url:"api/v1.0/checks/controller", - method:"GET" - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - check_phyloviz: (callback) => { - const req = { - url:"api/v1.0/checks/phyloviz", - method:"GET" - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - check_state: (callback) => { - const req = { - url:"api/v1.0/checks/state", - method:"GET" - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - change_state: (callback) => { - const req = { - url:"api/v1.0/checks/state", - method:"PUT" - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - //////////////// Protocols Requests ///////////////////////////////////////// - download_accession: (username, accession_numbers, callback) => { - - const req = { - url:"api/v1.0/downloads/", - method:"POST", - data: { accession_numbers: accession_numbers } - }; - - $http(req).then( (response) => { - callback(response, accession_numbers); - }, (response) => { - callback(response, accession_numbers); - }); - }, - - get_user_mails: (callback) => { - const req = { - url:"api/v1.0/users/email/", - method:"GET" - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - get_statistics: (callback) => { - const req = { - url:"api/v1.0/strains/statistics/", - method:"GET" - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - get_messages: (numberofmessages, callback) => { - const req = { - url:"api/v1.0/user/messages/", - method:"GET", - params: { - numberofmessages: numberofmessages - } - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - send_messages: (data, callback) => { - const req = { - url:"api/v1.0/user/messages/", - method:"POST", - data: data - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - delete_messages: (messageid, callback) => { - const req = { - url:"api/v1.0/user/messages/", - method:"DELETE", - params: { - messageid: messageid - } - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - mark_as_read: (messageid, callback) => { - const req = { - url:"api/v1.0/user/messages/", - method:"PUT", - params: { - messageid: messageid, - status: "read" - } - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - get_templates: (callback) => { - const req = { - url:"api/v1.0/user/messages/templates/", - method:"GET" - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - get_users: (callback) => { - - const req = { - url:"api/v1.0/users/", - method:"GET" - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - - }, - - - check_download_accession_status: (file_name, accession_numbers, callback) => { - - const req = { - url:"api/v1.0/downloads/", - method:"GET", - params: { accession_numbers: file_name } - }; - - $http(req).then( (response) => { - callback(response, accession_numbers); - }, (response) => { - callback(response, accession_numbers); - }); - }, - create_protocol: (protocol_object, callback) => { - - console.log(protocol_object); - const req = { - url:"api/v1.0/protocols/", - method:"POST", - headers: {"Content-Type": "application/json"}, - data: { - steps: protocol_object, - name: protocol_object.name, - version: protocol_object.Version - } - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - get_protocols_of_type: (selectedType, callback) => { - - const req = { - url:"api/v1.0/protocols/", - method:"GET", - params: { type: selectedType } - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - get_protocols_by_ids: (ids, workflow_entry, callback) => { - - const req = { - url:"api/v1.0/protocols/ids", - method:"GET", - params: { protocol_ids: ids } - }; - - $http(req).then( (response) => { - callback(response, workflow_entry); - }, (response) => { - callback(response, workflow_entry); - }); - }, - - - //////////////// Workflows Requests ///////////////////////////////////////// - add_workflow: (callback) => { - - const selClassEl = $( "#select_classifier option:selected" ); - const workflowSpecieEl = $( "#workflow_species option:selected" ); - const selectDependency = $( "#select_dependency option:selected" ); - - const req = { - url:"api/v1.0/workflows/", - method:"POST", - headers: {"Content-Type": "application/x-www-form-urlencoded"}, - data: $("#new_workflow_form").serialize() + "&classifier=" + selClassEl.text() + "&species=" + workflowSpecieEl.text() + "&dependency=" + selectDependency.text() - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - - }, - //////////////// Projects Table Requests ///////////////////////////////////////// - get_species_names: (callback) => { - - const req = { - url:"api/v1.0/species/", - method:"GET" - }; - - $http(req).then((response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - get_all_workflows: (callback) => { - - const req = { - url:"api/v1.0/workflows/all/", - method:"GET" - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - change_workflow_state: (selected_data, callback) => { - - const req = { - url:"api/v1.0/workflows/availability/", - method:"PUT", - params: - { - identifier: String(selected_data[0]), - to_change: String(selected_data[1]) - } - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - get_species_projects: (species_id, is_others, callback) => { - - //Get user projects for specie 1 - let req = {}; - - if(is_others){ - req = { - url:"api/v1.0/projects/species/" + species_id, - method:"GET", - params: { get_others: true } - } - } - else{ - req = { - url:"api/v1.0/projects/species/" + species_id, - method:"GET" - } - } - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - add_project_to_database: (callback) => { - - const req = { - url:"api/v1.0/projects/", - method:"POST", - headers: {"Content-Type": "application/x-www-form-urlencoded"}, - data: $('#new_project_form').serialize() - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - delete_project_from_database: (project_id, callback) => { - - const req = { - url:"api/v1.0/projects/" + project_id, - method:"DELETE" - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - load_project: (project_id, callback) => { - - const req = { - url:"api/v1.0/projects/" + project_id, - method: "GET" - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - }, - - - //////////////// Reports Requests ///////////////////////////////////////// - get_user_reports: (callback) => { - - const req = { - url: "api/v1.0/reports/", //Defined at utils.js - method: "GET" - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - - }, - get_project_reports: (project_id, pipelines_to_check, callback) => { - - const req = { - url: "api/v1.0/reports/project", //Defined at utils.js - method: "GET", - params:{"project_id": project_id, "pipelines_to_check":pipelines_to_check} - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - - }, - get_reports_by_strain: (strain_id_to_search, callback) => { - - const req = { - url: "api/v1.0/reports/strain", //Defined at utils.js - method:"GET", - params:{"strain_id": strain_id_to_search} - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - - }, - get_multiple_user_reports: (job_ids, callback) => { - - const req = { - url: "api/v1.0/reports/", //Defined at utils.js - method:"GET", - params: { - job_ids:job_ids.toString() - } - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - - }, - save_reports: (job_ids, strain_names, CURRENT_SPECIES_ID, callback) => { - - const req = { - url: "api/v1.0/reports/combined", //Defined at utils.js - headers: {"Content-Type": "application/x-www-form-urlencoded"}, - method:"POST", - data: $("#save_report_form").serialize() + "&job_ids=" + job_ids + "&strain_ids=" + strain_names +"&species_id="+ CURRENT_SPECIES_ID - }; - - $http(req).then( (response) => { - callback(response); - },function(response){ - callback(response); - }); - - }, - get_saved_user_reports: (CURRENT_SPECIES_ID, callback) => { - - const req = { - url: "api/v1.0/reports/combined", //Defined at utils.js - method:"GET", - params:{"species_id": CURRENT_SPECIES_ID} - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - - }, - get_user_trees: (CURRENT_SPECIES_ID, callback) => { - - const req = { - url: "api/v1.0/phyloviz/trees", //Defined at utils.js - method:"GET", - params:{"species_id": CURRENT_SPECIES_ID} - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - - }, - delete_combined_report: (report_name, callback) => { - - const req = { - url: "api/v1.0/reports/combined", //Defined at utils.js - method:"DELETE", - params: { - "report_name": report_name - } - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - - }, - - get_saved_report: (callback) => { - - const req = { - url: "api/v1.0/reports/combined/show", //Defined at utils.js - method:"GET", - }; - - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - - }, - - //////////////// Single Project Requests ///////////////////////////////////////// - get_workflows: (classifier, species, callback) => { - - const req = { - url: "api/v1.0/workflows/", //Defined at utils.js - method:"GET", - params:{"classifier": classifier, "species":species} - }; - - $http(req).then( (response) => { - callback(response); - }, (response) => { - callback(response); - }); - - }, - add_pipeline: (pipelineformID, callback) => { - - const req = { - url: CURRENT_PROJECT.pipelines, - headers: {"Content-Type": "application/x-www-form-urlencoded"}, - method:"POST", - data:$("#" + pipelineformID).serialize() - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - - }, - get_strains: (CURRENT_SPECIES_ID, from_user, callback) => { - - const req = { - url: "api/v1.0/strains/", - method:"GET", - params: - { - speciesID: CURRENT_SPECIES_ID, - from_user: from_user - } - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - - }, - update_strain: (strain_id, key, value, callback) => { - - const req = { - url: "api/v1.0/strains/", - method:"PUT", - params: - { - strain_id: strain_id, - key: key, - value: value - } - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - - }, - get_strain_by_name: (strain_name, callback) => { - - const req = { - url: "api/v1.0/strains/" + strain_name, - method:"GET" - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - - }, - get_applied_pipelines: (strain_id, project_id, callback) => { - - let req = {}; - - if (strain_id === null){ - req = { - url: "api/v1.0/projects/"+project_id+"/pipelines/", - method:"GET" - } - } - else{ - req = { - url: "api/v1.0/projects/"+project_id+"/pipelines/", - method:"GET", - params:{ strain_id_all:strain_id} - } - } - - $http(req).then( (response) => { - callback(response, strain_id); - }, - (response) => { - callback(response, strain_id); - }); - }, - get_public_strains_applied_pipelines: (callback) => { - - const req = { - url: "api/v1.0/projects/"+CURRENT_PROJECT_ID+"/pipelines/", - method:"GET", - params:{all:true} - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - }, - remove_pipeline_from_project: (strain_id, tag_remove, callback) => { - - const req = { - url: "api/v1.0/projects/"+CURRENT_PROJECT_ID+"/pipelines/", - method:"DELETE", - params: { - "strain_id": strain_id, - tag_remove: tag_remove - } - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - }, - change_pipeline_from_project: (strain_id, tag_remove, pipeline_to_use, callback) => { - - const req = { - url: "api/v1.0/projects/"+CURRENT_PROJECT_ID+"/pipelines/", - method:"PUT", - params: { - "strain_id": strain_id, - tag_remove: tag_remove - } - }; - - $http(req).then( (response) => { - callback(response, strain_id, pipeline_to_use); - }, - (response) => { - callback(response, strain_id, pipeline_to_use); - }); - }, - get_quota: (callback) => { - - const req = { - url: "api/v1.0/user/quota/", - method:"GET", - params: { - project_id: CURRENT_PROJECT_ID - } - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - - }, - lock_project: (project_id, callback) => { - - const req = { - url: "api/v1.0/projects/" + project_id, - method:"PUT", - params: { - lock: "lock", - project_id: project_id - } - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - - }, - delete_fastq: (selectedNames, callback) => { - const req = { - url: "api/v1.0/strains/fastq/", - method:"DELETE", - params: { - strain_names: selectedNames.join(","), - speciesID: CURRENT_SPECIES_ID - } - }; - - $http(req).then( (response) => { - callback(response, true); - }, - (response) => { - callback(response, false); - }); - }, + return { + + //////////// Perform checks /////////////////////////////////////////// + + check_ldap: (callback) => { + const req = { + url: "api/v1.0/checks/ldap", + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + check_db_general: (callback) => { + const req = { + url: "api/v1.0/checks/db/general", + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + check_db_mlst: (callback) => { + const req = { + url: "api/v1.0/checks/db/mlst", + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + check_allegro: (callback) => { + const req = { + url: "api/v1.0/checks/allegro", + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + check_authentication: (callback) => { + const req = { + url: "api/v1.0/checks/authentication", + method: "GET", + params: { + userId: CURRENT_USER_ID + } + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + check_controller: (callback) => { + const req = { + url: "api/v1.0/checks/controller", + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + check_phyloviz: (callback) => { + const req = { + url: "api/v1.0/checks/phyloviz", + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + check_state: (callback) => { + const req = { + url: "api/v1.0/checks/state", + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + change_state: (callback) => { + const req = { + url: "api/v1.0/checks/state", + method: "PUT" + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + //////////////// Protocols Requests ///////////////////////////////////////// + download_accession: (username, accession_numbers, callback) => { + + const req = { + url: "api/v1.0/downloads/", + method: "POST", + data: {accession_numbers: accession_numbers} + }; + + $http(req).then((response) => { + callback(response, accession_numbers); + }, (response) => { + callback(response, accession_numbers); + }); + }, + + get_user_mails: (callback) => { + const req = { + url: "api/v1.0/users/email/", + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + get_statistics: (callback) => { + const req = { + url: "api/v1.0/strains/statistics/", + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + get_messages: (numberofmessages, callback) => { + const req = { + url: "api/v1.0/user/messages/", + method: "GET", + params: { + numberofmessages: numberofmessages + } + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + send_messages: (data, callback) => { + const req = { + url: "api/v1.0/user/messages/", + method: "POST", + data: data + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + delete_messages: (messageid, callback) => { + const req = { + url: "api/v1.0/user/messages/", + method: "DELETE", + params: { + messageid: messageid + } + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + mark_as_read: (messageid, callback) => { + const req = { + url: "api/v1.0/user/messages/", + method: "PUT", + params: { + messageid: messageid, + status: "read" + } + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + get_templates: (callback) => { + const req = { + url: "api/v1.0/user/messages/templates/", + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + get_users: (callback) => { + + const req = { + url: "api/v1.0/users/", + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + + }, + + + check_download_accession_status: (file_name, accession_numbers, callback) => { + + const req = { + url: "api/v1.0/downloads/", + method: "GET", + params: {accession_numbers: file_name} + }; + + $http(req).then((response) => { + callback(response, accession_numbers); + }, (response) => { + callback(response, accession_numbers); + }); + }, + create_protocol: (protocol_object, callback) => { + + console.log(protocol_object); + const req = { + url: "api/v1.0/protocols/", + method: "POST", + headers: {"Content-Type": "application/json"}, + data: { + steps: protocol_object, + name: protocol_object.name, + version: protocol_object.Version + } + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + get_protocols_of_type: (selectedType, callback) => { + + const req = { + url: "api/v1.0/protocols/", + method: "GET", + params: {type: selectedType} + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + get_protocols_by_ids: (ids, workflow_entry, callback) => { + + const req = { + url: "api/v1.0/protocols/ids", + method: "GET", + params: {protocol_ids: ids} + }; + + $http(req).then((response) => { + callback(response, workflow_entry); + }, (response) => { + callback(response, workflow_entry); + }); + }, + + + //////////////// Workflows Requests ///////////////////////////////////////// + add_workflow: (callback) => { + + const selClassEl = $("#select_classifier option:selected"); + const workflowSpecieEl = $("#workflow_species option:selected"); + const selectDependency = $("#select_dependency option:selected"); + + const req = { + url: "api/v1.0/workflows/", + method: "POST", + headers: {"Content-Type": "application/x-www-form-urlencoded"}, + data: $("#new_workflow_form").serialize() + "&classifier=" + selClassEl.text() + "&species=" + workflowSpecieEl.text() + "&dependency=" + selectDependency.text() + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + + }, + //////////////// Projects Table Requests ///////////////////////////////////////// + get_species_names: (callback) => { + + const req = { + url: "api/v1.0/species/", + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + get_all_workflows: (callback) => { + + const req = { + url: "api/v1.0/workflows/all/", + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + change_workflow_state: (selected_data, callback) => { + + const req = { + url: "api/v1.0/workflows/availability/", + method: "PUT", + params: + { + identifier: String(selected_data[0]), + to_change: String(selected_data[1]) + } + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + get_species_projects: (species_id, is_others, callback) => { + + //Get user projects for specie 1 + let req = {}; + + if (is_others) { + req = { + url: "api/v1.0/projects/species/" + species_id, + method: "GET", + params: {get_others: true} + } + } + else { + req = { + url: "api/v1.0/projects/species/" + species_id, + method: "GET" + } + } + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + add_project_to_database: (callback) => { + + const req = { + url: "api/v1.0/projects/", + method: "POST", + headers: {"Content-Type": "application/x-www-form-urlencoded"}, + data: $('#new_project_form').serialize() + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + delete_project_from_database: (project_id, callback) => { + + const req = { + url: "api/v1.0/projects/" + project_id, + method: "DELETE" + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + load_project: (project_id, callback) => { + + const req = { + url: "api/v1.0/projects/" + project_id, + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + }, + + + //////////////// Reports Requests ///////////////////////////////////////// + get_user_reports: (callback) => { + + const req = { + url: "api/v1.0/reports/", //Defined at utils.js + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + + }, + get_project_reports: (project_id, pipelines_to_check, callback) => { + + const req = { + url: "api/v1.0/reports/project", //Defined at utils.js + method: "GET", + params: { + "project_id": project_id, + "pipelines_to_check": pipelines_to_check + } + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + + }, + get_reports_by_strain: (strain_id_to_search, callback) => { + + const req = { + url: "api/v1.0/reports/strain", //Defined at utils.js + method: "GET", + params: {"strain_id": strain_id_to_search} + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + + }, + get_multiple_user_reports: (job_ids, callback) => { + + const req = { + url: "api/v1.0/reports/", //Defined at utils.js + method: "GET", + params: { + job_ids: job_ids.toString() + } + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + + }, + save_reports: (job_ids, strain_names, CURRENT_SPECIES_ID, callback) => { + + const req = { + url: "api/v1.0/reports/combined", //Defined at utils.js + headers: {"Content-Type": "application/x-www-form-urlencoded"}, + method: "POST", + data: $("#save_report_form").serialize() + "&job_ids=" + job_ids + "&strain_ids=" + strain_names + "&species_id=" + CURRENT_SPECIES_ID + }; + + $http(req).then((response) => { + callback(response); + }, function (response) { + callback(response); + }); + + }, + get_saved_user_reports: (CURRENT_SPECIES_ID, callback) => { + + const req = { + url: "api/v1.0/reports/combined", //Defined at utils.js + method: "GET", + params: {"species_id": CURRENT_SPECIES_ID} + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + + }, + get_user_trees: (CURRENT_SPECIES_ID, callback) => { + + const req = { + url: "api/v1.0/phyloviz/trees", //Defined at utils.js + method: "GET", + params: {"species_id": CURRENT_SPECIES_ID} + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + + }, + delete_combined_report: (report_name, callback) => { + + const req = { + url: "api/v1.0/reports/combined", //Defined at utils.js + method: "DELETE", + params: { + "report_name": report_name + } + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + + }, + + get_saved_report: (callback) => { + + const req = { + url: "api/v1.0/reports/combined/show", //Defined at utils.js + method: "GET", + }; + + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + + }, + + //////////////// Single Project Requests ///////////////////////////////////////// + get_workflows: (classifier, species, callback) => { + + const req = { + url: "api/v1.0/workflows/", //Defined at utils.js + method: "GET", + params: {"classifier": classifier, "species": species} + }; + + $http(req).then((response) => { + callback(response); + }, (response) => { + callback(response); + }); + + }, + add_pipeline: (pipelineformID, callback) => { + + const req = { + url: CURRENT_PROJECT.pipelines, + headers: {"Content-Type": "application/x-www-form-urlencoded"}, + method: "POST", + data: $("#" + pipelineformID).serialize() + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + + }, + get_strains: (CURRENT_SPECIES_ID, from_user, callback) => { + + const req = { + url: "api/v1.0/strains/", + method: "GET", + params: + { + speciesID: CURRENT_SPECIES_ID, + from_user: from_user + } + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + + }, + update_strain: (strain_id, key, value, callback) => { + + const req = { + url: "api/v1.0/strains/", + method: "PUT", + params: + { + strain_id: strain_id, + key: key, + value: value + } + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + + }, + get_strain_by_name: (strain_name, callback) => { + + const req = { + url: "api/v1.0/strains/" + strain_name, + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + + }, + get_applied_pipelines: (strain_id, project_id, callback) => { + + let req = {}; + + if (strain_id === null) { + req = { + url: "api/v1.0/projects/" + project_id + "/pipelines/", + method: "GET" + } + } + else { + req = { + url: "api/v1.0/projects/" + project_id + "/pipelines/", + method: "GET", + params: {strain_id_all: strain_id} + } + } + + $http(req).then((response) => { + callback(response, strain_id); + }, + (response) => { + callback(response, strain_id); + }); + }, + get_public_strains_applied_pipelines: (callback) => { + + const req = { + url: "api/v1.0/projects/" + CURRENT_PROJECT_ID + "/pipelines/", + method: "GET", + params: {all: true} + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + }, + remove_pipeline_from_project: (strain_id, tag_remove, callback) => { + + const req = { + url: "api/v1.0/projects/" + CURRENT_PROJECT_ID + "/pipelines/", + method: "DELETE", + params: { + "strain_id": strain_id, + tag_remove: tag_remove + } + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + }, + change_pipeline_from_project: (strain_id, tag_remove, pipeline_to_use, callback) => { + + const req = { + url: "api/v1.0/projects/" + CURRENT_PROJECT_ID + "/pipelines/", + method: "PUT", + params: { + "strain_id": strain_id, + tag_remove: tag_remove + } + }; + + $http(req).then((response) => { + callback(response, strain_id, pipeline_to_use); + }, + (response) => { + callback(response, strain_id, pipeline_to_use); + }); + }, + get_quota: (callback) => { + + const req = { + url: "api/v1.0/user/quota/", + method: "GET", + params: { + project_id: CURRENT_PROJECT_ID + } + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + + }, + lock_project: (project_id, callback) => { + + const req = { + url: "api/v1.0/projects/" + project_id, + method: "PUT", + params: { + lock: "lock", + project_id: project_id + } + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + + }, + delete_fastq: (selectedNames, callback) => { + const req = { + url: "api/v1.0/strains/fastq/", + method: "DELETE", + params: { + strain_names: selectedNames.join(","), + speciesID: CURRENT_SPECIES_ID + } + }; + + $http(req).then((response) => { + callback(response, true); + }, + (response) => { + callback(response, false); + }); + }, sendCustomMail: (recipients, title, body, callback) => { - const req = { - url: "api/v1.0/mail/", - method:"POST", - data: { - recipients: recipients.join(","), - title:title, - body:body - } - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); + const req = { + url: "api/v1.0/mail/", + method: "POST", + data: { + recipients: recipients.join(","), + title: title, + body: body + } + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); }, sendMail: (recipients, template, info) => { - const req = { - url: "api/v1.0/mail/", - method:"POST", - data: { - recipients: recipients, - template: template, + const req = { + url: "api/v1.0/mail/", + method: "POST", + data: { + recipients: recipients, + template: template, info: info - } - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - }, - get_uploaded_files: (callback) => { - - const req = { - url: "api/v1.0/uploads/", - method:"GET" - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - }, - get_project_strains: (callback) => { - - const req = { - url: "api/v1.0/projects/"+CURRENT_PROJECT_ID+"/strains/", - method:"GET" - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - }, - get_project_strains_2: (strain_id, is_there, callback) => { - - const req = { - url: "api/v1.0/projects/"+CURRENT_PROJECT_ID+"/strains/", - method:"GET" - }; - - $http(req).then( (response) => { - callback(response, strain_id, is_there); - }, - (response) => { - callback(response, strain_id, is_there); - }); - }, - add_strain_to_project: (strain_name, callback) => { - - const req = { - url: "api/v1.0/projects/"+CURRENT_PROJECT_ID+"/strains/", - method:"PUT", - data: { - "strainID": strain_name.trim() - } - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - }, - add_new_strain: (callback) => { - - if ($("#Accession").val() !== "" && ($("#File_1").val() === "" || $("#File_1").val() === null)){ - $("#File_1").selectpicker("val", "None"); - } - if($("#Accession").val() !== "" && ($("#File_2").val() === "" || $("#File_2").val() === null)) { - $("#File_2").selectpicker("val", "None"); - } - - const req = { - url: "api/v1.0/strains/", - headers: {"Content-Type": "application/x-www-form-urlencoded"}, - method:"POST", - data: $("#new_strain_form").find("select, input, textarea").serialize() - }; - - $http(req).then((response) => { - callback(response); - }, - (response) => { - callback(response); - }); - - }, - - update_metadata: (strain_id, callback) => { - - const req = { - url: "api/v1.0/strains/", - headers: {"Content-Type": "application/x-www-form-urlencoded"}, - method:"PUT", - data: $("#modify_strain_form").find("select, input, textarea").serialize() + "&strain_id=" + strain_id - }; - - $http(req).then((response) => { - callback(response); - }, - (response) => { - callback(response); - }); - - }, - - remove_strain_from_project: (strain_name, callback) => { - - const req = { - url: "api/v1.0/projects/"+CURRENT_PROJECT_ID+"/strains/", - method:"DELETE", - params: { - "strainID": strain_name - } - } - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - }, - check_if_pipeline_exists: (strain_id, strainID, callback) => { - - const req = { - url: "api/v1.0/projects/"+CURRENT_PROJECT_ID+"/pipelines/", - method:"GET", - params: { - strain_id_all: strain_id, - parent_project_id: CURRENT_PROJECT_ID - } - }; - - $http(req).then( (response) => { - callback(response, strain_id, strainID); - }, - (response) => { - callback(response, strain_id, strainID); - }); - }, - add_pipeline: (strain_id, parent_pipeline_id, parent_project_id, callback) => { - - const req = { - url: "api/v1.0/projects/"+CURRENT_PROJECT_ID+"/pipelines/", - method:"POST", - data: { - strain_id: strain_id, - parent_pipeline_id:parent_pipeline_id, - parent_project_id:parent_project_id - } - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - }, - run_job: (strain_id, protocol_ids, pipeline_id, process_id, strain_name, strain_submitter, current_specie, strainName, to_run, process_to_wrkdir, callback) => { - - const processes_wrkdir = []; - - for(const x in process_id){ - if (process_to_wrkdir[String(pipeline_id) + "-" + String(process_id[x])] !== undefined){ - processes_wrkdir.push(process_to_wrkdir[String(pipeline_id) + "-" + String(process_id[x])]) - } - else{ - processes_wrkdir.push("false") - } - } - - const req = { - url: "api/v1.0/jobs/", - method:"POST", - data: { - strain_id: strain_id, - protocol_ids: protocol_ids, - project_id: CURRENT_PROJECT_ID, - pipeline_id: pipeline_id, - process_id: process_id.join(), - strain_submitter: strain_submitter, - current_specie: current_specie, - sampleName: strainName, - processes_to_run: to_run.join(), - processes_wrkdir: processes_wrkdir.join() - } - }; - - $http(req).then( (response) => { - callback(response, strain_name, pipeline_id); - }, - (response) => { - callback(response, strain_name, pipeline_id); - }); - - }, - get_job_status: (job_ids, procedure_names, sample_name, pipeline_id, process_positions, project_id, process_ids, job_location, callback) => { - - const req = { - url: "api/v1.0/jobs/", - method:"GET", - params: { - job_id: job_ids.join(), - procedure_name:procedure_names.join(), - sample_name:sample_name, - pipeline_id:pipeline_id, - process_position:process_positions.join(), - project_id:project_id, - process_id:process_ids, - database_to_include: CURRENT_SPECIES_NAME, - current_user_name: CURRENT_USER_NAME, - current_user_id: CURRENT_USER_ID, - from_process_controller: "false", - job_location: job_location, - homedir: HOME_DIR - } - }; - - $http(req).then( (response) => { - callback(response, job_ids, pipeline_id); - }, - (response) => { - callback(response, job_ids, pipeline_id); - }); - - }, - - //////////////////////////////// GET FILES //////////////////////////////////////// - get_user_files: (callback) => { - - const req = { - url: "api/v1.0/files/", - method:"GET" - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - }, - - get_user_files: (callback) => { - - const req = { - url: "api/v1.0/files/", - method:"GET" - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - }, - - set_user_parameters: (parameters_object_string, callback) => { - - const req = { - url: "api/v1.0/user/", - method:"PUT", - params: { - parameters_object: parameters_object_string - } - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - }, - - get_user_parameters: (callback) => { - - const req = { - url: "api/v1.0/user/", - method:"GET" - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - }, - - download_file: (path, callback) => { - - const req = { - url: "api/v1.0/jobs/results/download/", - method:"GET", - params: { - file_path: encodeURI(path) - } - }; - - $http(req).then( (response) => { - - const url = "api/v1.0/jobs/results/download/click/?file_path=" + encodeURI(response.data); - - let link = document.createElement("a"); - link.download = path.split('/').slice(-1)[0]; - link.href = url; - link.click(); - callback(); - }, - (response) => { - callback(response); - }); - - }, - - download_template_strain_file: (callback) => { - - const url = "api/v1.0/templates/batch_submission/"; - - let link = document.createElement("a"); - link.href = url; - link.click(); - link.remove(); - callback(); - - }, - - get_nextflow_log: (filename, pipeline_id, project_id, callback) => { - - const req = { - url: "api/v1.0/jobs/logs/nextflow/", - method:"GET", - params: { - filename: filename, - pipeline_id:pipeline_id, - project_id:project_id - } - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - }, - - trigger_inspect: (pipeline_id, project_id, callback) => { - - const req = { - url: "api/v1.0/jobs/inspect/", - method:"GET", - params: { - pipeline_id:pipeline_id, - project_id:project_id - } - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - }, - - kill_inspect: (pid, callback) => { - - const req = { - url: "api/v1.0/jobs/inspect/", - method:"PUT", - params: { - pid:pid - } - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - }, - - retry_pipeline: (pipeline_id, project_id, callback) => { - - const req = { - url: "api/v1.0/jobs/inspect/", - method:"POST", - data: { - pipeline_id:pipeline_id, - project_id:project_id - } - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - }, - - send_to_phyloviz: (job_ids, global_additional_data, species_id, callback) => { - - - const req = { - url: "api/v1.0/phyloviz/", - method:"POST", - data: { - job_ids: job_ids.join(","), - dataset_name: $('#modal_phyloviz_dataset_name').val(), - dataset_description: $('#modal_phyloviz_dataset_description').val(), - additional_data: JSON.stringify(global_additional_data), - max_closest: $("#closest_number_of_strains").val(), - database_to_include: $("#species_database option:selected").text(), - species_id: species_id, - missing_data: $('#missing_data_checkbox').is(":checked"), - missing_char: $('#missing_data_character').val(), - phyloviz_user: $('#phyloviz_user').val(), - phyloviz_pass: $('#phyloviz_pass').val(), - makePublic: $('#makePublic_checkbox').is(":checked") - } - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - - }, - - delete_tree: (tree_name, callback) => { - - const req = { - url: "api/v1.0/phyloviz/trees/", - method:"DELETE", - params: { - tree_name: tree_name - } - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - }, - - fetch_job: (redis_job_id, callback) => { - - const req = { - url: "api/v1.0/phyloviz/", - method:"GET", - params: { - job_id: redis_job_id - } - }; - - $http(req).then( (response) => { - callback(response, redis_job_id); - }, - (response) => { - callback(response, redis_job_id); - }); - }, - - check_protocol_parameters: (selected_param, callback) => { - - const req = { - url: "api/v1.0/protocols/params", - method:"GET", - params: { - selected_param: selected_param - } - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - }, - - test_workflow: (list_protocols, callback) => { - - const req = { - url: "api/v1.0/workflows/test", - method:"POST", - data: { - protocols: list_protocols - } - }; - - $http(req).then( (response) => { - callback(response); - }, - (response) => { - callback(response); - }); - } - } + } + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + }, + get_uploaded_files: (callback) => { + + const req = { + url: "api/v1.0/uploads/", + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + }, + get_project_strains: (callback) => { + + const req = { + url: "api/v1.0/projects/" + CURRENT_PROJECT_ID + "/strains/", + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + }, + get_project_strains_2: (strain_id, is_there, callback) => { + + const req = { + url: "api/v1.0/projects/" + CURRENT_PROJECT_ID + "/strains/", + method: "GET" + }; + + $http(req).then((response) => { + callback(response, strain_id, is_there); + }, + (response) => { + callback(response, strain_id, is_there); + }); + }, + add_strain_to_project: (strain_name, callback) => { + + const req = { + url: "api/v1.0/projects/" + CURRENT_PROJECT_ID + "/strains/", + method: "PUT", + data: { + "strainID": strain_name.trim() + } + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + }, + add_new_strain: (callback) => { + + if ($("#Accession").val() !== "" && ($("#File_1").val() === "" || $("#File_1").val() === null)) { + $("#File_1").selectpicker("val", "None"); + } + if ($("#Accession").val() !== "" && ($("#File_2").val() === "" || $("#File_2").val() === null)) { + $("#File_2").selectpicker("val", "None"); + } + + const req = { + url: "api/v1.0/strains/", + headers: {"Content-Type": "application/x-www-form-urlencoded"}, + method: "POST", + data: $("#new_strain_form").find("select, input, textarea").serialize() + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + + }, + + update_metadata: (strain_id, callback) => { + + const req = { + url: "api/v1.0/strains/", + headers: {"Content-Type": "application/x-www-form-urlencoded"}, + method: "PUT", + data: $("#modify_strain_form").find("select, input, textarea").serialize() + "&strain_id=" + strain_id + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + + }, + + remove_strain_from_project: (strain_name, callback) => { + + const req = { + url: "api/v1.0/projects/" + CURRENT_PROJECT_ID + "/strains/", + method: "DELETE", + params: { + "strainID": strain_name + } + } + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + }, + check_if_pipeline_exists: (strain_id, strainID, callback) => { + + const req = { + url: "api/v1.0/projects/" + CURRENT_PROJECT_ID + "/pipelines/", + method: "GET", + params: { + strain_id_all: strain_id, + parent_project_id: CURRENT_PROJECT_ID + } + }; + + $http(req).then((response) => { + callback(response, strain_id, strainID); + }, + (response) => { + callback(response, strain_id, strainID); + }); + }, + add_pipeline: (strain_id, parent_pipeline_id, parent_project_id, callback) => { + + const req = { + url: "api/v1.0/projects/" + CURRENT_PROJECT_ID + "/pipelines/", + method: "POST", + data: { + strain_id: strain_id, + parent_pipeline_id: parent_pipeline_id, + parent_project_id: parent_project_id + } + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + }, + run_job: (strain_id, protocol_ids, pipeline_id, process_id, strain_name, strain_submitter, current_specie, strainName, to_run, process_to_wrkdir, callback) => { + + const processes_wrkdir = []; + + for (const x in process_id) { + if (process_to_wrkdir[String(pipeline_id) + "-" + String(process_id[x])] !== undefined) { + processes_wrkdir.push(process_to_wrkdir[String(pipeline_id) + "-" + String(process_id[x])]) + } + else { + processes_wrkdir.push("false") + } + } + + const req = { + url: "api/v1.0/jobs/", + method: "POST", + data: { + strain_id: strain_id, + protocol_ids: protocol_ids, + project_id: CURRENT_PROJECT_ID, + pipeline_id: pipeline_id, + process_id: process_id.join(), + strain_submitter: strain_submitter, + current_specie: current_specie, + sampleName: strainName, + processes_to_run: to_run.join(), + processes_wrkdir: processes_wrkdir.join() + } + }; + + $http(req).then((response) => { + callback(response, strain_name, pipeline_id); + }, + (response) => { + callback(response, strain_name, pipeline_id); + }); + + }, + get_job_status: (job_ids, procedure_names, sample_name, pipeline_id, process_positions, project_id, process_ids, job_location, callback) => { + + const req = { + url: "api/v1.0/jobs/", + method: "GET", + params: { + job_id: job_ids.join(), + procedure_name: procedure_names.join(), + sample_name: sample_name, + pipeline_id: pipeline_id, + process_position: process_positions.join(), + project_id: project_id, + process_id: process_ids, + database_to_include: CURRENT_SPECIES_NAME, + current_user_name: CURRENT_USER_NAME, + current_user_id: CURRENT_USER_ID, + from_process_controller: "false", + job_location: job_location, + homedir: HOME_DIR + } + }; + + $http(req).then((response) => { + callback(response, job_ids, pipeline_id); + }, + (response) => { + callback(response, job_ids, pipeline_id); + }); + + }, + + //////////////////////////////// GET FILES //////////////////////////////////////// + get_user_files: (callback) => { + + const req = { + url: "api/v1.0/files/", + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + }, + + get_user_files: (callback) => { + + const req = { + url: "api/v1.0/files/", + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + }, + + set_user_parameters: (parameters_object_string, callback) => { + + const req = { + url: "api/v1.0/user/", + method: "PUT", + params: { + parameters_object: parameters_object_string + } + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + }, + + get_user_parameters: (callback) => { + + const req = { + url: "api/v1.0/user/", + method: "GET" + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + }, + + download_file: (path, callback) => { + + const req = { + url: "api/v1.0/jobs/results/download/", + method: "GET", + params: { + file_path: encodeURI(path) + } + }; + + $http(req).then((response) => { + + const url = "api/v1.0/jobs/results/download/click/?file_path=" + encodeURI(response.data); + + let link = document.createElement("a"); + link.download = path.split('/').slice(-1)[0]; + link.href = url; + link.click(); + callback(); + }, + (response) => { + callback(response); + }); + + }, + + download_template_strain_file: (callback) => { + + const url = "api/v1.0/templates/batch_submission/"; + + let link = document.createElement("a"); + link.href = url; + link.click(); + link.remove(); + callback(); + + }, + + get_nextflow_log: (filename, pipeline_id, project_id, callback) => { + + const req = { + url: "api/v1.0/jobs/logs/nextflow/", + method: "GET", + params: { + filename: filename, + pipeline_id: pipeline_id, + project_id: project_id + } + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + }, + + trigger_inspect: (pipeline_id, project_id, callback) => { + + const req = { + url: "api/v1.0/jobs/inspect/", + method: "GET", + params: { + pipeline_id: pipeline_id, + project_id: project_id + } + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + }, + + kill_inspect: (pid, callback) => { + + const req = { + url: "api/v1.0/jobs/inspect/", + method: "PUT", + params: { + pid: pid + } + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + }, + + retry_pipeline: (pipeline_id, project_id, callback) => { + + const req = { + url: "api/v1.0/jobs/inspect/", + method: "POST", + data: { + pipeline_id: pipeline_id, + project_id: project_id + } + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + }, + + send_to_phyloviz: (job_ids, global_additional_data, species_id, callback) => { + + + const req = { + url: "api/v1.0/phyloviz/", + method: "POST", + data: { + job_ids: job_ids.join(","), + dataset_name: $('#modal_phyloviz_dataset_name').val(), + dataset_description: $('#modal_phyloviz_dataset_description').val(), + additional_data: JSON.stringify(global_additional_data), + max_closest: $("#closest_number_of_strains").val(), + database_to_include: $("#species_database option:selected").text(), + species_id: species_id, + missing_data: $('#missing_data_checkbox').is(":checked"), + missing_char: $('#missing_data_character').val(), + phyloviz_user: $('#phyloviz_user').val(), + phyloviz_pass: $('#phyloviz_pass').val(), + makePublic: $('#makePublic_checkbox').is(":checked") + } + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + + }, + + delete_tree: (tree_name, callback) => { + + const req = { + url: "api/v1.0/phyloviz/trees/", + method: "DELETE", + params: { + tree_name: tree_name + } + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + }, + + fetch_job: (redis_job_id, callback) => { + + const req = { + url: "api/v1.0/phyloviz/", + method: "GET", + params: { + job_id: redis_job_id + } + }; + + $http(req).then((response) => { + callback(response, redis_job_id); + }, + (response) => { + callback(response, redis_job_id); + }); + }, + + check_protocol_parameters: (selected_param, callback) => { + + const req = { + url: "api/v1.0/protocols/params", + method: "GET", + params: { + selected_param: selected_param + } + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + }, + + test_workflow: (list_protocols, callback) => { + + const req = { + url: "api/v1.0/workflows/test", + method: "POST", + data: { + protocols: list_protocols + } + }; + + $http(req).then((response) => { + callback(response); + }, + (response) => { + callback(response); + }); + } + } }; \ No newline at end of file diff --git a/job_processing/database_functions.py b/job_processing/database_functions.py index 791e77bc..97bad225 100644 --- a/job_processing/database_functions.py +++ b/job_processing/database_functions.py @@ -12,11 +12,9 @@ allele_classes_to_ignore, core_increment_profile_file_correspondece, \ wg_increment_profile_file_correspondece, classification_levels -''' -Database Functions: +'''Database Functions: - Classify a profile based on Fast-MLST (https://github.com/aplf/fast-mlst) - by using the closest strain classifier from the profiles db -''' + by using the closest strain classifier from the profiles db''' database_correspondece = {"E.coli": Ecoli, "Yersinia": Yersinia, "Campylobacter": Campylobacter, diff --git a/job_processing/phyloviz_functions.py b/job_processing/phyloviz_functions.py index 21eaa46d..ee14b605 100644 --- a/job_processing/phyloviz_functions.py +++ b/job_processing/phyloviz_functions.py @@ -11,9 +11,8 @@ import fast_mlst_functions import database_functions -from config import wg_index_correspondece, core_index_correspondece, \ - core_headers_correspondece, wg_headers_correspondece, \ - allele_classes_to_ignore, phyloviz_root +from config import wg_index_correspondece, core_headers_correspondece, \ + wg_headers_correspondece, allele_classes_to_ignore, phyloviz_root database_correspondece = { "E.coli": Ecoli, From db18108cfa79b22b40d8934f920e8c2802c94dde Mon Sep 17 00:00:00 2001 From: bfrgoncalves Date: Tue, 11 Sep 2018 13:40:41 +0100 Subject: [PATCH 9/9] update readme --- README.md | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 28a66fa9..fa599cca 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,39 @@ # INNUENDO -#### A novel cross-sectorial platform for the integration of genomics in surveillance of foodborne pathogens [![Documentation Status](https://readthedocs.org/projects/innuendo/badge/?version=latest)](https://innuendo.readthedocs.io/en/latest/?badge=latest) +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/0fffb6e32a564841a1dfb9230616d5f6)](https://app.codacy.com/app/bfrgoncalves/INNUENDO_REST_API?utm_source=github.com&utm_medium=referral&utm_content=bfrgoncalves/INNUENDO_REST_API&utm_campaign=Badge_Grade_Dashboard) +#### A novel cross-sectorial platform for the integration of genomics in surveillance of foodborne pathogens -In this repository you will find all the necessary information regarding platform architecture, installation and source code. +In this repository you will find all the necessary information regarding +platform architecture, installation and source code. > **Architecture** -INNUENDO platform is divided into two distinct applications that comunicate between each other. The first one, the **INNUENDO frontend server**, comprises the user web interface and mechanisms to allow secure user authentication with LDAP and data storage into a dedicated database. It also comunicates with the **INNUENDO process controller**, which was developed with the aim of working as a bridge to allow running analytical procedures on a laptop or in a High Performance Computer (HPC), with the help of SLURM process manager. +INNUENDO platform is divided into two distinct applications that communicate +between each other. The first one, the **INNUENDO frontend server**, comprises +the user web interface and mechanisms to allow secure user authentication +using LDAP (if required), and database communication. It also communicates +with the **INNUENDO process controller**, which was developed with the aim of working as +a bridge to allow running analytical procedures on a laptop or in a High +Performance Computer (HPC), with the help of SLURM process manager. In this repository you can find the source code regarding the **INNUENDO frontend server** and its associated RESTful API. > **Installation** -Information about the platform instalation can be found at the documentation. +Information about the platform installation can be found at the documentation. > **Source code** -* [**INNUENDO frontend server**](https://github.com/B-UMMI/INNUENDO_REST_API) -* [**INNUENDO process controller server**](https://github.com/B-UMMI/INNUENDO_PROCESS_CONTROLLER) +* [**INNUENDO frontend server**](https://github.com/bfrgoncalves/INNUENDO_REST_API) +* [**INNUENDO process controller server**](https://github.com/bfrgoncalves/INNUENDO_PROCESS_CONTROLLER) + +> **Docker-Compose** + +A docker-compose version of the INNUENDO Platform is also available and can +be used for an easier deployment since it installs all the components +automatically. + +* [**Docker-Compose version**](https://github.com/bfrgoncalves/INNUENDO_docker)