biosimulators_utils.sedml package — BioSimulators utils 0.1.154 documentation

# biosimulators_utils.sedml package

## Submodules

## biosimulators_utils.sedml.data_model module

Data model for SED

Author

  Jonathan Karr <karr@mssm.edu>

Date

  2020-12-06

Copyright

  2020, Center for Reproducible Biomedical Modeling

License

  MIT

class biosimulators_utils.sedml.data_model.AbstractTask(id=None, name=None)

  Bases: `biosimulators_utils.sedml.data_model.SedBase`, `biosimulators_utils.sedml.data_model.SedIdGroupMixin`

  Base class for tasks

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  is_equal(other)

    Determine if tasks are equal

    Parameters

      other (`AbstractTask`) – another content item

    Returns

      `True`, if two tasks are equal

    Return type

      `bool`

class biosimulators_utils.sedml.data_model.AddElementModelChange(id=None, name=None, target=None, target_namespaces=None, new_elements=None)

  Bases: `biosimulators_utils.sedml.data_model.ModelChange`

  An addition of an element to a model

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  target

    path to the parent of the new element(s)

    Type

      `str`

  target_namespaces

    map of prefixes of namespaces for the target to their URIs

    Type

      `dict`

  new_elements

    new element(s)

    Type

      `str`

  is_equal(other)

    Determine if model changes are equal

    Parameters

      other (`AddElementModelChange`) – another content item

    Returns

      `True`, if two model changes are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.Algorithm(kisao_id=None, changes=None)

  Bases: `biosimulators_utils.sedml.data_model.SedBase`

  A simulation algorithm

  kisao_id

    KiSAO id (e.g., KISAO_0000029)

    Type

      `str`

  changes

    parameter changes

    Type

      `list` of `AlgorithmParameterChange`

  is_equal(other)

    Determine if algorithms are equal

    Parameters

      other (`Algorithm`) – another algorithm

    Returns

      `True`, if two algorithms are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.AlgorithmParameterChange(kisao_id=None, new_value=None)

  Bases: `biosimulators_utils.sedml.data_model.SedBase`

  A changed parameter of an algorithm

  kisao_id

    KiSAO id (e.g., KISAO_0000029)

    Type

      `str`

  new_value

    new value

    Type

      `str`

  is_equal(other)

    Determine if parameter changes are equal

    Parameters

      other (`AlgorithmParameterChange`) – another parameter change

    Returns

      `True`, if two parameter changes are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.AxisScale(value)

  Bases: `str`, `enum.Enum`

  Scale of an axis

  linear = 'linear'
  log = 'log'

class biosimulators_utils.sedml.data_model.ComputeModelChange(id=None, name=None, target=None, target_namespaces=None, variables=None, parameters=None, math=None)

  Bases: `biosimulators_utils.sedml.data_model.ModelChange`, `biosimulators_utils.sedml.data_model.Calculation`

  A replacement of an element of a model

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  target

    path to the element to replace

    Type

      `str`

  target_namespaces

    map of prefixes of namespaces for the target to their URIs

    Type

      `dict`

  variables

    variables

    Type

      `list` of `Variable`

  parameters

    parameters

    Type

      `list` of `Parameter`

  math

    mathematical expression

    Type

      `str`

  is_equal(other)

    Determine if model changes are equal

    Parameters

      other (`ComputeModelChange`) – another content item

    Returns

      `True`, if two model changes are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.Curve(id=None, name=None, x_scale=None, y_scale=None, x_data_generator=None, y_data_generator=None)

  Bases: `biosimulators_utils.sedml.data_model.SedBase`, `biosimulators_utils.sedml.data_model.SedIdGroupMixin`

  A curve in a 2D plot

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  x_scale

    x axis scale

    Type

      `AxisScale`

  y_scale

    y axis scale

    Type

      `AxisScale`

  x_data_generator

    x data generator

    Type

      `DataGenerator`

  y_data_generator

    y data generator

    Type

      `DataGenerator`

  is_equal(other)

    Determine if curves are equal

    Parameters

      other (`Curve`) – another curve

    Returns

      `True`, if two curves are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.DataGenerator(id=None, name=None, variables=None, parameters=None, math=None)

  Bases: `biosimulators_utils.sedml.data_model.Calculation`, `biosimulators_utils.sedml.data_model.SedIdGroupMixin`

  A data generator

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  variables

    variables

    Type

      `list` of `Variable`

  parameters

    parameters

    Type

      `list` of `Parameter`

  math

    mathematical expression

    Type

      `str`

  is_equal(other)
    Determine if data generators

      are equal

    Parameters

      other (`DataGenerator`) – another content item

    Returns

      `True`, if two data generators are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.DataSet(id=None, name=None, label=None, data_generator=None)

  Bases: `biosimulators_utils.sedml.data_model.SedBase`, `biosimulators_utils.sedml.data_model.SedIdGroupMixin`

  A data set in a report

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  label

    label

    Type

      `str`

  data_generator

    data generator

    Type

      `DataGenerator`

  is_equal(other)

    Determine if data sets are equal

    Parameters

      other (`DataSet`) – another content item

    Returns

      `True`, if two data sets are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.FunctionalRange(id=None, name=None, range=None, variables=None, parameters=None, math=None)

  Bases: `biosimulators_utils.sedml.data_model.Range`, `biosimulators_utils.sedml.data_model.Calculation`

  A functional range

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  range

    range

    Type

      `Range`

  variables

    variables

    Type

      `list` of `Variable`

  parameters

    parameters

    Type

      `list` of `Parameter`

  math

    mathematical expression

    Type

      `str`

  is_equal(other)

    Determine if ranges are equal

    Parameters

      other (`FunctionalRange`) – another content item

    Returns

      `True`, if two ranges are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.Model(id=None, name=None, source=None, language=None, changes=None)

  Bases: `biosimulators_utils.sedml.data_model.SedBase`, `biosimulators_utils.sedml.data_model.SedIdGroupMixin`

  A model

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  source

    path to the model file

    Type

      `str`

  language

    URN of the format of the model

    Type

      `str`

  changes

    model changes

    Type

      `list` of `ModelChange`

  is_equal(other)

    Determine if models are equal

    Parameters

      other (`Model`) – another content item

    Returns

      `True`, if two models are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.ModelAttributeChange(id=None, name=None, target=None, target_namespaces=None, new_value=None)

  Bases: `biosimulators_utils.sedml.data_model.ModelChange`

  A change of an attribute of a model

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  target

    path to the model element that should be changed

    Type

      `str`

  target_namespaces

    map of prefixes of namespaces for the target to their URIs

    Type

      `dict`

  new_value

    new value

    Type

      `str`

  is_equal(other)

    Determine if model attribute changes are equal

    Parameters

      other (`ModelAttributeChange`) – another content item

    Returns

      `True`, if two model attribute changes are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.ModelChange(id=None, name=None, target=None, target_namespaces=None)

  Bases: `biosimulators_utils.sedml.data_model.SedBase`, `biosimulators_utils.sedml.data_model.SedIdGroupMixin`, `biosimulators_utils.sedml.data_model.TargetGroupMixin`

  A change to a model

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  target

    path to the model element that should be changed

    Type

      `str`

  target_namespaces

    map of prefixes of namespaces for the target to their URIs

    Type

      `dict`

  is_equal(other)

    Determine if model changes are equal

    Parameters

      other (`ModelChange`) – another content item

    Returns

      `True`, if two model changes are equal

    Return type

      `bool`

