Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions docs/guide/combining.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Merging and simplifying look like bookkeeping and involve risk. Merging puts mod
| MATLAB | Python | Purpose |
|---|---|---|
| `mergeModels` | `merge_models` | combine models into one |
| `contractModel` | `remove_duplicate_reactions` | collapse identical reactions |
| `contractModel` | `contract_model` | collapse identical reactions |
| `simplifyModel` | `simplify_model` | drop what cannot carry flux |
| `expandModel` | `expand_model` | split reactions with `or` in the gene rule |
| `mergeCompartments` | `merge_compartments` | collapse the model to one compartment |
Expand Down Expand Up @@ -122,9 +122,9 @@ after contracting: 53 rxns
:sync: python

```python
from raven_toolbox.manipulation import remove_duplicate_reactions
from raven_toolbox.manipulation import contract_model

remove_duplicate_reactions(merged)
contract_model(merged)
print(f"after contracting: {len(merged.reactions)} rxns")
```

Expand All @@ -143,7 +143,8 @@ Every RAVEN function here returns a new model struct and leaves its input unchan

| Python | Behaviour |
|---|---|
| `remove_duplicate_reactions`, `simplify_model` | change the model in place and return `None` |
| `contract_model` | changes the model in place and returns the ids of the removed reactions |
| `simplify_model` | changes the model in place and returns `None` |
| `merge_models`, `merge_compartments` | return a new model |

`model = simplify_model(model)` is correct in MATLAB and sets `model` to `None` in Python. The model should be copied first when the original is needed.
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/homology.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ draft: 37 rxns, 49 mets, 54 genes
:::
::::

The transfer works reaction by reaction. For each reaction of the template, the genes in its gene rule are looked up in the hit table. A template gene is replaced by its accepted counterpart in the new organism, and the reaction is transferred when the rule can be satisfied after the substitution. A reaction that needs two subunits is kept with a placeholder gene (`OLD_<model>_<gene>`) for the missing subunit under the default `complexPolicy` (`complex_policy` in Python) of `flag`, and the policy `drop` removes each complex that has a missing subunit and removes the reaction when no complex remains. The rule `(A and B) or (C and D)` without a counterpart of `B` gives `C and D` under `drop`. A reaction with two isozymes is kept when either has a counterpart. The metabolites that a transferred reaction needs are transferred with it. The draft has 49 metabolites against 52 in the template, because the three metabolites that occur in dropped reactions alone are not created.
The transfer works reaction by reaction. For each reaction of the template, the genes in its gene rule are looked up in the hit table. A template gene is replaced by its accepted counterpart in the new organism, and the reaction is transferred when the rule can be satisfied after the substitution. A reaction that needs two subunits is kept with a placeholder gene (`OLD_<model>_<gene>`) for the missing subunit under the default `complexPolicy` (`complex_policy` in Python) of `flag`, and the policy `drop` removes each complex that has a missing subunit and removes the reaction when no complex remains. The rule `(A and B) or (C and D)` without a counterpart of `B` gives `C and D` under `drop`. A reaction with two isozymes is kept when either has a counterpart. With several templates ordered by `preferredOrder` (`preferred_order` in Python), a template gene that maps to a new gene which an earlier template already maps has its mappings removed and counts as a missing subunit, so `complexPolicy` applies to it: the rule `(a and b) or x` with `a` taken gives `(OLD_<model>_a and nb) or nx` under `flag`, `nb or nx` under `keep` and `nx` under `drop`. The metabolites that a transferred reaction needs are transferred with it. The draft has 49 metabolites against 52 in the template, because the three metabolites that occur in dropped reactions alone are not created.

The line `Standardizing grRules` shows RAVEN rewriting the rules of the template in a canonical form before the substitution. One rule written in two ways is then handled identically.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A function of RAVEN and its counterpart in raven-toolbox can differ in the algorithm they choose, in the form of the result or in the value of the result. The sections below describe the differences found by reading the code of both implementations. Where a section says that a result was not checked, no run compared the two implementations.

The list is incomplete, and a function that is not listed can behave differently. Candidates that were not compared include `random_sampling`, which replaces both `sampleACHR` and `sampleCHRR`; `remove_duplicate_reactions`, which replaces `contractModel`; and `simplify_model`, which corresponds to `simplifyModel`.
The list is incomplete, and a function that is not listed can behave differently. Candidates that were not compared include `random_sampling`, which replaces both `sampleACHR` and `sampleCHRR`; `contract_model`, which corresponds to `contractModel`; and `simplify_model`, which corresponds to `simplifyModel`.

## Metabolic task checking

Expand Down
2 changes: 1 addition & 1 deletion scripts/curated_pairs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ aliases:
addTransport: add_transport_reactions
changeGrRules: change_gene_reaction_rules
changeRxns: change_reaction_equations
contractModel: remove_duplicate_reactions
contractModel: contract_model
convertToIrrev: convert_to_irreversible
copyToComps: copy_to_compartment
findDuplicateRxns: find_duplicate_reactions
Expand Down
1 change: 1 addition & 0 deletions scripts/known_names.txt
Original file line number Diff line number Diff line change
Expand Up @@ -490,3 +490,4 @@ loadEcModel # GECKO function
load_ec_model # geckopy function
gecko_format # key of the metaData of an ecModel file
artefact_dir # parameter of get_kegg_model_for_organism_from_artefacts
preferred_order # get_model_from_homology argument
Loading