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

Bases: object

A citation

title[source]#

title

Type:

str

authors[source]#

authors

Type:

str

journal[source]#

journal

Type:

str

volume[source]#

volume

Type:

str

issue[source]#

issue

Type:

str

pages[source]#

pages

Type:

str

year[source]#

year

Type:

int

identifiers[source]#

identifiers

Type:

list of Identifier

is_equal(other)[source]#

Determine if citations are equal

Parameters:

other (Citation) – another citation

Returns:

True, if two citations are equal

Return type:

bool

to_tuple()[source]#

Get a tuple representation

Returns:

tuple representation

Return type:

tuple of str

class biosimulators_utils.biosimulations.data_model.ExternalReferences(identifiers=None, citations=None)[source]#

Bases: object

Identifiers and citations of an object

identifiers[source]#

identifiers

Type:

list of Identifier

citations[source]#

citations

Type:

list of Citation

is_equal(other)[source]#

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

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

Bases: object

Metadata about an object

description[source]#

description

Type:

str

tags[source]#

tags

Type:

list of str

authors[source]#

authors

Type:

list of Person

references[source]#

identifiers and citations

Type:

ExternalReferences

license[source]#

license

Type:

OntologyTerm

created[source]#

created date-time

Type:

datetime.datetime

updated[source]#

updated date-time

Type:

datetime.datetime

is_equal(other)[source]#

Determine if metadata are equal

Parameters:

other (Metadata) – another metadata

Returns:

True, if two metadata are equal

Return type:

bool

to_tuple()[source]#

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

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

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

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

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

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

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

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

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

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