class biosimulators_utils.sedml.data_model.ModelLanguage(value)

  Bases: `str`, `enum.Enum`

  Model language

  BNGL = 'urn:sedml:language:bngl'
  CellML = 'urn:sedml:language:cellml'
  CopasiML = 'urn:sedml:language:copasiml'
  GINML = 'urn:sedml:language:ginml'
  HOC = 'urn:sedml:language:hoc'
  Kappa = 'urn:sedml:language:kappa'
  LEMS = 'urn:sedml:language:lems'
  MASS = 'urn:sedml:language:mass'
  MorpheusML = 'urn:sedml:language:morpheusml'
  NeuroML = 'urn:sedml:language:neuroml'
  RBA = 'urn:sedml:language:rba'
  SBML = 'urn:sedml:language:sbml'
  Smoldyn = 'urn:sedml:language:smoldyn'
  VCML = 'urn:sedml:language:vcml'
  XPP = 'urn:sedml:language:xpp'
  ZGINML = 'urn:sedml:language:zginml'
  pharmML = 'urn:sedml:language:pharmml'

class biosimulators_utils.sedml.data_model.ModelLanguageEdamId(value)

  Bases: `str`, `enum.Enum`

  Model language EDAM id

  BNGL = 'format_3972'
  CellML = 'format_3240'
  CopasiML = 'format_9003'
  GINML = 'format_9009'
  HOC = 'format_9005'
  Kappa = 'format_9006'
  LEMS = 'format_9004'
  MASS = 'format_9011'
  MorpheusML = 'format_9002'
  NeuroML = 'format_3971'
  RBA = 'format_9012'
  SBML = 'format_2585'
  Smoldyn = 'format_9001'
  VCML = 'format_9000'
  XPP = 'format_9010'
  ZGINML = 'format_9008'
  pharmML = 'format_9007'

class biosimulators_utils.sedml.data_model.ModelLanguagePattern(value)

  Bases: `str`, `enum.Enum`

  Model language

  BNGL = '^urn:sedml:language:bngl(\\.|$)'
  CellML = '^urn:sedml:language:cellml(\\.\\d+_\\d+)?$'
  CopasiML = '^urn:sedml:language:copasiml(\\.|$)'
  GINML = '^urn:sedml:language:ginml(\\.|$)'
  HOC = '^urn:sedml:language:hoc(\\.|$)'
  Kappa = '^urn:sedml:language:kappa(\\.|$)'
  LEMS = '^urn:sedml:language:lems(\\.|$)'
  MASS = '^urn:sedml:language:mass(\\.|$)'
  MorpheusML = '^urn:sedml:language:morpheusml(\\.|$)'
  NeuroML = '^urn:sedml:language:neuroml(\\.version-\\d+_\\d+_\\d+\\.level\\-\\d+)?$'
  RBA = '^urn:sedml:language:rba(\\.|$)'
  SBML = '^urn:sedml:language:sbml(\\.level\\-\\d+\\.version\\-\\d+)?$'
  Smoldyn = '^urn:sedml:language:smoldyn(\\.|$)'
  VCML = '^urn:sedml:language:vcml(\\.|$)'
  XPP = '^urn:sedml:language:xpp(\\.|$)'
  ZGINML = '^urn:sedml:language:zginml(\\.|$)'
  pharmML = '^urn:sedml:language:pharmml(\\.|$)'

class biosimulators_utils.sedml.data_model.OneStepSimulation(id=None, name=None, algorithm=None, step=None)

  Bases: `biosimulators_utils.sedml.data_model.Simulation`

  A single simulation step

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  algorithm

    algorithm

    Type

      `Algorithm`

  step

    step

    Type

      `float`

  is_equal(other)

    Determine if simulations are equal

    Parameters

      other (`OneStepSimulation`) – another content item

    Returns

      `True`, if two simulations are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.Output(id=None, name=None)

  Bases: `biosimulators_utils.sedml.data_model.SedBase`, `biosimulators_utils.sedml.data_model.SedIdGroupMixin`

  An output

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  is_equal(other)

    Determine if outputs are equal

    Parameters

      other (`Output`) – another content item

    Returns

      `True`, if two outputs are equal

    Return type

      `bool`

class biosimulators_utils.sedml.data_model.Parameter(id=None, name=None, value=None)

  Bases: `biosimulators_utils.sedml.data_model.SedBase`, `biosimulators_utils.sedml.data_model.SedIdGroupMixin`

  A parameter involved in a data generator

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  value

    value

    Type

      `float`

  is_equal(other)

    Determine if data generator parameters are equal

    Parameters

      other (`Parameter`) – another content item

    Returns

      `True`, if two data generator parameters are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.Plot(id=None, name=None)

  Bases: `biosimulators_utils.sedml.data_model.Output`

  A 2D plot

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

