App routes

Insert data

Contains all the routes to add data to the database.

app.main.routes_insert_data.add_enzyme()

Adds an enzyme to the database.

First generates the list of gene bigg ids and strains so that these fields can be autocompleted.

After validating the form where the enzyme data is inserted:
  • creates the enzyme object and adds it to the DB

  • if the organism was specified:
    • adds the genes that encode for the enzyme, if those are specified

    • adds the pdb ids, if those are specified

    • adds the uniprot ids, if those are specified

Returns

url_for insert data with EnzymeForm before form validation url_for see_enzyme_list after form validation

app.main.routes_insert_data.add_enzyme_activation()

Adds an enzyme activation entry to the database.

Starts by creating a list of all metabolite bigg ids to use in the form auto completion.

After the form validation:
  • checks if the activator metabolite is in the DB and if not adds and returns the instance

  • queries the database to get the respective EnzymeReactionOrganism entry

    • if it doesn’t exist, it is addded

  • creates and adds the EnzymeReactionActivation object to the DB

  • associates the EnzymeReactionActivation to the specified models in the form

  • adds the references specified in the form.

Returns

url_for insert data with EnzymeActivationForm before form validation url_for see_enzyme_activator after form validation

app.main.routes_insert_data.add_enzyme_effector()

Adds an enzyme effector entry to the database.

The difference between an effector and an inhibitor/activator is that the former is assumed to be an allosteric effector, while an inhibitor is assumed to be a competitive/noncompetitive/uncompetitive inhibitor. Activators/Inhibitors are modeled differently than an effector. Also, an effector can be either activating or inhibiting.

Starts by creating a list of all metabolite bigg ids to use in the form auto completion.

After the form validation:
  • checks if the effector metabolite is in the DB and if not adds and returns the instance

  • queries the database to get the respective EnzymeReactionOrganism entry

    • if it doesn’t exist, it is addded

  • creates and adds the EnzymeReactionEffector object to the DB

  • associates the EnzymeReactionEffector to the specified models in the form

  • adds the references specified in the form.

Returns

url_for insert data with EnzymeEffectorForm before form validation url_for see_enzyme_effector after form validation

app.main.routes_insert_data.add_enzyme_inhibition()

Adds an enzyme inhibition entry to the database.

Starts by creating a list of all metabolite bigg ids to use in the form auto completion.

After the form validation:
  • checks if the inhibitor metabolite is in the DB and if not adds and returns the instance

  • checks if the affected metabolite is in the DB and if not adds and returns the instance

  • queries the database to get the respective EnzymeReactionOrganism entry

    • if it doesn’t exist, it is addded

  • creates and adds the EnzymeReactionInhibition object to the DB

  • associates the EnzymeReactionInhibition to the specified models in the form

  • adds the references specified in the form.

Returns

url_for insert data with EnzymeInhibitionForm before form validation url_for see_enzyme_inhibitor after form validation

app.main.routes_insert_data.add_enzyme_misc_info()

Adds miscellaneous info to the database. It is used to store info that doesn’t fit in any of the other existing categories, but is still deemed important.

After the form validation:
  • queries the database to get the respective EnzymeReactionOrganism entry

    • if it doesn’t exist, it is addded

  • creates and adds the EnzymeReactionMiscInfo object to the DB

  • associates the EnzymeReactionMiscInfo to the specified models in the form

  • adds the references specified in the form.

Returns

url_for insert data with EnzymeMiscInfoForm before form validation url_for see_enzyme_misc_info after form validation

app.main.routes_insert_data.add_gene()

Adds a gene to the database.

Returns

url_for insert data with GeneForm before form validation url_for see_enzyme_list after form validation

app.main.routes_insert_data.add_metabolite()

Adds a metabolite to the database.

After the form validation:
  • create Metabolite object and adds it to the DB

  • adds all compartments to DB where metabolite can be found (according to the data inserted by the user)

  • parses the lists of chebi IDs and inchis and adds the respective ChebiIds entries to the DB.

