diff --git a/.gitignore b/.gitignore index 8829ab6..26a451a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,14 +6,14 @@ .project env/ gurobi.log -BiGG_2.egg-info/ +*.egg-info/ docs/schema/ crontab.txt -bigg2/static/models -bigg2/static/dumped_models/ -bigg2/static/polished_models/ -bigg2/static/published_models/ +bigg_models/static/models +bigg_models/static/namespace .#* *.log .cache/ +temp_data/ *.swp +TAGS diff --git a/README.md b/README.md index 1f97229..00f976d 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,12 @@ https://github.com/SBRG/ome/blob/bigg/INSTALL.md Then, do the following to get BiGG Models up and running: -1. Download the code with ```git clone git@github.com:SBRG/BIGG2.git``` -2. ```cd BIGG2``` +1. Download the code with ```git clone git@github.com:SBRG/bigg_models.git``` +2. ```cd bigg_models``` 3. Install with ```python setup.py develop``` (may need to sudo or add --user) 4. Generate the PostgreSQL indices by running ```bin/make_database_indices```. 4. Generate the static models by running ```bin/make_all_static_models```. -5. Start the server with ```python -m bigg2.server --port=8910``` +5. Start the server with ```python -m bigg_models.server --port=8910``` Testing BiGG Models =================== diff --git a/bigg2/__init__.py b/bigg2/__init__.py deleted file mode 100644 index a12e1ba..0000000 --- a/bigg2/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from version import __version__ diff --git a/bigg2/check_running.sh b/bigg2/check_running.sh deleted file mode 100755 index 4c83e72..0000000 --- a/bigg2/check_running.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -source /Users/dbuser/bigg_production/env_production/bin/activate - -if ps -A | grep -v grep | grep 'python -m bigg2.server --port=8888'; then - echo Running; -else - python -m bigg2.server --port=8888 -fi -exit diff --git a/bigg2/comment-notify.py b/bigg2/comment-notify.py deleted file mode 100644 index c52b4f3..0000000 --- a/bigg2/comment-notify.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python - -from ome.base import Session -from ome.models import (Model, Component, Reaction,Compartment, Metabolite, - CompartmentalizedComponent, ModelReaction, ReactionMatrix, - GeneReactionMatrix, ModelCompartmentalizedComponent, ModelGene, - Gene, Comments, GenomeRegion, Genome) -import datetime -import argparse -import smtplib - -parser = argparse.ArgumentParser(description='input email information') -parser.add_argument('-u', '--user', help='Input user email', required=True) -parser.add_argument('-p', '--password', help='Input email password', required=True) -args = parser.parse_args() -session = Session() -current_time = datetime.datetime.now() -week_ago = current_time - datetime.timedelta(weeks=1) -comments = session.query(Comments).filter(Comments.date_created > week_ago).all() -gmail_user = args.user -gmail_pwd = args.password -smtpserver = smtplib.SMTP("smtp.gmail.com", 587) -smtpserver.ehlo() -smtpserver.starttls() -smtpserver.login(gmail_user, gmail_pwd) -complete_msg = "" -header = ('To:' + gmail_user + '\n' + 'From: ' + 'BiGG notification system' + '\n' + - 'Subject:BiGG comment notification\n') -for c in comments: - msg = 'Type: ' + c.type +'\n' + 'Body: ' + c.text + '\n' + 'From: ' + c.email - complete_msg += msg -complete_msg = header + complete_msg -smtpserver.sendmail(gmail_user, gmail_user, complete_msg) -smtpserver.close() diff --git a/bigg2/crontab_check_running.txt b/bigg2/crontab_check_running.txt deleted file mode 100644 index a4dc931..0000000 --- a/bigg2/crontab_check_running.txt +++ /dev/null @@ -1 +0,0 @@ -* * * * * /Users/dbuser/bigg_production/BIGG2/bigg2/check_running.sh 2>> /Users/dbuser/bigg_production/BIGG2/bigg2/output.log diff --git a/bigg2/static/css/builder-embed-1.3.0.css b/bigg2/static/css/builder-embed-1.3.0.css deleted file mode 100644 index 5f3691c..0000000 --- a/bigg2/static/css/builder-embed-1.3.0.css +++ /dev/null @@ -1,141 +0,0 @@ -@charset "utf-8"; - -svg.escher-svg #mouse-node { - fill: none; -} -svg.escher-svg #canvas { - stroke: #ccc; - stroke-width: 7px; - fill: white; -} -svg.escher-svg .resize-rect { - fill: black; - opacity: 0; - stroke: none; -} -svg.escher-svg .label { - font-family: sans-serif; - font-style: italic; - font-weight: bold; - font-size: 8px; - fill: black; - stroke: none; - text-rendering: optimizelegibility; - cursor: default; -} -svg.escher-svg .reaction-label { - font-size: 30px; - fill: rgb(32, 32, 120); - text-rendering: optimizelegibility; -} -svg.escher-svg .node-label { - font-size: 20px; -} -svg.escher-svg .gene-label { - font-size: 18px; - fill: rgb(32, 32, 120); - text-rendering: optimizelegibility; - cursor: default; -} -svg.escher-svg .text-label .label { - font-size: 50px; -} -svg.escher-svg .text-label-input { - font-size: 50px; -} -svg.escher-svg .node-circle { - stroke-width: 2px; -} -svg.escher-svg .midmarker-circle, svg.escher-svg .multimarker-circle { - fill: white; - fill-opacity: 0.2; - stroke: rgb(50, 50, 50); -} -svg.escher-svg g.selected .node-circle{ - stroke-width: 6px; - stroke: rgb(20, 113, 199); -} -svg.escher-svg g.selected .label { - fill: rgb(20, 113, 199); -} -svg.escher-svg .metabolite-circle { - stroke: rgb(162, 69, 16); - fill: rgb(224, 134, 91); -} -svg.escher-svg g.selected .metabolite-circle { - stroke: rgb(5, 2, 0); -} -svg.escher-svg .segment { - stroke: #334E75; - stroke-width: 10px; - fill: none; -} -svg.escher-svg .arrowhead { - fill: #334E75; -} -svg.escher-svg .stoichiometry-label-rect { - fill: white; - opacity: 0.5; -} -svg.escher-svg .stoichiometry-label { - fill: #334E75; - font-size: 17px; -} -svg.escher-svg .membrane { - fill: none; - stroke: rgb(255, 187, 0); -} -svg.escher-svg .brush .extent { - fill-opacity: 0.1; - fill: black; - stroke: #fff; - shape-rendering: crispEdges; -} -svg.escher-svg #brush-container .background { - fill: none; -} -svg.escher-svg .bezier-circle { - fill: rgb(255,255,255); -} -svg.escher-svg .bezier-circle.b1 { - stroke: red; -} -svg.escher-svg .bezier-circle.b2 { - stroke: blue; -} -svg.escher-svg .connect-line{ - stroke: rgb(200,200,200); -} -svg.escher-svg .direction-arrow { - stroke: black; - stroke-width: 1px; - fill: white; - opacity: 0.3; -} -svg.escher-svg .start-reaction-cursor { - cursor: pointer; -} -svg.escher-svg .start-reaction-target { - stroke: rgb(100,100,100); - fill: none; - opacity: 0.5; -} -svg.escher-svg .rotation-center-line { - stroke: red; - stroke-width: 5px; -} -svg.escher-svg .highlight { - fill: #D97000; - text-decoration: underline; -} -svg.escher-svg .cursor-grab { - cursor: grab; - cursor: -webkit-grab; -} -svg.escher-svg .cursor-grabbing { - cursor: grabbing; - cursor: -webkit-grabbing; -} -svg.escher-svg .edit-text-cursor { - cursor: text; -} diff --git a/bigg2/static/js/script.js b/bigg2/static/js/script.js deleted file mode 100644 index a2c23f1..0000000 --- a/bigg2/static/js/script.js +++ /dev/null @@ -1,68 +0,0 @@ -$(document).ready(function() { - // clickable table rows - $(".clickable-row").click(function() { - window.document.location = $(this).attr("href"); - }); - - // submit buttons - $("#submit").click(function(event) { - event.preventDefault(); - var email = $.trim($("input[name='email']").val()), - comments = $.trim($("textarea[name='comments']").val()), - type = $.trim($("select[name='type']").val()), - url = window.location.href, - error = null; - if (email == '' || email.indexOf('@') == -1) error = 'Please enter an email address.'; - else if (comments.length < 10) error = 'Please enter a descriptive comment.'; - if (error) { - $('#message-container').html( - ''); - return; - } - $.post("/submiterror", {email: email, comments: comments, type: type, url: url}) - .done(function(data) { - $('#message-container').html( - ''); - }) - .fail(function() { - $('#message-container').html( - ''); - }); - }); - - // navbar position - var navPos = $('.navbar').offset().top; - - // fixed nav on scroll - $(window).scroll(function() { - var checkScrollPosition = $(this).scrollTop() >= navPos; - $('.navbar').css('position', checkScrollPosition ? 'fixed' : 'relative'); - $('body').css('padding-top', checkScrollPosition ? '72px' : '0px'); - $('#nav-title-background').css('visibility', checkScrollPosition ? 'hidden' : 'visible'); - }); -}); diff --git a/bigg2/templates/comments.html b/bigg2/templates/comments.html deleted file mode 100644 index c49ac6f..0000000 --- a/bigg2/templates/comments.html +++ /dev/null @@ -1,47 +0,0 @@ -
- - -

