cobamp.wrappers package¶
Submodules¶
cobamp.wrappers.external_wrappers module¶
-
class
cobamp.wrappers.external_wrappers.AbstractObjectReader(model)[source]¶ Bases:
objectAn abstract class for reading metabolic model objects from external frameworks, and extracting the data needed for pathway analysis methods. Also deals with name conversions.
-
g2rx(expression, and_fx=<built-in function min>, or_fx=<built-in function max>, as_vector=False, apply_fx=None)[source]¶
-
get_irreversibilities(as_index)[source]¶ Returns a vector representing irreversible reactions, either as a vector of booleans (each value is a flux, ordered in the same way as reaction identifiers) or as a vector of reaction indexes.
Parameters
as_dict: A boolean value that controls whether the result is a vector of indexes
-
get_model_bounds(as_dict, separate_list)[source]¶ Returns the lower and upper bounds for all fluxes in the model. This either comes in the form of an ordered list with tuples of size 2 (lb,ub) or a dictionary with the same tuples mapped by strings with reaction identifiers.
Parameters
as_dict: A boolean value that controls whether the result is a dictionary mapping str to tuple of size 2 separate: A boolean value that controls whether the result is two numpy.array(), one for lb and the other
to ub
-
get_model_gprs(apply_fx=None)[source]¶ Returns the model gene-protein-reaction rules associated with each reaction
-
get_reaction_and_metabolite_ids()[source]¶ Returns two ordered iterables containing the metabolite and reaction ids respectively.
-
get_rx_instances()[source]¶ Returns the reaction instances contained in the model. Varies depending on the framework.
-
get_stoichiometric_matrix()[source]¶ Returns a 2D numpy array with the stoichiometric matrix whose metabolite and reaction indexes match the names defined in the class variables r_ids and m_ids
-
metabolite_id_to_index(id)[source]¶ Returns the numerical index of a metabolite when given a string representing its identifier.
Parameters
id: A metabolite identifier as a string
-
-
class
cobamp.wrappers.external_wrappers.COBRAModelObjectReader(model)[source]¶ Bases:
cobamp.wrappers.external_wrappers.AbstractObjectReader-
get_irreversibilities(as_index)[source]¶ Returns a vector representing irreversible reactions, either as a vector of booleans (each value is a flux, ordered in the same way as reaction identifiers) or as a vector of reaction indexes.
Parameters
as_dict: A boolean value that controls whether the result is a vector of indexes
-
get_model_bounds(as_dict=False, separate_list=False)[source]¶ Returns the lower and upper bounds for all fluxes in the model. This either comes in the form of an ordered list with tuples of size 2 (lb,ub) or a dictionary with the same tuples mapped by strings with reaction identifiers.
Parameters
as_dict: A boolean value that controls whether the result is a dictionary mapping str to tuple of size 2 separate: A boolean value that controls whether the result is two numpy.array(), one for lb and the other
to ub
-
get_model_gprs(apply_fx=None, token_to_gene_ratio=20)[source]¶ Returns the model gene-protein-reaction rules associated with each reaction
-
get_reaction_and_metabolite_ids()[source]¶ Returns two ordered iterables containing the metabolite and reaction ids respectively.
-
-
class
cobamp.wrappers.external_wrappers.CobampModelObjectReader(model)[source]¶ Bases:
cobamp.wrappers.external_wrappers.AbstractObjectReader-
get_irreversibilities(as_index)[source]¶ Returns a vector representing irreversible reactions, either as a vector of booleans (each value is a flux, ordered in the same way as reaction identifiers) or as a vector of reaction indexes.
Parameters
as_dict: A boolean value that controls whether the result is a vector of indexes
-
get_model_bounds(as_dict, separate_list=False)[source]¶ Returns the lower and upper bounds for all fluxes in the model. This either comes in the form of an ordered list with tuples of size 2 (lb,ub) or a dictionary with the same tuples mapped by strings with reaction identifiers.
Parameters
as_dict: A boolean value that controls whether the result is a dictionary mapping str to tuple of size 2 separate: A boolean value that controls whether the result is two numpy.array(), one for lb and the other
to ub
-
get_reaction_and_metabolite_ids()[source]¶ Returns two ordered iterables containing the metabolite and reaction ids respectively.
-
-
class
cobamp.wrappers.external_wrappers.FramedModelObjectReader(model)[source]¶ Bases:
cobamp.wrappers.external_wrappers.AbstractObjectReader-
get_irreversibilities(as_index)[source]¶ Returns a vector representing irreversible reactions, either as a vector of booleans (each value is a flux, ordered in the same way as reaction identifiers) or as a vector of reaction indexes.
Parameters
as_dict: A boolean value that controls whether the result is a vector of indexes
-
get_model_bounds(as_dict=False, separate_list=False)[source]¶ Returns the lower and upper bounds for all fluxes in the model. This either comes in the form of an ordered list with tuples of size 2 (lb,ub) or a dictionary with the same tuples mapped by strings with reaction identifiers.
Parameters
as_dict: A boolean value that controls whether the result is a dictionary mapping str to tuple of size 2 separate: A boolean value that controls whether the result is two numpy.array(), one for lb and the other
to ub
-
get_reaction_and_metabolite_ids()[source]¶ Returns two ordered iterables containing the metabolite and reaction ids respectively.
-
-
class
cobamp.wrappers.external_wrappers.MatFormatReader(model)[source]¶ Bases:
cobamp.wrappers.external_wrappers.AbstractObjectReader-
get_irreversibilities(as_index)[source]¶ Returns a vector representing irreversible reactions, either as a vector of booleans (each value is a flux, ordered in the same way as reaction identifiers) or as a vector of reaction indexes.
Parameters
as_dict: A boolean value that controls whether the result is a vector of indexes
-
get_model_bounds(as_dict=False, separate_list=False)[source]¶ Returns the lower and upper bounds for all fluxes in the model. This either comes in the form of an ordered list with tuples of size 2 (lb,ub) or a dictionary with the same tuples mapped by strings with reaction identifiers.
Parameters
as_dict: A boolean value that controls whether the result is a dictionary mapping str to tuple of size 2 separate: A boolean value that controls whether the result is two numpy.array(), one for lb and the other
to ub
-
get_model_gprs(apply_fx=None)[source]¶ Returns the model gene-protein-reaction rules associated with each reaction
-
get_reaction_and_metabolite_ids()[source]¶ Returns two ordered iterables containing the metabolite and reaction ids respectively.
-
cobamp.wrappers.method_wrappers module¶
-
class
cobamp.wrappers.method_wrappers.KShortestEFMEnumeratorWrapper(model, non_consumed, consumed, produced, subset=None, **kwargs)[source]¶ Bases:
cobamp.wrappers.method_wrappers.KShortestEnumeratorWrapperExtension of the abstract class KShortestEnumeratorWrapper that takes a metabolic model as input and yields elementary flux modes.
-
class
cobamp.wrappers.method_wrappers.KShortestEFPEnumeratorWrapper(model, subset, non_consumed=[], consumed=[], produced=[], **kwargs)[source]¶ Bases:
cobamp.wrappers.method_wrappers.KShortestEnumeratorWrapperExtension of the abstract class KShortestEnumeratorWrapper that takes a metabolic model as input and yields elementary flux patterns.
-
class
cobamp.wrappers.method_wrappers.KShortestEnumeratorWrapper(model, algorithm_type='kse_populate', stop_criteria=1, forced_solutions=None, excluded_solutions=None, solver='CPLEX', force_bounds={}, n_threads=0, workmem=None, big_m=False, max_populate_sols_override=None, time_limit=None, big_m_value=None)[source]¶ Bases:
object-
ALGORITHM_TYPE_ITERATIVE= 'kse_iterative'¶
-
ALGORITHM_TYPE_POPULATE= 'kse_populate'¶
-
-
class
cobamp.wrappers.method_wrappers.KShortestMCSEnumeratorWrapper(model, target_flux_space_dict, target_yield_space_dict, **kwargs)[source]¶ Bases:
cobamp.wrappers.method_wrappers.KShortestEnumeratorWrapperExtension of the abstract class KShortestEnumeratorWrapper that takes a metabolic model as input and yields minimal cut sets.