biosimulators_utils.combine package#

Submodules#

biosimulators_utils.combine.data_model module#

Data model for COMBINE/OMEX archives

Author:

Jonathan Karr <karr@mssm.edu>

Date:

2020-12-06

Copyright:

2020, Center for Reproducible Biomedical Modeling

License:

MIT

class biosimulators_utils.combine.data_model.CombineArchive(contents=None)[source]#

Bases: CombineArchiveBase

A COMBINE/OMEX archive

contents[source]#

contents of the archive

Type:

list of CombineArchiveContent

get_master_content()[source]#

Get the master content of an archive

Returns:

master content

Return type:

list of CombineArchiveContent

is_equal(other)[source]#

Determine if two content items are equal

Parameters:

other (CombineArchiveContent) – another content item

Returns:

True, if two archives are equal

Return type:

bool

to_tuple()[source]#

Tuple representation of a COMBINE/OMEX archive

Returns:

tuple representation of a COMBINE/OMEX archive

Return type:

tuple of str

class biosimulators_utils.combine.data_model.CombineArchiveBase[source]#

Bases: ABC

A COMBINE/OMEX archive

class biosimulators_utils.combine.data_model.CombineArchiveContent(location=None, format=None, master=False)[source]#

Bases: CombineArchiveBase

A content item (e.g., file) in a COMBINE/OMEX archive

location[source]#

path to the content

Type:

str

format[source]#

URL for the specification of the format of the content

Type:

str

master[source]#

True, if the content is the “primary” content of the parent archive

Type:

bool

is_equal(other)[source]#

Determine if two content items are equal

Parameters:

other (CombineArchiveContent) – another content item

Returns:

True, if two content items are equal

Return type:

bool

to_tuple()[source]#

Tuple representation of a content item of a COMBINE/OMEX archive

Returns:

tuple representation of a content item of a COMBINE/OMEX archive

Return type:

tuple of str

class biosimulators_utils.combine.data_model.CombineArchiveContentFormat(value)[source]#

Bases: str, Enum

Format for the content of COMBINE/OMEX archives

