Annotation (Python)¶
raven-toolbox objects in raven_toolbox.annotation, collected from the source of the tracked branch.
Functions¶
| Function | Summary |
|---|---|
add_sbo_terms |
Assign SBO terms to metabolites and reactions in-place. |
load_delta_g_csv |
Stamp note_key on each entity from a CSV of id → value. |
save_delta_g_csv |
Dump entity.notes[note_key] for each entity to a CSV. |
Reference¶
add_sbo_terms¶
Assign SBO terms to metabolites and reactions in-place.
Metabolite SBO assignment
- SBO:0000649 (Biomass) for metabolites whose name is in
biomass_met_names or ends with any of
biomass_met_suffixes (default: " backbone" / " chain").
- SBO:0000247 (Simple chemical) otherwise.
Reaction SBO assignment
- SBO:0000176 (Metabolic reaction) default.
- Single-reactant reactions (exchange / sink / demand):
* extracellular → SBO:0000627 (exchange)
* coefficient < 0 → SBO:0000632 (sink)
* else → SBO:0000628 (demand)
- Transport reactions → SBO:0000655 (default detector: same
metabolite name appearing in ≥ 2 compartments).
- The reaction whose name matches biomass_rxn_name →
SBO:0000629.
- The reaction whose name matches ngam_rxn_name →
SBO:0000630.
- Other reactions whose name contains any
pseudoreaction_name_substrings → SBO:0000395.
"fill" semantic: SBO is written to annotation['sbo'] only when
that key is missing or empty — mirrors RAVEN's
editMiriam(..., 'fill') mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
transport_detector
|
Callable[[Model], set[str]] | None
|
Optional callable that takes the model and returns the set of
reaction ids classified as transport. When |
None
|
only_last_reaction_for_pseudo
|
bool
|
Bug-compatibility flag, off by default. The legacy yeast-GEM
MATLAB |
False
|
load_delta_g_csv¶
Stamp note_key on each entity from a CSV of id → value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entities
|
Iterable
|
Cobra entities ( |
required |
path
|
str | Path
|
Path to the CSV. |
required |
id_column
|
str
|
Column labels in the CSV. Defaults match the yeast-GEM
convention ( |
'Var1'
|
value_column
|
str
|
Column labels in the CSV. Defaults match the yeast-GEM
convention ( |
'Var1'
|
note_key
|
str
|
Key under which the value is stored on |
'deltaG'
|
verbose
|
bool
|
Print a summary of unmatched entity ids. |
False
|
Returns:
| Type | Description |
|---|---|
The number of entities that were stamped (i.e. matched the CSV).
|
|
save_delta_g_csv¶
Dump entity.notes[note_key] for each entity to a CSV.
Entities without note_key set get NaN written, preserving
one-row-per-entity ordering (mirrors MATLAB's array2table([ids,
values]) behaviour).
Returns:
| Type | Description |
|---|---|
The number of rows written (= number of entities).
|
|