Returns

url_for insert data with MetaboliteForm before form validation url_for see_metabolite after form validation

app.main.routes_insert_data.add_model()

” Adds a model to the database.

The model can either be built from an existing model (base model) or from scratch.

If the model is to be built from an existing model the user is redirected to modify_model.

If the model is to be built from scatch:
  • before the form validation a list of organisms is built to be used in the form autocompletion.

  • after the form validation:
    • checks if the organism exists and if not adds it to the DB

    • adds the model

    • adds all the specified enz_rxn_orgs entities to the DB

Returns

url_for insert data with ModelFormBase before form validation url_for modify_model after form validation if a base model is specified url_for insert data with ModelForm before form validation if a model is to be created from scratch url_for see_model_list after form validation and if model is created from scratch

app.main.routes_insert_data.add_model_assumption()

” Adds a model assumption to the database.

After form validation:
  • the ModelAssumptions object is created and added to the DB

  • all associated references are also added to the DB

Returns

url_for insert data with ModelAssumptionsForm before form validation url_for see_model_list after form validation

app.main.routes_insert_data.add_organism()

” Adds an organism to the database.

After form validation:
  • the Organism object is created and added to the DB

Returns

url_for insert data with OrganismForm before form validation url_for see_organism_list after form validation

app.main.routes_insert_data.add_reaction()

” Adds a reaction to the database.

Before form validation builds a list of isoenzymes to be used in the form autocompletion.

After form validation:
  • the Reaction object is created and added to the DB

  • the metabolites involved in the reaction are associated to the reaction

  • if a compartment is specified, it is associated to the reaction

  • the respective EnzymeReactionOrganism objects are created and added to the DB

  • mechanism references are added to the DB

  • EnzymeReactionOrganism entities are associated to the respective model

  • standard Gibbs energies are added and associated to the reaction

Returns

url_for insert data with ReactionForm before form validation url_for see_reaction_list after form validation

Model IO

Contains the routes to download and upload models in excel (GRASP’s input files).

app.main.routes_model_io.upload_model()

Takes in the excel input file for GRASP and inserts the following data in the DB: Model: a model for the chosen organism is added. Enzymes: Metabolites: Reactions: Inhibitions: Activations: Effectors: Gibbs energies:

Returns

None

Modify data

Contains all the routes to modify the data in the database.

app.main.routes_modify_data.modify_enzyme(isoenzyme)

Modifies an enzyme in the database.

Before form validation:
  • formats data_form properly to pass the data to EnzymeForm, this data is used to fill in the EnzymeForm with the

values currently in the database. - gathers gene_ids and strains into data_list to use for form autocompletion

After form validation: - updates the enzyme data - if an organism is specified, it removes all:

  • genes associated to the enzyme

  • structures associated to the enzyme

  • organisms associated to the enzyme

  • the new associations are then added if specified

Parameters

isoenzyme

the name of the isoenzyme to be modified.

Returns:

url_for insert_data with EnzymeForm before form validation url_for see_enzyme after form validation

app.main.routes_modify_data.modify_enzyme_activator(activator_id)

Modifies an enzyme activator in the database.

Before form validation:
  • gathers all metabolite bigg ids in data_list to use for the form autocompletion

  • gathers all the data for the activator from the DB to fill in the form with the existing values

After form validation:
  • if any of the specified ids for EnzymeReactionOrganism is different from the current ones, it looks for the

entity with the new ids, and if it doesn’t exist, it creates a new one and associates it to the activator.

  • checks if the activator metabolite already exists in the DB and if not adds it

  • updates the attributes for evidence level and comments

  • associates the activator to the specified models (should also be emptying the associated models before? TODO)

  • removes all references associated to this activation and adds the newly specified ones

Note: enzyme activations can only be added to models through this view, not removed, so that a given user doesn’t mess around with other users models.

Parameters

activator_id

