biosimulators_utils.omex_meta package

Submodules

biosimulators_utils.omex_meta.data_model module

Data model for working with OMEX Metadata

Author

Jonathan Karr <karr@mssm.edu>

Date

2021-06-23

Copyright

2021, Center for Reproducible Biomedical Modeling

License

MIT

class biosimulators_utils.omex_meta.data_model.OmexMetadataInputFormat(value)[source]

Bases: str, enum.Enum

An format for reading an OMEX Metadata file

nquads = 'nquads'[source]
ntriples = 'ntriples'[source]
rdfa = 'rdfa'[source]
rdfxml = 'rdfxml'[source]
turtle = 'turtle'[source]
class biosimulators_utils.omex_meta.data_model.OmexMetadataOutputFormat(value)[source]

Bases: str, enum.Enum

An format for writing an OMEX Metadata file

dot = 'dot'[source]
html = 'html'[source]
json = 'json'[source]
json_triples = 'json-triples'[source]
nquads = 'nquads'[source]
ntriples = 'ntriples'[source]
rdfxml = 'rdfxml'[source]
rdfxml_abbrev = 'rdfxml-abbrev'[source]
rdfxml_xmp = 'rdfxml-xmp'[source]
turtle = 'turtle'[source]
class biosimulators_utils.omex_meta.data_model.OmexMetadataSchema(value)[source]

Bases: str, enum.Enum

Schema for OMEX Metadata documents

biosimulations = 'BioSimulations'[source]
rdf_triples = 'rdf_triples'[source]
class biosimulators_utils.omex_meta.data_model.Triple(subject, predicate, object)[source]

Bases: object

An RDF triple

subject[source]

subject

Type

rdflib.term.BNode, rdflib.term.Literal, or rdflib.term.URIRef

predicate[source]

predict

Type

rdflib.term.BNode, rdflib.term.Literal, or rdflib.term.URIRef

object[source]

object

Type

rdflib.term.BNode, rdflib.term.Literal, or rdflib.term.URIRef

biosimulators_utils.omex_meta.io module

Methods for reading and writing OMEX Metadata files

Author

Jonathan Karr <karr@mssm.edu>

Date

2021-06-23

Copyright

2021, Center for Reproducible Biomedical Modeling

License

MIT

class biosimulators_utils.omex_meta.io.BiosimulationsOmexMetaReader[source]

Bases: biosimulators_utils.omex_meta.io.OmexMetaReader

Utility for reading the metadata about a COMBINE/OMEX archive in an OMEX Metadata file into a dictionary with BioSimulations schema

classmethod get_combine_archive_uri(triples)[source]

Get the URI used to the describe the COMBINE/OMEX archive in a list of RDF triples

Parameters

triples (list of dict) – representation of the OMEX Metadata file as list of triples

Returns

URI used to the describe the COMBINE/OMEX archive in the list of triples

Return type

str

classmethod parse_triples_to_schema(triples, combine_archive_uri)[source]

Convert a graph of RDF triples into BioSimulations’ metadata schema

Parameters
  • triples (list of dict) – representation of the OMEX Meta file as list of triples

  • combine_archive_uri (str) – URI used to the describe the COMBINE/OMEX archive in the list of triples

Returns

representation of the triples in BioSimulations’ metadata schema

Return type

list of object

run(filename_or_filenames, archive=None, working_dir=None, config=None)[source]
Read the metadata about a COMBINE/OMEX archive in an OMEX Metadata file into a dictionary

with BioSimulations schema

Parameters
  • filename_or_filenames (str or list of str) – path or paths to OMEX Metadata files

  • archive (CombineArchive, optional) – parent COMBINE archive

  • working_dir (str, optional) – working directory (e.g., directory of the parent COMBINE/OMEX archive)

  • config (Config, optional) – configuration

Returns

  • dict: representation of the metadata about a COMBINE/OMEX

    archive in an OMEX Metadata file as a dictionary with BioSimulations schema

  • nested list of str: nested list of errors with the OMEX Metadata file

  • nested list of str: nested list of warnings with the OMEX Metadata file

Return type

tuple

class biosimulators_utils.omex_meta.io.BiosimulationsOmexMetaWriter[source]

Bases: biosimulators_utils.omex_meta.io.OmexMetaWriter

Utility for writing the metadata about a COMBINE/OMEX archive to an OMEX Metadata file

run(el_metadatas, filename, config=None)[source]

Write an OMEX Metadata file

Parameters
  • el_metadatas (list of dict) – representation of the metadata about the elements in a COMBINE/OMEX archive in an OMEX Metadata file

  • filename (str) – path to save OMEX Metadata file

  • config (Config, optional) – configuration

class biosimulators_utils.omex_meta.io.TriplesOmexMetaReader[source]

Bases: biosimulators_utils.omex_meta.io.OmexMetaReader

Utility for reading an OMEX Metadata file into a list of triples

run(filename_or_filenames, archive=None, working_dir=None, config=None)[source]

Read an OMEX Metadata file into a list of triples

Parameters
  • filename_or_filenames (str or list of str) – path or paths to OMEX Metadata files

  • archive (CombineArchive, optional) – parent COMBINE archive

  • working_dir (str, optional) – working directory (e.g., directory of the parent COMBINE/OMEX archive)

  • config (Config, optional) – configuration

