Пример #1
0
def _load_reactions(sbml_model, model):
    new_reactions_ids = []
    new_reactions = []
    for reaction in sbml_model.getListOfReactions():
        if reaction.getId() not in model.reactions:
            new_reactions.append(_load_reaction(reaction))
            new_reactions_ids.append(reaction.getId())
    return (new_reactions_ids, new_reactions)
Пример #2
0
def _load_cb_parameters(sbml_model, model):
    cb_parameters = []
    for reaction in sbml_model.getListOfReactions():
        if reaction.getId() not in model.reactions:
            cb_parameters.append((reaction.getId(),
                                  _get_cb_parameter(reaction, LB_TAG),
                                  _get_cb_parameter(reaction, UB_TAG),
                                  _get_cb_parameter(reaction, OBJ_TAG, default_value=0)))

    bounds = map(lambda (r_id, lb, ub, coeff): (r_id, lb, ub), cb_parameters)
    coefficients = map(lambda (r_id, lb, ub, coeff): (r_id, coeff), cb_parameters)

    return bounds, coefficients
Пример #3
0
def _load_stoichiometry(sbml_model, model):
    inputs = []
    for reaction in sbml_model.getListOfReactions():
        if reaction.getId() not in model.reactions:
            for reactant in reaction.getListOfReactants():
                inputs.append((reactant.getSpecies(), reaction.getId(), -reactant.getStoichiometry()))

    outputs = []
    for reaction in sbml_model.getListOfReactions():
        if reaction.getId() not in model.reactions:
            for product in reaction.getListOfProducts():
                outputs.append((product.getSpecies(), reaction.getId(), product.getStoichiometry()))

    return inputs + outputs
Пример #4
0
def _load_reaction(reaction):
    return Reaction(reaction.getId(), reaction.getName(), reaction.getReversible())