the id of the activator to be modified

Returns:

url_for insert_data with EnzymeActivationForm before form validation url_for see_enzyme_activator after form validation

app.main.routes_modify_data.modify_enzyme_effector(effector_id)

Modifies an enzyme effector in the database.

An effector is an allosteric effector, it can be either activating or inhibiting and is modelled differently from the inhibitors and activators.

Before form validation:
  • gathers all metabolite bigg ids in data_list to use for the form autocompletion

  • gathers all the data for the effector from the DB to fill in the form with the existing values

After form validation:
  • if any of the specified ids for EnzymeReactionOrganism is different from the current ones, it looks for the

entity with the new ids, and if it doesn’t exist, it creates a new one and associates it to the effector.

  • checks if the effector metabolite already exists in the DB and if not adds it

  • updates the attributes for evidence level and comments

  • associates the effector to the specified models (should also be emptying the associated models before? TODO)

  • removes all references associated to this effector and adds the newly specified ones

Note: enzyme effectors can only be added to models through this view, not removed, so that a given user doesn’t mess around with other users models.

Parameters

effector_id

the id of the effector to be modified

Returns:

url_for insert_data with EnzymeEffectorForm before form validation url_for see_enzyme_effector after form validation

app.main.routes_modify_data.modify_enzyme_inhibitor(inhibitor_id)

Modifies an enzyme inhibitor in the database.

Before form validation:
  • gathers all metabolite bigg ids in data_list to use for the form autocompletion

  • gathers all the data for the inhibitor from the DB to fill in the form with the existing values

After form validation:
  • if any of the specified ids for EnzymeReactionOrganism is different from the current ones, it looks for the

entity with the new ids, and if it doesn’t exist, it creates a new one and associates it to the inhibitor.

  • checks if the inhibitor metabolite already exists in the DB and if not adds it

  • checks if the affected metabolite already exists in the DB and if not adds it

  • updates the attributes for evidence level and comments

  • associates the inhibitor to the specified models (should also be emptying the associated models before? TODO)

  • removes all references associated to this inhibition and adds the newly specified ones

Note: enzyme inhibitions can only be added to models through this view, not removed, so that a given user doesn’t mess around with other users models.

Parameters

inhibitor_id

the id of the inhibitor to be modified

Returns:

url_for insert_data with EnzymeInhibitionForm before form validation url_for see_enzyme_inhibitor after form validation

app.main.routes_modify_data.modify_enzyme_misc_info(misc_info_id)

Modifies a miscellaneous info entry in the database.

Before form validation:
  • gathers all the data for the misc info from the DB to fill in the form with the existing values

After form validation:
  • if any of the specified ids for EnzymeReactionOrganism is different from the current ones, it looks for the

entity with the new ids, and if it doesn’t exist, it creates a new one and associates it to the misc info. - updates the topic and description - updates the attributes for evidence level and comments - associates the misc info to the specified models (should also be emptying the associated models before? TODO) - removes all references associated to this misc info and adds the newly specified ones

Note: enzyme misc info can only be added to models through this view, not removed, so that a given user doesn’t mess around with other users models.

Parameters

misc_info_id

the id of the miscellaneous information to be modified

Returns:

url_for insert_data with EnzymeMiscInfoForm before form validation url_for see_enzyme_misc_info after form validation

app.main.routes_modify_data.modify_enzyme_select_organism(isoenzyme)

Modifies an isoenzyme in the database.

It starts by showing a form for the user to select the organism, then collects all the data for the specified enzyme in the given organism from the database, puts it into data_form and redirects the user to modify_enzyme. When in modify_enzyme, a form will be displayed with all fields filled in with the data in data_form.

Parameters

isoenzyme

the name of the isoenzyme to be modified.

Returns:

url_for insert_data with ReactionForm before form validation url_for modify_enzyme after form validation

app.main.routes_modify_data.modify_metabolite(grasp_id)

Modifies the metabolite with the specified grasp_id.

