2.1.1.4.1.1. enkie.io.cobra
Methods for parsing metabolites and reactions from cobra models.
2.1.1.4.1.1.1. Module Contents
- class enkie.io.cobra.EnzymeFactoryInterface[source]
Interface for a class implementing creation methods for enzyme objects
- property uniprot_fields: Set[str][source]
Gets the Uniprot fields required by this class to create Enzyme instances.
- abstract create(ec: str, uniprot_ids: List[str], gene_ids: List[str], uniprot_data: pandas.DataFrame) enkie.enzyme.Enzyme [source]
Create and Enzyme instance.
- Parameters:
- Returns:
The created instance.
- Return type:
- Raises:
NotImplementedError – If the method is not implemented in the child class.
- class enkie.io.cobra.EnzymeFactory[source]
Bases:
EnzymeFactoryInterface
Factory class for the construction of Enzyme objects.
- enkie.io.cobra.parse_enzymes(model: cobra.Model, reaction_ids: List[str], spontaneous_genes: Iterable = None, enzyme_factory: EnzymeFactoryInterface = None) OrderedDict[str, List[Enzyme]] [source]
Parse enzyme information from the given cobra model.
- Parameters:
model (cobra.Model) – The target model.
reaction_ids (List[str]) – Identifiers of the reactions for which enzyme objects should be constructed.
spontaneous_genes (Iterable, optional) – Identifiers of pseudo-genes that represent spontaneous (non enzyme-associated) reactions, by default None
enzyme_factory (EnzymeFactoryInterface, optional) – Factory object for the construction of enzyme objects, by default None
- Returns:
The enzymes of each reaction.
- Return type:
- enkie.io.cobra.get_needed_metabolite_ids(model: cobra.Model, reaction_ids: List[str]) List[str] [source]
Get the identifiers of the metabolites participating to the given reactions.
- enkie.io.cobra.parse_metabolite_id(metabolite: cobra.Metabolite, metabolites_namespace: str = None) str [source]
Get the identifier (including namespace) of a metabolite.
- Parameters:
metabolite (cobra.Metabolite) – The target metabolite.
metabolites_namespace (str, optional) – The namespace to read the identifier from, by default None.
- Returns:
The metabolite identifier..
- Return type:
- Raises:
ValueError – If no annotation was found for the given namespace.
- enkie.io.cobra.parse_metabolites(model: cobra.Model, metabolite_ids: List[str], metabolites_namespace: str = None) OrderedDict[str, Metabolite] [source]
Parse the given metabolites from a model.
- Parameters:
- Returns:
Mapping from query IDs to the parsed metabolites.
- Return type:
OrderedDict[str, Metabolite]
- enkie.io.cobra.parse_reactions(model: cobra.Model, metabolites: OrderedDict[str, Metabolite], reaction_ids: List[str], reactions_namespace: str = None) OrderedDict[str, Reaction] [source]
Parse the given reaction from a model.
- Parameters:
model (cobra.Model) – The target model.
metabolites (OrderedDict[str, Metabolite]) – The metabolites participating to the reactions.
reaction_ids (List[str]) – The identifiers of the reaction to be parsed.
reactions_namespace (str, optional) – The namespace from which reaction identifiers should be read, by default None
- Returns:
Mapping from input IDs to the parsed reactions.
- Return type:
- Raises:
ValueError – If a reaction has not identifier annotation for the specified namespace.
- enkie.io.cobra.make_default_rate_laws(reactions: Dict[str, enkie.reaction.Reaction], reaction_enzymes: Dict[str, List[enkie.enzyme.Enzyme]], rate_law_type: enkie.modular_rate_law.RateLawDenominator = DEFAULT_RATE_LAW_TYPE) Tuple[List[enkie.modular_rate_law.ModularRateLaw], List[enkie.enzyme.Enzyme]] [source]
Create default rate laws for the given enzymes.
- Parameters:
reactions (Dict[str, Reaction]) – The reactions catalyzed by the enzymes.
reaction_enzymes (Dict[str, List[Enzyme]]) – Mapping from reaction identifiers to enzymes for which rate laws should be created.
rate_law_type (RateLawDenominator, optional) – The rate law type to use, by default DEFAULT_RATE_LAW_TYPE
- Returns:
The created rate laws and the corresponding enzymes.
- Return type:
Tuple[List[ModularRateLaw], List[Enzyme]]