biosimulators_utils package — BioSimulators utils 0.1.154 documentation

# biosimulators_utils package

## Subpackages

- biosimulators_utils.archive package
  - Submodules
  - biosimulators_utils.archive.data_model module
  - biosimulators_utils.archive.io module
  - biosimulators_utils.archive.utils module
- biosimulators_utils.biosimulations package
  - Submodules
  - biosimulators_utils.biosimulations.data_model module
  - biosimulators_utils.biosimulations.utils module
- biosimulators_utils.combine package
  - Submodules
  - biosimulators_utils.combine.data_model module
  - biosimulators_utils.combine.exceptions module
  - biosimulators_utils.combine.exec module
  - biosimulators_utils.combine.io module
  - biosimulators_utils.combine.utils module
  - biosimulators_utils.combine.validation module
- biosimulators_utils.gh_action package
  - Submodules
  - biosimulators_utils.gh_action.core module
  - biosimulators_utils.gh_action.data_model module
- biosimulators_utils.kisao package
  - Submodules
  - biosimulators_utils.kisao.utils module
- biosimulators_utils.licensing package
  - Submodules
  - biosimulators_utils.licensing.core module
  - biosimulators_utils.licensing.gurobi module
- biosimulators_utils.log package
  - Submodules
  - biosimulators_utils.log.data_model module
  - biosimulators_utils.log.utils module
  - biosimulators_utils.log.warnings module
- biosimulators_utils.model_lang package
  - Subpackages
    - biosimulators_utils.model_lang.bngl package
      - Submodules
      - biosimulators_utils.model_lang.bngl.utils module
      - biosimulators_utils.model_lang.bngl.validation module
    - biosimulators_utils.model_lang.cellml package
      - Submodules
      - biosimulators_utils.model_lang.cellml.utils module
      - biosimulators_utils.model_lang.cellml.validation module
    - biosimulators_utils.model_lang.lems package
      - Submodules
      - biosimulators_utils.model_lang.lems.validation module
    - biosimulators_utils.model_lang.neuroml package
      - Submodules
      - biosimulators_utils.model_lang.neuroml.validation module
    - biosimulators_utils.model_lang.rba package
      - Submodules
      - biosimulators_utils.model_lang.rba.utils module
      - biosimulators_utils.model_lang.rba.validation module
    - biosimulators_utils.model_lang.sbml package
      - Submodules
      - biosimulators_utils.model_lang.sbml.utils module
      - biosimulators_utils.model_lang.sbml.validation module
    - biosimulators_utils.model_lang.smoldyn package
      - Submodules
      - biosimulators_utils.model_lang.smoldyn.utils module
      - biosimulators_utils.model_lang.smoldyn.validation module
    - biosimulators_utils.model_lang.xpp package
      - Submodules
      - biosimulators_utils.model_lang.xpp.data_model module
      - biosimulators_utils.model_lang.xpp.utils module
      - biosimulators_utils.model_lang.xpp.validation module
- biosimulators_utils.omex_meta package
  - Submodules
  - biosimulators_utils.omex_meta.data_model module
  - biosimulators_utils.omex_meta.io module
  - biosimulators_utils.omex_meta.utils module
  - biosimulators_utils.omex_meta.validation module
- biosimulators_utils.ref package
  - Submodules
  - biosimulators_utils.ref.data_model module
  - biosimulators_utils.ref.utils module
- biosimulators_utils.report package
  - Submodules
  - biosimulators_utils.report.data_model module
  - biosimulators_utils.report.io module
  - biosimulators_utils.report.warnings module
- biosimulators_utils.sedml package
  - Submodules
  - biosimulators_utils.sedml.data_model module
  - biosimulators_utils.sedml.exceptions module
  - biosimulators_utils.sedml.exec module
  - biosimulators_utils.sedml.io module
  - biosimulators_utils.sedml.math module
  - biosimulators_utils.sedml.model_utils module
  - biosimulators_utils.sedml.utils module
  - biosimulators_utils.sedml.validation module
  - biosimulators_utils.sedml.warnings module