Before form validation:
  • gathers all the data for the metabolite from the DB to fill in the form with the existing values

After form validation:
  • updates the metabolite attributes

  • removes the existing metabolite associations to compartments and adds the newly specified ones

  • removes the existing metabolite associations to ChebiIds and adds the newly specified ones

Parameters

grasp_id

grasp_id of the metabolite to be modified

Returns:

url_for insert_data with MetaboliteForm before form validation url_for see_metabolite after form validation

app.main.routes_modify_data.modify_model(model_name)

Modifies the model with the specified name (model names are unique).

Before form validation:
  • gathers all the data for the model from the DB to fill in the form with the existing values

  • gathers all organism names into data_list to be used for autocompletion in the form

After form validation:
  • looks for the specified organism in the DB, and if it doesn’t exist it creates it

  • updates the model attributes

  • removes all the model associations to:
    • inhibitors

    • activators

    • effectors

    • EnzymeReactionOrganisms

    • misc info

    • model assumptions

  • adds the newly specified (above) associations

Parameters

model_name

name of the model to be modified

Returns:

url_for insert_data with ModelModifyForm before form validation url_for see_model after form validation

app.main.routes_modify_data.modify_model_assumption(model_assumption_id)

Modifies the model assumption with the specified ID.

Before form validation:
  • gathers all the data for the given model assumption from the DB to fill in the form with the existing values

After form validation:
  • updates the model assumption attributes

  • removes the existing references associated to the assumptions and adds the newly specified ones

Parameters

model_assumption_id

id of the model assumption to be modified

Returns:

url_for insert_data with ModelAssumptionsForm before form validation url_for see_model_assumption after form validation

app.main.routes_modify_data.modify_organism(organism_name)

Modifies the organism with the specified name (organism names are unique).

Before form validation:
  • gathers the data for the given organism from the DB to fill in the form with the existing values

After form validation:
  • updates the organism attributes (basically the name)

Parameters

organism_name

name of the organism to be modified

Returns:

url_for insert_data with OrganismForm before form validation url_for see_organism after form validation

app.main.routes_modify_data.modify_reaction(reaction_acronym)

Modifies the reaction in the DB with the given reaction_acronym.

Before getting here the user has already:
  1. selected the organism that the reaction is associated to

  2. selected the isoenzyme that catalyzes the reaction

  3. selected the model to which the reaction is associated to

Before form validation:
  • gets all the info needed to fill in the data_form which is used to fill in the fields of ReactionForm with

the current information in the DB

After form validation:
  • updates all the reaction attributes

  • removes currently associated metabolites and adds the ones newly specified

  • associates the reaction the newly specified compartments (shouldn’t it remove it from the previous ones as well?

maybe not) - if there is more than one isoenzyme associated to the reaction it focuses on the first one to find the respective EnzymeReactionOrganism entity, and if it doesn’t exist, it is created (there should probably be a loop going through all the EnzymeReactionOrganism entities? TODO) - the current enzyme mechanism references are removed and the newly specified ones are added - newly specified models and gibbs energies are added

  • the reason model associations are not removed is because it might mess other people’s models.

Note: the models associated to a given enzyme_reaction_organism are never removed, only added. This is to avoid that user 2 by mistake removes the association between a given enzyme_reaction_organism and the models from user 1.

Parameters

reaction_acronym

the acronym of the reaction to be modified

Returns:

url_for insert_data with ReactionForm before form validation url_for see_reaction after form validation

app.main.routes_modify_data.modify_reaction_select_isoenzyme(reaction_acronym)
Before selecting a reaction to be modified the user needs to:
  1. select the organism that the reaction is associated to

  2. select the isoenzyme that catalyzes the reaction

  3. select the model to which the reaction is associated to

In here, the user is selecting the isoenzyme that catalyzes the reaction (step 2).

Before form validation:
  • gets all the isoenzymes associated to the previously specified organism and reaction_acronym, these will be