- - {% with question_title='Reporting errors'%} - {% with question_text='Please help improve the quality of the BiGG database by reporting any issues you find.'%} - {% include 'question_mark.html' %} - {% endwith %} - {% endwith %} -

-
-
- - -
-
-

Email Address

- -
-

- Choose a type - {% with question_title='Reporting errors'%} - {% with question_text='Website Bugs will be fixed as soon as possible. Model Issues will be resolved quickly if they are very simple (e.g. misnamed genes). Model issues that change the nature of the model cannot be fixed immediately; these will be stored in our database so they can be referenced when the next version of the model is being built.'%} - {% include 'question_mark.html' %} - {% endwith %} - {% endwith %} -

- -

Please describe the error

-
- -

- -

-
-
-
- -
-
diff --git a/bigg2/templates/escher_script.html b/bigg2/templates/escher_script.html deleted file mode 100644 index c46e449..0000000 --- a/bigg2/templates/escher_script.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - diff --git a/bigg2/version.py b/bigg2/version.py deleted file mode 100644 index c8ea969..0000000 --- a/bigg2/version.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = 'dev' diff --git a/bigg_models/__init__.py b/bigg_models/__init__.py new file mode 100644 index 0000000..e7b5fe8 --- /dev/null +++ b/bigg_models/__init__.py @@ -0,0 +1 @@ +from version import __version__, __api_version__ diff --git a/bigg2/curation.py b/bigg_models/curation.py similarity index 100% rename from bigg2/curation.py rename to bigg_models/curation.py diff --git a/bigg2/db_analysis/__init__.py b/bigg_models/db_analysis/__init__.py similarity index 100% rename from bigg2/db_analysis/__init__.py rename to bigg_models/db_analysis/__init__.py diff --git a/bigg2/db_analysis/db_analysis.py b/bigg_models/db_analysis/db_analysis.py similarity index 100% rename from bigg2/db_analysis/db_analysis.py rename to bigg_models/db_analysis/db_analysis.py diff --git a/bigg2/drop_indices.sql b/bigg_models/drop_indices.sql similarity index 100% rename from bigg2/drop_indices.sql rename to bigg_models/drop_indices.sql diff --git a/bigg2/model_dumper.py b/bigg_models/model_dumper.py similarity index 95% rename from bigg2/model_dumper.py rename to bigg_models/model_dumper.py index 96eca2e..37d9209 100644 --- a/bigg2/model_dumper.py +++ b/bigg_models/model_dumper.py @@ -1,4 +1,4 @@ -from bigg2.server import static_model_dir as static_dir +from bigg_models.server import static_model_dir as static_dir from ome.base import Session from ome.models import Model @@ -18,7 +18,7 @@ def autodetect_model_polisher(): """Return the path to ModelPolisher.""" return abspath(join(dirname(__file__), '..', 'bin', - 'ModelPolisher-1.0.jar')) + 'ModelPolisher-1.2.jar')) def make_all_static_models(): @@ -53,10 +53,12 @@ def make_all_static_models(): def write_static_model(bigg_id, model_polisher_path=None): - """write out static files for a model with the given bigg ID + """Write out static files for a model with the given BiGG ID. This will output compressed and uncompressed SBML L3 + FBCv2, JSON, - and MAT files""" + and MAT files. + + """ success = True print('Dumping model') t = time.time() diff --git a/bigg2/queries.py b/bigg_models/queries.py similarity index 96% rename from bigg2/queries.py rename to bigg_models/queries.py index 75e39f0..6fe16dc 100644 --- a/bigg2/queries.py +++ b/bigg_models/queries.py @@ -1,10 +1,12 @@ +from bigg_models.version import (__version__ as version, + __api_version__ as api_version) + from ome.models import * from ome.base import Publication, PublicationModel from ome.loading.model_loading import parse from ome import settings from ome.util import make_reaction_copy_id, ref_str_to_tuple, ref_tuple_to_str -from sqlalchemy import func from sqlalchemy import desc, asc, func, or_, and_ from collections import defaultdict from os.path import abspath, dirname, join, isfile, getsize @@ -248,14 +250,18 @@ def get_reaction_and_models(reaction_bigg_id, session): # metabolites metabolite_db = _get_metabolite_list_for_reaction(reaction_bigg_id, session) - return {'bigg_id': result_db[0][0], - 'name': result_db[0][1], - 'pseudoreaction': result_db[0][2], - 'database_links': db_link_results, - 'old_identifiers': old_id_results, - 'metabolites': metabolite_db, - 'models_containing_reaction': [{'bigg_id': x[3], 'organism': x[4]} - for x in result_db]} + reaction_string = build_reaction_string(metabolite_db, -1000, 1000, False) + return { + 'bigg_id': result_db[0][0], + 'name': result_db[0][1], + 'pseudoreaction': result_db[0][2], + 'database_links': db_link_results, + 'old_identifiers': old_id_results, + 'metabolites': metabolite_db, + 'reaction_string': reaction_string, + 'models_containing_reaction': [{'bigg_id': x[3], 'organism': x[4]} + for x in result_db], + } def get_reactions_for_model(model_bigg_id, session): @@ -322,7 +328,10 @@ def get_model_reaction(model_bigg_id, reaction_bigg_id, session): result_list = [] for result_db in model_reaction_db: gene_db = _get_gene_list_for_model_reaction(result_db[2], session) - + reaction_string = build_reaction_string(metabolite_db, + result_db[4], + result_db[5], + False) result_list.append({ 'gene_reaction_rule': result_db[3], 'lower_bound': result_db[4], @@ -331,7 +340,8 @@ def get_model_reaction(model_bigg_id, reaction_bigg_id, session): 'genes': gene_db, 'copy_number': result_db[8], 'subsystem': result_db[9], - 'exported_reaction_id': make_reaction_copy_id(reaction_bigg_id, result_db[8]) + 'exported_reaction_id': make_reaction_copy_id(reaction_bigg_id, result_db[8]), + 'reaction_string': reaction_string, }) return { @@ -592,7 +602,7 @@ def get_model_and_counts(model_bigg_id, session, static_model_dir=None): genome_ref_string = ref_tuple_to_str(model_db[2].accession_type, genome_name) escher_maps = get_escher_maps_for_model(model_db[0].id, session) - result = {'bigg_id': model_db[0].bigg_id, + result = {'model_bigg_id': model_db[0].bigg_id, 'published_filename': model_db[0].published_filename, 'organism': getattr(model_db[2], 'organism', None), 'genome_name': genome_name, @@ -925,7 +935,7 @@ def _compile_db_links(results): """Return links for the results that have a url_prefix.""" links = {} sources = defaultdict(list) - for data_source_name, url_prefix, synonym in results: + for data_source_bigg_id, data_source_name, url_prefix, synonym in results: if url_prefix is None: continue link = url_prefix + synonym @@ -935,7 +945,7 @@ def _compile_db_links(results): def _get_db_links_for_reaction(reaction_bigg_id, session): result_db = (session - .query(DataSource.name, DataSource.url_prefix, Synonym.synonym) + .query(DataSource.bigg_id, DataSource.name, DataSource.url_prefix, Synonym.synonym) .join(Synonym) .join(Reaction, Reaction.id == Synonym.ome_id) .filter(Reaction.bigg_id == reaction_bigg_id)) @@ -972,7 +982,7 @@ def _get_old_ids_for_model_reaction(model_bigg_id, reaction_bigg_id, session): def _get_db_links_for_model_gene(gene_bigg_id, session): result_db = (session - .query(DataSource.name, DataSource.url_prefix, Synonym.synonym) + .query(DataSource.bigg_id, DataSource.name, DataSource.url_prefix, Synonym.synonym) .join(Synonym) .join(Gene, Gene.id == Synonym.ome_id) .filter(Gene.bigg_id == gene_bigg_id)) @@ -994,12 +1004,12 @@ def _get_old_ids_for_model_gene(gene_bigg_id, model_bigg_id, session): def _get_db_links_for_metabolite(met_bigg_id, session): result_db_1 = (session - .query(DataSource.name, DataSource.url_prefix, Synonym.synonym) + .query(DataSource.bigg_id, DataSource.name, DataSource.url_prefix, Synonym.synonym) .join(Synonym) .join(Metabolite, Metabolite.id == Synonym.ome_id) .filter(Metabolite.bigg_id == met_bigg_id)) result_db_2 = (session - .query(DataSource.name, DataSource.url_prefix, Synonym.synonym) + .query(DataSource.bigg_id, DataSource.name, DataSource.url_prefix, Synonym.synonym) .join(Synonym) .join(CompartmentalizedComponent, CompartmentalizedComponent.id == Synonym.ome_id) @@ -1287,6 +1297,17 @@ def search_for_reactions(query_string, session, page=None, size=None, sort_colum for x in query] +def reaction_with_hash(hash, session): + """Find the reaction with the given hash.""" + res = (session + .query(Reaction.bigg_id, Reaction.name) + .filter(Reaction.reaction_hash == hash) + .first()) + if res is None: + raise NotFoundError + return {'bigg_id': res[0], 'model_bigg_id': 'universal', 'name': res[1]} + + def search_for_universal_metabolites_count(query_string, session): """Count the search results.""" # similarity functions @@ -1700,10 +1721,11 @@ def search_ids_fast(query_string, session, limit=None): def get_database_sources(session): # for advanced search result_db = (session - .query(DataSource.name) + .query(DataSource.bigg_id, DataSource.name) + .filter(DataSource.name != None) .distinct() .order_by(DataSource.name)) - return [x[0] for x in result_db] + return [(x[0], x[1]) for x in result_db] def get_metabolites_for_database_id(session, query, database_source): @@ -1711,14 +1733,14 @@ def get_metabolites_for_database_id(session, query, database_source): .query(Metabolite.bigg_id, Metabolite.name) .join(Synonym, Synonym.ome_id == Metabolite.id) .join(DataSource, DataSource.id == Synonym.data_source_id) - .filter(DataSource.name == database_source) + .filter(DataSource.bigg_id == database_source) .filter(Synonym.synonym == query.strip())) comp_comp_db = (session .query(Metabolite.bigg_id, Metabolite.name) .join(CompartmentalizedComponent) .join(Synonym, Synonym.ome_id == CompartmentalizedComponent.id) .join(DataSource, DataSource.id == Synonym.data_source_id) - .filter(DataSource.name == database_source) + .filter(DataSource.bigg_id == database_source) .filter(Synonym.synonym == query.strip())) return [{'bigg_id': x[0], 'model_bigg_id': 'universal', 'name': x[1]} for x in chain(met_db, comp_comp_db)] @@ -1729,7 +1751,7 @@ def get_reactions_for_database_id(session, query, database_source): .query(Reaction.bigg_id, Reaction.name) .join(Synonym, Synonym.ome_id == Reaction.id) .join(DataSource, DataSource.id == Synonym.data_source_id) - .filter(DataSource.name == database_source) + .filter(DataSource.bigg_id == database_source) .filter(Synonym.synonym == query.strip())) return [{'bigg_id': x[0], 'model_bigg_id': 'universal', 'name': x[1]} for x in result_db] @@ -1742,7 +1764,7 @@ def get_genes_for_database_id(session, query, database_source): .join(DataSource) .join(ModelGene) .join(Model) - .filter(DataSource.name == database_source) + .filter(DataSource.bigg_id == database_source) .filter(Synonym.synonym == query.strip())) return [{'bigg_id': x[0], 'model_bigg_id': x[1], 'name': x[2]} for x in result_db] @@ -1751,4 +1773,8 @@ def get_genes_for_database_id(session, query, database_source): # version def database_version(session): - return {'last_updated': str(session.query(DatabaseVersion).first().date_time)} + return { + 'last_updated': str(session.query(DatabaseVersion).first().date_time), + 'bigg_models_version': version, + 'api_version': api_version, + } diff --git a/bigg2/server.py b/bigg_models/server.py similarity index 90% rename from bigg2/server.py rename to bigg_models/server.py index ce7f999..2794c98 100644 --- a/bigg2/server.py +++ b/bigg_models/server.py @@ -1,5 +1,16 @@ #!/usr/bin/env python -import smtplib + +from bigg_models import queries, __api_version__ as api_v +from bigg_models.queries import NotFoundError + +from ome.models import (Model, Component, Reaction, Compartment, Metabolite, + CompartmentalizedComponent, ModelReaction, + ReactionMatrix, GeneReactionMatrix, + ModelCompartmentalizedComponent, ModelGene, Gene, + GenomeRegion, Genome) +from ome.base import Session +from ome.loading.parse import split_compartment, hash_metabolite_dictionary + import tornado.ioloop import tornado.web import tornado.httpserver @@ -9,31 +20,22 @@ asynchronous, HTTPError) from tornado.httpclient import AsyncHTTPClient from tornado import gen -from os.path import abspath, dirname, join + +import os +from os.path import abspath, dirname, join, isfile from jinja2 import Environment, PackageLoader -from sqlalchemy.orm import sessionmaker, aliased, Bundle -from sqlalchemy import create_engine, desc, func, or_ -from collections import Counter -import simplejson as json import subprocess -import os -from os.path import isfile import mimetypes -import datetime - -from six import iteritems +import json -from bigg2 import queries -from bigg2.queries import NotFoundError -import ome -from ome import settings -from ome.models import (Model, Component, Reaction, Compartment, Metabolite, - CompartmentalizedComponent, ModelReaction, - ReactionMatrix, GeneReactionMatrix, - ModelCompartmentalizedComponent, ModelGene, Gene, - Comments, GenomeRegion, Genome) -from ome.base import Session -from ome.loading.parse import split_compartment +# sbml validator +try: + import cobra_sbml_validator +except ImportError: + print('COBRA SBML Validator not installed') + HAS_SBML_VALIDATOR = False +else: + HAS_SBML_VALIDATOR = True # sbml validator @@ -52,15 +54,14 @@ define('debug', default=False, help='Start server in debug mode') # set up jinja2 template location -env = Environment(loader=PackageLoader('bigg2', 'templates'), +env = Environment(loader=PackageLoader('bigg_models', 'templates'), extensions=['jinja2.ext.with_']) # root directory directory = abspath(dirname(__file__)) static_model_dir = join(directory, "static", "models") -# api version -api_v = 'v2' +# host api_host = 'bigg.ucsd.edu' # content types @@ -133,6 +134,7 @@ def get_application(debug=False): # # Search (r'/api/%s/search$' % api_v, SearchHandler), + (r'/api/%s/search_reaction_with_stoichiometry$' % api_v, ReactionWithStoichHandler), (r'/search$', SearchDisplayHandler), (r'/advanced_search$', AdvancedSearchHandler), (r'/advanced_search_external_id_results$', AdvancedSearchExternalIDHandler), @@ -142,11 +144,9 @@ def get_application(debug=False): # Maps (r'/escher_map_json/([^/]+)$', EscherMapJSONHandler), # - # Comments - (r'/submiterror$', SubmitErrorHandler), - # # Pages - (r'/web_api$', WebAPIHandler), + (r'/web_api$', RedirectHandler, {'url': '/data_access'}), + (r'/data_access$', WebAPIHandler), (r'/license$', LicenseHandler), # # Version @@ -177,7 +177,7 @@ def run(public=True): tornado.options.parse_command_line() debug = options.debug http_server = tornado.httpserver.HTTPServer(get_application(debug=debug)) - print('serving BiGG 2 on port %d' % options.port) + print('serving BiGG Models on port %d' % options.port) http_server.listen(options.port, None if public else "localhost") try: tornado.ioloop.IOLoop.instance().start() @@ -194,23 +194,6 @@ def stop(): # Handlers # ------------------------------------------------------------------------------- -class BiggStaticFileHandler(StaticFileHandler): - """This is sets the Content-Type for the various model formats - - This is mainly for testing. In production, the /static path should be - handled by nginx or apache""" - def get_content_type(self): - path = self.absolute_path - # need to fix type for gzip files until tornado patched - # https://github.com/tornadoweb/tornado/pull/1468 - if path.endswith(".xml.gz"): - return "application/gzip" - # mat needs to be binary - elif path.endswith(".mat"): - return "application/octet-stream" - else: - return StaticFileHandler.get_content_type(self) - def _possibly_compartmentalized_met_id(obj): if 'compartment_bigg_id' not in obj: return obj['bigg_id'] @@ -276,8 +259,11 @@ def return_result(self, result): This is suitable for cases where the template takes exactly the same result as the JSON api. This function will serve JSON if the request URI starts with JSON, otherwise it will render the objects template - with the data""" + with the data + + """ if self.request.uri.startswith("/api"): + self.write(result) else: self.write(self.template.render(result)) @@ -306,7 +292,7 @@ def _get_pager_args(self, default_sort_column=None, sort_direction="ascending"): # determine which column we are sorting by # These are parameters formatted as col[i] = 0 (or 1 for descending) - for param_name, param_value in iteritems(self.request.query_arguments): + for param_name, param_value in self.request.query_arguments.iteritems(): if not (param_name.startswith("col[") and param_name.endswith("]")): continue @@ -359,7 +345,7 @@ def get(self): class UniversalReactionListDisplayHandler(BaseHandler): def get(self): - template = env.get_template("list_display.html") + template = env.get_template('list_display.html') dictionary = {'results': {'reactions': 'ajax'}, 'hide_organism': True} self.write(template.render(dictionary)) @@ -367,7 +353,7 @@ def get(self): class UniversalReactionHandler(BaseHandler): - template = env.get_template("universal_reaction.html") + template = env.get_template('universal_reaction.html') def get(self, reaction_bigg_id): result = safe_query(queries.get_reaction_and_models, reaction_bigg_id) @@ -447,12 +433,7 @@ class ReactionDisplayHandler(BaseHandler): def get(self, model_bigg_id, reaction_bigg_id): template = env.get_template("reaction.html") data = safe_query(queries.get_model_reaction, - model_bigg_id, reaction_bigg_id) - for result in data['results']: - result['reaction_string'] = queries.build_reaction_string(data['metabolites'], - result['lower_bound'], - result['upper_bound'], - False) + model_bigg_id, reaction_bigg_id) self.write(template.render(data)) self.finish() @@ -471,7 +452,7 @@ def get(self): class CompartmentHandler(BaseHandler): template = env.get_template("compartment.html") - + def get(self, compartment_bigg_id): session = Session() result_db = (session @@ -530,7 +511,7 @@ def get(self): class ModelsListDisplayHandler(BaseHandler): def get(self): - template = env.get_template("list_display.html") + template = env.get_template('list_display.html') template_data = {'results': {'models': 'ajax'}} self.write(template.render(template_data)) self.finish() @@ -538,8 +519,11 @@ def get(self): class ModelDownloadHandler(BaseHandler): def get(self, model_bigg_id): - extension = self.get_argument("format", "json") - self.redirect("/static/models/%s.%s" % (model_bigg_id, extension)) + with open(join(directory, 'static', 'models', '%s.json' % model_bigg_id)) as f: + json_str = f.read() + self.write(json_str) + self.set_header('Content-type', 'application/json; charset=utf-8') + self.finish() class ModelHandler(BaseHandler): @@ -709,6 +693,23 @@ def get(self): self.finish() +class ReactionWithStoichHandler(BaseHandler): + def get(self): + metabolite_dict = {k: float(v[0]) for k, v in + self.request.query_arguments.iteritems()} + hash = hash_metabolite_dictionary(metabolite_dict) + session = Session() + try: + results = {'results': [queries.reaction_with_hash(hash, session)], + 'results_count': 1} + except NotFoundError: + results = {'results': [], + 'results_count': 0} + session.close() + self.write(results) + self.finish() + + class SearchDisplayHandler(BaseHandler): def get(self): template = env.get_template("list_display.html") @@ -820,25 +821,10 @@ def get(self, map_name): self.finish() -class SubmitErrorHandler(BaseHandler): - def post(self): - session = Session() - useremail = self.get_argument("email", "empty") - comments = self.get_argument("comments", "empty") - type = self.get_argument("type", "empty") - weburl = self.get_argument("url", "empty") - now = datetime.datetime.now() - commentobject = Comments(email=useremail, text=comments, - date_created=now, type=type, url=weburl) - session.add(commentobject) - session.commit() - session.close() - - class WebAPIHandler(BaseHandler): def get(self): - template = env.get_template('web_api.html') - self.write(template.render(api_host=api_host)) + template = env.get_template('data_access.html') + self.write(template.render(api_v=api_v, api_host=api_host)) self.finish() @@ -863,10 +849,10 @@ class StaticFileHandlerWithEncoding(StaticFileHandler): def get_absolute_path(self, root, path): p = abspath(join(root, path)) # if the client accepts gzip - if "gzip" in self.request.headers.get('Accept-Encoding', ''): - if isfile(p + ".gz"): - self.set_header("Content-Encoding", "gzip") - return p + ".gz" + if 'gzip' in self.request.headers.get('Accept-Encoding', ''): + if isfile(p + '.gz'): + self.set_header('Content-Encoding', 'gzip') + return p + '.gz' return p def get_content_type(self): @@ -875,13 +861,13 @@ def get_content_type(self): # from https://github.com/tornadoweb/tornado/pull/1468 # per RFC 6713, use the appropriate type for a gzip compressed file - if encoding == "gzip": - return "application/gzip" + if encoding == 'gzip': + return 'application/gzip' # As of 2015-07-21 there is no bzip2 encoding defined at # http://www.iana.org/assignments/media-types/media-types.xhtml # So for that (and any other encoding), use octet-stream. elif encoding is not None: - return "application/octet-stream" + return 'application/octet-stream' # assume utf-8 for xml and json elif mime_type == 'application/xml': @@ -894,8 +880,8 @@ def get_content_type(self): return mime_type # if mime_type not detected, use application/octet-stream else: - return "application/octet-stream" + return 'application/octet-stream' -if __name__ == "__main__": +if __name__ == '__main__': run() diff --git a/bigg2/setup.sql b/bigg_models/setup.sql similarity index 100% rename from bigg2/setup.sql rename to bigg_models/setup.sql diff --git a/bigg2/static/assets/ajax-loader.gif b/bigg_models/static/assets/ajax-loader.gif similarity index 100% rename from bigg2/static/assets/ajax-loader.gif rename to bigg_models/static/assets/ajax-loader.gif diff --git a/bigg2/static/assets/bigg-github.png b/bigg_models/static/assets/bigg-github.png similarity index 100% rename from bigg2/static/assets/bigg-github.png rename to bigg_models/static/assets/bigg-github.png diff --git a/bigg2/static/assets/bigg_sbml.xsl b/bigg_models/static/assets/bigg_sbml.xsl similarity index 100% rename from bigg2/static/assets/bigg_sbml.xsl rename to bigg_models/static/assets/bigg_sbml.xsl diff --git a/bigg2/static/assets/cfb-logo.png b/bigg_models/static/assets/cfb-logo.png similarity index 100% rename from bigg2/static/assets/cfb-logo.png rename to bigg_models/static/assets/cfb-logo.png diff --git a/bigg2/static/assets/escher-logo.png b/bigg_models/static/assets/escher-logo.png similarity index 100% rename from bigg2/static/assets/escher-logo.png rename to bigg_models/static/assets/escher-logo.png diff --git a/bigg2/static/assets/f21.png b/bigg_models/static/assets/f21.png similarity index 100% rename from bigg2/static/assets/f21.png rename to bigg_models/static/assets/f21.png diff --git a/bigg2/static/assets/f22.png b/bigg_models/static/assets/f22.png similarity index 100% rename from bigg2/static/assets/f22.png rename to bigg_models/static/assets/f22.png diff --git a/bigg2/static/assets/f23.png b/bigg_models/static/assets/f23.png similarity index 100% rename from bigg2/static/assets/f23.png rename to bigg_models/static/assets/f23.png diff --git a/bigg2/static/assets/favicon.ico b/bigg_models/static/assets/favicon.ico similarity index 100% rename from bigg2/static/assets/favicon.ico rename to bigg_models/static/assets/favicon.ico diff --git a/bigg2/static/assets/logo-header.png b/bigg_models/static/assets/logo-header.png similarity index 100% rename from bigg2/static/assets/logo-header.png rename to bigg_models/static/assets/logo-header.png diff --git a/bigg2/static/assets/metabolites.png b/bigg_models/static/assets/metabolites.png similarity index 100% rename from bigg2/static/assets/metabolites.png rename to bigg_models/static/assets/metabolites.png diff --git a/bigg2/static/assets/models.png b/bigg_models/static/assets/models.png similarity index 100% rename from bigg2/static/assets/models.png rename to bigg_models/static/assets/models.png diff --git a/bigg2/static/assets/reactions.png b/bigg_models/static/assets/reactions.png similarity index 100% rename from bigg2/static/assets/reactions.png rename to bigg_models/static/assets/reactions.png diff --git a/bigg2/static/assets/sbrg-logo.png b/bigg_models/static/assets/sbrg-logo.png similarity index 100% rename from bigg2/static/assets/sbrg-logo.png rename to bigg_models/static/assets/sbrg-logo.png diff --git a/bigg2/static/assets/ucsd-logo.png b/bigg_models/static/assets/ucsd-logo.png similarity index 100% rename from bigg2/static/assets/ucsd-logo.png rename to bigg_models/static/assets/ucsd-logo.png diff --git a/bigg2/static/css/frontpage.css b/bigg_models/static/css/frontpage.css similarity index 99% rename from bigg2/static/css/frontpage.css rename to bigg_models/static/css/frontpage.css index 4e78a7a..64c438c 100644 --- a/bigg2/static/css/frontpage.css +++ b/bigg_models/static/css/frontpage.css @@ -162,7 +162,7 @@ footer { } @media (min-width: 992px) { - #bigg2-github { + #bigg-models-github { margin-top: 30px; } } diff --git a/bigg2/static/css/style.css b/bigg_models/static/css/style.css similarity index 90% rename from bigg2/static/css/style.css rename to bigg_models/static/css/style.css index feb0473..f48e882 100644 --- a/bigg2/static/css/style.css +++ b/bigg_models/static/css/style.css @@ -1,12 +1,12 @@ body { - font-size: 19px; + font-size: 19px !important; color: #444444; height: 100%; width: 100%; } h1, h2, h3, h4, h5, h6 { - font-family: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: normal; } h1 { @@ -64,7 +64,7 @@ span.pseudoreaction { height: 60px; background-color: #0099FF; z-index: 10; -} +} #nav-title { width: 100%; } @@ -78,7 +78,16 @@ span.pseudoreaction { text-shadow: rgba(0, 0, 0, 0.5) 0px 0px 10px; } -.light { +/* fix nav padding */ +.nav>li>a { + padding: 10px 12px; +} +.navbar-nav>li>a { + padding-top: 15px; + padding-bottom: 15px; +} + +.light { color: #999999; } p { @@ -138,9 +147,9 @@ td:target { } .escher-map { margin-bottom: 10px; - width: 100%; - height: 500px; - border: 1px solid #DDD; + width: 100%; + height: 500px; + border: 1px solid #DDD; border-radius: 4px; } .centered { @@ -171,7 +180,7 @@ td:target { #loading-model{ clear:both; - + margin-top: 100px; } .btn-group-vertical{ @@ -212,22 +221,22 @@ td:target { transition: opacity 1s; } .carousel .one { - - background: url(f21.png) no-repeat center center fixed; + + background: url(f21.png) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } .carousel .two { - background: url(f22.png) no-repeat center center fixed; + background: url(f22.png) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } .carousel .three { - background: url(f23.png) no-repeat center center fixed; + background: url(f23.png) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; diff --git a/bigg2/static/js/jquery.tablesorter.pager.js b/bigg_models/static/js/jquery.tablesorter.pager.js similarity index 95% rename from bigg2/static/js/jquery.tablesorter.pager.js rename to bigg_models/static/js/jquery.tablesorter.pager.js index cce6ea2..5a34d82 100644 --- a/bigg2/static/js/jquery.tablesorter.pager.js +++ b/bigg_models/static/js/jquery.tablesorter.pager.js @@ -1,184 +1,184 @@ -(function($) { - $.extend({ - tablesorterPager: new function() { - - function updatePageDisplay(c) { - var s = $(c.cssPageDisplay,c.container).val((c.page+1) + c.seperator + c.totalPages); - } - - function setPageSize(table,size) { - var c = table.config; - c.size = size; - c.totalPages = Math.ceil(c.totalRows / c.size); - c.pagerPositionSet = false; - moveToPage(table); - fixPosition(table); - } - - function fixPosition(table) { - var c = table.config; - if(!c.pagerPositionSet && c.positionFixed) { - var c = table.config, o = $(table); - if(o.offset) { - c.container.css({ - top: o.offset().top + o.height() + 'px', - position: 'absolute' - }); - } - c.pagerPositionSet = true; - } - } - - function moveToFirstPage(table) { - var c = table.config; - c.page = 0; - moveToPage(table); - } - - function moveToLastPage(table) { - var c = table.config; - c.page = (c.totalPages-1); - moveToPage(table); - } - - function moveToNextPage(table) { - var c = table.config; - c.page++; - if(c.page >= (c.totalPages-1)) { - c.page = (c.totalPages-1); - } - moveToPage(table); - } - - function moveToPrevPage(table) { - var c = table.config; - c.page--; - if(c.page <= 0) { - c.page = 0; - } - moveToPage(table); - } - - - function moveToPage(table) { - var c = table.config; - if(c.page < 0 || c.page > (c.totalPages-1)) { - c.page = 0; - } - - renderTable(table,c.rowsCopy); - } - - function renderTable(table,rows) { - - var c = table.config; - var l = rows.length; - var s = (c.page * c.size); - var e = (s + c.size); - if(e > rows.length ) { - e = rows.length; - } - - - var tableBody = $(table.tBodies[0]); - - // clear the table body - - $.tablesorter.clearTableBody(table); - - for(var i = s; i < e; i++) { - - //tableBody.append(rows[i]); - - var o = rows[i]; - var l = o.length; - for(var j=0; j < l; j++) { - - tableBody[0].appendChild(o[j]); - - } - } - - fixPosition(table,tableBody); - - $(table).trigger("applyWidgets"); - - if( c.page >= c.totalPages ) { - moveToLastPage(table); - } - - updatePageDisplay(c); - } - - this.appender = function(table,rows) { - - var c = table.config; - - c.rowsCopy = rows; - c.totalRows = rows.length; - c.totalPages = Math.ceil(c.totalRows / c.size); - - renderTable(table,rows); - }; - - this.defaults = { - size: 10, - offset: 0, - page: 0, - totalRows: 0, - totalPages: 0, - container: null, - cssNext: '.next', - cssPrev: '.prev', - cssFirst: '.first', - cssLast: '.last', - cssPageDisplay: '.pagedisplay', - cssPageSize: '.pagesize', - seperator: "/", - positionFixed: true, - appender: this.appender - }; - - this.construct = function(settings) { - - return this.each(function() { - - config = $.extend(this.config, $.tablesorterPager.defaults, settings); - - var table = this, pager = config.container; - - $(this).trigger("appendCache"); - - config.size = parseInt($(".pagesize",pager).val()); - - $(config.cssFirst,pager).click(function() { - moveToFirstPage(table); - return false; - }); - $(config.cssNext,pager).click(function() { - moveToNextPage(table); - return false; - }); - $(config.cssPrev,pager).click(function() { - moveToPrevPage(table); - return false; - }); - $(config.cssLast,pager).click(function() { - moveToLastPage(table); - return false; - }); - $(config.cssPageSize,pager).change(function() { - setPageSize(table,parseInt($(this).val())); - return false; - }); - }); - }; - - } - }); - // extend plugin scope - $.fn.extend({ - tablesorterPager: $.tablesorterPager.construct - }); - +(function($) { + $.extend({ + tablesorterPager: new function() { + + function updatePageDisplay(c) { + var s = $(c.cssPageDisplay,c.container).val((c.page+1) + c.seperator + c.totalPages); + } + + function setPageSize(table,size) { + var c = table.config; + c.size = size; + c.totalPages = Math.ceil(c.totalRows / c.size); + c.pagerPositionSet = false; + moveToPage(table); + fixPosition(table); + } + + function fixPosition(table) { + var c = table.config; + if(!c.pagerPositionSet && c.positionFixed) { + var c = table.config, o = $(table); + if(o.offset) { + c.container.css({ + top: o.offset().top + o.height() + 'px', + position: 'absolute' + }); + } + c.pagerPositionSet = true; + } + } + + function moveToFirstPage(table) { + var c = table.config; + c.page = 0; + moveToPage(table); + } + + function moveToLastPage(table) { + var c = table.config; + c.page = (c.totalPages-1); + moveToPage(table); + } + + function moveToNextPage(table) { + var c = table.config; + c.page++; + if(c.page >= (c.totalPages-1)) { + c.page = (c.totalPages-1); + } + moveToPage(table); + } + + function moveToPrevPage(table) { + var c = table.config; + c.page--; + if(c.page <= 0) { + c.page = 0; + } + moveToPage(table); + } + + + function moveToPage(table) { + var c = table.config; + if(c.page < 0 || c.page > (c.totalPages-1)) { + c.page = 0; + } + + renderTable(table,c.rowsCopy); + } + + function renderTable(table,rows) { + + var c = table.config; + var l = rows.length; + var s = (c.page * c.size); + var e = (s + c.size); + if(e > rows.length ) { + e = rows.length; + } + + + var tableBody = $(table.tBodies[0]); + + // clear the table body + + $.tablesorter.clearTableBody(table); + + for(var i = s; i < e; i++) { + + //tableBody.append(rows[i]); + + var o = rows[i]; + var l = o.length; + for(var j=0; j < l; j++) { + + tableBody[0].appendChild(o[j]); + + } + } + + fixPosition(table,tableBody); + + $(table).trigger("applyWidgets"); + + if( c.page >= c.totalPages ) { + moveToLastPage(table); + } + + updatePageDisplay(c); + } + + this.appender = function(table,rows) { + + var c = table.config; + + c.rowsCopy = rows; + c.totalRows = rows.length; + c.totalPages = Math.ceil(c.totalRows / c.size); + + renderTable(table,rows); + }; + + this.defaults = { + size: 10, + offset: 0, + page: 0, + totalRows: 0, + totalPages: 0, + container: null, + cssNext: '.next', + cssPrev: '.prev', + cssFirst: '.first', + cssLast: '.last', + cssPageDisplay: '.pagedisplay', + cssPageSize: '.pagesize', + seperator: "/", + positionFixed: true, + appender: this.appender + }; + + this.construct = function(settings) { + + return this.each(function() { + + config = $.extend(this.config, $.tablesorterPager.defaults, settings); + + var table = this, pager = config.container; + + $(this).trigger("appendCache"); + + config.size = parseInt($(".pagesize",pager).val()); + + $(config.cssFirst,pager).click(function() { + moveToFirstPage(table); + return false; + }); + $(config.cssNext,pager).click(function() { + moveToNextPage(table); + return false; + }); + $(config.cssPrev,pager).click(function() { + moveToPrevPage(table); + return false; + }); + $(config.cssLast,pager).click(function() { + moveToLastPage(table); + return false; + }); + $(config.cssPageSize,pager).change(function() { + setPageSize(table,parseInt($(this).val())); + return false; + }); + }); + }; + + } + }); + // extend plugin scope + $.fn.extend({ + tablesorterPager: $.tablesorterPager.construct + }); + })(jQuery); \ No newline at end of file diff --git a/bigg2/static/js/question_mark.js b/bigg_models/static/js/question_mark.js similarity index 100% rename from bigg2/static/js/question_mark.js rename to bigg_models/static/js/question_mark.js diff --git a/bigg_models/static/js/script.js b/bigg_models/static/js/script.js new file mode 100644 index 0000000..a38e905 --- /dev/null +++ b/bigg_models/static/js/script.js @@ -0,0 +1,29 @@ +/* global $ */ + +$(document).ready(function() { + // clickable table rows + $('.clickable-row').click(function() { + window.document.location = $(this).attr('href') + }) + + // Go to a new GitHub issue page and fill out some key info. + $('#comment-link').click(function() { + var url = ('https://github.com/SBRG/bigg_models/issues/new?body=' + + encodeURIComponent('# Description of the issue\n\n\n\n# Page\n' + + window.location.href + '\n# Browser\n' + + window.navigator.userAgent)) + window.open(url, '_blank') + return false; + }) + + // navbar position + var navPos = $('.navbar').offset().top + + // fixed nav on scroll + $(window).scroll(function() { + var checkScrollPosition = $(this).scrollTop() >= navPos + $('.navbar').css('position', checkScrollPosition ? 'fixed' : 'relative') + $('body').css('padding-top', checkScrollPosition ? '72px' : '0px') + $('#nav-title-background').css('visibility', checkScrollPosition ? 'hidden' : 'visible') + }) +}) diff --git a/bigg2/static/js/tablesorter_normal.js b/bigg_models/static/js/tablesorter_normal.js similarity index 100% rename from bigg2/static/js/tablesorter_normal.js rename to bigg_models/static/js/tablesorter_normal.js diff --git a/bigg2/static/js/tablesorter_pager.js b/bigg_models/static/js/tablesorter_pager.js similarity index 100% rename from bigg2/static/js/tablesorter_pager.js rename to bigg_models/static/js/tablesorter_pager.js diff --git a/bigg2/static/lib/tablesorter/.gitattributes b/bigg_models/static/lib/tablesorter/.gitattributes similarity index 100% rename from bigg2/static/lib/tablesorter/.gitattributes rename to bigg_models/static/lib/tablesorter/.gitattributes diff --git a/bigg2/static/lib/tablesorter/.gitignore b/bigg_models/static/lib/tablesorter/.gitignore similarity index 100% rename from bigg2/static/lib/tablesorter/.gitignore rename to bigg_models/static/lib/tablesorter/.gitignore diff --git a/bigg2/static/lib/tablesorter/addons/pager/icons/first.png b/bigg_models/static/lib/tablesorter/addons/pager/icons/first.png similarity index 100% rename from bigg2/static/lib/tablesorter/addons/pager/icons/first.png rename to bigg_models/static/lib/tablesorter/addons/pager/icons/first.png diff --git a/bigg2/static/lib/tablesorter/addons/pager/icons/last.png b/bigg_models/static/lib/tablesorter/addons/pager/icons/last.png similarity index 100% rename from bigg2/static/lib/tablesorter/addons/pager/icons/last.png rename to bigg_models/static/lib/tablesorter/addons/pager/icons/last.png diff --git a/bigg2/static/lib/tablesorter/addons/pager/icons/loading.gif b/bigg_models/static/lib/tablesorter/addons/pager/icons/loading.gif similarity index 100% rename from bigg2/static/lib/tablesorter/addons/pager/icons/loading.gif rename to bigg_models/static/lib/tablesorter/addons/pager/icons/loading.gif diff --git a/bigg2/static/lib/tablesorter/addons/pager/icons/next.png b/bigg_models/static/lib/tablesorter/addons/pager/icons/next.png similarity index 100% rename from bigg2/static/lib/tablesorter/addons/pager/icons/next.png rename to bigg_models/static/lib/tablesorter/addons/pager/icons/next.png diff --git a/bigg2/static/lib/tablesorter/addons/pager/icons/prev.png b/bigg_models/static/lib/tablesorter/addons/pager/icons/prev.png similarity index 100% rename from bigg2/static/lib/tablesorter/addons/pager/icons/prev.png rename to bigg_models/static/lib/tablesorter/addons/pager/icons/prev.png diff --git a/bigg2/static/lib/tablesorter/dist/css/images/black-asc.gif b/bigg_models/static/lib/tablesorter/dist/css/images/black-asc.gif similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/black-asc.gif rename to bigg_models/static/lib/tablesorter/dist/css/images/black-asc.gif diff --git a/bigg2/static/lib/tablesorter/dist/css/images/black-desc.gif b/bigg_models/static/lib/tablesorter/dist/css/images/black-desc.gif similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/black-desc.gif rename to bigg_models/static/lib/tablesorter/dist/css/images/black-desc.gif diff --git a/bigg2/static/lib/tablesorter/dist/css/images/black-unsorted.gif b/bigg_models/static/lib/tablesorter/dist/css/images/black-unsorted.gif similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/black-unsorted.gif rename to bigg_models/static/lib/tablesorter/dist/css/images/black-unsorted.gif diff --git a/bigg2/static/lib/tablesorter/dist/css/images/bootstrap-black-unsorted.png b/bigg_models/static/lib/tablesorter/dist/css/images/bootstrap-black-unsorted.png similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/bootstrap-black-unsorted.png rename to bigg_models/static/lib/tablesorter/dist/css/images/bootstrap-black-unsorted.png diff --git a/bigg2/static/lib/tablesorter/dist/css/images/bootstrap-white-unsorted.png b/bigg_models/static/lib/tablesorter/dist/css/images/bootstrap-white-unsorted.png similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/bootstrap-white-unsorted.png rename to bigg_models/static/lib/tablesorter/dist/css/images/bootstrap-white-unsorted.png diff --git a/bigg2/static/lib/tablesorter/dist/css/images/dragtable-handle.png b/bigg_models/static/lib/tablesorter/dist/css/images/dragtable-handle.png similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/dragtable-handle.png rename to bigg_models/static/lib/tablesorter/dist/css/images/dragtable-handle.png diff --git a/bigg2/static/lib/tablesorter/dist/css/images/dragtable-handle.svg b/bigg_models/static/lib/tablesorter/dist/css/images/dragtable-handle.svg similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/dragtable-handle.svg rename to bigg_models/static/lib/tablesorter/dist/css/images/dragtable-handle.svg diff --git a/bigg2/static/lib/tablesorter/dist/css/images/dropbox-asc-hovered.png b/bigg_models/static/lib/tablesorter/dist/css/images/dropbox-asc-hovered.png similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/dropbox-asc-hovered.png rename to bigg_models/static/lib/tablesorter/dist/css/images/dropbox-asc-hovered.png diff --git a/bigg2/static/lib/tablesorter/dist/css/images/dropbox-asc.png b/bigg_models/static/lib/tablesorter/dist/css/images/dropbox-asc.png similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/dropbox-asc.png rename to bigg_models/static/lib/tablesorter/dist/css/images/dropbox-asc.png diff --git a/bigg2/static/lib/tablesorter/dist/css/images/dropbox-desc-hovered.png b/bigg_models/static/lib/tablesorter/dist/css/images/dropbox-desc-hovered.png similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/dropbox-desc-hovered.png rename to bigg_models/static/lib/tablesorter/dist/css/images/dropbox-desc-hovered.png diff --git a/bigg2/static/lib/tablesorter/dist/css/images/dropbox-desc.png b/bigg_models/static/lib/tablesorter/dist/css/images/dropbox-desc.png similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/dropbox-desc.png rename to bigg_models/static/lib/tablesorter/dist/css/images/dropbox-desc.png diff --git a/bigg2/static/lib/tablesorter/dist/css/images/first.png b/bigg_models/static/lib/tablesorter/dist/css/images/first.png similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/first.png rename to bigg_models/static/lib/tablesorter/dist/css/images/first.png diff --git a/bigg2/static/lib/tablesorter/dist/css/images/green-asc.gif b/bigg_models/static/lib/tablesorter/dist/css/images/green-asc.gif similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/green-asc.gif rename to bigg_models/static/lib/tablesorter/dist/css/images/green-asc.gif diff --git a/bigg2/static/lib/tablesorter/dist/css/images/green-desc.gif b/bigg_models/static/lib/tablesorter/dist/css/images/green-desc.gif similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/green-desc.gif rename to bigg_models/static/lib/tablesorter/dist/css/images/green-desc.gif diff --git a/bigg2/static/lib/tablesorter/dist/css/images/green-header.gif b/bigg_models/static/lib/tablesorter/dist/css/images/green-header.gif similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/green-header.gif rename to bigg_models/static/lib/tablesorter/dist/css/images/green-header.gif diff --git a/bigg2/static/lib/tablesorter/dist/css/images/green-unsorted.gif b/bigg_models/static/lib/tablesorter/dist/css/images/green-unsorted.gif similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/green-unsorted.gif rename to bigg_models/static/lib/tablesorter/dist/css/images/green-unsorted.gif diff --git a/bigg2/static/lib/tablesorter/dist/css/images/ice-asc.gif b/bigg_models/static/lib/tablesorter/dist/css/images/ice-asc.gif similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/ice-asc.gif rename to bigg_models/static/lib/tablesorter/dist/css/images/ice-asc.gif diff --git a/bigg2/static/lib/tablesorter/dist/css/images/ice-desc.gif b/bigg_models/static/lib/tablesorter/dist/css/images/ice-desc.gif similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/ice-desc.gif rename to bigg_models/static/lib/tablesorter/dist/css/images/ice-desc.gif diff --git a/bigg2/static/lib/tablesorter/dist/css/images/ice-unsorted.gif b/bigg_models/static/lib/tablesorter/dist/css/images/ice-unsorted.gif similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/ice-unsorted.gif rename to bigg_models/static/lib/tablesorter/dist/css/images/ice-unsorted.gif diff --git a/bigg2/static/lib/tablesorter/dist/css/images/last.png b/bigg_models/static/lib/tablesorter/dist/css/images/last.png similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/last.png rename to bigg_models/static/lib/tablesorter/dist/css/images/last.png diff --git a/bigg2/static/lib/tablesorter/dist/css/images/loading.gif b/bigg_models/static/lib/tablesorter/dist/css/images/loading.gif similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/loading.gif rename to bigg_models/static/lib/tablesorter/dist/css/images/loading.gif diff --git a/bigg2/static/lib/tablesorter/dist/css/images/metro-black-asc.png b/bigg_models/static/lib/tablesorter/dist/css/images/metro-black-asc.png similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/metro-black-asc.png rename to bigg_models/static/lib/tablesorter/dist/css/images/metro-black-asc.png diff --git a/bigg2/static/lib/tablesorter/dist/css/images/metro-black-desc.png b/bigg_models/static/lib/tablesorter/dist/css/images/metro-black-desc.png similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/metro-black-desc.png rename to bigg_models/static/lib/tablesorter/dist/css/images/metro-black-desc.png diff --git a/bigg2/static/lib/tablesorter/dist/css/images/metro-loading.gif b/bigg_models/static/lib/tablesorter/dist/css/images/metro-loading.gif similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/metro-loading.gif rename to bigg_models/static/lib/tablesorter/dist/css/images/metro-loading.gif diff --git a/bigg2/static/lib/tablesorter/dist/css/images/metro-unsorted.png b/bigg_models/static/lib/tablesorter/dist/css/images/metro-unsorted.png similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/metro-unsorted.png rename to bigg_models/static/lib/tablesorter/dist/css/images/metro-unsorted.png diff --git a/bigg2/static/lib/tablesorter/dist/css/images/metro-white-asc.png b/bigg_models/static/lib/tablesorter/dist/css/images/metro-white-asc.png similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/metro-white-asc.png rename to bigg_models/static/lib/tablesorter/dist/css/images/metro-white-asc.png diff --git a/bigg2/static/lib/tablesorter/dist/css/images/metro-white-desc.png b/bigg_models/static/lib/tablesorter/dist/css/images/metro-white-desc.png similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/metro-white-desc.png rename to bigg_models/static/lib/tablesorter/dist/css/images/metro-white-desc.png diff --git a/bigg2/static/lib/tablesorter/dist/css/images/next.png b/bigg_models/static/lib/tablesorter/dist/css/images/next.png similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/next.png rename to bigg_models/static/lib/tablesorter/dist/css/images/next.png diff --git a/bigg2/static/lib/tablesorter/dist/css/images/prev.png b/bigg_models/static/lib/tablesorter/dist/css/images/prev.png similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/prev.png rename to bigg_models/static/lib/tablesorter/dist/css/images/prev.png diff --git a/bigg2/static/lib/tablesorter/dist/css/images/white-asc.gif b/bigg_models/static/lib/tablesorter/dist/css/images/white-asc.gif similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/white-asc.gif rename to bigg_models/static/lib/tablesorter/dist/css/images/white-asc.gif diff --git a/bigg2/static/lib/tablesorter/dist/css/images/white-desc.gif b/bigg_models/static/lib/tablesorter/dist/css/images/white-desc.gif similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/white-desc.gif rename to bigg_models/static/lib/tablesorter/dist/css/images/white-desc.gif diff --git a/bigg2/static/lib/tablesorter/dist/css/images/white-unsorted.gif b/bigg_models/static/lib/tablesorter/dist/css/images/white-unsorted.gif similarity index 100% rename from bigg2/static/lib/tablesorter/dist/css/images/white-unsorted.gif rename to bigg_models/static/lib/tablesorter/dist/css/images/white-unsorted.gif diff --git a/bigg2/static/lib/tablesorter/jquery.tablesorter.min.js b/bigg_models/static/lib/tablesorter/jquery.tablesorter.min.js similarity index 100% rename from bigg2/static/lib/tablesorter/jquery.tablesorter.min.js rename to bigg_models/static/lib/tablesorter/jquery.tablesorter.min.js diff --git a/bigg2/static/lib/tablesorter/jquery.tablesorter.pager.css b/bigg_models/static/lib/tablesorter/jquery.tablesorter.pager.css similarity index 100% rename from bigg2/static/lib/tablesorter/jquery.tablesorter.pager.css rename to bigg_models/static/lib/tablesorter/jquery.tablesorter.pager.css diff --git a/bigg2/static/lib/tablesorter/jquery.tablesorter.pager.js b/bigg_models/static/lib/tablesorter/jquery.tablesorter.pager.js similarity index 100% rename from bigg2/static/lib/tablesorter/jquery.tablesorter.pager.js rename to bigg_models/static/lib/tablesorter/jquery.tablesorter.pager.js diff --git a/bigg2/static/lib/tablesorter/theme.bigg.css b/bigg_models/static/lib/tablesorter/theme.bigg.css similarity index 100% rename from bigg2/static/lib/tablesorter/theme.bigg.css rename to bigg_models/static/lib/tablesorter/theme.bigg.css diff --git a/bigg2/templates/about_license.html b/bigg_models/templates/about_license.html similarity index 70% rename from bigg2/templates/about_license.html rename to bigg_models/templates/about_license.html index 5a0d727..cfc6035 100644 --- a/bigg2/templates/about_license.html +++ b/bigg_models/templates/about_license.html @@ -1,44 +1,41 @@ - @@ -59,18 +57,6 @@
- - - -

