micom.util¶
Holds utility functions for other modules.
Attributes¶
Functions¶
Check if a reaction is a demand reaction. |
|
|
Check for forced sinks and demands and deactivates them. |
|
Download a model. |
|
Read a model from a local file. |
|
Load a cobra model from several file types. |
|
Load a community model from a pickled version. |
|
Convert several models to Python pickles. |
|
Return ascii character for the ordinal or the original string. |
|
Clean ids up a bit. |
|
Get the compartment id for a cobra object and prune the prefix if needed. |
|
Join several models into one. |
|
Extract a list of fluxes from the model primals. |
|
Add a variable to a model equaling an expression. |
|
Get the metabolite from an exchange reaction ID. |
|
Check whether a community already carries a modification. |
|
Format min_growth into a pandas series. |
|
Set minimum growth constraints on a model. |
|
Adjust the optlang solver configuration for larger problems. |
Reset the lower bound for the community growth. |
Module Contents¶
- micom.util.load_pickle(filename)[source]¶
Load a community model from a pickled version.
- Parameters:
filename (str) – The file the community is stored in.
- Returns:
The loaded community model.
- Return type:
- micom.util.compartment_id(micom_obj)[source]¶
Get the compartment id for a cobra object and prune the prefix if needed.
- micom.util.join_models(model_files, id=None)[source]¶
Join several models into one.
This requires all the models to use the same ID system.
- Parameters:
model_files (list of strings) – The files to be joined.
id (str) – The new ID for the model. Will be the ID of the first model if None.
- Returns:
The joined cobra Model.
- Return type:
cobra.Model
- micom.util.fluxes_from_primals(model, info)[source]¶
Extract a list of fluxes from the model primals.
- micom.util.add_var_from_expression(model, name, expr, lb=None, ub=None)[source]¶
Add a variable to a model equaling an expression.
- micom.util.check_modification(community)[source]¶
Check whether a community already carries a modification.
- Parameters:
community (micom.Community) – The community class to check.
- Raises:
ValueError – If the community already carries a modification and adding another would not be safe.
- micom.util._format_min_growth(min_growth, taxa)[source]¶
Format min_growth into a pandas series.
- Parameters:
min_growth (positive float or array-like object.) – The minimum growth rate for each individual in the community. Either a single value applied to all individuals or one value for each.
taxa (array-like) – The ID for each individual model in the community.
- Returns:
A pandas Series mapping each individual to its minimum growth rate.
- Return type:
pandas.Series
- micom.util._apply_min_growth(community, min_growth, atol=1e-06, rtol=1e-06)[source]¶
Set minimum growth constraints on a model.
Will integrate with the context.