passed on to the SelectIsoenzymeForm and are pre-selected.

After form validation:
  • adds the selected isoenzyme to the data_form to be used in modify_reaction

Parameters

reaction_acronym

the acronym of the reaction to be modified

Returns:

url_for insert_data with SelectIsoenzymeForm before form validation url_for modify_reaction_select_model after form validation

app.main.routes_modify_data.modify_reaction_select_model(reaction_acronym)
Before selecting a reaction to be modified the user needs to:
  1. select the organism that the reaction is associated to

  2. select the isoenzyme that catalyzes the reaction

  3. select the model to which the reaction is associated to

In here, the user is selecting the model to which the reaction is associated to (step 3).

Before form validation:
  • gets the EnzymeReactionOrganism entity to which the reaction can be associated to, so it can select all models

associated to that EnzymeReactionOrganism, from which the user can select one in the SelectModelForm
  • even though this is the intention, i’m not sure it is working like that (TODO)

After form validation:
  • adds the selected model name to the data_form to be used in modify_reaction

Parameters

reaction_acronym

the acronym of the reaction to be modified

Returns:

url_for insert_data with SelectModelForm before form validation url_for modify_reaction after form validation

app.main.routes_modify_data.modify_reaction_select_organism(reaction_acronym)
Before selecting a reaction to be modified the user needs to:
  1. select the organism that the reaction is associated to

  2. select the isoenzyme that catalyzes the reaction

  3. select the model to which the reaction is associated to

In here, the user is selecting the organism that the reaction is associated to (step 1).

After form validation:
  • starts gathering data into data_form to be used in modify_reaction, in particular the organism name.

Parameters

reaction_acronym

the acronym of the reaction to be modified

Returns:
url_for insert_data with SelectOrganismForm before form validation and after form validation if no organism is

selected.

url_for modify_reaction_select_isoenzyme after form validation

See data

Contains all the routes to see the data in the database.

app.main.routes_see_data.see_enzyme(isoenzyme)
Get’s the data about the specified isoenzyme to be rendered in the front end:
  • enzyme attributes

  • organisms the enzyme is associated to

  • models the enzyme is associated to

  • the reactions catalyzed by the enzyme

  • inhibitors

  • activators

  • effectors

  • misc info

  • pdb ids (through EnzymeStructure)

  • uniprot ids (through EnzymeReactionOrganism)

It also renders a “Modify” button which will redirect the user to modify_enzyme_select_organism

Returns

url_for modify_enzyme_select_organism if user clicks on “Modify” render_template to see_data with data_type set to enzymes.

app.main.routes_see_data.see_enzyme_activator(activator_id)
Get’s the data about the specified activator to be rendered in the front end:
  • isoenzyme

  • reaction

  • organism

  • activating metabolite

  • activation constant

  • evidence level

  • comments

  • models that the activator is associated to

  • references for the specified inhibition

It also renders a “Modify” button which will redirect the user to modify_enzyme_activator

Returns

url_for modify_enzyme_activator if user clicks on “Modify” render_template to see_data with data_type set to activator.

app.main.routes_see_data.see_enzyme_activators_list()
Get’s the data about all enzyme inhibitors in the DB to put on a table:
  • ID

  • inhibitor

  • inhibition type

  • affected metabolite

  • enzyme

  • reaction

  • organism

Returns

render_template to see_data with tab_status set to enzyme_inhibitors.

app.main.routes_see_data.see_enzyme_effector(effector_id)
Get’s the data about the specified effector to be rendered in the front end:
  • isoenzyme

  • reaction

  • organism

  • effector metabolite

  • effector type

  • evidence level

  • comments

  • models that the effector is associated to

  • references for the specified effector

It also renders a “Modify” button which will redirect the user to modify_enzyme_effector

Returns

url_for modify_enzyme_effector if user clicks on “Modify” render_template to see_data with data_type set to effector.