BiGG Models


@@ -131,7 +117,7 @@

BiGG Models

- BiGG Models is open source + BiGG Models is open source

BiGG Models is open source, so you can browse the code, submit @@ -139,8 +125,8 @@

diff --git a/bigg2/templates/json_link.html b/bigg_models/templates/json_link.html similarity index 77% rename from bigg2/templates/json_link.html rename to bigg_models/templates/json_link.html index 6ee8a47..bb2f7ef 100644 --- a/bigg2/templates/json_link.html +++ b/bigg_models/templates/json_link.html @@ -6,11 +6,11 @@ {% endwith %} {% endwith %} :  - - {{bigg_id}}.json + {{model_bigg_id}}.json {% endif %} diff --git a/bigg2/templates/list_display.html b/bigg_models/templates/list_display.html similarity index 100% rename from bigg2/templates/list_display.html rename to bigg_models/templates/list_display.html diff --git a/bigg2/templates/mat_link.html b/bigg_models/templates/mat_link.html similarity index 75% rename from bigg2/templates/mat_link.html rename to bigg_models/templates/mat_link.html index d668936..79f722e 100644 --- a/bigg2/templates/mat_link.html +++ b/bigg_models/templates/mat_link.html @@ -6,11 +6,11 @@ {% endwith %} {% endwith %} :  - - {{bigg_id}}.mat + {{model_bigg_id}}.mat {% endif %} diff --git a/bigg2/templates/metabolite.html b/bigg_models/templates/metabolite.html similarity index 100% rename from bigg2/templates/metabolite.html rename to bigg_models/templates/metabolite.html diff --git a/bigg2/templates/model.html b/bigg_models/templates/model.html similarity index 84% rename from bigg2/templates/model.html rename to bigg_models/templates/model.html index d8a5d6e..2c6901f 100644 --- a/bigg2/templates/model.html +++ b/bigg_models/templates/model.html @@ -1,10 +1,10 @@ {% extends "parent_display.html" %} -{% block title %}BiGG Model: {{bigg_id}}{% endblock %} +{% block title %}BiGG Model: {{model_bigg_id}}{% endblock %} {% block content %}
-

Model: {{bigg_id}}

+

Model: {{model_bigg_id}}


{% if organism is not none %}

Organism:

@@ -30,13 +30,13 @@

Model metrics:

- + Metabolites{{metabolite_count}} - + Reactions{{reaction_count}} - + Genes{{gene_count}} diff --git a/bigg2/templates/old_identifiers.html b/bigg_models/templates/old_identifiers.html similarity index 100% rename from bigg2/templates/old_identifiers.html rename to bigg_models/templates/old_identifiers.html diff --git a/bigg2/templates/parent_display.html b/bigg_models/templates/parent_display.html similarity index 80% rename from bigg2/templates/parent_display.html rename to bigg_models/templates/parent_display.html index 20e3b06..9522914 100644 --- a/bigg2/templates/parent_display.html +++ b/bigg_models/templates/parent_display.html @@ -4,22 +4,18 @@ {% block title %}BiGG Models{% endblock %} BiGG Models - - - - + - - - - - + + + - + + @@ -30,8 +26,8 @@ {% include 'analytics.html' %} - - {% block navbar %} + + {% block navbar %}
- {% endblock %} + {% endblock %}
@@ -93,6 +88,8 @@

BiGG Models