ACTIONSCRIPT = 'http://purl.org/NET/mediatypes/text/x-actionscript'[source]#
ADOBE_FLASH = 'http://purl.org/NET/mediatypes/application/x-shockwave-flash'[source]#
AI = 'http://purl.org/NET/mediatypes/application/pdf'[source]#
BMP = 'http://purl.org/NET/mediatypes/image/bmp'[source]#
BNGL = 'http://purl.org/NET/mediatypes/text/bngl+plain'[source]#
BOURNE_SHELL = 'http://purl.org/NET/mediatypes/text/x-sh'[source]#
BioPAX = 'http://identifiers.org/combine.specifications/biopax'[source]#
C = 'http://purl.org/NET/mediatypes/text/x-c'[source]#
CPP_HEADER = 'http://purl.org/NET/mediatypes/text/x-c++hdr'[source]#
CPP_SOURCE = 'http://purl.org/NET/mediatypes/text/x-c++src'[source]#
CSS = 'http://purl.org/NET/mediatypes/text/css'[source]#
CSV = 'http://purl.org/NET/mediatypes/text/csv'[source]#
CellML = 'http://identifiers.org/combine.specifications/cellml'[source]#
CopasiML = 'http://purl.org/NET/mediatypes/application/x-copasi'[source]#
DLL = 'http://purl.org/NET/mediatypes/application/vnd.microsoft.portable-executable'[source]#
DOC = 'http://purl.org/NET/mediatypes/application/msword'[source]#
DOCX = 'http://purl.org/NET/mediatypes/application/vnd.openxmlformats-officedocument.wordprocessingml.document'[source]#
EPS = 'http://purl.org/NET/mediatypes/application/postscript'[source]#
Escher = 'http://purl.org/NET/mediatypes/application/escher+json'[source]#
GENESIS = 'http://purl.org/NET/mediatypes/text/x-genesis'[source]#
GIF = 'http://purl.org/NET/mediatypes/image/gif'[source]#
GINML = 'http://purl.org/NET/mediatypes/application/ginml+xml'[source]#
GMSH_MESH = 'http://purl.org/NET/mediatypes/model/mesh'[source]#
GRAPHML = 'http://purl.org/NET/mediatypes/application/graphml+xml'[source]#
HDF5 = 'http://purl.org/NET/mediatypes/application/x-hdf'[source]#
HOC = 'http://purl.org/NET/mediatypes/text/x-hoc'[source]#
HTML = 'http://purl.org/NET/mediatypes/text/html'[source]#
ICO = 'http://purl.org/NET/mediatypes/image/x-icon'[source]#
INI = 'http://purl.org/NET/mediatypes/text/x-ini'[source]#
IPython_Notebook = 'http://purl.org/NET/mediatypes/application/x-ipynb+json'[source]#
JAVASCRIPT = 'http://purl.org/NET/mediatypes/text/javascript'[source]#
JAVA_ARCHIVE = 'http://purl.org/NET/mediatypes/application/java-archive'[source]#
JAVA_CLASS = 'http://purl.org/NET/mediatypes/application/java-vm'[source]#
JAVA_SOURCE = 'http://purl.org/NET/mediatypes/text/x-java'[source]#
JPEG = 'http://purl.org/NET/mediatypes/image/jpeg'[source]#
JSON = 'http://purl.org/NET/mediatypes/application/json'[source]#
Kappa = 'http://purl.org/NET/mediatypes/text/x-kappa'[source]#
LEMS = 'http://purl.org/NET/mediatypes/application/lems+xml'[source]#
MAPLE_WORKSHEET = 'http://purl.org/NET/mediatypes/application/x-maple'[source]#
MARKDOWN = 'http://purl.org/NET/mediatypes/text/markdown'[source]#
MASS = 'http://purl.org/NET/mediatypes/application/mass+json'[source]#
MATHEMATICA_NOTEBOOK = 'http://purl.org/NET/mediatypes/application/vnd.wolfram.mathematica'[source]#
MATLAB = 'http://purl.org/NET/mediatypes/text/x-matlab'[source]#
MATLAB_DATA = 'http://purl.org/NET/mediatypes/application/x-matlab-data'[source]#
MATLAB_FIGURE = 'http://purl.org/NET/mediatypes/application/matlab-fig'[source]#
MorpheusML = 'http://purl.org/NET/mediatypes/application/morpheusml+xml'[source]#
NCS = 'http://purl.org/NET/mediatypes/text/x-ncs'[source]#
NEURON_SESSION = 'http://purl.org/NET/mediatypes/text/x-nrn-ses'[source]#
NMODL = 'http://purl.org/NET/mediatypes/text/x-nmodl'[source]#
NeuroML = 'http://identifiers.org/combine.specifications/neuroml'[source]#
NuML = 'http://purl.org/NET/mediatypes/application/numl+xml'[source]#
ODE = 'http://purl.org/NET/mediatypes/text/x-ode'[source]#
ODT = 'http://purl.org/NET/mediatypes/application/vnd.oasis.opendocument.text'[source]#
OMEX = 'http://identifiers.org/combine.specifications/omex'[source]#
OMEX_MANIFEST = 'http://identifiers.org/combine.specifications/omex-manifest'[source]#
OMEX_METADATA = 'http://identifiers.org/combine.specifications/omex-metadata'[source]#
OTHER = 'http://purl.org/NET/mediatypes/application/octet-stream'[source]#
OWL = 'http://purl.org/NET/mediatypes/application/rdf+xml'[source]#
PDF = 'http://purl.org/NET/mediatypes/application/PDF'[source]#
PERL = 'http://purl.org/NET/mediatypes/text/x-perl'[source]#
PHP = 'http://purl.org/NET/mediatypes/application/x-httpd-php'[source]#
PNG = 'http://purl.org/NET/mediatypes/image/png'[source]#
POSTSCRIPT = 'http://purl.org/NET/mediatypes/application/postscript'[source]#
PPT = 'http://purl.org/NET/mediatypes/application/vnd.ms-powerpoint'[source]#
PPTX = 'http://purl.org/NET/mediatypes/application/vnd.openxmlformats-officedocument.presentationml.presentation'[source]#
PSD = 'http://purl.org/NET/mediatypes/image/vnd.adobe.photoshop'[source]#
Python = 'http://purl.org/NET/mediatypes/application/x-python-code'[source]#
QUICKTIME = 'http://purl.org/NET/mediatypes/video/quicktime'[source]#
R = 'http://purl.org/NET/mediatypes/text/x-r'[source]#
RBA = 'http://purl.org/NET/mediatypes/application/rba+zip'[source]#
RDF_XML = 'http://purl.org/NET/mediatypes/application/rdf+xml'[source]#
RST = 'http://purl.org/NET/mediatypes/text/x-rst'[source]#
RUBY = 'http://purl.org/NET/mediatypes/text/x-ruby'[source]#
R_Project = 'http://purl.org/NET/mediatypes/application/x-r-project'[source]#
SBGN = 'http://identifiers.org/combine.specifications/sbgn'[source]#
SBML = 'http://identifiers.org/combine.specifications/sbml'[source]#
SBOL = 'http://identifiers.org/combine.specifications/sbol'[source]#
SBOL_VISUAL = 'http://identifiers.org/combine.specifications/sbol-visual'[source]#
SED_ML = 'http://identifiers.org/combine.specifications/sed-ml'[source]#
SHOCKWAVE_FLASH = 'http://purl.org/NET/mediatypes/application/x-shockwave-flash'[source]#
SLI = 'http://purl.org/NET/mediatypes/text/x-sli'[source]#
SO = 'http://purl.org/NET/mediatypes/application/x-sharedlib'[source]#
SQL = 'http://purl.org/NET/mediatypes/application/sql'[source]#
SVG = 'http://purl.org/NET/mediatypes/image/svg+xml'[source]#
SVGZ = 'http://purl.org/NET/mediatypes/image/svg+xml-compressed'[source]#
Scilab = 'http://purl.org/NET/mediatypes/application/x-scilab'[source]#
SimBiology_Project = 'http://purl.org/NET/mediatypes/application/x-sbproj'[source]#
Smoldyn = 'http://purl.org/NET/mediatypes/text/smoldyn+plain'[source]#
TEXT = 'http://purl.org/NET/mediatypes/text/plain'[source]#
TIFF = 'http://purl.org/NET/mediatypes/image/tiff'[source]#
TSV = 'http://purl.org/NET/mediatypes/text/tab-separated-values'[source]#
VCML = 'http://purl.org/NET/mediatypes/application/vcml+xml'[source]#
Vega = 'http://purl.org/NET/mediatypes/application/vnd.vega.v5+json'[source]#
Vega_Lite = 'http://purl.org/NET/mediatypes/application/vnd.vegalite.v3+json'[source]#
WEBP = 'http://purl.org/NET/mediatypes/image/webp'[source]#
XLS = 'http://purl.org/NET/mediatypes/application/vnd.ms-excel'[source]#
XLSX = 'http://purl.org/NET/mediatypes/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'[source]#
XML = 'http://purl.org/NET/mediatypes/application/xml'[source]#
XPP = 'http://purl.org/NET/mediatypes/text/x-ode'[source]#
XPP_AUTO = 'http://purl.org/NET/mediatypes/text/x-ode-auto'[source]#
XPP_SET = 'http://purl.org/NET/mediatypes/text/x-ode-set'[source]#
XSL = 'http://purl.org/NET/mediatypes/application/xslfo+xml'[source]#
XUL = 'http://purl.org/NET/mediatypes/text/xul'[source]#
XYZ = 'http://purl.org/NET/mediatypes/chemical/x-xyz'[source]#
YAML = 'http://purl.org/NET/mediatypes/application/x-yaml'[source]#
ZGINML = 'http://purl.org/NET/mediatypes/application/zginml+zip'[source]#
ZIP = 'http://purl.org/NET/mediatypes/application/zip'[source]#
pharmML = 'http://purl.org/NET/mediatypes/application/pharmml+xml'[source]#
class biosimulators_utils.combine.data_model.CombineArchiveContentFormatPattern(value)[source]#