app.main.routes_see_data.see_enzyme_effectors_list()
Get’s the data about all enzyme effectors in the DB to put on a table:
  • ID

  • effector

  • type

  • enzyme

  • reaction

  • organism

Returns

render_template to see_data with tab_status set to enzyme_effectors.

app.main.routes_see_data.see_enzyme_inhibitor(inhibitor_id)
Get’s the data about the specified inhibitor to be rendered in the front end:
  • isoenzyme

  • reaction

  • organism

  • inhibiting metabolite

  • inhibition type

  • affected metabolite

  • inhibition constant

  • evidence level

  • comments

  • models that the inhibitor is associated to

  • references for the specified inhibition

It also renders a “Modify” button which will redirect the user to modify_enzyme_inhibitor

Returns

url_for modify_enzyme_inhibitor if user clicks on “Modify” render_template to see_data with data_type set to inhibitor.

app.main.routes_see_data.see_enzyme_inhibitors_list()
Get’s the data about all enzyme inhibitors in the DB to put on a table:
  • ID

  • inhibitor

  • inhibition type

  • affected metabolite

  • enzyme

  • reaction

  • organism

Returns

render_template to see_data with tab_status set to enzyme_inhibitors.

app.main.routes_see_data.see_enzyme_list()
Get’s the data about all enzymes to put on a table:
  • name

  • acronym

  • isoenzyme

  • EC number

Returns

render_template to see_data with tab_status set to enzymes.

app.main.routes_see_data.see_enzyme_misc_info(misc_info_id)
Get’s the data about the specified miscellaneous info to be rendered in the front end:
  • isoenzyme

  • reaction

  • organism

  • topic

  • description

  • evidence level

  • comments

  • models that the misc info is associated to

  • references for the specified misc info

It also renders a “Modify” button which will redirect the user to modify_enzyme_misc_info

Returns

url_for modify_enzyme_misc_info if user clicks on “Modify” render_template to see_data with data_type set to misc_info.

app.main.routes_see_data.see_enzyme_misc_info_list()
Get’s the data about all miscellaneous info in the DB to put on a table:
  • ID

  • topic

  • enzyme

  • reaction

  • organism

Returns

render_template to see_data with tab_status set to enzyme_misc_info.

app.main.routes_see_data.see_gene_list()
Get’s the data about all genes info in the DB to put on a table:
  • in theory, in practice there is no tab for genes yet TODO

Returns

render_template to see_data with tab_status set to … TODO

app.main.routes_see_data.see_mechanism_list()
Get’s the data about all enzyme mechanisms info in the DB to put on a table:
  • ID

  • name

  • image (diagram with binding/release order)

Returns

render_template to see_data with tab_status set to mechanisms.

app.main.routes_see_data.see_metabolite(grasp_id)
Get’s the data about the specified metabolite to be rendered in the front end:
  • name

  • grasp ID

  • bigg ID

  • metanetX ID

  • compartments where the metabolite can be found

  • ChEBIs

  • InChis

  • reactions in which it participates

It also renders a “Modify” button which will redirect the user to modify_metabolite

Returns

url_for modify_metabolite if user clicks on “Modify” render_template to see_data with data_type set to metabolite.

app.main.routes_see_data.see_metabolite_list()
Get’s the data about all metabolites in the DB to put on a table:
  • GRASP ID

  • name

  • bigg ID

  • metanetX ID

  • compartment

Returns

render_template to see_data with tab_status set to metabolites.

app.main.routes_see_data.see_model(model_name)
Get’s the data about the specified model to be rendered in the front end:
  • name

  • organism

  • strain

  • comments

  • assumptions

  • reactions that constitute the model with respective data:
    • inhibitors

    • activators

    • effectors

    • misc info

It also renders a “Modify” button which will redirect the user to modify_model

Returns

url_for modify_model if user clicks on “Modify” render_template to see_data with data_type set to model.

