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
An format for reading an OMEX Metadata file
- class biosimulators_utils.omex_meta.data_model.OmexMetadataOutputFormat(value)[source]#
Bases:
str
,Enum
An format for writing an OMEX Metadata file
- class biosimulators_utils.omex_meta.data_model.OmexMetadataSchema(value)[source]#
Bases:
str
,Enum
Schema for OMEX Metadata documents
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:
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
ofdict
) – 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
ofdict
) – representation of the OMEX Meta file as list of triplescombine_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
ofobject
- 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
orlist
ofstr
) – path or paths to OMEX Metadata filesarchive (
CombineArchive
, optional) – parent COMBINE archiveworking_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/OMEXarchive in an OMEX Metadata file as a dictionary with BioSimulations schema
nested
list
ofstr
: nested list of errors with the OMEX Metadata filenested
list
ofstr
: nested list of warnings with the OMEX Metadata file
- Return type:
tuple
- class biosimulators_utils.omex_meta.io.BiosimulationsOmexMetaWriter[source]#
Bases:
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
ofdict
) – representation of the metadata about the elements in a COMBINE/OMEX archive in an OMEX Metadata filefilename (
str
) – path to save OMEX Metadata fileconfig (
Config
, optional) – configuration
- class biosimulators_utils.omex_meta.io.TriplesOmexMetaReader[source]#
Bases:
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
orlist
ofstr
) – path or paths to OMEX Metadata filesarchive (
CombineArchive
, optional) – parent COMBINE archiveworking_dir (
str
, optional) – working directory (e.g., directory of the parent COMBINE/OMEX archive)config (
Config
, optional) – configuration
- Returns:
list
ofdict
: representation of the OMEX Metadata file as list of triplesnested
list
ofstr
: nested list of errors with the OMEX Metadata filenested
list
ofstr
: nested list of warnings with the OMEX Metadata file
- Return type:
tuple
- class biosimulators_utils.omex_meta.io.TriplesOmexMetaWriter[source]#
Bases:
OmexMetaWriter
Utility for writing a list of triples to an OMEX Metadata file
- 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
orlist
ofstr
) – path or paths to OMEX Metadata filesarchive (
CombineArchive
, optional) – parent COMBINE archiveworking_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 inschema
nested
list
ofstr
: nested list of errors with the OMEX Metadata filenested
list
ofstr
: 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 archivearchive_dirname (
str
) – directory with the content of the archiveconfig (
Config
, optional) – configuration
- Returns:
object
: representation of the OMEX Metadata file inschema
nested
list
ofstr
: nested list of errors with the OMEX Metadata filenested
list
ofstr
: nested list of warnings with the OMEX Metadata file
- Return type:
tuple
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, encoding='utf-8', archive_uri=None)[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 aboutmetadata_filename (
str
) – path to save metadatametadata_format (
OmexMetadataOutputFormat
, optional) – format formetadata_filename
encoding (
str
, optional) – encoding (e.g.,utf-8
)
- 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 archivearchive_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 archivearchive_uri (
str
, optional) – URI for the parent COMBINE/OMEX archive
- Returns:
tuple:
str
: global URI for the content itemstr
: 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
ofdict
) – BioSimulations metadata about 1 or more URIsarchive (
CombineArchive
, optional) – parent COMBINE archiveworking_dir (
str
, optional) – working directory (e.g., directory of the parent COMBINE/OMEX archive)
- Returns:
nested
list
ofstr
: nested list of errors with the metadatanested
list
ofstr
: 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 metadatavalidate_minimal_metadata (
bool
, optional) – whether to check that all required metadata attributes are definedarchive (
CombineArchive
, optional) – parent COMBINE archiveworking_dir (
str
, optional) – working directory (e.g., directory of the parent COMBINE/OMEX archive)
- Returns:
nested
list
ofstr
: nested list of errors with the metadatanested
list
ofstr
: nested list of warnings with the metadata
- Return type:
tuple