Bases: str, Enum

Format for the content of COMBINE/OMEX archives

ACTIONSCRIPT = '^https?://purl\\.org/NET/mediatypes/text/x-actionscript$'[source]#
ADOBE_FLASH = '^https?://purl\\.org/NET/mediatypes/(application/x-shockwave-flash|application/vnd\\.adobe\\.flash-movie)$'[source]#
AI = '^https?://purl\\.org/NET/mediatypes/(application/pdf|application/postscript)$'[source]#
BMP = '^https?://purl\\.org/NET/mediatypes/image/bmp$'[source]#
BNGL = '^https?://purl\\.org/NET/mediatypes/text/bngl\\+plain($|\\.)'[source]#
BOURNE_SHELL = '^https?://purl\\.org/NET/mediatypes/(text/x-sh|application/x-sh)$'[source]#
BioPAX = '^https?://identifiers\\.org/combine\\.specifications/biopax($|\\.)'[source]#
C = '^https?://purl\\.org/NET/mediatypes/text/x-c$'[source]#
CPP_HEADER = '^https?://purl\\.org/NET/mediatypes/text/x-c\\+\\+hdr$'[source]#
CPP_SOURCE = '^https?://purl\\.org/NET/mediatypes/text/x-c\\+\\+src$'[source]#
CSS = '^https?://purl\\.org/NET/mediatypes/text/css$'[source]#
CSV = '^https?://purl\\.org/NET/mediatypes/text/csv$'[source]#
CellML = '^https?://identifiers\\.org/combine\\.specifications/cellml($|\\.)'[source]#
CopasiML = '^https?://purl\\.org/NET/mediatypes/application/x-copasi$'[source]#
DLL = '^https?://purl\\.org/NET/mediatypes/application/vnd\\.microsoft\\.portable-executable$'[source]#
DOC = '^https?://purl\\.org/NET/mediatypes/application/msword$'[source]#
DOCX = '^https?://purl\\.org/NET/mediatypes/application/vnd\\.openxmlformats-officedocument\\.wordprocessingml\\.document$'[source]#
EPS = '^https?://purl\\.org/NET/mediatypes/(application/postscript|application/eps|application/x-eps|image/eps|image/x-eps)$'[source]#
Escher = '^https?://purl\\.org/NET/mediatypes/application/escher\\+json$'[source]#
GENESIS = '^https?://purl\\.org/NET/mediatypes/text/x-genesis$'[source]#
GIF = '^https?://purl\\.org/NET/mediatypes/image/gif$'[source]#
GINML = '^https?://purl\\.org/NET/mediatypes/application/ginml\\+xml$'[source]#
GMSH_MESH = '^https?://purl\\.org/NET/mediatypes/model/mesh$'[source]#
GRAPHML = '^https?://purl\\.org/NET/mediatypes/(application/graphml\\+xml|application/x-graphml\\+xml)$'[source]#
HDF5 = '^https?://purl\\.org/NET/mediatypes/application/x-hdf5?$'[source]#
HOC = '^https?://purl\\.org/NET/mediatypes/text/x-hoc$'[source]#
HTML = '^https?://purl\\.org/NET/mediatypes/(text/html|application/xhtml\\+xml)$'[source]#
ICO = '^https?://purl\\.org/NET/mediatypes/(image/x-icon|image/vnd\\.microsoft\\.icon)$'[source]#
INI = '^https?://purl\\.org/NET/mediatypes/text/x-ini$'[source]#
IPython_Notebook = '^https?://purl\\.org/NET/mediatypes/application/x-ipynb\\+json$'[source]#
JAVASCRIPT = '^https?://purl\\.org/NET/mediatypes/(text/javascript|text/x-javascript|application/javascript|application/x-javascript)$'[source]#
JAVA_ARCHIVE = '^https?://purl\\.org/NET/mediatypes/(application/java-archive|application/x-java-archive|application/jar|application/x-jar)$'[source]#
JAVA_CLASS = '^https?://purl\\.org/NET/mediatypes/(application/java-vm|application/x-java-vm|application/java|application/x-java)$'[source]#
JAVA_SOURCE = '^https?://purl\\.org/NET/mediatypes/(text/x-java|text/x-java-source)$'[source]#
JPEG = '^https?://purl\\.org/NET/mediatypes/image/jpeg$'[source]#
JSON = '^https?://purl\\.org/NET/mediatypes/application/json$'[source]#
Kappa = '^https?://purl\\.org/NET/mediatypes/text/x-kappa$'[source]#
LEMS = '^https?://purl\\.org/NET/mediatypes/application/lems\\+xml$'[source]#
MAPLE_WORKSHEET = '^https?://purl\\.org/NET/mediatypes/application/x-maple$'[source]#
MARKDOWN = '^https?://purl\\.org/NET/mediatypes/text/markdown$'[source]#
MASS = '^https?://purl\\.org/NET/mediatypes/application/mass\\+json$'[source]#
MATHEMATICA_NOTEBOOK = '^https?://purl\\.org/NET/mediatypes/application/vnd\\.wolfram\\.mathematica$'[source]#
MATLAB = '^https?://purl\\.org/NET/mediatypes/text/x-matlab$'[source]#
MATLAB_DATA = '^https?://purl\\.org/NET/mediatypes/application/x-matlab-data$'[source]#
MATLAB_FIGURE = '^https?://purl\\.org/NET/mediatypes/application/matlab-fig$'[source]#
MorpheusML = '^https?://purl\\.org/NET/mediatypes/application/morpheusml\\+xml$'[source]#
NCS = '^https?://purl\\.org/NET/mediatypes/text/x-ncs$'[source]#
NEURON_SESSION = '^https?://purl\\.org/NET/mediatypes/text/x-nrn-ses$'[source]#
NMODL = '^https?://purl\\.org/NET/mediatypes/text/x-nmodl$'[source]#
NeuroML = '^https?://identifiers\\.org/combine\\.specifications/neuroml($|\\.)'[source]#
NuML = '^https?://purl\\.org/NET/mediatypes/application/numl\\+xml$'[source]#
ODE = '^https?://purl\\.org/NET/mediatypes/text/x-(ode|xpp)$'[source]#
ODT = '^https?://purl\\.org/NET/mediatypes/application/vnd\\.oasis\\.opendocument\\.text$'[source]#
OMEX = '^https?://identifiers\\.org/combine\\.specifications/omex($|\\.)'[source]#
OMEX_MANIFEST = '^https?://identifiers\\.org/combine\\.specifications/omex-manifest($|\\.)'[source]#
OMEX_METADATA = '^https?://identifiers\\.org/combine\\.specifications/omex-metadata($|\\.)'[source]#
OTHER = '^https?://purl\\.org/NET/mediatypes/application/octet-stream$'[source]#
OWL = '^https?://purl\\.org/NET/mediatypes/application/rdf\\+xml$'[source]#
PDF = '^https?://purl\\.org/NET/mediatypes/application/pdf$'[source]#
PERL = '^https?://purl\\.org/NET/mediatypes/(text/x-perl|application/x-perl)$'[source]#
PHP = '^https?://purl\\.org/NET/mediatypes/(application/x-httpd-php|application/x-httpd-php-source|application/x-php|text/x-php)$'[source]#
PNG = '^https?://purl\\.org/NET/mediatypes/image/png$'[source]#
POSTSCRIPT = '^https?://purl\\.org/NET/mediatypes/application/postscript$'[source]#
PPT = '^https?://purl\\.org/NET/mediatypes/application/vnd\\.ms-powerpoint$'[source]#
PPTX = '^https?://purl\\.org/NET/mediatypes/application/vnd\\.openxmlformats-officedocument\\.presentationml\\.presentation$'[source]#
PSD = '^https?://purl\\.org/NET/mediatypes/(image/vnd\\.adobe\\.photoshop|image/psd|image/x-psd|application/photoshop|application/x-photoshop|application/psd|application/x-psd)$'[source]#
Python = '^https?://purl\\.org/NET/mediatypes/application/x-python-code$'[source]#
QUICKTIME = '^https?://purl\\.org/NET/mediatypes/(video/quicktime|image/mov)$'[source]#
R = '^https?://purl\\.org/NET/mediatypes/text/x-r$'[source]#
RBA = '^https?://purl\\.org/NET/mediatypes/application/rba\\+zip$'[source]#
RDF_XML = '^https?://purl\\.org/NET/mediatypes/application/rdf\\+xml$'[source]#
RST = '^https?://purl\\.org/NET/mediatypes/text/x-rst$'[source]#
RUBY = '^https?://purl\\.org/NET/mediatypes/text/x-ruby$'[source]#
R_Project = '^https?://purl\\.org/NET/mediatypes/application/x-r-project$'[source]#
SBGN = '^https?://identifiers\\.org/combine\\.specifications/sbgn($|\\.)'[source]#
SBML = '^https?://identifiers\\.org/combine\\.specifications/sbml($|\\.)'[source]#
SBOL = '^https?://identifiers\\.org/combine\\.specifications/sbol($|\\.)'[source]#
SBOL_VISUAL = '^https?://identifiers\\.org/combine\\.specifications/sbol-visual($|\\.)'[source]#
SED_ML = '^https?://identifiers\\.org/combine\\.specifications/sed\\-?ml($|\\.)'[source]#
SHOCKWAVE_FLASH = '^https?://purl\\.org/NET/mediatypes/(application/x-shockwave-flash|application/vnd\\.adobe\\.flash-movie)$'[source]#
SLI = '^https?://purl\\.org/NET/mediatypes/text/x-sli$'[source]#
SO = '^https?://purl\\.org/NET/mediatypes/application/x-sharedlib$'[source]#
SQL = '^https?://purl\\.org/NET/mediatypes/application/sql$'[source]#
SVG = '^https?://purl\\.org/NET/mediatypes/image/svg\\+xml$'[source]#
SVGZ = '^https?://purl\\.org/NET/mediatypes/image/svg\\+xml-compressed$'[source]#
Scilab = '^https?://purl\\.org/NET/mediatypes/application/x-scilab$'[source]#
SimBiology_Project = '^https?://purl\\.org/NET/mediatypes/application/x-sbproj$'[source]#
Smoldyn = '^https?://purl\\.org/NET/mediatypes/text/smoldyn\\+plain$'[source]#
TEXT = '^https?://purl\\.org/NET/mediatypes/text/plain$'[source]#
TIFF = '^https?://purl\\.org/NET/mediatypes/image/tiff$'[source]#
TSV = '^https?://purl\\.org/NET/mediatypes/text/tab-separated-values$'[source]#
VCML = '^https?://purl\\.org/NET/mediatypes/application/vcml\\+xml$'[source]#
Vega = '^https?://purl\\.org/NET/mediatypes/application/vnd\\.vega\\.v5\\+json$'[source]#
Vega_Lite = '^https?://purl\\.org/NET/mediatypes/application/vnd\\.vegalite\\.v3\\+json$'[source]#
WEBP = '^https?://purl\\.org/NET/mediatypes/image/webp$'[source]#
XLS = '^https?://purl\\.org/NET/mediatypes/application/vnd\\.ms-excel$'[source]#
XLSX = '^https?://purl\\.org/NET/mediatypes/application/vnd\\.openxmlformats-officedocument\\.spreadsheetml\\.sheet$'[source]#
XML = '^https?://purl\\.org/NET/mediatypes/application/xml$'[source]#
XPP = '^https?://purl\\.org/NET/mediatypes/text/x-(ode|xpp)$'[source]#
XPP_AUTO = '^https?://purl\\.org/NET/mediatypes/text/x-(ode|xpp)-auto$'[source]#
XPP_SET = '^https?://purl\\.org/NET/mediatypes/text/x-(ode|xpp)-set$'[source]#
XSL = '^https?://purl\\.org/NET/mediatypes/(application/xslfo\\+xml|text/xsl)$'[source]#
XUL = '^https?://purl\\.org/NET/mediatypes/text/xul$'[source]#
XYZ = '^https?://purl\\.org/NET/mediatypes/chemical/x-xyz$'[source]#
YAML = '^https?://purl\\.org/NET/mediatypes/application/x-yaml$'[source]#
ZGINML = '^https?://purl\\.org/NET/mediatypes/application/zginml\\+zip$'[source]#
ZIP = '^https?://purl\\.org/NET/mediatypes/application/zip$'[source]#
pharmML = '^https?://purl\\.org/NET/mediatypes/application/pharmml\\+xml$'[source]#

