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.OmexMetaInputFormat(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.OmexMetaOutputFormat(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.OmexMetaSchema(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, root_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

  • root_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, format=OmexMetaInputFormat.rdfxml, archive=None, working_dir=None)[source]
Read the metadata about a COMBINE/OMEX archive in an OMEX Metadata file into a dictionary

with BioSimulations schema

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

  • format (OmexMetaInputFormat, optional) – format for filename

  • archive (CombineArchive, optional) – parent COMBINE archive

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

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, format=OmexMetaOutputFormat.rdfxml_abbrev)[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

  • format (OmexMetaOutputFormat, optional) – format for filename

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, format=OmexMetaInputFormat.rdfxml, archive=None, working_dir=None)[source]

Read an OMEX Metadata file into a list of triples

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

  • format (OmexMetaInputFormat, optional) – format for filename

  • archive (CombineArchive, optional) – parent COMBINE archive

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

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, format=OmexMetaOutputFormat.rdfxml)[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

  • format (OmexMetaOutputFormat, optional) – format for filename

biosimulators_utils.omex_meta.io.read_omex_meta_file(filename, schema, format=OmexMetaInputFormat.rdfxml, archive=None, working_dir=None)[source]

Read an OMEX Metadata file

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

  • schema (OmexMetaSchema) – schema to parse filename into

  • format (OmexMetaInputFormat, optional) – format for filename

  • archive (CombineArchive, optional) – parent COMBINE archive

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

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, schema)[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

  • schema (OmexMetaSchema) – schema to parse filename into

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, schema, filename, format=OmexMetaOutputFormat.rdfxml_abbrev)[source]

Write an OMEX Metadata file

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

  • schema (OmexMetaSchema) – schema for content into

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

  • format (OmexMetaOutputFormat, optional) – format for filename

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=OmexMetaOutputFormat.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 (OmexMetaOutputFormat, optional) – format for metadata_filename

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 file in a COMBINE/OMEX archive

Parameters
  • metadata (dict) – BioSimulations metadata

  • 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