Exemplo n.º 1
0
def create_distrib(tmp=False):
    """ Create demo model.

    :return:
    """
    factory = Factory(modules=['sbmlutils.examples.models.distrib.distrib_ex1'],
                      target_dir=os.path.join(models_dir, 'results'))
    factory.create(tmp)
Exemplo n.º 2
0
def create(tmp=False):
    """Create model.

    :return:
    """
    models_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)))

    factory = Factory(modules=["model"], output_dir=os.path.join(models_dir, "results"))
    factory.create(tmp)
Exemplo n.º 3
0
def create_distrib(tmp=False):
    """ Create demo model.

    :return:
    """
    factory = Factory(
        modules=['sbmlutils.examples.models.distrib.distrib_ex1'],
        target_dir=os.path.join(models_dir, 'results'))
    factory.create(tmp)
Exemplo n.º 4
0
def create(tmp=False):
    """ Create model.

    :return:
    """
    models_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)))

    factory = Factory(modules=['model'],
                      target_dir=os.path.join(models_dir, 'results'))
    factory.create(tmp)
Exemplo n.º 5
0
def create(tmp=False):
    """ Create demo model.

    :return:
    """
    models_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)))

    factory = Factory(modules=['sbmlutils.examples.models.example1.model'],
                      target_dir=os.path.join(models_dir, 'results'))
    factory.create(tmp)
Exemplo n.º 6
0
def create_distrib(tmp=False):
    """Create demo model.

    :return:
    """
    factory = Factory(
        modules=["sbmlutils.examples.models.distrib.distrib_ex1"],
        output_dir=os.path.join(models_dir, "results"),
    )
    factory.create(tmp)
Exemplo n.º 7
0
def create(tmp=False):
    """Create demo model.

    :return:
    """
    models_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)))

    factory = Factory(
        modules=["sbmlutils.examples.models.example1.model"],
        output_dir=os.path.join(models_dir, "results"),
    )
    factory.create(tmp)
Exemplo n.º 8
0
def create(tmp=False):
    """ Create model.
    :return:
    """
    models_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)))

    print('-' * 80)
    print(models_dir)
    print('-' * 80)
    factory = Factory(modules=['sbmlutils.examples.models.assignment.model'],
                      target_dir=os.path.join(models_dir, 'results'))
    factory.create(tmp)
Exemplo n.º 9
0
def create(tmp=False):
    """Create demo model.

    :return:
    """
    models_dir = Path(__file__).parent
    factory = Factory(
        modules=["sbmlutils.examples.models.tiny_model.model"],
        output_dir=models_dir / "results",
        annotations=models_dir / "annotations.xlsx",
    )
    factory.create(tmp)
Exemplo n.º 10
0
def create(tmp=False):
    """Create model.
    :return:
    """
    models_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)))

    print("-" * 80)
    print(models_dir)
    print("-" * 80)
    factory = Factory(
        modules=["sbmlutils.examples.models.assignment.model"],
        output_dir=os.path.join(models_dir, "results"),
    )
    factory.create(tmp)
Exemplo n.º 11
0
def create(tmp=False):
    """ Create demo model.

    :return:
    """
    models_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)))

    print('-'*80)
    print(models_dir)
    print('-' * 80)

    factory = Factory(modules=['sbmlutils.examples.models.tiny_model.model'],
                      target_dir=os.path.join(models_dir, 'results'),
                      annotations=os.path.join(models_dir, 'annotations.xlsx'))
    factory.create(tmp)
Exemplo n.º 12
0
def create(tmp=False):
    """ Create demo model.

    :return:
    """
    models_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)))

    print('-' * 80)
    print(models_dir)
    print('-' * 80)

    factory = Factory(modules=['sbmlutils.examples.models.tiny_model.model'],
                      target_dir=os.path.join(models_dir, 'results'),
                      annotations=os.path.join(models_dir, 'annotations.xlsx'))
    factory.create(tmp)
Exemplo n.º 13
0
def create(tmp=False):
    """ Create demo model.

    :return:
    """
    models_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)))

    factory = Factory(modules=['sbmlutils.examples.models.fbc.fbc_ex1'],
                      target_dir=os.path.join(models_dir, 'results'))
    factory.create(tmp)

    factory = Factory(modules=['sbmlutils.examples.models.fbc.fbc_ex2'],
                      target_dir=os.path.join(models_dir, 'results'))
    factory.create(tmp)