class biosimulators_utils.sedml.data_model.Plot2D(id=None, name=None, curves=None)

  Bases: `biosimulators_utils.sedml.data_model.Plot`

  A 2D plot

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  curves

    curves

    Type

      `list` of `Curve`

  is_equal(other)

    Determine if plots are equal

    Parameters

      other (`Plot2D`) – another plot

    Returns

      `True`, if two plots are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.Plot3D(id=None, name=None, surfaces=None)

  Bases: `biosimulators_utils.sedml.data_model.Plot`

  A 3D plot

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  surfaces

    surfaces

    Type

      `list` of `Surface`

  is_equal(other)

    Determine if plots are equal

    Parameters

      other (`Plot3D`) – another plot

    Returns

      `True`, if two plots are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.Range(id=None, name=None)

  Bases: `biosimulators_utils.sedml.data_model.SedBase`, `biosimulators_utils.sedml.data_model.SedIdGroupMixin`

  A range

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`, optional

  is_equal(other)

    Determine if ranges are equal

    Parameters

      other (`Range`) – another content item

    Returns

      `True`, if two ranges are equal

    Return type

      `bool`

class biosimulators_utils.sedml.data_model.RemoveElementModelChange(id=None, name=None, target=None, target_namespaces=None)

  Bases: `biosimulators_utils.sedml.data_model.ModelChange`

  A removal of an element from a model

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  target

    path to the element to remove

    Type

      `str`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.RepeatedTask(id=None, name=None, range=None, reset_model_for_each_iteration=None, changes=None, sub_tasks=None, ranges=None)

  Bases: `biosimulators_utils.sedml.data_model.AbstractTask`

  A repeated task

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  range

    range of the iterations of the repeated task

    Type

      `Range`

  reset_model_for_each_iteration

    whether to reset the model for each iteration of the repeated task

    Type

      `bool`

  changes

    set value model changes

    Type

      `list` of `SetValueComputeModelChange`

  sub_tasks

    sub-tasks

    Type

      `list` of `SubTask`

  ranges

    ranges

    Type

      `list` of `Range`

  is_equal(other)

    Determine if repeated tasks are equal

    Parameters

      other (`RepeatedTask`) – another content item

    Returns

      `True`, if two repeated tasks are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.ReplaceElementModelChange(id=None, name=None, target=None, target_namespaces=None, new_elements=None)

  Bases: `biosimulators_utils.sedml.data_model.ModelChange`

  A replacement of an element of a model

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  target

    path to the element to replace

    Type

      `str`

  target_namespaces

    map of prefixes of namespaces for the target to their URIs

    Type

      `dict`

  new_elements

    new element(s)

    Type

      `str`

  is_equal(other)

    Determine if model changes are equal

    Parameters

      other (`ReplaceElementModelChange`) – another content item

    Returns

      `True`, if two model changes are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.Report(id=None, name=None, data_sets=None)

  Bases: `biosimulators_utils.sedml.data_model.Output`

  A report

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  data_sets

    data sets

    Type

      `list` of `DataSet`

  is_equal(other)

    Determine if reports are equal

    Parameters

      other (`Report`) – another content item

    Returns

      `True`, if two reports are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.SedBase

  Bases: `abc.ABC`

  Base class for SED classes

  is_equal(other)

    Determine if simulations are equal

    Parameters

      other (`SedBase`) – another content item

    Returns

      `True`, if two simulations are equal

    Return type

      `bool`

  abstract to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.SedDocument(level=1, version=3, models=None, simulations=None, tasks=None, data_generators=None, outputs=None, metadata=None)

  Bases: `biosimulators_utils.sedml.data_model.SedBase`

  A SED-ML document

  level

    level

    Type

      `int`

  version

    version

    Type

      `int`

  models

    models

    Type

      `list` of `Model`

  simulations

    simulations

    Type

      `list` of `Simulation`

  tasks

    tasks

    Type

      `list` of `AbstractTask`

  data_generators

    data generators

    Type

      `list` of `DataGenerator`

  outputs

    outputs

    Type

      `list` of `Output`

  metadata

    metadata

    Type

      `Metadata`

  is_equal(other)

    Determine if SED-ML documents are equal

    Parameters

      other (`SedDocument`) – another SED-ML document

    Returns

      `True`, if two SED-ML documents are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.SedIdGroupMixin(id=None, name=None)

  Bases: `abc.ABC`

  Object with an id and optional name

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  is_equal(other)

    Determine if simulations are equal

    Parameters

      other (`SedIdGroupMixin`) – another content item

    Returns

      `True`, if two simulations are equal

    Return type

      `bool`

class biosimulators_utils.sedml.data_model.SetValueComputeModelChange(id=None, name=None, target=None, target_namespaces=None, variables=None, parameters=None, math=None, model=None, range=None, symbol=None)

  Bases: `biosimulators_utils.sedml.data_model.ComputeModelChange`, `biosimulators_utils.sedml.data_model.Calculation`

  A change that sets the value of an attribute of a model within an iteration of a repeated task

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  target

    path to the element to replace

    Type

      `str`

  target_namespaces

    map of prefixes of namespaces for the target to their URIs

    Type

      `dict`

  variables

    variables

    Type

      `list` of `Variable`

  parameters

    parameters

    Type

      `list` of `Parameter`

  math

    mathematical expression

    Type

      `str`

  model

    model

    Type

      `Model`

  range

    range

    Type

      `Range`

  symbol

    symbol

    Type

      `str`

  is_equal(other)

    Determine if model changes are equal

    Parameters

      other (`SetValueComputeModelChange`) – another content item

    Returns

      `True`, if two model changes are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.Simulation(id=None, name=None, algorithm=None)

  Bases: `biosimulators_utils.sedml.data_model.SedBase`, `biosimulators_utils.sedml.data_model.SedIdGroupMixin`

  A simulation

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  algorithm

    algorithm

    Type

      `Algorithm`

  is_equal(other)

    Determine if simulations are equal

    Parameters

      other (`Simulation`) – another content item

    Returns

      `True`, if two simulations are equal

    Return type

      `bool`

class biosimulators_utils.sedml.data_model.SteadyStateSimulation(id=None, name=None, algorithm=None)

  Bases: `biosimulators_utils.sedml.data_model.Simulation`

  A steady-state simulation

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  algorithm

    algorithm

    Type

      `Algorithm`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.SubTask(task=None, order=None)

  Bases: `biosimulators_utils.sedml.data_model.SedBase`

  A subtask of a repeated task

  task

    task

    Type

      `AbstractTask`

  order

    order in which the subtask should be executed

    Type

      `int`

  is_equal(other)

    Determine if repeated tasks are equal

    Parameters

      other (`SubTask`) – another content item

    Returns

      `True`, if two repeated tasks are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.Surface(id=None, name=None, x_scale=None, y_scale=None, z_scale=None, x_data_generator=None, y_data_generator=None, z_data_generator=None)

  Bases: `biosimulators_utils.sedml.data_model.SedBase`, `biosimulators_utils.sedml.data_model.SedIdGroupMixin`

  A surface in a 3D plot

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  x_scale

    x axis scale

    Type

      `AxisScale`

  y_scale

    y axis scale

    Type

      `AxisScale`

  z_scale

    z axis scale

    Type

      `AxisScale`

  x_data_generator

    x data generator

    Type

      `DataGenerator`

  y_data_generator

    y data generator

    Type

      `DataGenerator`

  z_data_generator

    z data generator

    Type

      `DataGenerator`

  is_equal(other)

    Determine if surfaces are equal

    Parameters

      other (`Surface`) – another surface

    Returns

      `True`, if two surfaces are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.Symbol(value)

  Bases: `str`, `enum.Enum`

  Variable sumbol

  time = 'urn:sedml:symbol:time'

class biosimulators_utils.sedml.data_model.TargetGroupMixin(target=None, target_namespaces=None)

  Bases: `abc.ABC`

  Object with an id and optional name

  target

    id

    Type

      `str`

  target_namespaces

    map of prefixes of namespaces for the target to their URIs

    Type

      `dict`

  is_equal(other)

    Determine if simulations are equal

    Parameters

      other (`TargetGroupMixin`) – another content item

    Returns

      `True`, if two simulations are equal

    Return type

      `bool`

class biosimulators_utils.sedml.data_model.Task(id=None, name=None, model=None, simulation=None)

  Bases: `biosimulators_utils.sedml.data_model.AbstractTask`

  A task

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  model

    model

    Type

      `Model`

  simulation

    simulation

    Type

      `Simulation`

  is_equal(other)

    Determine if tasks are equal

    Parameters

      other (`Task`) – another content item

    Returns

      `True`, if two tasks are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.UniformRange(id=None, name=None, start=None, end=None, number_of_steps=None, number_of_points=None, type=None)

  Bases: `biosimulators_utils.sedml.data_model.Range`

  A uniform range

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  start

    start value

    Type

      `float`

  end

    end value

    Type

      `float`

  number_of_steps

    number of steps

    Type

      `int`

  type

    type

    Type

      `UniformRangeType`

  is_equal(other)

    Determine if ranges are equal

    Parameters

      other (`UniformRange`) – another content item

    Returns

      `True`, if two ranges are equal

    Return type

      `bool`

  property number_of_points
  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.UniformTimeCourseSimulation(id=None, name=None, algorithm=None, initial_time=None, output_start_time=None, output_end_time=None, number_of_steps=None, number_of_points=None)

  Bases: `biosimulators_utils.sedml.data_model.Simulation`

  A uniform time course simulation

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  algorithm

    algorithm

    Type

      `Algorithm`

  initial_time

    initial time

    Type

      `float`

  output_start_time

    output start time

    Type

      `float`

  output_end_time

    output end time

    Type

      `float`

  number_of_steps

    number of time steps

    Type

      `int`

  is_equal(other)

    Determine if simulations are equal

    Parameters

      other (`UniformTimeCourseSimulation`) – another content item

    Returns

      `True`, if two simulations are equal

    Return type

      `bool`

  property number_of_points
  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.Variable(id=None, name=None, target=None, target_namespaces=None, symbol=None, task=None, model=None)

  Bases: `biosimulators_utils.sedml.data_model.SedBase`, `biosimulators_utils.sedml.data_model.SedIdGroupMixin`

  A model variable

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  target

    target

    Type

      `str`

  target_namespaces

    map of prefixes of namespaces for the target to their URIs

    Type

      `dict`

  symbol

    symbol

    Type

      `str`

  task

    task

    Type

      `AbstractTask`

  model

    model

    Type

      `Model`

  is_equal(other)

    Determine if data generator variables are equal

    Parameters

      other (`Variable`) – another content item

    Returns

      `True`, if two data generator variables are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.sedml.data_model.VectorRange(id=None, name=None, values=None)

  Bases: `biosimulators_utils.sedml.data_model.Range`

  A vector range

  id

    id

    Type

      `str`

  name

    name

    Type

      `str`

  values

    values

    Type

      `list` of `float`

  is_equal(other)

    Determine if ranges are equal

    Parameters

      other (`VectorRange`) – another content item

    Returns

      `True`, if two ranges are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

## biosimulators_utils.sedml.exceptions module

Exceptions for SED-ML

Author

  Jonathan Karr <karr@mssm.edu>

Date

  2021-01-12

Copyright

  2021, Center for Reproducible Biomedical Modeling

License

  MIT

exception biosimulators_utils.sedml.exceptions.SedmlExecutionError

  Bases: `biosimulators_utils.exceptions.BioSimulatorsException`

  Error that a SED document could not be executed

exception biosimulators_utils.sedml.exceptions.UnsupportedModelLanguageError

  Bases: `biosimulators_utils.exceptions.BioSimulatorsException`, `NotImplementedError`

  Error that a SED document could not be executed

## biosimulators_utils.sedml.exec module

Utilities for executing tasks in SED documents

Author

  Jonathan Karr <karr@mssm.edu>

Date

  2020-12-06

Copyright

  2020, Center for Reproducible Biomedical Modeling

License

  MIT

biosimulators_utils.sedml.exec.exec_plot_2d(plot, variable_results, base_out_path, rel_out_path, formats, task, log)

  Execute a 2D plot, generating the curves which are available

  Parameters

    - plot (`Plot2D`) – plot

    - variable_results (`VariableResults`) – result of each data generator

    - base_out_path (`str`) – base path to store the plot. Complete path is `{base_out_path}/{rel_out_path}/{plot.id}.csv`

    - rel_out_path (`str`, optional) – path relative to `base_out_path` to store the plot

    - formats (`list` of `VizFormat`, optional) – plot format (e.g., pdf)

    - task (`Task`) – task

    - log (`ReportLog`, optional) – log of plot

  Returns

    - `Status`: status

    - `Exception`: exception for failure

    - `bool`: whether `task` contributes a variable to the plot

  Return type

    `tuple`

biosimulators_utils.sedml.exec.exec_plot_3d(plot, variable_results, base_out_path, rel_out_path, formats, task, log)

  Execute a 3D plot, generating the surfaces which are available

  Parameters

    - plot (`Plot3D`) – plot

    - variable_results (`VariableResults`) – result of each data generator

    - base_out_path (`str`) – base path to store the plot. Complete path is `{base_out_path}/{rel_out_path}/{plot.id}.pdf`

    - rel_out_path (`str`, optional) – path relative to `base_out_path` to store the plot

    - formats (`list` of `VizFormat`, optional) – plot format (e.g., pdf)

    - task (`Task`) – task

    - log (`ReportLog`, optional) – log of plot

  Returns

    - `Status`: status

    - `Exception`: exception for failure

    - `bool`: whether `task` contributes a variable to the plot

  Return type

    `tuple`

biosimulators_utils.sedml.exec.exec_repeated_task(task, task_executer, task_vars, doc, apply_xml_model_changes=False, model_etrees=None, pretty_print_modified_xml_models=False, config=None)

  Execute a repeated SED task

  Parameters

    - task (`RepeatedTask`) – task

    - task_executer (`types.FunctionType`) –

      function to execute each task in the SED-ML file. The function must implement the following interface:

          def exec_task(task, variables, preprocessed_task=None, log=None, config=None, **simulator_config):
              ''' Execute a simulation and return its results

              Args:
                 task (:obj:`Task`): task
                 variables (:obj:`list` of :obj:`Variable`): variables that should be recorded
                 preprocessed_task (:obj:`object`, optional): preprocessed information about the task, including possible
                      model changes and variables. This can be used to avoid repeatedly executing the same initialization
                      for repeated calls to this method.
                 log (:obj:`TaskLog`, optional): log for the task
                 config (:obj:`Config`, optional): BioSimulators common configuration
                 **simulator_config (:obj:`dict`, optional): optional simulator-specific configuration

              Returns:
                 :obj:`VariableResults`: results of variables
              '''
              pass

    - task_vars (`list` of `Variable`) – variables that task must record

    - doc (`SedDocument` or `str`) – SED document or a path to SED-ML file which defines a SED document

    - apply_xml_model_changes (`bool`, optional) – if `True`, apply any model changes specified in the SED-ML file before calling `task_executer`.

    - model_etrees (`dict` of `str` to `etree._Element`) –

    - pretty_print_modified_xml_models (`bool`, optional) – if `True`, pretty print modified XML models

    - config (`Config`, optional) – BioSimulators common configuration

  Returns

    results of the variables

  Return type

    `VariableResults`

biosimulators_utils.sedml.exec.exec_report(report, variable_results, base_out_path, rel_out_path, formats, task, log=None, type=<class 'biosimulators_utils.sedml.data_model.Report'>)

  Execute a report, generating the data sets which are available

  Parameters

    - report (`Report`) – report

    - variable_results (`VariableResults`) – result of each data generator

    - base_out_path (`str`) –

      path to store the outputs

      - CSV: directory in which to save outputs to files `{base_out_path}/{rel_out_path}/{report.id}.csv`

      - HDF5: directory in which to save a single HDF5 file (`{base_out_path}/reports.h5`), with reports at keys `{rel_out_path}/{report.id}` within the HDF5 file

    - rel_out_path (`str`, optional) – path relative to `base_out_path` to store the outputs

    - formats (`list` of `ReportFormat`, optional) – report format (e.g., csv or h5)

    - task (`Task`) – task

    - log (`ReportLog`, optional) – log of report

    - type (`types.Type`) – type of output (e.g., subclass of `Output` such as `Report`, `Plot2D`)

  Returns

    - `DataSetResults`: report

    - `Status`: status

    - `Exception`: exception for failure

    - `bool`: whether `task` contribute a variable to the report

  Return type

    `tuple`

biosimulators_utils.sedml.exec.exec_sed_doc(task_executer, doc, working_dir, base_out_path, rel_out_path=None, apply_xml_model_changes=False, log=None, indent=0, pretty_print_modified_xml_models=False, log_level=StandardOutputErrorCapturerLevel.c, config=None)

  Execute the tasks specified in a SED document and generate the specified outputs

  Parameters

    - task_executer (`types.FunctionType`) –

      function to execute each task in the SED-ML file. The function must implement the following interface:

          def exec_task(task, variables, preprocessed_task=None, log=None, config=None, **simulator_config):
              ''' Execute a simulation and return its results

              Args:
                  task (:obj:`Task`): task
                  variables (:obj:`list` of :obj:`Variable`): variables that should be recorded
                  preprocessed_task (:obj:`object`, optional): preprocessed information about the task, including possible
                      model changes and variables. This can be used to avoid repeatedly executing the same initialization
                      for repeated calls to this method.
                  log (:obj:`TaskLog`, optional): log for the task
                  config (:obj:`Config`, optional): BioSimulators common configuration
                  **simulator_config (:obj:`dict`, optional): optional simulator-specific configuration

              Returns:
                 :obj:`VariableResults`: results of variables
              '''
              pass

    - doc (`SedDocument` or `str`) – SED document or a path to SED-ML file which defines a SED document

    - working_dir (`str`) – working directory of the SED document (path relative to which models are located)

    - base_out_path (`str`) –

      path to store the outputs

      - CSV: directory in which to save outputs to files `{base_out_path}/{rel_out_path}/{report.id}.csv`

      - HDF5: directory in which to save a single HDF5 file (`{base_out_path}/reports.h5`), with reports at keys `{rel_out_path}/{report.id}` within the HDF5 file

    - rel_out_path (`str`, optional) – path relative to `base_out_path` to store the outputs

    - apply_xml_model_changes (`bool`, optional) – if `True`, apply any model changes specified in the SED-ML file before calling `task_executer`.

    - log (`SedDocumentLog`, optional) – log of the document

    - indent (`int`, optional) – degree to indent status messages

    - pretty_print_modified_xml_models (`bool`, optional) – if `True`, pretty print modified XML models

    - log_level (`StandardOutputErrorCapturerLevel`, optional) – level at which to log output

    - config (`Config`) – configuration

  Returns

    - `ReportResults`: results of each report

    - `SedDocumentLog`: log of the document

  Return type

    `tuple`

biosimulators_utils.sedml.exec.exec_task(task, task_executer, task_vars, doc, log=None, config=None)

  Execute a basic SED task

  Parameters

    - task (`Task`) – task

    - task_executer (`types.FunctionType`) –

      function to execute each task in the SED-ML file. The function must implement the following interface:

          def exec_task(task, variables, preprocessed_task=None, log=None, config=None, **simulator_config):
              ''' Execute a simulation and return its results

              Args:
                  task (:obj:`Task`): task
                  variables (:obj:`list` of :obj:`Variable`): variables that should be recorded
                  preprocessed_task (:obj:`object`, optional): preprocessed information about the task, including possible
                      model changes and variables. This can be used to avoid repeatedly executing the same initialization
                      for repeated calls to this method.
                  log (:obj:`TaskLog`, optional): log for the task
                  config (:obj:`Config`, optional): BioSimulators common configuration
                  **simulator_config (:obj:`dict`, optional): optional simulator-specific configuration

              Returns:
                  :obj:`tuple`:

                      * :obj:`VariableResults`: results of variables
                      * :obj:`TaskLog`: log
              '''
              pass

    - task_vars (`list` of `Variable`) – variables that task must record

    - doc (`SedDocument` or `str`) – SED document or a path to SED-ML file which defines a SED document

    - log (`TaskLog`, optional) – log

    - config (`Config`, optional) – BioSimulators common configuration

  Returns

    results of the variables

  Return type

    `VariableResults`

biosimulators_utils.sedml.exec.get_report_for_plot2d(plot)

  Get a report for a 2D plot with a dataset for each data generator of the curves

  Parameters

    plot (`Plot2D`) – plot

  Returns

    report with a dataset for each data generator of the curves

  Return type

    `Report`

biosimulators_utils.sedml.exec.get_report_for_plot3d(plot)

  Get a report for a 3D plot with a dataset for each data generator of the surfaces

  Parameters

    plot (`Plot3D`) – plot

  Returns

    report with a dataset for each data generator of the surfaces

  Return type

    `Report`

## biosimulators_utils.sedml.io module

Utilities for reading and writing SED documents to SED-ML files

Author

  Jonathan Karr <karr@mssm.edu>

Date

  2020-12-06

Copyright

  2020, Center for Reproducible Biomedical Modeling

License

  MIT

class biosimulators_utils.sedml.io.SedmlSimulationReader

  Bases: `object`

  SED-ML reader

  errors

    errors

    Type

      nested `list` of `str`

  warnings

    warnings

    Type

      nested `list` of `str`

  run(filename, validate_semantics=True, validate_models_with_languages=True, validate_targets_with_model_sources=True, config=None)

    Base class for reading a SED document

    Parameters

      - filename (`str`) – path to SED-ML document

      - validate_semantics (`bool`, optional) – if `True`, check that SED-ML is semantically valid

      - validate_models_with_languages (`bool`, optional) – if `True`, validate models

      - validate_targets_with_model_sources (`bool`, optional) – if `True`, validate targets against their models

      - config (`Config`, optional) – whether to fail on missing includes

    Returns

      SED document

    Return type

      `data_model.SedDocument`

    Raises

      ValueError – if any of the following conditions are met * The SED document contains changes other than instances of SedChangeAttribute * The models or simulations don’t have unique ids * A model or simulation references cannot be resolved

class biosimulators_utils.sedml.io.SedmlSimulationWriter

  Bases: `object`

  SED-ML writer

  _num_meta_id

    number of assigned meta ids

    Type

      `int`

  _doc_sed

    SED document

    Type

      `libsedml.SedDocument`

  _obj_to_sed_obj_map

    map from data model objects to their corresponding libSED-ML objects

    Type

      `object` => `object`

  run(doc, filename, validate_semantics=True, validate_models_with_languages=True, validate_targets_with_model_sources=True, config=None)

    Save a SED document to an SED-ML XML file

    Parameters

      - doc (`data_model.SedDocument`) – SED document

      - filename (`str`) – Path to save simulation experiment in SED-ML format

      - validate_semantics (`bool`, optional) – if `True`, check that SED-ML is semantically valid

      - validate_models_with_languages (`bool`, optional) – if `True`, validate models

      - validate_targets_with_model_sources (`bool`, optional) – if `True`, validate targets against their models

      - config (`Config`, optional) – whether to fail on missing includes

    Raises

      NotImplementedError – document uses an supported type of task or output

## biosimulators_utils.sedml.math module

Data model for SED

Author

  Jonathan Karr <karr@mssm.edu>

Date

  2020-12-06

Copyright

  2020, Center for Reproducible Biomedical Modeling

License

  MIT

biosimulators_utils.sedml.math.compile_math(math)

  Compile a mathematical expression

  Parameters

    math (`str`) – mathematical expression

  Returns

    compiled expression

  Return type

    `_ast.Expression`

biosimulators_utils.sedml.math.eval_math(math, compiled_math, workspace)

  Compile a mathematical expression

  Parameters

    - math (`str`) – mathematical expression

    - compiled_math (`_ast.Expression`) – compiled expression

    - workspace (`dict`) – values to use for the symbols in the expression

  Returns

    result of the expression

  Return type

    `object`

  Raises

    ValueError – if the expression could not be evaluated

biosimulators_utils.sedml.math.log(*args)

  Evaluate a logarithm

  Parameters

    *args (`list` of `float`) – value optional proceeded by a base; otherwise the logarithm is calculated in base 10

  Returns

    `float`

biosimulators_utils.sedml.math.piecewise(*args)

  Evaluate a MathML piecewise function

  Parameters

    *args (`list` of `float`) – pairs of value and conditions followed by a default value

  Returns

    `float`

## biosimulators_utils.sedml.model_utils module

Utilities for working with models referenced by SED documents

Author

  Jonathan Karr <karr@mssm.edu>

Date

  2021-04-05

Copyright

  2021, Center for Reproducible Biomedical Modeling

License

  MIT

biosimulators_utils.sedml.model_utils.build_combine_archive_for_model(model_filename, model_language, simulation_type, archive_filename, extra_contents=None, config=None, **model_language_options)

  Build A COMBINE/OMEX archive with a SED-ML file for a model

  Parameters

    - model_filename (`str`) – path to model file

    - model_language (`ModelLanguage`) – model language

    - simulation_type (`type`) – subclass of `Simulation`

    - archive_filename (`str`) – path to save COMBINE/OMEX archive

    - extra_contents (`dict` of `str` -> `CombineArchiveContent`, optional) – dictionary that maps the local paths of additional files to include in the COMBINE/OMEX archive to their intended locations within the COMBINE/OMEX archive

    - config (`Config`, optional) – whether to fail on missing includes

    - **model_language_options – additional options to pass to the methods for individual model formats

biosimulators_utils.sedml.model_utils.get_parameters_variables_outputs_for_simulation(model_filename, model_language, simulation_type, algorithm_kisao_id=None, change_level=<class 'biosimulators_utils.sedml.data_model.SedDocument'>, native_ids=False, native_data_types=False, model_language_options=None)

  Get the possible observables for a simulation of a model

  This method supports the following formats

  - SBML

  - SBML-fbc

  - SBML-qual

  Parameters

    - model_filename (`str`) – path to model file

    - model_language (`str`) – model language (e.g., `urn:sedml:language:sbml`)

    - simulation_type (`types.Type`) – subclass of `Simulation`

    - algorithm_kisao_id (`str`, optional) – KiSAO id of the algorithm for simulating the model (e.g., `KISAO_0000019` for CVODE)

    - change_level (`types.Type`, optional) – level at which model changes will be made (`SedDocument` or `Task`)

    - native_ids (`bool`, optional) – whether to return the raw id and name of each model component rather than the suggested name for the variable of an associated SED-ML data generator

    - native_data_types (`bool`, optional) – whether to return new_values in their native data types

    - model_language_options (`dict`, optional) – additional options to pass to the methods for individual model formats. Dictionary that maps model languages (`ModelLanguage`) to dictionaries of optional keyword arguments for each language

  Returns

    possible attributes of a model that can be changed and their default values `list` of `Simulation`: simulation of the model `list` of `Variable`: possible observables for a simulation of the model `list` of `Plot`: possible plots of the results of a simulation of the model

  Return type

    `list` of `ModelAttributeChange`

  Raises

    UnsupportedModelLanguageError – if `model_language` is not a supported language

## biosimulators_utils.sedml.utils module

Utilities for working with SED documents

Author

  Jonathan Karr <karr@mssm.edu>

Date

  2020-12-06

Copyright

  2020, Center for Reproducible Biomedical Modeling

License

  MIT

biosimulators_utils.sedml.utils.add_namespaces_to_xml_node(node, namespace_prefixes, namespaces)

  Add namespaces to an XML node

  Parameters

    - node (`libsedml.XMLNode`) – XML node

    - namespace_prefixes (`set` of `str`) – namespace prefixes used in the node which aren’t defined in the node

    - namespaces (`libsedml.XMLNamespaces`) – namespaces for the parent document

biosimulators_utils.sedml.utils.append_all_nested_children_to_doc(doc)

  Append all nested children to a SED document

  Parameters

    doc (`SedDocument`) – SED document

biosimulators_utils.sedml.utils.apply_changes_to_xml_model(model, model_etree, sed_doc=None, working_dir=None, variable_values=None, range_values=None, validate_unique_xml_targets=True)

  Modify an XML-encoded model according to a model change

  Parameters

    - model (`Model`) – model

    - model_etree (`etree._ElementTree`) – element tree for model

    - sed_doc (`SedDocument`, optional) – parent SED document; used to resolve sources defined by reference to other models; required for compute changes

    - working_dir (`str`, optional) – working directory of the SED document (path relative to which models are located); required for compute changes

    - variable_values (`dict`, optional) – dictionary which contains the value of each variable of each compute model change

    - range_values (`dict`, optional) – dictionary which contains the value of each range of each set value compute model change

    - validate_unique_xml_targets (`bool`, optional) – whether to validate the XML targets match uniue objects

biosimulators_utils.sedml.utils.calc_compute_model_change_new_value(change, variable_values=None, range_values=None)

  Calculate the new value of a compute model change

  Parameters

    - change (`ComputeModelChange`) – change

    - variable_values (`dict`, optional) – dictionary which contains the value of each variable of each compute model change

    - range_values (`dict`, optional) – dictionary which contains the value of each range of each set value compute model change

  Returns

    new value

  Return type

    `float`

biosimulators_utils.sedml.utils.calc_data_generator_results(data_generator, variable_results)

  Calculate the results of a data generator from the results of its variables

  Parameters

    - data_generator (`DataGenerator`) – data generator

    - variable_results (`VariableResults`) – results for the variables of the data generator

  Returns

    result of data generator

  Return type

    `numpy.ndarray`

biosimulators_utils.sedml.utils.calc_data_generators_results(data_generators, variable_results, output, task, make_shapes_consistent=True)

  Calculator the values of a list of data generators

  Parameters

    - data_generators (`list` of `DataGenerator`) – SED task

    - variable_results (`VariableResults`) – results of the SED variables involved in the data generators

    - output (`Output`) – SED output

    - task (`Task`) – SED task

    - make_shapes_consistent (`bool`, optional) – where to make the shapes of the data generators consistent (e.g., for concatenation into a table for a report)

  Returns

    - `DataGeneratorResults`: values of the data generators

    - `dict` of `str` to `Status`: dictionary that maps the id of each data generator to its status

    - `Exception`: exception for failures

    - `bool`: where the task contributes to any of the data generators

  Return type

    `tuple`

biosimulators_utils.sedml.utils.convert_xml_node_to_string(node)

  Generate a string representation of an XML node

  Parameters

    node (`libsedml.XMLNode`) – XML node

  Returns

    string representation of the node

  Return type

    `str`

biosimulators_utils.sedml.utils.does_model_language_use_xpath_variable_targets(language)

  Determine if the model language uses XPaths to target variables of data generators

  Parameters

    language (`str`) – language

  Returns

    `True`, if the model language is encoded in XML

  Return type

    `bool`

biosimulators_utils.sedml.utils.get_data_generators_for_output(output)

  Get the data generators involved in an output

  Parameters

    output (`Output`) – report or plot

  Returns

    data generators involved in the output

  Return type

    `set` of `DataGenerator`

biosimulators_utils.sedml.utils.get_first_last_models_executed_by_task(task)

  Get the models executed by a task in the order they are executed

  Parameters

    task (`Task`) – task

  Returns

    models

  Return type

    `tuple` of `Model`

biosimulators_utils.sedml.utils.get_model_changes_for_task(task)

  Get the changes to models for a task

  Parameters

    task (`Task`) – task

  Returns

    changes to the model

  Return type

    `list` of `ModelChange`

biosimulators_utils.sedml.utils.get_models_referenced_by_model_change(change)

  Get the models referenced from a model change

  Parameters

    change (`ModelChange`) – model change

  Returns

    models

  Return type

    `set` of `Model`

biosimulators_utils.sedml.utils.get_models_referenced_by_range(range)

  Get the models referenced by a range

  Parameters

    range (`Range`) – range

  Returns

    models

  Return type

    `set` of `Model`

biosimulators_utils.sedml.utils.get_models_referenced_by_task(task)

  Get the models referenced from a task

  Parameters

    task (`Task`) – task

  Returns

    models

  Return type

    `set` of `Model`

biosimulators_utils.sedml.utils.get_namespaces_for_sed_object(obj)

  Get the namespace prefixes and URIs defined for a SED object

  Parameters

    obj (`libsedml.SedBase`) – SED object

  Returns

    dictionary that maps the prefixes of namespaces to their URIs

  Return type

    `dict`

biosimulators_utils.sedml.utils.get_range_len(range)

  Get the length of a range

  Parameters

    range (`Range`) – range

  Returns

    length of the range

  Return type

    `int`

  Raises

    NotImplementedError – if range isn’t an instance of `UniformRange`, `VectorRange`, or `FunctionalRange`.

biosimulators_utils.sedml.utils.get_task_results_shape(task)

  Get the shape of the results of a task

  Parameters

    task (`Task`) – task

  Returns

    shape of the results of a task

  Return type

    `tuple` of `int`

biosimulators_utils.sedml.utils.get_value_of_variable_model_xml_targets(variable, model_etrees)

  Get the value of a variable of a model

  Parameters

    - variable (`Variable`) – variable

    - model_etrees (`dict` of `str` to `etree._Element`) – dictionary that maps the ids of models to paths to files which contain their XML definitions

  Returns

    value

  Return type

    `float`

biosimulators_utils.sedml.utils.get_values_of_variable_model_xml_targets_of_model_change(change, sed_doc, model_etrees, working_dir)

  Get the values of the model variables of a compute model change

  Parameters

    - change (`ComputeModelChange`) – compute model change

    - sed_doc (`SedDocument`) – SED document

    - model_etrees (`dict` of `str` to `etree._Element`) – map from the ids of models to element trees of their sources

    - working_dir (`str`) – working directory of the SED document (path relative to which models are located)

  Returns

    dictionary which contains the value of each variable of each

      compute model change

  Return type

    `dict`

biosimulators_utils.sedml.utils.get_variables_for_data_generators(data_generators)

  Get the variables involved in a collection of generators

  Parameters

    data_generators (`list` of `DataGenerator`) – data generators

  Returns

    variables involved in the data generators

  Return type

    `set` of `Variable`

biosimulators_utils.sedml.utils.get_variables_for_task(doc, task)

  Get the variables that a task must record

  Parameters

    - doc (`SedDocument`) – SED document

    - task (`Task`) – task

  Returns

    variables that task must record

  Return type

    `list` of `Variable`

biosimulators_utils.sedml.utils.get_xml_node_namespace_tag_target(etree, target_namespaces=None)

  Get the namespace, tag, and target of an XML node

  Parameters

    - etree (`etree._Element`) – element tree

    - target_namespaces (`dict`, optional) – dictionary that maps the prefixes of namespaces to their URIs

  Returns

    - `str`: namespace URI

    - `str`: namespace prefix

    - `str`: tag

    - `str`: target for use with SED target XPaths

    - `dict`: dictionary that maps the prefixes of namespaces to their URIs

  Return type

    `tuple`

biosimulators_utils.sedml.utils.is_model_language_encoded_in_xml(language)

  Determine if the model language is encoded in XML

  Parameters

    language (`str`) – language

  Returns

    `True`, if the model language is encoded in XML

  Return type

    `bool`

biosimulators_utils.sedml.utils.remove_algorithm_parameter_changes(sed_doc)

  Remove algorithm parameter changes from a SED document

  Parameters

    sed_doc (`SedDocument`) – SED document

biosimulators_utils.sedml.utils.remove_model_changes(sed_doc)

  Remove model changes from a SED document

  Parameters

    sed_doc (`SedDocument`) – SED document

biosimulators_utils.sedml.utils.remove_plots(sed_doc)

  Remove plots from a SED document

  Parameters

    sed_doc (`SedDocument`) – SED document

biosimulators_utils.sedml.utils.replace_complex_data_generators_with_generators_for_individual_variables(sed_doc)

  Remove model changes from a SED document

  Parameters

    sed_doc (`SedDocument`) – SED document

biosimulators_utils.sedml.utils.resolve_model(model, sed_doc, working_dir)

  Resolve the source of a model

  Parameters

    - model (`Model`) –

      model whose `source` is one of the following

      - A path to a file

      - A URL

      - A MIRIAM URN for an entry in the BioModelsl database (e.g., `urn:miriam:biomodels.db:BIOMD0000000012`)

      - A reference to another model, using the `id` of the other model (e.g., `#other-model-id`). In this case, the model also inherits changes from the parent model.

    - sed_doc (`SedDocument`) – parent SED document; used to resolve sources defined by reference to other models

    - working_dir (`str`) – working directory of the SED document (path relative to which models are located)

  Returns

    temporary path to the source of the modified model, if the model needed to be resolved from

  Return type

    `str`

