Utilities¶
model_to_mat ¶
model_to_mat(model, file_name, varname=None)
Save the cobra model as a .mat file.
This .mat file can be used directly in the MATLAB version of COBRA.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
cobra.core.Model.Model object
|
The model to save |
required |
file_name
|
str or file-like object
|
The file to save to |
required |
varname
|
string
|
The name of the variable within the workspace |
None
|
load_test_model ¶
load_test_model(
name: str = "e_coli_core.xml",
use_gene_level: bool = True,
model_path: Optional[PathLike] = None,
) -> cobra.Model
Get a cobra.Model in the core folder
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
file name of the cobra.Model |
'e_coli_core.xml'
|
use_gene_level
|
bool
|
If true, use gene entrez id (without transcript part) |
True
|
model_path
|
Optional[PathLike]
|
The path of model directory, default: ../../assets/core from the folder the package is located |
None
|
Returns:
| Type | Description |
|---|---|
Model
|
The requested cobra.Model |
save_model ¶
save_model(
model: Model, output_file_name: Union[str, PathLike]
) -> None
Save a cobra.Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Model
|
Saved cobra.Model |
required |
output_file_name
|
Union[str, PathLike]
|
Saved core' file name |
required |
Returns:
| Type | Description |
|---|---|
None
|
|
load_model ¶
load_model(model_file_path: str) -> cobra.Model
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_file_path
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
Model
|
|
make_irrev_rxn ¶
make_irrev_rxn(
mod,
rxn_id,
add_inplace=True,
ignore_irrev=False,
forward_prefix="_F_",
backward_prefix="_R_",
*,
remove_original=False,
copy_attributes=True
) -> List[cobra.Reaction]
Create irreversible forward/backward copies of a reaction.
A reversible reaction lb < 0 < ub is represented as two non-negative
flux reactions: a forward copy with the original stoichiometry and a
backward copy with negated stoichiometry. This is the representation needed
for enzyme constraints because enzyme usage must be non-negative in both
directions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mod
|
Model
|
Model containing the reaction. |
required |
rxn_id
|
str
|
ID of the reaction to split. |
required |
add_inplace
|
bool
|
Add the generated reactions to mod. |
True
|
ignore_irrev
|
bool
|
If True, skip only directions with zero feasible capacity. |
False
|
forward_prefix
|
str
|
Prefixes used to generate reaction IDs. |
'_F_'
|
backward_prefix
|
str
|
Prefixes used to generate reaction IDs. |
'_F_'
|
remove_original
|
bool
|
If True and |
False
|
copy_attributes
|
bool
|
Copy name, subsystem, GPR, notes, and annotation to generated reactions. |
True
|
get_logger ¶
get_logger(name: str) -> logging.Logger
Get a logger within the pipeGEM namespace.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the logger, typically |
required |
Returns:
| Type | Description |
|---|---|
Logger
|
|