def bounds_model(sbml_file, directory, doc_fba, annotations=None): """" Bounds model. """ bounds_notes = notes.format(""" <h2>BOUNDS submodel</h2> <p>Submodel for dynamically calculating the flux bounds. The dynamically changing flux bounds are the input to the FBA model.</p> """) doc = builder.template_doc_bounds(settings.MODEL_ID) model = doc.getModel() utils.set_model_info(model, notes=bounds_notes, creators=creators, units=units, main_units=main_units) builder.create_dfba_dt(model, step_size=DT_SIM, time_unit=UNIT_TIME, create_port=True) # compartment compartment_id = 'cell' builder.create_dfba_compartment(model, compartment_id=compartment_id, unit_volume=UNIT_VOLUME, create_port=True) # species model_fba = doc_fba.getModel() builder.create_dfba_species(model, model_fba, compartment_id=compartment_id, unit_amount=UNIT_AMOUNT, hasOnlySubstanceUnits=False, create_port=True) # exchange bounds builder.create_exchange_bounds(model_bounds=model, model_fba=model_fba, unit_flux=UNIT_FLUX, create_ports=True) builder.create_dynamic_bounds(model_bounds=model, model_fba=model_fba, unit_flux=UNIT_FLUX) # annotations if annotations: annotator.annotate_sbml_doc(doc, annotations) sbmlio.write_sbml(doc, filepath=os.path.join(directory, sbml_file), validate=True)
def bounds_model(sbml_file, directory, doc_fba=None): """" Submodel for dynamically calculating the flux bounds. The dynamically changing flux bounds are the input to the FBA model. The units of the exchange fluxes must fit to the transported species. """ doc = builder.template_doc_bounds("ecoli") model = doc.getModel() bounds_notes = notes.format(""" <h2>BOUNDS submodel</h2> <p>Submodel for dynamically calculating the flux bounds. The dynamically changing flux bounds are the input to the FBA model.</p> """) utils.set_model_info(model, notes=bounds_notes, creators=creators, units=units, main_units=main_units) # dt compartment_id = "bioreactor" builder.create_dfba_dt(model, time_unit=UNIT_TIME, create_port=True) # compartment builder.create_dfba_compartment(model, compartment_id=compartment_id, unit_volume=UNIT_VOLUME, create_port=True) # dynamic species model_fba = doc_fba.getModel() builder.create_dfba_species(model, model_fba, compartment_id=compartment_id, unit_amount=UNIT_AMOUNT, create_port=True, exclude_sids=['X']) # FIXME: define biomass separately, also port needed for biomass mc.create_objects(model, [ mc.Parameter(sid='cf_X', value=1.0, unit="g_per_mmol", name="biomass conversion factor", constant=True), mc.Species(sid='X', initialAmount=0.001, compartment=compartment_id, name='biomass', substanceUnit='g', hasOnlySubstanceUnits=True, conversionFactor='cf_X') ]) # exchange & dynamic bounds if not biomass_weighting: builder.create_exchange_bounds(model, model_fba=model_fba, unit_flux=UNIT_FLUX, create_ports=True) builder.create_dynamic_bounds(model, model_fba, unit_flux=UNIT_FLUX) else: builder.create_exchange_bounds(model, model_fba=model_fba, unit_flux=UNIT_FLUX_PER_G, create_ports=True) builder.create_dynamic_bounds(model, model_fba, unit_flux=UNIT_FLUX_PER_G) sbmlio.write_sbml(doc, filepath=pjoin(directory, sbml_file), validate=True)
def bounds_model(sbml_file, directory, doc_fba, annotations=None): """" Bounds model. """ bounds_notes = notes.format(""" <h2>BOUNDS submodel</h2> <p>Submodel for dynamically calculating the flux bounds. The dynamically changing flux bounds are the input to the FBA model.</p> """) doc = builder.template_doc_bounds(settings.MODEL_ID) model = doc.getModel() utils.set_model_info(model, notes=bounds_notes, creators=creators, units=units, main_units=main_units) builder.create_dfba_dt(model, step_size=DT_SIM, time_unit=UNIT_TIME, create_port=True) # compartment compartment_id = 'cell' builder.create_dfba_compartment(model, compartment_id=compartment_id, unit_volume=UNIT_VOLUME, create_port=True) # species model_fba = doc_fba.getModel() builder.create_dfba_species(model, model_fba, compartment_id=compartment_id, unit_amount=UNIT_AMOUNT, hasOnlySubstanceUnits=False, create_port=True) # exchange bounds builder.create_exchange_bounds(model_bounds=model, model_fba=model_fba, unit_flux=UNIT_FLUX, create_ports=True) builder.create_dynamic_bounds(model_bounds=model, model_fba=model_fba, unit_flux=UNIT_FLUX) # annotations if annotations: annotation.annotate_sbml_doc(doc, annotations) sbmlio.write_sbml(doc, filepath=os.path.join(directory, sbml_file), validate=True)