biosimulators_utils.sedml.utils.resolve_model_and_apply_xml_changes(model, sed_doc, working_dir, apply_xml_model_changes=True, save_to_file=True, pretty_print_modified_xml_models=False)

  Resolve the source of a model and, optionally, apply XML changes to the model.

  Parameters

    - model (`Model`) –

      model whose `source` is one of the following

      - A path to a file

      - A URL

      - A MIRIAM URN for an entry in the BioModelsl database (e.g., `urn:miriam:biomodels.db:BIOMD0000000012`)

      - A reference to another model, using the `id` of the other model (e.g., `#other-model-id`). In this case, the model also inherits changes from the parent model.

    - sed_doc (`SedDocument`) – parent SED document; used to resolve sources defined by reference to other models

    - working_dir (`str`) – working directory of the SED document (path relative to which models are located)

    - apply_xml_model_changes (`bool`, optional) – if `True`, apply any model changes specified in the SED-ML file before calling `task_executer`.

    - save_to_file (`bool`) – whether to save the resolved/modified model to a file

    - pretty_print_modified_xml_models (`bool`, optional) – if `True`, pretty print modified XML models

  Returns

    - `Model`: modified model

    - `str`: temporary path to the source of the modified model, if the model needed to be resolved from a remote source of modified

    - `etree._Element`: element tree for the resolved/modified model

  Return type

    `tuple`

