2.1.2.14. enkie.utils
General utility methods.
2.1.2.14.1. Module Contents
- enkie.utils.get_internal_reaction_ids(model: cobra.Model) List[str] [source]
Get the identifier of the internal reactions in the model, i.e. reactions that are not exchanges, biomass, demands or sinks.
- Parameters:
model (cobra.Model) – The target model.
- Returns:
The identifiers of the internal reactions.
- Return type:
List[str]
- enkie.utils.get_path(path: Union[pathlib.Path, str]) pathlib.Path [source]
Gets a
Path
object from different representations.- Parameters:
path (Union[Path, str]) – A
Path
object or a string describing the path.- Returns:
A
Path
object.- Return type:
Path
- Raises:
ValueError – If the type of the input is not supported.
- enkie.utils.make_stoichiometric_matrix(reactions: List[enkie.miriam_reaction.MiriamReaction], metabolites: List[enkie.miriam_metabolite.MiriamMetabolite]) numpy.ndarray [source]
Make a stoichiometric matrix for a given network.
- Parameters:
reactions (List[MiriamReaction]) – The reactions in the network.
metabolites (List[MiriamMetabolite]) – The metabolites in the network.
- Returns:
The stoichiometric matrix of the network.
- Return type:
np.ndarray
- enkie.utils.qvector(elements: List[enkie.commons.Q]) enkie.commons.Q [source]
Converts a list of quantities to a quantity vector.
- Parameters:
elements (List[Q]) – List of quantities.
- Returns:
Quantity vector.
- Return type:
Q
- enkie.utils.qrvector(elements: List[enkie.commons.Q]) enkie.commons.Q [source]
Converts a list of quantities to a quantity row vector.
- Parameters:
elements (List[Q]) – List of quantities.
- Returns:
Quantity row vector.
- Return type:
Q
- enkie.utils.to_reactions_idxs(reactions: Union[List[int], List[str], cobra.DictList, List[cobra.Reaction]], model: cobra.Model) List[int] [source]
Utility function to obtain a list of reaction indices from different representations.
- Parameters:
- Returns:
List of reaction indices.
- Return type:
List[int]
- Raises:
ValueError – If the list is not of one of the expected formats.