medusa.core.ensemble¶
Module Contents¶
-
medusa.core.ensemble.REACTION_ATTRIBUTES= ['lower_bound', 'upper_bound']¶
-
medusa.core.ensemble.MISSING_ATTRIBUTE_DEFAULT¶
-
class
medusa.core.ensemble.Ensemble(list_of_models=[], identifier=None, name=None)¶ Bases:
cobra.core.object.ObjectEnsemble of metabolic models
Parameters: - identifier (string) – The identifier to associate with the ensemble as a string.
- list_of_models (list of cobra.core.model.Model) – Either a list of existing Model objects in which case a new Model object is instantiated and an ensemble is constructed using the list of Models, or None/empty list, in which case an ensemble is created with empty attributes.
- name (string) – Human-readable name for the ensemble
-
base_model¶ A cobra.core.Model that contains all variable and invariable components of an ensemble.
Type: Model
-
members¶ A DictList where the key is the member identifier and the value is a medusa.core.member.Member object
Type: DictList
-
features¶ A DictList where the key is the feature identifier and the value is a medusa.core.feature.Feature object
Type: DictList
-
_populate_features_base(self, list_of_models)¶
-
_populate_members(self, list_of_models)¶
-
set_state(self, member)¶ Set the state of the base model to represent a single member.
Sets all features to the state for the provided member. Only reaction states are currently implemented (e.g. GPRs as features will not work)
Parameters: member (str or medusa.Member) – The Member.id, or the Member object itself, to set the state of the Ensemble.base_model to represent.
-
to_pickle(self, filename)¶ Save an ensemble as a pickled object. Pickling is currently the only supported method for saving and loading ensembles.
Parameters: filename (String) – location to save the pickle.
-
extract_member(self, member)¶ Extract an individual member as a cobrapy model (cobra.Model), removing any components associated with features that are inactive in member.
Provided as a more convenient option than medusa.Member.to_model(), but is the exact same.
Parameters: member (str or medusa.Member) – The Member.id, or the Member object itself, to be represented in the cobrapy model output. Returns: model – The extracted member as a cobrapy model. Return type: cobra.Model