biosimulators_utils.sedml.utils.resolve_range(range, model_etrees=None)

  Resolve the values of a range

  Parameters

    - range (`Range`) – range

    - model_etrees (`dict` of `str` to `etree._Element`) – map from the ids of models to element trees of their sources; required to resolve variables of functional ranges

  Returns

    values of the range

  Return type

    `list` of `float`

  Raises

    NotImplementedError – if range isn’t an instance of `UniformRange`, `VectorRange`, or `FunctionalRange`.

## biosimulators_utils.sedml.validation module

Methods for validating SED objects

Author

  Jonathan Karr <karr@mssm.edu>

Date

  2020-12-09

Copyright

  2020, Center for Reproducible Biomedical Modeling

License

  MIT

biosimulators_utils.sedml.validation.validate_algorithm(algorithm)

  Validate an algorithm

  Parameters

    algorithm (`Algorithm`) – algorithm

  Returns

    - nested `list` of `str`: nested list of errors (e.g., required ids missing or ids not unique)

    - nested `list` of `str`: nested list of errors (e.g., required ids missing or ids not unique)

  Return type

    `tuple`

biosimulators_utils.sedml.validation.validate_calculation(calculation)

  Validate that all of the symbols needed for a calculation are defined

  Parameters

    expression (`Calculation`) –

  Returns

    - nested `list` of `str`: nested list of errors (e.g., required ids missing or ids not unique)

    - nested `list` of `str`: nested list of warmings (e.g., required ids missing or ids not unique)

  Return type

    `tuple`

