medusa.test

Package Contents

class medusa.test.Ensemble(list_of_models=[], identifier=None, name=None)

Bases:cobra.core.object.Object

Ensemble 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
medusa.test.medusa_directory
medusa.test.data_dir
medusa.test.create_test_ensemble(ensemble_name='Staphylococcus aureus')

Returns a previously-generated ensemble for testing model_name: str

One of ‘Staphylococcus_aureus_ensemble’
medusa.test.create_test_model(model_name='textbook')

Returns a cobra.Model for testing model_name: str

One of [‘Staphylococcus aureus’] or any models in cobra.test
medusa.test.load_biolog_plata()
medusa.test.load_universal_modelseed()