diff --git a/RAVEN b/RAVEN index ccbb175..cd327fa 160000 --- a/RAVEN +++ b/RAVEN @@ -1 +1 @@ -Subproject commit ccbb1752f303ec9757ec5f77fc2462132c765d44 +Subproject commit cd327faf78f11e5009c5bcf81ff9c8a7d6726eb3 diff --git a/docs/guide/combining.md b/docs/guide/combining.md index b4a1013..473b12c 100644 --- a/docs/guide/combining.md +++ b/docs/guide/combining.md @@ -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 | @@ -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") ``` @@ -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. diff --git a/docs/guide/homology.md b/docs/guide/homology.md index 37ee424..d040d0c 100644 --- a/docs/guide/homology.md +++ b/docs/guide/homology.md @@ -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__`) 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__`) 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__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. diff --git a/docs/raven3-vs-raven-toolbox/same-function-different-answer.md b/docs/raven3-vs-raven-toolbox/same-function-different-answer.md index eb71cd4..282f237 100644 --- a/docs/raven3-vs-raven-toolbox/same-function-different-answer.md +++ b/docs/raven3-vs-raven-toolbox/same-function-different-answer.md @@ -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 diff --git a/raven-toolbox b/raven-toolbox index 4b72a10..83bd344 160000 --- a/raven-toolbox +++ b/raven-toolbox @@ -1 +1 @@ -Subproject commit 4b72a1024232e468d17d9f8f9b74e24a23aa1a31 +Subproject commit 83bd3446404f541fd5536c7c2541e536261a8c8a diff --git a/scripts/curated_pairs.yml b/scripts/curated_pairs.yml index 7e3d9b0..756744b 100644 --- a/scripts/curated_pairs.yml +++ b/scripts/curated_pairs.yml @@ -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 diff --git a/scripts/known_names.txt b/scripts/known_names.txt index 5b4cdb4..06fdbe3 100644 --- a/scripts/known_names.txt +++ b/scripts/known_names.txt @@ -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