- biosimulators_utils.simulator package
  - Submodules
  - biosimulators_utils.simulator.cli module
  - biosimulators_utils.simulator.data_model module
  - biosimulators_utils.simulator.environ module
  - biosimulators_utils.simulator.exceptions module
  - biosimulators_utils.simulator.exec module
  - biosimulators_utils.simulator.io module
  - biosimulators_utils.simulator.specs module
  - biosimulators_utils.simulator.utils module
- biosimulators_utils.simulator_registry package
  - Submodules
  - biosimulators_utils.simulator_registry.data_model module
  - biosimulators_utils.simulator_registry.process_submission module
  - biosimulators_utils.simulator_registry.query module
  - biosimulators_utils.simulator_registry.submit module
- biosimulators_utils.utils package
  - Submodules
  - biosimulators_utils.utils.core module
  - biosimulators_utils.utils.identifiers_org module
  - biosimulators_utils.utils.logging module
- biosimulators_utils.viz package
  - Subpackages
    - biosimulators_utils.viz.vega package
      - Subpackages
      - Submodules
      - biosimulators_utils.viz.vega.utils module
  - Submodules
  - biosimulators_utils.viz.data_model module
  - biosimulators_utils.viz.io module
  - biosimulators_utils.viz.utils module
  - biosimulators_utils.viz.warnings module
- biosimulators_utils.xml package
  - Submodules
  - biosimulators_utils.xml.utils module

## Submodules

## biosimulators_utils.config module

Common configuration for simulation tools

Author

  Jonathan Karr <karr@mssm.edu>

Date

  2020-12-29

Copyright

  2020, Center for Reproducible Biomedical Modeling

License

  MIT

class biosimulators_utils.config.Colors(value)

  Bases: `str`, `enum.Enum`

  An enumeration.

  failed = 'red'
  failure = 'red'
  pass = 'green'
  passed = 'green'
  queued = 'cyan'
  running = 'green'
  skip = 'magenta'
  skipped = 'magenta'
  succeeded = 'blue'
  success = 'blue'
  warned = 'yellow'
  warning = 'yellow'

