Skip to content

Commit

Permalink
Update essential reactions in spreadsheets. Include online web docs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexOarga committed Feb 3, 2022
1 parent bd269b2 commit 8c42fd6
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 54 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ The computation of vulnerabilities can also be exploited programmatically via th

## Table of Contents
- [License](#license)
- [Online Web](#online-web)
- [Install](#Install)
- [Quickstart](#Quickstart)
- [Documentation](#documentation)
Expand All @@ -48,6 +49,10 @@ The computation of vulnerabilities can also be exploited programmatically via th

CONTRABASS is released under [GPLv3 license](LICENSE).

## Online Web

CONTRABASS can also be executed through the [CONTRABASS Online Web App (http://contrabass.unizar.es)](http://contrabass.unizar.es).

## Install
```CONTRABASS``` can be installed via **pip** package manager:
```shell
Expand All @@ -59,7 +64,7 @@ CONTRABASS is released under [GPLv3 license](LICENSE).
Generate report on vulnerabilities on input model ```MODEL.xml```

```shell
$ contrabass report critial-reactions MODEL.xml
$ contrabass report critical-reactions MODEL.xml
```

Generate report on growth-dependent reactions on input model ```MODEL.xml```
Expand Down
2 changes: 2 additions & 0 deletions docs/source/ComputeGrowthDependent.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _growth-op-documentation:

5. Compute growth dependent reactions
========================================
.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/License.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

9. License
10. License
===============

CONTRABASS is released under GPLv3_.
Expand Down
65 changes: 65 additions & 0 deletions docs/source/OnlineWebApp.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@

9. Online Web App
===============

CONTRABASS can also be executed though the online web application at CONTRABASS-Online_.

9.1. Usage
------------

9.1.1. Submit model
*********************

To load a model in the web app drag-and-drop a valid SBML model to the box on the left (see image below).
CONTRABASS also comes with 4 sample models to try out the tool. To use one of the 4 sample models, simply click on one
of the ```Try this model``` buttons in the box on the right (see image below). (see image below).

.. image:: _static/step1.png
:align: center
:alt: step 1

9.1.2. Run operation
************************

If the model is correctly formatted, CONTRABASS will read the model and notify when it is ready.
When the read completes successfully, a row similar to the following with the model data will appear on the page:

.. image:: _static/step2.png
:align: center
:alt: step 2
.
CONTRABASS allows you to execute the two operations explained above in the documentation, that is:
- **Compute growth dependent reactions**: produce an overview of the critical reactions in the model and explore how they vary when the growth constraints vary (See :ref:`growth-op-documentation`).
- **Compute critical reactions**: compute sets of critical reactions and their intersections for a given growth rate (See :ref:`vulnerabilities-documentation`).

If we click on one of the 2 accordions showing the 2 possible operations, they will expand showing the optional parameters
that we can adjust before starting the execution (see image below).
Once we are done with the parameters, to start the execution simply click the ```Execute``` button.

.. image:: _static/step3.png
:align: center
:alt: step 3

While the selected operation is being executed, the page will show feedback on the computations performed:

.. image:: _static/step4.png
:align: center
:alt: step 4

9.1.3. Download reports
************************

Once the selected operation ends its execution, the web will display 2 buttons (see image below) to download different reports:

- **Download spreadsheet**: Download the spreadsheet report of the computation.
- **View report**: View and online interactive report with the result of the computation.


.. image:: _static/step5.png
:align: center
:alt: step 5



.. _CONTRABASS-Online: https://github.com/openCONTRABASS/CONTRABASS/blob/master/LICENSE

Binary file added docs/source/_static/step1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/step2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/step3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/step4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to CONRTABASS's documentation!
Welcome to CONTRABASS's documentation!
========================================

.. toctree::
:maxdepth: 4
:glob:

Introduction
OnlineWebApp
Installation
ToolCommands
ComputeVulnerabilities
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[metadata]
name = contrabass
url = https://github.com/openCONTRABASS/CONTRABASS
version = 0.2.0
version = 0.2.1
author = Alex Oarga
author_email = [email protected]
description = Constraint-based model vulnerabilities analysis
Expand Down
63 changes: 13 additions & 50 deletions src/contrabass/core/Spreadsheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,24 +834,7 @@ def __aux_spreadsheet_get_data(self, state):
if state.essential_genes() is not None:
essential_genes = [g.id for g in state.essential_genes()]

er_g0 = []
er_g005 = []
objective_value = state.objective_value()
if state.objective_value() is not None:
if not isnan(state.objective_value()):
objective_value_005 = state.objective_value() * 0.05
else:
objective_value_005 = 0
for reaction, value in knockout_growth.items():
if not isnan(objective_value):
if isnan(value) or value == 0:
er_g0.append(reaction)
er_g005.append(reaction)
elif value < objective_value_005:
er_g005.append(reaction)
else:
er_g0.append(reaction)
er_g005.append(reaction)
essential_reactions = state.essential_reactions()

reversibles = state.reversible_reactions()

Expand All @@ -862,9 +845,7 @@ def __aux_spreadsheet_get_data(self, state):
list(chokepoints_dict.keys()),
essential_genes,
genes_reactions_dict,
knockout_growth,
er_g0,
er_g005,
essential_reactions,
reversibles,
dead_reactions,
]
Expand All @@ -878,15 +859,9 @@ def __aux_spreadsheet_write_two_model_summary(
sheet.write(x + 3, y + 1, "Chokepoint reactions", style=style)
sheet.write(x + 4, y + 1, "Essential genes", style=style)
sheet.write(x + 5, y + 1, "Essential genes reactions", style=style)
sheet.write(x + 6, y + 1, "Essential reactions (objective=0)", style=style)
sheet.write(
x + 7,
y + 1,
"Essential reactions (objective < 5% max objective)",
style=style,
)
sheet.write(x + 8, y + 1, "Reversible reactions", style=style)
sheet.write(x + 9, y + 1, "Dead reactions", style=style)
sheet.write(x + 6, y + 1, "Essential reactions", style=style)
sheet.write(x + 7, y + 1, "Reversible reactions", style=style)
sheet.write(x + 8, y + 1, "Dead reactions", style=style)
sheet.write(x + 1, y + 2, "Before", style=style)
sheet.write(x + 1, y + 3, "After", style=style)
sheet.write(x + 1, y + 5, "Only before", style=style)
Expand Down Expand Up @@ -951,15 +926,9 @@ def __aux_spreadsheet_write_four_model_summary(
sheet.write(x + 3, y + 1, "Chokepoint reactions", style=style)
sheet.write(x + 4, y + 1, "Essential genes", style=style)
sheet.write(x + 5, y + 1, "Essential genes reactions", style=style)
sheet.write(x + 6, y + 1, "Essential reactions (objective=0)", style=style)
sheet.write(
x + 7,
y + 1,
"Essential reactions (objective < 5% max objective)",
style=style,
)
sheet.write(x + 8, y + 1, "Reversible reactions", style=style)
sheet.write(x + 9, y + 1, "Dead reactions", style=style)
sheet.write(x + 6, y + 1, "Essential reactions", style=style)
sheet.write(x + 7, y + 1, "Reversible reactions", style=style)
sheet.write(x + 8, y + 1, "Dead reactions", style=style)

sheet.write(x + 1, y + 2, "Only: M0", style=style)
sheet.write(x + 1, y + 3, "Only: MNODEM", style=style)
Expand All @@ -984,8 +953,6 @@ def __aux_spreadsheet_write_four_model_summary(
model_results[2][i],
model_results[3][i],
]
if i == 8:
print(set_list)
self.__aux_write_sets(sheet, x + i + 2, y, set_list)

#
Expand Down Expand Up @@ -1100,10 +1067,6 @@ def spreadsheet_write_summary(
list_model_fvadem_results,
]

# remove essential_reactions list with objective values
for m in models:
del m[4]

list_metabolites = [
len(state_initial.metabolites()),
len(state_dem.metabolites()),
Expand All @@ -1119,9 +1082,9 @@ def spreadsheet_write_summary(

# 1: list(chokepoints_dict.keys()),
# 3: genes_reactions_dict,
# 5: er_g0
# 4: essential_reactions
reactions_data = []
for i in [1, 3, 5]:
for i in [1, 3, 4]:
rdl = [
list_model_initial_results[i],
list_model_dem_results[i],
Expand Down Expand Up @@ -1223,7 +1186,7 @@ def spreadsheet_write_summary(
style,
y,
0,
"CHOKEPOINT REACTIONS - ESSENTIAL REACTIONS (objectite value < 5% max objective value)",
"CHOKEPOINT REACTIONS - ESSENTIAL REACTIONS",
"Only chokepoints",
reactions_data[0],
"Only essential reactions",
Expand All @@ -1236,7 +1199,7 @@ def spreadsheet_write_summary(
style,
y,
0,
"ESSENTIAL GENES REACTIONS - ESSENTIAL REACTIONS (objectite value < 5% max objective value)",
"ESSENTIAL GENES REACTIONS - ESSENTIAL REACTIONS",
"Only essential genes reactions",
reactions_data[1],
"Only essential reactions",
Expand All @@ -1249,7 +1212,7 @@ def spreadsheet_write_summary(
style,
y,
0,
"CHOKEPOINT REACTIONS - ESSENTIAL GENES REACTIONS - ESSENTIAL REACTIONS (objectite value < 5% max objective value)",
"CHOKEPOINT REACTIONS - ESSENTIAL GENES REACTIONS - ESSENTIAL REACTIONS",
"Only chokepoints reactions",
reactions_data[0],
"Only essential genes reactions",
Expand Down

0 comments on commit 8c42fd6

Please sign in to comment.