biosimulators_utils.combine.exceptions module#

Exceptions for COMBINE/OMEX archives

Author:

Jonathan Karr <karr@mssm.edu>

Date:

2021-01-12

Copyright:

2021, Center for Reproducible Biomedical Modeling

License:

MIT

exception biosimulators_utils.combine.exceptions.CombineArchiveExecutionError[source]#

Bases: BioSimulatorsException

Error that a SED document could not be executed

exception biosimulators_utils.combine.exceptions.NoSedmlError[source]#

Bases: BioSimulatorsException

Error that a COMBINE/OMEX archive does not contain any SED-ML files

biosimulators_utils.combine.exec module#

Utilities for executing tasks in SED-ML files in COMBINE/OMEX archives

Author:

Jonathan Karr <karr@mssm.edu>

Date:

2020-12-06

Copyright:

2020, Center for Reproducible Biomedical Modeling

License:

MIT

biosimulators_utils.combine.exec.exec_sedml_docs_in_archive(sed_doc_executer, archive_filename, out_dir, apply_xml_model_changes=False, sed_doc_executer_supported_features=(<class 'biosimulators_utils.sedml.data_model.Task'>, <class 'biosimulators_utils.sedml.data_model.Report'>, <class 'biosimulators_utils.sedml.data_model.DataSet'>, <class 'biosimulators_utils.sedml.data_model.Plot2D'>, <class 'biosimulators_utils.sedml.data_model.Curve'>, <class 'biosimulators_utils.sedml.data_model.Plot3D'>, <class 'biosimulators_utils.sedml.data_model.Surface'>), sed_doc_executer_logged_features=(<class 'biosimulators_utils.sedml.data_model.Task'>, <class 'biosimulators_utils.sedml.data_model.Report'>, <class 'biosimulators_utils.sedml.data_model.DataSet'>, <class 'biosimulators_utils.sedml.data_model.Plot2D'>, <class 'biosimulators_utils.sedml.data_model.Curve'>, <class 'biosimulators_utils.sedml.data_model.Plot3D'>, <class 'biosimulators_utils.sedml.data_model.Surface'>), log_level=StandardOutputErrorCapturerLevel.c, config=None)[source]#