class biosimulators_utils.config.Config(OMEX_METADATA_INPUT_FORMAT=OmexMetadataInputFormat.rdfxml, OMEX_METADATA_OUTPUT_FORMAT=OmexMetadataOutputFormat.rdfxml_abbrev, OMEX_METADATA_SCHEMA=OmexMetadataSchema.biosimulations, VALIDATE_OMEX_MANIFESTS=True, VALIDATE_SEDML=True, VALIDATE_SEDML_MODELS=True, VALIDATE_IMPORTED_MODEL_FILES=True, VALIDATE_OMEX_METADATA=True, VALIDATE_IMAGES=True, VALIDATE_RESULTS=True, ALGORITHM_SUBSTITUTION_POLICY=AlgorithmSubstitutionPolicy.SIMILAR_VARIABLES, COLLECT_COMBINE_ARCHIVE_RESULTS=False, COLLECT_SED_DOCUMENT_RESULTS=False, SAVE_PLOT_DATA=True, REPORT_FORMATS=[<ReportFormat.h5: 'h5'>], VIZ_FORMATS=[<VizFormat.pdf: 'pdf'>], H5_REPORTS_PATH='reports.h5', REPORTS_PATH='reports.zip', PLOTS_PATH='plots.zip', BUNDLE_OUTPUTS=True, KEEP_INDIVIDUAL_OUTPUTS=True, LOG=True, LOG_PATH='log.yml', BIOSIMULATORS_API_ENDPOINT='https://api.biosimulators.org/', BIOSIMULATIONS_API_ENDPOINT='https://api.biosimulations.org/', BIOSIMULATIONS_API_AUTH_ENDPOINT='https://auth.biosimulations.org/oauth/token', BIOSIMULATIONS_API_AUDIENCE='api.biosimulations.org', VERBOSE=False, DEBUG=False)

  Bases: `object`

  Configuration

  OMEX_METADATA_INPUT_FORMAT

    format to validate OMEX Metadata files against

    Type

      `OmexMetadataInputFormat`

  OMEX_METADATA_OUTPUT_FORMAT

    format to export OMEX Metadata files

    Type

      `OmexMetadataOutputFormat`

  OMEX_METADATA_SCHEMA

    schema to validate OMEX Metadata files against

    Type

      `OmexMetadataSchema`

  VALIDATE_OMEX_MANIFESTS

    whether to validate OMEX manifests during the validation of COMBINE/OMEX archives

    Type

      `bool`

  VALIDATE_SEDML

    whether to validate SED-ML files during the validation of COMBINE/OMEX archives

    Type

      `bool`

  VALIDATE_SEDML_MODELS

    whether to validate models referenced by SED-ML files during the validation of COMBINE/OMEX archives

    Type

      `bool`

  VALIDATE_IMPORTED_MODEL_FILES

    whether to validate files imported from models

    Type

      `bool`

  VALIDATE_OMEX_METADATA

    whether to validate OMEX metadata (RDF files) during the validation of COMBINE/OMEX archives

    Type

      `bool`

  VALIDATE_IMAGES

    whether to validate the images in COMBINE/OMEX archives during their validation

    Type

      `bool`

  VALIDATE_RESULTS

    whether to validate the results of simulations following their execution

    Type

      `bool`

  ALGORITHM_SUBSTITUTION_POLICY

    algorithm substition policy

    Type

      `AlgorithmSubstitutionPolicy`

  COLLECT_COMBINE_ARCHIVE_RESULTS

    whether to assemble an in memory data structure with all of the simulation results of COMBINE/OMEX archives

    Type

      `bool`

  COLLECT_SED_DOCUMENT_RESULTS

    whether to assemble an in memory data structure with all of the simulation results of SED documents

    Type

      `bool`

  SAVE_PLOT_DATA

    whether to save data for plots alongside data for reports in CSV/HDF5 files

    Type

      `bool`

  REPORT_FORMATS

    default formats to generate reports in

    Type

      `list` of `ReportFormat`

  VIZ_FORMATS

    default formats to generate plots in

    Type

      `list` of `VizFormat`

  H5_REPORTS_PATH

    path to save reports in HDF5 format relative to base output directory

    Type

      `str`

  REPORTS_PATH

    path to save zip archive of reports relative to base output directory

    Type

      `str`

  PLOTS_PATH

    path to save zip archive of plots relative to base output directory

    Type

      `str`

  BUNDLE_OUTPUTS

    indicates whether bundles of report and plot outputs should be produced

    Type

      `bool`

  KEEP_INDIVIDUAL_OUTPUTS

    indicates whether the individual output files should be kept

    Type

      `bool`

  LOG

    whether to log the execution of a COMBINE/OMEX archive

    Type

      `bool`

  LOG_PATH

    path to save the execution log of a COMBINE/OMEX archive

    Type

      `str`

  BIOSIMULATORS_API_ENDPOINT

    URL for BioSimulators API

    Type

      `str`

  BIOSIMULATIONS_API_ENDPOINT

    URL for BioSimulations API

    Type

      `str`

  BIOSIMULATIONS_API_AUTH_ENDPOINT

    authorization endpoint for the BioSimulations API

    Type

      `str`

  BIOSIMULATIONS_API_AUDIENCE

    audience for the BioSimulations API

    Type

      `str`

  VERBOSE

    whether to display the detailed output of the execution of each task

    Type

      `bool`

  DEBUG

    whether to raise exceptions rather than capturing them

    Type

      `bool`

biosimulators_utils.config.get_app_dirs()

  Get the directories for the application

  Returns

    application directories

  Return type

    `appdirs.AppDirs`

biosimulators_utils.config.get_config()

  Get the configuration

  Returns

    configuration

  Return type

    `Config`

## biosimulators_utils.data_model module

Core data model

Author

  Jonathan Karr <karr@mssm.edu>

Date

  2020-12-06

Copyright

  2020, Center for Reproducible Biomedical Modeling

License

  MIT

class biosimulators_utils.data_model.Identifier(namespace=None, id=None, url=None)

  Bases: `object`

  An identifier

  namespace

    namespace

    Type

      `str`

  id

    id

    Type

      `str`

  url

    URL

    Type

      `str`

  is_equal(other)

    Determine if identifiers are equal

    Parameters

      other (`Identifier`) – another identifier

    Returns

      `True`, if two identifiers are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.data_model.OntologyTerm(namespace=None, id=None, url=None)

  Bases: `biosimulators_utils.data_model.Identifier`

  Term in an ontology