biosimulators_utils.sedml.validation.validate_data_generator(data_generator, model_etrees=None, validate_targets_with_model_sources=True)

  Validate a data generator

  - Parameters have ids

  - Variables have ids

  - Variables have target OR symbol

  - Variables don’t have model references

  - Have math

  - Math is valid

  Parameters

    - data_generator (`DataGenerator`) – data generator

    - model_etrees (`dict`, optional) – dictionary that maps models to XML element trees of their sources

    - validate_targets_with_model_sources (`bool`, optional) – whether to validate the targets of the variables of the data generator

  Returns

    - nested `list` of `str`: nested list of errors (e.g., required ids missing or ids not unique)

    - nested `list` of `str`: nested list of warnings (e.g., required ids missing or ids not unique)

  Return type

    `tuple`

biosimulators_utils.sedml.validation.validate_data_generator_variables(variables, model_etrees=None, validate_targets_with_model_sources=True)

  Check variables have a symbol or target

  Parameters

    - variables (`list` of `Variable`) – variables

    - model_etrees (`dict`, optional) – dictionary that maps models to XML element trees of their sources

    - validate_targets_with_model_sources (`bool`, optional) – whether to validate the targets of the variables of the data generator

  Returns

    nested list of errors (e.g., required ids missing or ids not unique)

  Return type

    nested `list` of `str`

