def find_converting_reactions(model, pair):
    """
    Find all reactions which convert a given metabolite pair.

    Parameters
    ----------
    model : cobra.Model
        The metabolic model under investigation.
    pair: tuple or list
        A pair of metabolite identifiers without compartment suffix.

    Returns
    -------
    frozenset
        The set of reactions that have one of the pair on their left-hand
        side and the other on the right-hand side.

    """
    first = set(find_met_in_model(model, pair[0]))
    second = set(find_met_in_model(model, pair[1]))
    hits = list()
    for rxn in model.reactions:
        # FIXME: Use `set.issubset` much more idiomatic.
        if len(first & set(rxn.reactants)) > 0 and len(
                second & set(rxn.products)) > 0:
            hits.append(rxn)
        elif len(first & set(rxn.products)) > 0 and len(
                second & set(rxn.reactants)) > 0:
            hits.append(rxn)
    return frozenset(hits)
def find_converting_reactions ( model , pair ) : first = set ( find_met_in_model ( model , pair [ 0 ] ) ) second = set ( find_met_in_model ( model , pair [ 1 ] ) ) hits = list ( ) for rxn in model . reactions : if len ( first & set ( rxn . reactants ) ) > 0 and len ( second & set ( rxn . products ) ) > 0 : hits . append ( rxn ) elif len ( first & set ( rxn . products ) ) > 0 and len ( second & set ( rxn . reactants ) ) > 0 : hits . append ( rxn ) return frozenset ( hits )
Find all reactions which convert a given metabolite pair.

    Parameters
    ----------
    model : cobra.Model
        The metabolic model under investigation.
    pair: tuple or list
        A pair of metabolite identifiers without compartment suffix.

    Returns
    -------
    frozenset
        The set of reactions that have one of the pair on their left-hand
        side and the other on the right-hand side.