class biosimulators_utils.data_model.Person(given_name=None, other_name=None, family_name=None)

  Bases: `object`

  A person

  given_name

    given/first name

    Type

      `str`

  other_name

    other/middle name

    Type

      `str`

  family_name

    family/last name

    Type

      `str`

  is_equal(other)

    Determine if two authors are equal

    Parameters

      other (`Person`) – another author

    Returns

      `True`, if two authors are equal

    Return type

      `bool`

  to_tuple()

    Tuple representation of a person

    Returns

      tuple representation of a person

    Return type

      `tuple` of `str`

class biosimulators_utils.data_model.ValueType(value)

  Bases: `str`, `enum.Enum`

  A type of value (e.g., of a model attribute change or algorithm parameter change)

  any = 'any'
  boolean = 'boolean'
  float = 'float'
  integer = 'integer'
  kisao_id = 'kisaoId'
  list = 'list'
  object = 'object'
  string = 'string'

## biosimulators_utils.exceptions module

Standard exceptions issued by biosimulation tools

Author

  Jonathan Karr <karr@mssm.edu>

Date

  2020-12-29

Copyright

  2020, Center for Reproducible Biomedical Modeling

License

  MIT

exception biosimulators_utils.exceptions.BioSimulatorsException

  Bases: `Exception`

  Base class for simulator exceptions

## biosimulators_utils.image module

Utilities for working with Docker images

Author

  Jonathan Karr <karr@mssm.edu>

Date

  2020-12-06

Copyright

  2020, Center for Reproducible Biomedical Modeling

License

  MIT

biosimulators_utils.image.convert_docker_image_to_singularity(docker_image, singularity_filename=None)

  Convert a locally cached Docker image to a Singularity image.

  Remotely published Docker images (e.g., images published to Docker Hub, GitHub Container Registry, etc.) should first be pulled (e.g., using `pull_docker_image` or `docker pull {image}`).

  Parameters

    - docker_image (`str`) –

    - singularity_filename (`str`, optional) – file name for saving Singularity image

  Returns

    path where Singularity image was saved

  Return type

    `str`

biosimulators_utils.image.get_docker_image(docker_client, tag, pull=True)

  Get a Docker image for a simulator

  Parameters

    - docker_client (`docker.client.DockerClient`) – Docker client

    - tag (`str`) – tag (e.g., `biosimulators/tellurium`) or URL (`ghcr.io/biosimulators/tellurium`) for a Docker image of a simulator

  Returns

    Docker image

  Return type

    `docker.models.images.Image`

biosimulators_utils.image.login_to_docker_registry(registry, username, password)

  Login to a Docker registry

  Parameters

    - registry (`str`) – registry (e.g., ghcr.io)

    - username (`str`) – user name

    - password (`str`) – password

  Returns

    Docker client

  Return type

    `docker.client.DockerClient`

biosimulators_utils.image.pull_docker_image(docker_client, url)

  Pull Docker image

  Parameters

    - docker_client (`docker.client.DockerClient`) – Docker client

    - url (`str`) – URL for Docker image

  Returns

    Docker image

  Return type

    `docker.models.images.Image`

biosimulators_utils.image.tag_and_push_docker_image(docker_client, image, tag)

  Tag and push Docker image

  Parameters

    - docker_client (`docker.client.DockerClient`) – Docker client

    - image (`docker.models.images.Image`) – Docker image

    - tag (`str`) – tag

## biosimulators_utils.warnings module

Standard warnings issued by biosimulation tools

Author

  Jonathan Karr <karr@mssm.edu>

Date

  2020-12-29

Copyright

  2020, Center for Reproducible Biomedical Modeling

License

  MIT

exception biosimulators_utils.warnings.BioSimulatorsWarning

  Bases: `UserWarning`

  Base class for simulator warnings

biosimulators_utils.warnings.warn(message, category)

  Issue a warning in a color

  Parameters

    - message (`str`) – message

    - category (`type`) – category