Execute the SED-ML files in a COMBINE/OMEX archive (execute tasks and save outputs)

Parameters:
  • sed_doc_executer (types.FunctionType) –

    function to execute each SED document in the archive. The function must implement the following interface:

    def sed_doc_executer(doc, working_dir, base_out_path, rel_out_path=None,
                 apply_xml_model_changes=False,
                 log=None, log_level=StandardOutputErrorCapturerLevel.c, indent=0, config=None):
        ''' Execute the tasks specified in a SED document and generate the specified outputs
    
        Args:
            doc (:obj:`SedDocument` of :obj:`str`): SED document or a path to SED-ML file which defines a SED document
            working_dir (:obj:`str`): working directory of the SED document (path relative to which models are located)
    
            out_path (:obj:`str`): path to store the outputs
    
                * CSV: directory in which to save outputs to files
                  ``{out_path}/{rel_out_path}/{report.id}.csv``
                * HDF5: directory in which to save a single HDF5 file (``{out_path}/reports.h5``),
                  with reports at keys ``{rel_out_path}/{report.id}`` within the HDF5 file
    
            rel_out_path (:obj:`str`, optional): path relative to :obj:`out_path` to store the outputs
            apply_xml_model_changes (:obj:`bool`, optional): if :obj:`True`, apply any model changes specified in the SED-ML file
            log (:obj:`SedDocumentLog`, optional): execution status of document
            log_level (:obj:`StandardOutputErrorCapturerLevel`, optional): level at which to log output
            indent (:obj:`int`, optional): degree to indent status messages
            config (:obj:`Config`, optional): BioSimulators common configuration
        '''
    

  • archive_filename (str) – path to COMBINE/OMEX archive

  • out_dir (str) –

    path to store the outputs of the archive

    • CSV: directory in which to save outputs to files { out_dir }/{ relative-path-to-SED-ML-file-within-archive }/{ report.id }.csv

    • HDF5: directory in which to save a single HDF5 file ({ out_dir }/reports.h5), with reports at keys { relative-path-to-SED-ML-file-within-archive }/{ report.id } within the HDF5 file

  • apply_xml_model_changes (bool) – if True, apply any model changes specified in the SED-ML files before calling task_executer.

  • sed_doc_executer_supported_features (list of type, optional) – list of the types of elements that the SED document executer supports. Default: tasks, reports, plots, data sets, curves, and surfaces.

  • sed_doc_executer_logged_features (list of type, optional) – list of the types fo elements which that the SED document executer logs. Default: tasks, reports, plots, data sets, curves, and surfaces.

  • log_level (StandardOutputErrorCapturerLevel, optional) – level at which to log output

  • config (Config) – configuration