Exemplo n.º 14
0
def create(tmp=False):
    """Create demo model.

    :return:
    """
    models_dir = Path(__file__).parent
    output_dir = models_dir / "results"

    factory = Factory(modules=["sbmlutils.examples.models.fbc.fbc_ex1"],
                      output_dir=output_dir)
    factory.create(tmp)

    factory = Factory(modules=["sbmlutils.examples.models.fbc.fbc_ex2"],
                      output_dir=output_dir)
    factory.create(tmp)
Exemplo n.º 15
0
def create(tmp=False):
    """ Create demo model.

    :return:
    """
    models_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)))

    print('-' * 80)
    print(models_dir)
    print('-' * 80)

    factory = Factory(modules=['sbmlutils.examples.models.demo.model'],
                      target_dir=os.path.join(models_dir, 'results'),
                      annotations=os.path.join(models_dir,
                                               'demo_annotations.xlsx'))
    factory.create(tmp)

    # without annotations
    factory_no_annotations = Factory(
        modules=['sbmlutils.examples.models.demo.model'],
        target_dir=os.path.join(models_dir, 'results'),
        mid="{}_{}_{}".format(model.mid, model.version, "no_annotations"))
    factory_no_annotations.create(tmp)
Exemplo n.º 16
0
])

# ---------------------------------------------------------------------------------------------------------------------
# Assignments
# ---------------------------------------------------------------------------------------------------------------------
assignments = [
    InitialAssignment('S1', '10.0 mM', UNIT_mM),
]

# ---------------------------------------------------------------------------------------------------------------------
# Rules
# ---------------------------------------------------------------------------------------------------------------------
rules = []

# ---------------------------------------------------------------------------------------------------------------------
# Reactions
# ---------------------------------------------------------------------------------------------------------------------
reactions = [

]


if __name__ == "__main__":

    import os
    from sbmlutils.modelcreator.creator import Factory
    models_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)))
    factory = Factory(modules=['sbmlutils.examples.models.example1.model'],
                      target_dir=os.path.join(models_dir, 'results'))
    factory.create()
Exemplo n.º 17
0
from matplotlib import pylab as plt
from sbmlutils.modelcreator.creator import Factory
import cobra
from cobra.io import read_sbml_model

# -----------------------------------------------------------------------------
# create model
# -----------------------------------------------------------------------------
models_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)))

print('-' * 80)
print(models_dir)
print('-' * 80)

factory = Factory(modules=['sbmlutils.examples.models.tiny_model.model'],
                  target_dir=os.path.join(models_dir, 'results'),
                  annotations=os.path.join(models_dir, 'annotations.xlsx'))
_, _, tiny_sbml = factory.create(tmp=False)

# -----------------------------------------------------------------------------
# run ode simulation
# -----------------------------------------------------------------------------
# tiny_sbml = os.path.join(os.path.dirname(os.path.abspath(__file__)),
#                         'results',
#                         '{}_{}.xml'.format(model.mid, model.version))

r = roadrunner.RoadRunner(tiny_sbml)
r.timeCourseSelections = [
    "time"
] + r.model.getBoundarySpeciesIds() + r.model.getFloatingSpeciesIds(
) + r.model.getReactionIds() + r.model.getGlobalParameterIds()
Exemplo n.º 18
0
def create(tmp: bool = False) -> None:
    factory = Factory(
        modules=["sbmlutils.examples.models.boundary_condition_2.model"],
        output_dir=Path(__file__).parent / "results",
    )
    factory.create(tmp)
Exemplo n.º 19
0
# ---------------------------------------------------------------------------------------------------------------------
# Assignments
# ---------------------------------------------------------------------------------------------------------------------
assignments = [
    InitialAssignment("S1", "10.0 mM", UNIT_mM),
]

# ---------------------------------------------------------------------------------------------------------------------
# Rules
# ---------------------------------------------------------------------------------------------------------------------
rules = []

# ---------------------------------------------------------------------------------------------------------------------
# Reactions
# ---------------------------------------------------------------------------------------------------------------------
reactions = []

