Esempio n. 1
0
def create_fva_model(sbml, r_id2bounds, new_sbml):
    def r_updater(r):
        l_b, u_b = r_id2bounds[format_r_id(r.id)]
        set_bounds(r, l_b, max(u_b, 0))
        if l_b * u_b >= 0:
            r.setReversible(False)

    r_ids = set(r_id2bounds.keys()) | {format_r_id(r_id, False) for r_id in r_id2bounds.keys()}
    r_ids2sbml(r_ids, sbml, new_sbml, 'FVA', r_updater)
    return new_sbml
Esempio n. 2
0
def visualize_model(sbml, vis_r_ids, id2mask, id2color, title, info, invisible_layers, layer2mask, res_dir, tab2html):
    combined_sbml = os.path.join(res_dir, "Combined_model.xml")
    r_ids2sbml(vis_r_ids, sbml, combined_sbml, "combined")
    doc = libsbml.SBMLReader().readSBML(combined_sbml)
    model = doc.getModel()
    id2mask = get_full_id2mask(id2mask, model)
    process_sbml(
        combined_sbml,
        verbose=True,
        web_page_prefix="visualization",
        generalize=False,
        id2mask=id2mask,
        layer2mask=layer2mask,
        tab2html=tab2html,
        title=title,
        id2color=id2color,
        tabs=None,
        info=info,
        invisible_layers=invisible_layers,
    )