Returns:

  • SedDocumentResults: results

  • CombineArchiveLog: log

Return type:

tuple

biosimulators_utils.combine.io module#

Utilities for reading and writing COMBINE/OMEX archives

Author:

Jonathan Karr <karr@mssm.edu>

Date:

2020-12-06

Copyright:

2020, Center for Reproducible Biomedical Modeling

License:

MIT

class biosimulators_utils.combine.io.CombineArchiveReader[source]#

Bases: object

Reader for COMBINE/OMEX archives

errors[source]#

errors

Type:

nested list of str

warnings[source]#

warnings

Type:

nested list of str

NONE_DATETIME = '2000-01-01T00:00:00Z'[source]#
read_manifest(filename, archive_filename=None, config=None)[source]#

Read the contents of an OMEX manifest file

Parameters:
  • filename (str) – path to OMEX manifest file

  • archive_filename (str, option) – path to COMBINE archive

  • config (Config, optional) – configuration

Returns:

contents of the OMEX manifest file

Return type:

list of CombineArchiveContent

run(in_file: str, out_dir: str, include_omex_metadata_files: bool = True, config: Config | None = None) CombineArchive[source]#

Read an archive from a file

Parameters:
  • in_file (str) – path to archive

  • out_dir (str) – directory where the contents of the archive should be unpacked

  • include_omex_metadata_files (bool, optional) – whether to include the OMEX metadata file as part of the contents of the archive

  • config (Config, optional) – configuration