if __name__ == "__main__":

    import os

    from sbmlutils.modelcreator.creator import Factory

    models_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)))
    factory = Factory(
        modules=["sbmlutils.examples.models.example1.model"],
        output_dir=os.path.join(models_dir, "results"),
    )
    factory.create()
Exemplo n.º 20
0
#
# The list of tuples can be provided on object generation
#
# ```
#     Species(sid='e__gal', compartment='ext', initialConcentration=3.0,
#                 substanceUnit=UNIT_KIND_MOLE, boundaryCondition=True,
#                 name='D-galactose', sboTerm=SBO_SIMPLE_CHEMICAL,
#                 annotations=[
#                     (BQB.IS, "bigg.metabolite/gal"),  # galactose
#                     (BQB.IS, "chebi/CHEBI:28061"),  # alpha-D-galactose
#                     (BQB.IS, "vmhmetabolite/gal"),
#                 ]
#             ),
# ```
#
# For the full example see [model_with_annotations.py](./model_with_annotations.py)

# In[4]:

import os
from sbmlutils.modelcreator.creator import Factory
factory = Factory(modules=['model_with_annotations'], target_dir='./models')
[_, _, sbml_path] = factory.create()

# check the annotations on the species
import libsbml
doc = libsbml.readSBMLFromFile(sbml_path)  # type: libsbml.SBMLDocument
model = doc.getModel()  # type: libsbml.Model
s1 = model.getSpecies('e__gal')  # type: libsbml.Species
print(s1.toSBML())
Exemplo n.º 21
0
from matplotlib import pylab as plt
from sbmlutils.modelcreator.creator import Factory
import cobra
from cobra.io import read_sbml_model

# -----------------------------------------------------------------------------
# create model
# -----------------------------------------------------------------------------
models_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)))

print('-'*80)
print(models_dir)
print('-' * 80)

factory = Factory(modules=['sbmlutils.examples.models.tiny_model.model'],
                  target_dir=os.path.join(models_dir, 'results'),
                  annotations=os.path.join(models_dir, 'annotations.xlsx'))
_, _, tiny_sbml = factory.create(tmp=False)


# -----------------------------------------------------------------------------
# run ode simulation
# -----------------------------------------------------------------------------
# tiny_sbml = os.path.join(os.path.dirname(os.path.abspath(__file__)),
#                         'results',
#                         '{}_{}.xml'.format(model.mid, model.version))


r = roadrunner.RoadRunner(tiny_sbml)
r.timeCourseSelections = ["time"] + r.model.getBoundarySpeciesIds() + r.model.getFloatingSpeciesIds() + r.model.getReactionIds() + r.model.getGlobalParameterIds()
r.timeCourseSelections += ["[{}]".format(key) for key in r.model.getFloatingSpeciesIds()]
Exemplo n.º 22
0
def create(tmp: bool = False) -> None:
    factory = Factory(
        modules=["sbmlutils.examples.models.initial_assignment.model"],
        output_dir=Path(__file__).parent / "results",
    )
    factory.create(tmp)
Exemplo n.º 23
0
from sbmlutils.examples.models.tiny_model import model as model_definition
from sbmlutils.fbc.cobra import read_cobra_model
from sbmlutils.modelcreator.creator import Factory

# -----------------------------------------------------------------------------
# create model
# -----------------------------------------------------------------------------
tiny_dir = Path(__file__).parent

print("-" * 80)
print(tiny_dir)
print("-" * 80)

factory = Factory(
    modules=["sbmlutils.examples.models.tiny_model.model"],
    output_dir=tiny_dir / "results",
    annotations=tiny_dir / "annotations.xlsx",
)
_, _, tiny_sbml = factory.create(tmp=False)

# -----------------------------------------------------------------------------
# run ode simulation
# -----------------------------------------------------------------------------
# tiny_sbml = os.path.join(os.path.dirname(os.path.abspath(__file__)),
#                         'results',
#                         '{}_{}.xml'.format(model.mid, model.version))

r = roadrunner.RoadRunner(str(tiny_sbml))
r.timeCourseSelections = (["time"] + r.model.getBoundarySpeciesIds() +
                          r.model.getFloatingSpeciesIds() +
                          r.model.getReactionIds() +