biosimulators_utils.sedml.validation.validate_doc(doc, working_dir, validate_semantics=True, validate_models_with_languages=True, validate_targets_with_model_sources=True, config=None)

  Validate a SED document

  Parameters

    - doc (`SedDocument`) – SED document

    - working_dir (`str`) – working directory (e.g., for referencing model files)

    - validate_semantics (`bool`, optional) – if `True`, check that SED-ML is semantically valid

    - validate_models_with_languages (`bool`, optional) – if `True`, validate models

    - validate_targets_with_model_sources (`bool`, optional) – if `True`, validate targets against their models

    - config (`Config`, optional) – whether to fail on missing includes

  Returns

    - nested `list` of `str`: nested list of errors (e.g., required ids missing or ids not unique)

    - nested `list` of `str`: nested list of errors (e.g., required ids missing or ids not unique)

  Return type

    `tuple`

biosimulators_utils.sedml.validation.validate_model(model, model_ids, working_dir, validate_models_with_languages=True, config=None)

  Check a model

  Parameters

    - model (`Model`) – model

    - model_ids (`list` of `str`) – ids of models

    - working_dir (`str`) – working directory (e.g., for referencing model files)

    - validate_models_with_languages (`bool`, optional) – if `True`, validate models

    - config (`Config`, optional) – whether to fail on missing includes

  Returns

    - nested `list` of `str`: nested list of errors (e.g., required ids missing or ids not unique)

    - nested `list` of `str`: nested list of warnings (e.g., required ids missing or ids not unique)

  Return type

    `tuple`

biosimulators_utils.sedml.validation.validate_model_change_types(changes, types=(<class 'biosimulators_utils.sedml.data_model.ModelChange'>, ))

  Check that model changes are valid

  Parameters

    - changes (`list` of `ModelChange`) – model changes

    - types (`type` or `tuple` of `type`, optional) – valid type(s) of model changes

  Returns

    nested list of errors (e.g., required ids missing or ids not unique)

  Return type

    nested `list` of `str`