Returns:

description of archive

Return type:

CombineArchive

Raises:

ValueError – archive is invalid

class biosimulators_utils.combine.io.CombineArchiveWriter[source]#

Bases: object

Writer for COMBINE/OMEX archives

errors[source]#

errors

Type:

nested list of str

warnings[source]#

warnings

Type:

nested list of str

run(archive, in_dir, out_file)[source]#

Write an archive to a file

Parameters:
  • archive (CombineArchive) – description of archive

  • in_dir (str) – directory which contains the files in the archive

  • out_file (str) – path to save archive

Raises:

AssertionError – if files could not be added to the archive or the archive could not be saved

write_manifest(contents, filename)[source]#

Write an OMEX manifest file

Parameters:
  • contents (list of CombineArchiveContent) – contents of a COMBINE/OMEX archive

  • filename (str) – path to OMEX manifest file

class biosimulators_utils.combine.io.CombineArchiveZipReader[source]#

Bases: object

Create a COMBINE/OMEX archive object from a plain zip archive. Set the format of files with the extension .sedml to CombineArchiveContentFormat.SED_ML.value.

classmethod run(in_file, out_dir=None)[source]#

Read an archive from a zip file

Parameters:
  • in_file (str) – path to archive

  • out_dir (str, optional) – directory where the contents of the archive should be unpacked

