biosimulators_utils.biosimulations package — BioSimulators utils 0.1.154 documentation

# biosimulators_utils.biosimulations package

## Submodules

## biosimulators_utils.biosimulations.data_model module

Data model for BioSimulations metadata

Author

  Jonathan Karr <karr@mssm.edu>

Date

  2020-12-06

Copyright

  2020, Center for Reproducible Biomedical Modeling

License

  MIT

class biosimulators_utils.biosimulations.data_model.Citation(title=None, authors=None, journal=None, volume=None, issue=None, pages=None, year=None, identifiers=None)

  Bases: `object`

  A citation

  title

    title

    Type

      `str`

  authors

    authors

    Type

      `str`

  journal

    journal

    Type

      `str`

  volume

    volume

    Type

      `str`

  issue

    issue

    Type

      `str`

  pages

    pages

    Type

      `str`

  year

    year

    Type

      `int`

  identifiers

    identifiers

    Type

      `list` of `Identifier`

  is_equal(other)

    Determine if citations are equal

    Parameters

      other (`Citation`) – another citation

    Returns

      `True`, if two citations are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.biosimulations.data_model.ExternalReferences(identifiers=None, citations=None)

  Bases: `object`

  Identifiers and citations of an object

  identifiers

    identifiers

    Type

      `list` of `Identifier`

  citations

    citations

    Type

      `list` of `Citation`

  is_equal(other)

    Determine if collections of external references are equal

    Parameters

      other (`ExternalReferences`) – another collection of external referencse

    Returns

      `True`, if two collections of external references are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

class biosimulators_utils.biosimulations.data_model.Metadata(description=None, tags=None, authors=None, references=None, license=None, created=None, updated=None)

  Bases: `object`

  Metadata about an object

  description

    description

    Type

      `str`

  tags

    tags

    Type

      `list` of `str`

  authors

    authors

    Type

      `list` of `Person`

  references

    identifiers and citations

    Type

      `ExternalReferences`

  license

    license

    Type

      `OntologyTerm`

  created

    created date-time

    Type

      `datetime.datetime`

  updated

    updated date-time

    Type

      `datetime.datetime`

  is_equal(other)

    Determine if metadata are equal

    Parameters

      other (`Metadata`) – another metadata

    Returns

      `True`, if two metadata are equal

    Return type

      `bool`

  to_tuple()

    Get a tuple representation

    Returns

      tuple representation

    Return type

      `tuple` of `str`

## biosimulators_utils.biosimulations.utils module

Utility methods for working with BioSimulations and runBioSimulations

Author

  Jonathan Karr <karr@mssm.edu>

Date

  2021-01-30

Copyright

  2021, Center for Reproducible Biomedical Modeling

License

  MIT

biosimulators_utils.biosimulations.utils.get_api_session(num_retries=10, backoff_factor=0.25, config=None)

  Get a session for the BioSimulations API with retrying

  Parameters

    - num_retries (`int`) – number of times to retry each query

    - backoff_factor (`float`) – initial delay between retries

    - config (`Config`, optional) – configuration

  Returns

    session

  Return type

    `requests.Session`

biosimulators_utils.biosimulations.utils.get_authorization_for_client(id, secret, config=None)

  Get the authorization for a client of the BioSimulations API

  Parameters

    - id (`str`) – id of the API client

    - secret (`str`) – secret for API client

    - config (`Config`, optional) – configuration

  Returns

    authorization for the client

  Return type

    `str`

biosimulators_utils.biosimulations.utils.get_file_extension_combine_uri_map(config=None)

  Get a map from file extensions to URIs for use with manifests of COMBINE/OMEX archives

  Parameters

    config (`Config`, optional) – configuration

  Returns

    which maps extensions to lists of associated URIs

  Return type

    `dict`

biosimulators_utils.biosimulations.utils.get_formats(config=None)

  Get information about the file formats used by BioSimulations

  Parameters

    config (`Config`, optional) – configuration

  Returns

    information about the file formats used by BioSimulations

  Return type

    `list` of `dict`

biosimulators_utils.biosimulations.utils.get_ontology_terms(ontology, config=None)

  Get the terms of an ontology used by BioSimulations

  Parameters

    - ontology (`str`) – ontology such as `EDAM`, `KISAO`, `Linguist`, `SBO`, `SIO`, or `SPDX`

    - config (`Config`, optional) – configuration

  Returns

    ontology terms

  Return type

    `list` of `dict`

biosimulators_utils.biosimulations.utils.get_published_project(project_id, config=None)

  Publish a project to BioSimulations

  Parameters

    - project_id (`str`) – desired id for the published project

    - config (`Config`, optional) – configuration

  Returns

    in schema `Project` or `None` if the project doesn’t exist

  Return type

    `dict`

biosimulators_utils.biosimulations.utils.publish_simulation_project(run_id, project_id, overwrite=True, auth=None, config=None)

  Publish a project to BioSimulations

  Parameters

    - run_id (`str`) – id of the simulation run to publish

    - project_id (`str`) – desired id for the published project

    - (obj (auth) – str, optional): authorization for the BioSimulations; needed to claim edit the published project in the future

    - config (`Config`, optional) – configuration

biosimulators_utils.biosimulations.utils.run_simulation_project(name, filename_or_url, simulator, simulator_version='latest', cpus=1, memory=8, max_time=20, env_vars=None, purpose='other', email=None, project_id=None, auth=None, config=None)

  Submit a simulation project (COMBINE/OMEX archive) to runBioSimulations and, optionally, BioSimulations

  Parameters

    - name (`str`) – name for the simulation run

    - filename_or_url (`str`) – path or URL to COMBINE/OMEX archive

    - simulator (`str`) – BioSimulators id for simulator

    - simulator_version (`str`, optional) – simulator version

    - cpus (`int`, optional) – CPUs

    - memory (`float`, optional) – maximum memory in GB

    - max_time (`float`, optional) – maximum execution time in minutes

    - env_vars (`list` of `dict`, optional) – environment variables to execute the COMBINE/OMEX archive. Each element should have two string-valued keys `key` and `value`

    - purpose (`str`, optional) – purpose (`academic` or `other`)

    - email (`str`, optional) – email to receive a notification upon completion of the simulation run

    - project_id (`str`, optional) – id to publish the run as to BioSimulations

    - (obj (auth) – str, optional): authorization for the BioSimulations; needed to claim edit the published project in the future

    - config (`Config`, optional) – configuration

  Returns

    runBioSimulations id

  Return type

    `str`

biosimulators_utils.biosimulations.utils.validate_biosimulations_api_response(response, failure_introductory_message, exception_type=None)

  Validate a response from one of BioSimulation’s APIs.

  Parameters

    - response (`requests.models.Response`) – API response

    - failure_introductory_message (`str`) – introductory message for failures

    - exception_type (`type`, optional) – type of exception to throw

  Raises

    requests.RequestException –