app.main.routes_see_data.see_model_assumption(model_assumption_id)
Get’s the data about the specified model assumption to be rendered in the front end:
  • assumption

  • description

  • evidence level

  • included in model

  • comments

  • references

It also renders a “Modify” button which will redirect the user to modify_model_assumption

Returns

url_for modify_model_assumption if user clicks on “Modify” render_template to see_data with data_type set to model_assumption.

app.main.routes_see_data.see_model_assumptions_list()
Get’s the data about all model assumptions in the DB to put on a table:
  • ID

  • assumption

  • model

Returns

render_template to see_data with tab_status set to model_assumptions.

app.main.routes_see_data.see_model_list()
Get’s the data about all models in the DB to put on a table:
  • name

  • organism

  • strain

Returns

render_template to see_data with tab_status set to models.

app.main.routes_see_data.see_organism(organism_name)
Get’s the data about the specified organism to be rendered in the front end:
  • name

  • models for that organism

It also renders a “Modify” button which will redirect the user to modify_organism

Returns

url_for modify_organism if user clicks on “Modify” render_template to see_data with data_type set to organism.

app.main.routes_see_data.see_organism_list()
Get’s the data about all organisms in the DB to put on a table:
  • name

Returns

render_template to see_data with tab_status set to organisms.

app.main.routes_see_data.see_reaction(reaction_acronym)
Get’s the data about the specified reaction to be rendered in the front end:
  • name

  • acronym

  • reaction string

  • metanetX ID

  • KEGG ID

  • compartment where it occurs

  • catalyzing isoenzymes

  • gibbs energies

  • models it is part of

  • organisms it is part of

It also renders a “Modify” button which will redirect the user to modify_reaction_select_organism

Returns

url_for modify_reaction_select_organism if user clicks on “Modify” render_template to see_data with data_type set to reaction.

app.main.routes_see_data.see_reaction_list()
Get’s the data about all reactions in the DB to put on a table:
  • name

  • reaction

  • metanetX

  • bigg ID

  • kegg ID

  • compartment

Returns

render_template to see_data with tab_status set to reactions.

User

Contains all the routes related to user functionality. This has quite a bit of cargo code that I still intend to use.

app.main.routes_user.edit_profile()

Page where the user can edit their page.

Returns

url_for to main.edit_profile after form_validation render_template to edit_profile before form validation

app.main.routes_user.explore()

Page where you end up after clicking on explore, where you see all the posts.

Parameters

username – name of the user you want to follow

Returns

redirect to index

app.main.routes_user.follow(username)

Page where you end up after clicking on follow for a given user with username.

Parameters

username – name of the user you want to follow

Returns

redirect to main.user

app.main.routes_user.index()

Starting page.

It shows a form to do a post as well as posts from other users.

Returns

render_template to index

app.main.routes_user.unfollow(username)

Page where you end up after clicking on unfollow for a given user with username.

Parameters

username – name of the user you want to unfollow

Returns

redirect to main.user

app.main.routes_user.user(username)

This is the selected user’s page, shows all the user’s posts

Parameters

username – username for the selected user’s page.

Returns

render_template to user

Utils

Contains functions used in differente routes.

app.main.utils.add_effector(effector_dic, rxn, effector_type, model, enz_rxn_org)

Used in model_io to add effectors to the DB. Checks if the effector metabolite already exists in the DB, if not adds it. Checks if the effector already exists in the DB, if not adds it. If there are references associated adds them.

Parameters
  • effector_dic – with entries like {reaction ID: [[effectors], [references]]}

  • rxn – reaction ID

  • effector_type – effector type, either inhibiting or activating

  • model – model object to associate effector to

  • enz_rxn_org – EnzymeReactionOrganism to associate effector with

Returns

None

app.main.utils.add_enzyme_genes(gene_names, enzyme, organism_id)

If gene doesn’t exist in DB, adds it. Then adds the connection between gene, enzyme, and organism.

Parameters
  • gene_names – a list of gene names.

  • enzyme – an enzyme object.

  • organism_id – the id of the organism (in the DB).