biosimulators_utils.sedml.validation.validate_model_changes(model)

  Check that model changes are semantically valid

  - Check that the variables of compute model changes are valid

  Parameters

    model (`Model`) – model

  Returns

    nested list of errors (e.g., required ids missing or ids not unique)

  Return type

    nested `list` of `str`

biosimulators_utils.sedml.validation.validate_model_language(language, valid_languages)

  Check that model is encoded in a specific language

  Parameters

    - language (`str`) – model language

    - valid_language (`ModelLanguage` or `list` of `ModelLanguage`) – valid language(s)

  Returns

    nested list of errors (e.g., required ids missing or ids not unique)

  Return type

    nested `list` of `str`

biosimulators_utils.sedml.validation.validate_model_source(model, model_ids, working_dir, validate_models_with_languages=True, config=None)

  Check the source of a model

  Parameters

    - model (`Model`) – model

    - model_ids (`list` of `str`) – ids of models

    - working_dir (`str`) – working directory (e.g., for referencing model files)

    - validate_models_with_languages (`bool`, optional) – if `True`, validate models

    - config (`Config`, optional) – whether to fail on missing includes

  Returns

    - nested `list` of `str`: nested list of errors (e.g., required ids missing or ids not unique)

    - nested `list` of `str`: nested list of warnings (e.g., required ids missing or ids not unique)

  Return type

    `tuple`

biosimulators_utils.sedml.validation.validate_model_with_language(source, language, name=None, config=None)

  Check that a model is valid

  Parameters

    - source (`str`) – path to model

    - language (`ModelLanguage`) – language

    - name (`str`, optional) – name of model for use in error messages

    - config (`Config`, optional) – whether to fail on missing includes

  Returns

    - nested `list` of `str`: nested list of errors (e.g., required ids missing or ids not unique)

    - nested `list` of `str`: nested list of errors (e.g., required ids missing or ids not unique)

    - `object`: model object

  Return type

    `tuple`

biosimulators_utils.sedml.validation.validate_output(output)

  Validate an output

  - Reports * Data sets have ids and labels * Data sets reference data generators

  - Plots

    > - Curves and surfaces have ids

    > - x, y, z attributes reference data generators

  Parameters

    output (`Output`) – output

  Returns

    - nested `list` of `str`: nested list of errors (e.g., required ids missing or ids not unique)

    - nested `list` of `str`: nested list of warnings (e.g., required ids missing or ids not unique)

  Return type

    `tuple`

biosimulators_utils.sedml.validation.validate_reference(obj, obj_label, attr_name, attr_label)

biosimulators_utils.sedml.validation.validate_repeated_task_has_one_model(task)

  Validate a that a repeated task involves a single model

  Parameters

    task (`RepeatedTask`) – repeated task

  Returns

    - nested `list` of `str`: nested list of errors (e.g., required ids missing or ids not unique)

    - nested `list` of `str`: nested list of warnings (e.g., required ids missing or ids not unique)

  Return type

    `tuple`

biosimulators_utils.sedml.validation.validate_simulation(simulation)

  Check that simulation is a valid simulation

  Parameters

    simulation (`Simulation`) – simulation

  Returns

    - nested `list` of `str`: nested list of errors (e.g., required ids missing or ids not unique)

    - nested `list` of `str`: nested list of errors (e.g., required ids missing or ids not unique)

  Return type

    `tuple`

biosimulators_utils.sedml.validation.validate_simulation_type(simulation, types)

  Check that simulation is a time course simulation

  Parameters

    - simulation (`Simulation`) – simulation

    - types (`type`) – valid simulation types

  Returns

    nested list of errors (e.g., required ids missing or ids not unique)

  Return type

    nested `list` of `str`

biosimulators_utils.sedml.validation.validate_target(target, namespaces, context, language, model_id, model_etree=None, doc=None, check_in_model_source=False)

  Validate that a target is a valid XPath and that the namespaces needed to resolve a target are defined

  Parameters

    - target (`str`) – XPath to a model element or attribute

    - namespaces (`dict`) – dictionary that maps prefixes of namespaces to their URIs

    - context (`type`) –

    - language (`str`) – model language

    - model_id (`str`) – model id

    - model_etree (`etree.Element`, optional) – XML element tree for model source

    - doc (`SedDocument`, optional) – SED document

    - check_in_model_source (`bool`, optional) – whether to check that the target exists in the source

  Returns

    nested list of errors (e.g., required ids missing or ids not unique)

  Return type

    nested `list` of `str`

biosimulators_utils.sedml.validation.validate_target_xpaths(targets, model_etree, attr='id')

  Validate that the target of each model change or variable matches one object in an XML-encoded model and, optionally, return the value of one of its attributes

  Parameters

    - targets (`list` of `TargetGroupMixin`) – model changes or variables

    - model_source (`lxml.etree._ElementTree`) – element tree for the XML model document

    - attr (`str`, optional) – attribute to get values of

  Returns

    dictionary that maps each XPath to the

      value of the attribute of the object in the XML file that matches the XPath

  Return type

    `dict` of `str` to `str`

biosimulators_utils.sedml.validation.validate_task(task)

  Validate a simulation task

  Parameters

    task (`Task`) – task

  Returns

    nested list of errors (e.g., required ids missing or ids not unique)

  Return type

    nested `list` of `str`

biosimulators_utils.sedml.validation.validate_uniform_range(range)

  Validate a uniform range

  Parameters

    range (`data_model.UniformRange`) – range

  Returns

    nested list of errors (e.g., required ids missing or ids not unique)

  Return type

    nested `list` of `str`

## biosimulators_utils.sedml.warnings module

Warnings for misuse of SED-ML

Author

  Jonathan Karr <karr@mssm.edu>

Date

  2020-12-06

Copyright

  2020, Center for Reproducible Biomedical Modeling

License

  MIT

exception biosimulators_utils.sedml.warnings.IllogicalSedmlWarning

  Bases: `biosimulators_utils.warnings.BioSimulatorsWarning`

  Warning that a SED document is illogical, such as when a report or plot contains no datasets, curves, or surfaces.

exception biosimulators_utils.sedml.warnings.InconsistentVariableShapesWarning

  Bases: `biosimulators_utils.warnings.BioSimulatorsWarning`

  Warning that the variables of a data generator have different shapes.

exception biosimulators_utils.sedml.warnings.NoCurvesWarning

  Bases: `biosimulators_utils.sedml.warnings.IllogicalSedmlWarning`

  Warning that a 2D plot does not contain any curves

exception biosimulators_utils.sedml.warnings.NoDataSetsWarning

  Bases: `biosimulators_utils.sedml.warnings.IllogicalSedmlWarning`

  Warning that a report does not contain any data sets

exception biosimulators_utils.sedml.warnings.NoOutputsWarning

  Bases: `biosimulators_utils.sedml.warnings.IllogicalSedmlWarning`

  Warning that a SED document does not have any outputs

exception biosimulators_utils.sedml.warnings.NoSurfacesWarning

  Bases: `biosimulators_utils.sedml.warnings.IllogicalSedmlWarning`

  Warning that a 3D plot does not contain any surfaces

exception biosimulators_utils.sedml.warnings.NoTasksWarning

  Bases: `biosimulators_utils.sedml.warnings.IllogicalSedmlWarning`

  Warning that a SED document does not have any tasks

exception biosimulators_utils.sedml.warnings.SedmlFeatureNotSupportedWarning

  Bases: `biosimulators_utils.warnings.BioSimulatorsWarning`

  Warning that a feature of a SED document was skipped because it requires a SED feature that is not yet supported. The warning is only used when skipping a portion of a document doesn’t affect the semantic meaning of the unskipped portions of the document (e.g., skipping generating a plot doesn’t adversely affect reports).