Returns

  • list of dict: representation of the OMEX Metadata file as list of triples

  • nested list of str: nested list of errors with the OMEX Metadata file

  • nested list of str: nested list of warnings with the OMEX Metadata file

Return type

tuple

class biosimulators_utils.omex_meta.io.TriplesOmexMetaWriter[source]

Bases: biosimulators_utils.omex_meta.io.OmexMetaWriter

Utility for writing a list of triples to an OMEX Metadata file

run(triples, filename, namespaces=None, config=None)[source]

Write a list of triples to an OMEX Metadata file

Parameters
  • triples (list of Triple) – representation of the OMEX Metadata file as list of triples

  • filename (str) – path to OMEX Metadata file

  • config (Config, optional) – configuration

biosimulators_utils.omex_meta.io.read_omex_meta_file(filename_or_filenames, archive=None, working_dir=None, config=None)[source]

Read an OMEX Metadata file

Parameters
  • filename_or_filenames (str or list of str) – path or paths to OMEX Metadata files

  • archive (CombineArchive, optional) – parent COMBINE archive

  • working_dir (str, optional) – working directory (e.g., directory of the parent COMBINE/OMEX archive)

  • config (Config, optional) – configuration

Returns

  • object: representation of the OMEX Metadata file in schema

  • nested list of str: nested list of errors with the OMEX Metadata file

  • nested list of str: nested list of warnings with the OMEX Metadata file

Return type

tuple

biosimulators_utils.omex_meta.io.read_omex_meta_files_for_archive(archive, archive_dirname, config=None)[source]

Read all of the OMEX Metadata files in an archive

Parameters
  • archive (CombineArchive) – COMBINE/OMEX archive

  • archive_dirname (str) – directory with the content of the archive

  • config (Config, optional) – configuration

Returns

  • object: representation of the OMEX Metadata file in schema

  • nested list of str: nested list of errors with the OMEX Metadata file

  • nested list of str: nested list of warnings with the OMEX Metadata file

Return type

tuple

biosimulators_utils.omex_meta.io.write_omex_meta_file(content, filename, config=None)[source]

Write an OMEX Metadata file

Parameters
  • content (object) – representation of the OMEX Metadata file in schema

  • filename (str) – path to save OMEX Metadata file

  • config (Config, optional) – configuration

biosimulators_utils.omex_meta.utils module

Methods for generating OMEX metdata files for models

Author

Jonathan Karr <karr@mssm.edu>

Date

2021-07-19

Copyright

2021, Center for Reproducible Biomedical Modeling

License

MIT

biosimulators_utils.omex_meta.utils.build_omex_meta_file_for_model(model_filename, metadata_filename, metadata_format=OmexMetadataOutputFormat.rdfxml_abbrev)[source]

Create an OMEX metadata file for a model encoded in CellML or SBML. Also add missing metadata ids to the model file.

Parameters
  • model_filename (str) – path to model to extract metadata about

  • metadata_filename (str) – path to save metadata

  • metadata_format (OmexMetadataOutputFormat, optional) – format for metadata_filename

biosimulators_utils.omex_meta.utils.get_global_combine_archive_content_uri(content_rel_uri, archive_uri=None)[source]

Get a global URI for a content item of a COMBINE/OMEX archive

Parameters
  • content_rel_uri (str) – URI for a content item of a COMBINE/OMEX archive, relative to its parent archive

  • archive_uri (str, optional) – URI for the parent COMBINE/OMEX archive

Returns

global URI for the content item

Return type

str

biosimulators_utils.omex_meta.utils.get_local_combine_archive_content_uri(content_uri, archive_uri=None)[source]

Get the relative URI for a content item of a COMBINE/OMEX archive

Parameters
  • content_uri (str) – global URI for a content item of a COMBINE/OMEX archive

  • archive_uri (str, optional) – URI for the parent COMBINE/OMEX archive

Returns

tuple:

  • str: global URI for the content item

  • str: URI for the parent COMBINE/OMEX archive

biosimulators_utils.omex_meta.validation module

Methods for validate BioSimulations metadata

Author

Jonathan Karr <karr@mssm.edu>

Date

2021-06-23

Copyright

2021, Center for Reproducible Biomedical Modeling

License

MIT

biosimulators_utils.omex_meta.validation.validate_biosimulations_metadata(metadata, archive=None, working_dir=None)[source]

Validate BioSimulations metadata for a COMBINE/OMEX archive

Parameters
  • metadata (list of dict) – BioSimulations metadata about 1 or more URIs

  • archive (CombineArchive, optional) – parent COMBINE archive

  • working_dir (str, optional) – working directory (e.g., directory of the parent COMBINE/OMEX archive)

Returns

  • nested list of str: nested list of errors with the metadata

  • nested list of str: nested list of warnings with the metadata

Return type

tuple

biosimulators_utils.omex_meta.validation.validate_biosimulations_metadata_for_uri(metadata, validate_minimal_metadata=False, archive=None, working_dir=None)[source]

Validate BioSimulations metadata for a file in a COMBINE/OMEX archive

Parameters
  • metadata (dict) – BioSimulations metadata

  • validate_minimal_metadata (bool, optional) – whether to check that all required metadata attributes are defined

  • archive (CombineArchive, optional) – parent COMBINE archive

  • working_dir (str, optional) – working directory (e.g., directory of the parent COMBINE/OMEX archive)

Returns

  • nested list of str: nested list of errors with the metadata

  • nested list of str: nested list of warnings with the metadata

Return type

tuple