Skip to content

Commit

Permalink
Merge pull request #1 from SamiralVdB/documentation
Browse files Browse the repository at this point in the history
Documentation
  • Loading branch information
SamiralVdB authored Jan 15, 2024
2 parents 9f938e4 + 73f3ba0 commit 4e43f5a
Show file tree
Hide file tree
Showing 34 changed files with 20,152 additions and 1,696 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ We have extended this package with the following features:
Note that the package has been tested with the [Gurobi](https://www.mathworks.com/products/connections/product_detail/gurobi-optimizer.html) solver.

## What can you find where in this repository?
This repository contains not only the source code, but also examples and scripts which were used in [publication](linktopublication).
This repository contains not only the source code, but also examples and scripts which were used in **INSERT PUBLICATION HERE**.
- **Data**
- *eGFP_expression_Bienick2014*: measured growth rate and eGFP expression by [Bienick et al. (2014)](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0109105)
- *proteinAllocationModel_iML1515_EnzymaticData_py*: information about the proteinsectors of the PAM for *Escherichia coli* (*E.coli*)
Expand Down
23 changes: 23 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Python venv for temporary build of pydoc-markdown
.venv
49 changes: 49 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Website

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
You will need NodeJS to be able to run Docusaurus for development.

### Installation
To use Docusaurus, install NodeJS. You will find a comprehensive guide [here](https://nodejs.org/en/download/package-manager#debian-and-ubuntu-based-linux-distributions) for linux systems.

```
$ npm install
```

### Local Development

```
$ npm run start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ npm run build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true npm run deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> npm run deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

# Documenting your code

## Setup

This installation makes use of the Python module "pydoc-markdown". If you want to use it, install this module and execute it in the base directory of this repo. The provided pydoc-markdown.yml file contains all necessary configurations needed. It will generate the API reference from the docstrings in the PAModelpy package. Please note, that you have to use Google docstring format if you want to make changes to the PAModelpy project.
3 changes: 3 additions & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
45 changes: 45 additions & 0 deletions docs/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
with import <nixpkgs> { };

let
venvDir = "./.venv";
pythonPackages = pkgs.python310Packages;
in pkgs.mkShell rec {
name = "impurePythonEnv";
buildInputs = [
pythonPackages.python
pythonPackages.virtualenv
pythonPackages.numpy
pkgs.zlib
pkgs.expat
nodejs_20
];

# This is very close to how venvShellHook is implemented, but
# adapted to use 'virtualenv'
shellHook = ''
SOURCE_DATE_EPOCH=$(date +%s)
if [ -d "${venvDir}" ]; then
echo "Skipping venv creation, '${venvDir}' already exists"
else
echo "Creating new venv environment in path: '${venvDir}'"
${pythonPackages.python.interpreter} -m venv "${venvDir}"
fi
source "${venvDir}/bin/activate"
pip install -r requirements.txt
LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath buildInputs}:$LD_LIBRARY_PATH"
LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib.outPath}/lib:$LD_LIBRARY_PATH"
# Add the expat library path to LD_LIBRARY_PATH
LD_LIBRARY_PATH=${pkgs.expat}/lib:$LD_LIBRARY_PATH
# fixes libstdc++ issues and libgl.so issues
LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib/:/run/opengl-driver/lib/:$LD_LIBRARY_PATH
# fixes xcb issues :
QT_PLUGIN_PATH=${pkgs.qt5.qtbase}/${pkgs.qt5.qtbase.qtPluginPrefix}
PATH="$PWD/node_modules/.bin/:$PATH"
'';
}
183 changes: 183 additions & 0 deletions docs/docs/api_reference/CatalyticEvent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
---
sidebar_label: CatalyticEvent
title: CatalyticEvent
---

CatalyticEvent object which relates Reaction variables to the EnzymeVariable and Enzyme objects.
It contains multiple functions which enable easy mapping and handling of one Event of catalysis
(e.g. one conversion of substrate to product, can be catalyzed by multiple enzymes)

## CatalyticEvent Objects

```python
class CatalyticEvent(Object)
```

CatalyticEvent is a class for holding information regarding the catalysis of a Reaction in a cobra.Model object.
It serves as an interface between the metabolic reaction and the associated enzyme constraints and variables.

**Notes**:

There are three different scenarios:
- Enzyme complex: multiple enzymes together are associated with an EnzymeComplex object
- Isozymes: multiple enzymes independently associated with a single catalytic event
- Other: a single enzyme is associated with a single catalytic event


**Arguments**:

- `kcats2enzymes` _dict_ - A dictionary with enzyme, kcat key, value pairs to connect the enzyme with the associated reaction.
The kcat is another dictionary with &#x27;f&#x27; and &#x27;b&#x27; for the forward and backward reactions, respectively.
- `id` _str, optional_ - The identifier to associate with this catalytic event (default None).
- `rxn_id` _str, optional_ - The reaction with which this catalytic event is associated.
- `name` _str, optional_ - A human-readable name for the reaction (default &quot;&quot;).

#### kcat\_values

```python
@property
def kcat_values()
```

returns a dictionary with kcat values and enzymes

#### flux

```python
@property
def flux() -> float
```

Get the flux value in the most recent solution.

Flux is the primal value of the corresponding variable in the model.

**Returns**:

- `flux` _float_ - Flux is the primal value of the corresponding variable in the model.


**Warnings**:

* Accessing reaction fluxes through a `Solution` object is the safer,
preferred, and only guaranteed to be correct way. You can see how to
do so easily in the examples.
* Reaction flux is retrieved from the currently defined
`self._model.solver`. The solver status is checked but there are no
guarantees that the current solver state is the one you are looking
for.
* If you modify the underlying model after an optimization, you will
retrieve the old optimization values.


**Raises**:

- `RuntimeError` - If the underlying model was never optimized beforehand or the
reaction is not part of a model.
- `OptimizationError` - If the solver status is anything other than `optimal`.
- `AssertionError` - If the flux value is not within the bounds.


**Examples**:

```
>>> from cobra.io import load_model
>>> model = load_model("textbook")
>>> solution = model.optimize()
>>> model.variables.PFK.flux
7.477381962160283
>>> solution.fluxes.PFK
7.4773819621602833
```

#### concentration

```python
@property
def concentration() -> float
```

Get the enzyme concentration value of the most recent solution.
The enzyme concentration equals the flux value.

**Returns**:

- `float` - Enzyme concentration in [mmol/gDW].

#### add\_enzymes

```python
def add_enzymes(enzyme_kcat_dict: dict)
```

Add enzymes to the catalytic event and create bindings to the related model.
The enzymes in the enzyme_kcat_dict are individual isozymes. Enzyme complexes
should be added as an EnzymeComplex object with a single kcat value.

**Arguments**:

- `enzyme_kcat_dict` - Dict
A nested dictionary with enzyme, kcat key, value pairs to connect the
enzyme with the associated reaction. The kcat is another dictionary with `f` and `b`
for the forward and backward reactions respectively.

#### remove\_enzymes

```python
def remove_enzymes(enzyme_list: list)
```

Remove enzymes from the catalytic event and remove the catalytic event from the
constraint expressions related to the enzyme.

**Arguments**:

- `enzyme_list` - List[Union[str, PAModelpy.Package.Enzyme]]
A list with PAModelpy.Package.Enzyme objects to be removed. If a list of identifiers (str)
is provided, the corresponding enzyme will be obtained from the CatalyticEvent.enzymes attribute.

#### change\_kcat\_values

```python
def change_kcat_values(enzyme_kcat_dict: dict)
```

Change kcat values for the enzyme variable.

**Arguments**:

- `enzyme_kcat_dict` - Dict[str, Dict[str, float]]
A nested dictionary with enzyme identifiers as keys and kcat dictionaries as values.
The kcat dictionary should have `f` and `b` keys for the forward and backward reactions, respectively.

#### \_\_copy\_\_

```python
def __copy__() -> "CatalyticEvent"
```

Copy the CatalyticEvent.

**Returns**:

CatalyticEvent:
A new CatalyticEvent that is a copy of the original CatalyticEvent.

#### \_\_deepcopy\_\_

```python
def __deepcopy__(memo: dict) -> "CatalyticEvent"
```

Copy the CatalyticEvent with memo.

**Arguments**:

- `memo` _dict_ - Automatically passed parameter.


**Returns**:

CatalyticEvent:
A new CatalyticEvent that is a copy of the original CatalyticEvent with memo.

21 changes: 21 additions & 0 deletions docs/docs/api_reference/Constraints.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
sidebar_label: Constraints
title: Constraints
---

## Constraint Objects

```python
class Constraint(Metabolite)
```

Class for information about a Constraint in a protein Sector.

Constraint is a class for holding information similar to
a metabolite in a cobra.Reaction object.

**Arguments**:

- `id` _str_ - The identifier to associate with the constraint.
- `name` _str_ - A human-readable name.

Loading

0 comments on commit 4e43f5a

Please sign in to comment.