biosimulators_utils package#

Subpackages#

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)[source]#

Bases: str, Enum

An enumeration.

__format__(format_spec)[source]#

Returns format using actual value type unless __str__ has been overridden.

failed = 'red'[source]#
failure = 'red'[source]#
pass = 'green'[source]#
passed = 'green'[source]#
queued = 'cyan'[source]#
running = 'green'[source]#
skip = 'magenta'[source]#
skipped = 'magenta'[source]#
succeeded = 'blue'[source]#
success = 'blue'[source]#
warned = 'yellow'[source]#
warning = 'yellow'[source]#
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], VIZ_FORMATS=[VizFormat.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)[source]#

Bases: object

Configuration

OMEX_METADATA_INPUT_FORMAT[source]#

format to validate OMEX Metadata files against

Type:

OmexMetadataInputFormat

OMEX_METADATA_OUTPUT_FORMAT[source]#

format to export OMEX Metadata files

Type:

OmexMetadataOutputFormat

OMEX_METADATA_SCHEMA[source]#

schema to validate OMEX Metadata files against

Type:

OmexMetadataSchema

VALIDATE_OMEX_MANIFESTS[source]#

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

Type:

bool

VALIDATE_SEDML[source]#

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

Type:

bool

VALIDATE_SEDML_MODELS[source]#

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

Type:

bool

VALIDATE_IMPORTED_MODEL_FILES[source]#

whether to validate files imported from models

Type:

bool

VALIDATE_OMEX_METADATA[source]#

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

Type:

bool

VALIDATE_IMAGES[source]#

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

Type:

bool

VALIDATE_RESULTS[source]#

whether to validate the results of simulations following their execution

Type:

bool

ALGORITHM_SUBSTITUTION_POLICY[source]#

algorithm substition policy

Type:

AlgorithmSubstitutionPolicy

COLLECT_COMBINE_ARCHIVE_RESULTS[source]#

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

Type:

bool

COLLECT_SED_DOCUMENT_RESULTS[source]#

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

Type:

bool

SAVE_PLOT_DATA[source]#

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

Type:

bool

REPORT_FORMATS[source]#

default formats to generate reports in

Type:

list of ReportFormat

VIZ_FORMATS[source]#

default formats to generate plots in

Type:

list of VizFormat

H5_REPORTS_PATH[source]#

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

Type:

str

REPORTS_PATH[source]#

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

Type:

str

PLOTS_PATH[source]#

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

Type:

str

BUNDLE_OUTPUTS[source]#

indicates whether bundles of report and plot outputs should be produced

Type:

bool

KEEP_INDIVIDUAL_OUTPUTS[source]#

indicates whether the individual output files should be kept

Type:

bool

LOG[source]#

whether to log the execution of a COMBINE/OMEX archive

Type:

bool

LOG_PATH[source]#

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

Type:

str

BIOSIMULATORS_API_ENDPOINT[source]#

URL for BioSimulators API

Type:

str

BIOSIMULATIONS_API_ENDPOINT[source]#

URL for BioSimulations API

Type:

str

BIOSIMULATIONS_API_AUTH_ENDPOINT[source]#

authorization endpoint for the BioSimulations API

Type:

str

BIOSIMULATIONS_API_AUDIENCE[source]#

audience for the BioSimulations API

Type:

str

VERBOSE[source]#

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

Type:

bool

DEBUG[source]#

whether to raise exceptions rather than capturing them

Type:

bool

biosimulators_utils.config.get_app_dirs()[source]#

Get the directories for the application

Returns:

application directories

Return type:

appdirs.AppDirs

biosimulators_utils.config.get_config()[source]#

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)[source]#

Bases: object

An identifier

namespace[source]#

namespace

Type:

str

id[source]#

id

Type:

str

url[source]#

URL

Type:

str

is_equal(other)[source]#

Determine if identifiers are equal

Parameters:

other (Identifier) – another identifier

Returns:

True, if two identifiers are equal

Return type:

bool

to_tuple()[source]#

Get a tuple representation

Returns:

tuple representation

Return type:

tuple of str

class biosimulators_utils.data_model.OntologyTerm(namespace=None, id=None, url=None)[source]#

Bases: Identifier

Term in an ontology

class biosimulators_utils.data_model.Person(given_name=None, other_name=None, family_name=None)[source]#

Bases: object

A person

given_name[source]#

given/first name

Type:

str

other_name[source]#

other/middle name

Type:

str

family_name[source]#

family/last name

Type:

str

is_equal(other)[source]#

Determine if two authors are equal

Parameters:

other (Person) – another author

Returns:

True, if two authors are equal

Return type:

bool

to_tuple()[source]#

Tuple representation of a person

Returns:

tuple representation of a person

Return type:

tuple of str

class biosimulators_utils.data_model.ValueType(value)[source]#

Bases: str, Enum

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

__format__(format_spec)[source]#

Returns format using actual value type unless __str__ has been overridden.

any = 'any'[source]#
boolean = 'boolean'[source]#
float = 'float'[source]#
integer = 'integer'[source]#
kisao_id = 'kisaoId'[source]#
list = 'list'[source]#
object = 'object'[source]#
string = 'string'[source]#

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[source]#

Bases: Exception

Base class for simulator exceptions

biosimulators_utils.globals module#

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_url: str, singularity_filename: str | None = None)[source]#

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_url (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: DockerClient, tag: str, pull: bool = True) Image[source]#

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: str, username: str, password: str)[source]#

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)[source]#

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)[source]#

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[source]#

Bases: UserWarning

Base class for simulator warnings

biosimulators_utils.warnings.warn(message, category)[source]#

Issue a warning in a color

Parameters:
  • message (str) – message

  • category (type) – category