Returns:

description of the archive

Return type:

CombineArchive

Raises:

ValueError – archive is invalid

biosimulators_utils.combine.utils module#

Utilities for working with COMBINE/OMEX archives

Author:

Jonathan Karr <karr@mssm.edu>

Date:

2020-12-06

Copyright:

2020, Center for Reproducible Biomedical Modeling

License:

MIT

biosimulators_utils.combine.utils.get_sedml_contents(archive, include_all_sed_docs_when_no_sed_doc_is_master=True, always_include_all_sed_docs=False)[source]#

Get the SED-ML files in an archive

Parameters:
  • archive (CombineArchive) – COMBINE/OMEX archive

  • include_all_sed_docs_when_no_sed_doc_is_master (bool, optional) – if true and no SED document has master="true", return all SED documents.

  • always_include_all_sed_docs (bool, optional) – if true, return all SED documents, regardless of whether they have master="true" or not.

Returns:

SED-ML files in a COMBINE/OMEX archive

Return type:

list of CombineArchiveContent

biosimulators_utils.combine.utils.get_summary_sedml_contents(archive, archive_dir, include_all_sed_docs_when_no_sed_doc_is_master=True, always_include_all_sed_docs=False, config=None)[source]#

Get a summary of the SED-ML content in a COMBINE/OMEX archive

Parameters:
  • archive (CombineArchive) – COMBINE/OMEX archive

  • archive_dir (str) – path where the content of the archive is located

  • include_all_sed_docs_when_no_sed_doc_is_master (bool, optional) – if true and no SED document has master="true", return all SED documents.

  • always_include_all_sed_docs (bool, optional) – if true, return all SED documents, regardless of whether they have master="true" or not.

  • config (Config, optional) – whether to fail on missing includes

Returns:

summary of the SED-ML content in a COMBINE/OMEX archive

Return type:

str

biosimulators_utils.combine.validation module#

Methods for validating COMBINE archives

Author:

Jonathan Karr <karr@mssm.edu>

Date:

2021-04-16

Copyright:

2021, Center for Reproducible Biomedical Modeling

License:

MIT

biosimulators_utils.combine.validation.validate(archive: CombineArchive, archive_dirname: str, include_all_sed_docs_when_no_sed_doc_is_master: bool = True, always_include_all_sed_docs: bool = False, formats_to_validate: list[CombineArchiveContentFormat] = [CombineArchiveContentFormat.SED_ML], validate_models_with_languages: bool = True, config: Config | None = None)[source]#

Validate a COMBINE/OMEX archive and the SED-ML and model documents it contains

Parameters:
  • archive (CombineArchive) – COMBINE/OMEX archive

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

  • include_all_sed_docs_when_no_sed_doc_is_master (bool, optional) – if true and no SED document has master="true", return all SED documents.

  • always_include_all_sed_docs (bool, optional) – if true, return all SED documents, regardless of whether they have master="true" or not.

  • formats_to_validate (list of CombineArchiveContentFormat, optional) – list for formats of files to validate

  • validate_models_with_languages (bool, optional) – if True, validate models

  • config (Config, optional) – configuration

Returns:

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

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

Return type:

tuple

biosimulators_utils.combine.validation.validate_content(content, archive_dirname, formats_to_validate=[CombineArchiveContentFormat.SED_ML], validate_models_with_languages=True, config=None)[source]#

Validate an item of a COMBINE/OMEX archive

Parameters:
  • content (CombineArchiveContent) – item of a COMBINE/OMEX archive

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

  • formats_to_validate (list of CombineArchiveContentFormat, optional) – list for formats of files to validate

  • validate_models_with_languages (bool, optional) – if True, validate models

  • config (Config, optional) – configuration

Returns:

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

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

Return type:

tuple

biosimulators_utils.combine.validation.validate_format(format)[source]#

Validate a COMBINE of an element of a COMBINE/OMEX archive

Parameters:

format (str) – format

Returns:

nested list of errors with the archive

Return type:

nested list of str