Returns

None

app.main.utils.add_enzyme_organism(enzyme, organism_id, uniprot_id_list, number_of_active_sites)

If no EnzymeOrganism entry with the given uniprot_id exists, add it. Repeat for each uniprot_id in uniprot_id_list.

Parameters
  • enzyme – an enzyme object.

  • organism_id – the id of the organism (in the DB).

  • uniprot_id_list – a list of uniprot IDs.

  • number_of_active_sites – the number of active sites in the enzyme.

Returns

None

app.main.utils.add_enzyme_organism_subunits_only(enzyme, organism_id, number_of_active_sites)

If no EnzymeOrganism for the given enzyme and organism exist, add it with the given number of active_sites.

Parameters
  • enzyme – an enzyme object.

  • organism_id – the id of the organism (in the DB).

  • number_of_active_sites – the number of active sites in the enzyme.

Returns

None

app.main.utils.add_enzyme_structures(enzyme, organism_id, pdb_id_list, strain_list)

If the enzyme structures don’t exist, adds them.

Parameters
  • enzyme – an enzyme object.

  • organism_id – the id of the organism (in the DB).

  • pdb_id_list – a list of pdb ids.

  • strain_list – a list of strains, either a single one or one per pdb_id.

Returns

None

app.main.utils.add_gibbs_energy(reaction_id, model_id, standard_dg, standard_dg_std, standard_dg_ph, standard_dg_is, std_gibbs_energy_references)

Adds the standard Gibbs energies to a reaction. First check if these exist already, if not creates it. Then adds the references.

Parameters
  • reaction_id – id of the reaction to which the Gibbs energy is going to be associated with

  • model_id – id of model that the reaction is part of

  • standard_dg – value of the standard Gibbs energy in kJ/mol

  • standard_dg_std – value of the standard deviation of the standard Gibbs energy, in kJ/mol

  • standard_dg_ph – pH for the standard Gibbs energy

  • standard_dg_is – ionic strength for the standard Gibbs energy

  • std_gibbs_energy_references – list of references for the given standard Gibbs energy

Returns

None

app.main.utils.add_mechanism_references(mechanism_references, enzyme_reaction_model)

Takes in a list of doi and adds them as references to the database. Then adds them as mechanism references.

Parameters
  • mechanism_references – a list of references for a mechanism

  • enzyme_reaction_model – enzyme_reaction_model that has the given mechanism refs

Returns

None

app.main.utils.add_metabolites_to_reaction(reaction, reaction_string)

Takes in a reaction string, checks if the metabolites involved exist in the database, if not adds them, and then associates the metabolites with the reaction.

Parameters
  • reaction – reaction object from DB

  • reaction_string – reaction string in the format A_c + B_c <-> P_c

Returns

reaction object with added metabolites.

app.main.utils.add_references(references, obj, mechanism_ref=False)

Takes in a list of doi and adds them as references to the database. Returns a list of the DB instances of the references inserted. :param references: a list of references :param obj: DB object to which the references will be added :param mechanism_ref: boolean specifying whether or not the reference is for a mechanism

Returns

None

app.main.utils.check_metabolite(bigg_id)

Check if metabolite is part of the database and if it isn’t add it and return the instance.

Parameters

bigg_id – bigg_id for the metabolite.

Returns

the metabolite object that was added to the DB

app.main.utils.set_binding_release_order(rxn, rxn_string, enz_rxn_org, mechanisms_dict)

Used in the model_io to add binding and release order for the metabolites in the given reaction following the given mechanism.

Parameters
  • rxn – reaction name

  • rxn_string – reaction string in the format A_c + B_c <-> P_c

  • enz_rxn_org – EnzymeReactionOrganism object from the database

  • mechanisms_dict – dictionary with the form {‘rxn’: [[mech name], [binding metabolites], [release metabolites]]}

Returns

binding_order, release_order lists