Input and output
File I/O and serialization
Base.close
— Methodclose(model::HDF5Model)
Close (and un-cache) the HDF5Model
data. This allows the associated file to be opened for writing again.
COBREXA.load_h5_model
— Methodload_h5_model(file_name::String) -> HDF5Model
Return a HDF5Model associated with the given file. Does not actually load anything (for efficiency) – use precache!
to start pulling data into the memory.
COBREXA.save_h5_model
— Methodsave_h5_model(model::MetabolicModel, file_name::String) -> HDF5Model
Converts and writes a metabolic model to disk in the HDF5 format.
Additionally returns an (uncached) HDF5Model
that represents the contents of the saved file. Because all HDF5-based models need to be backed by disk storage, writing the data to disk (using this function) is the only way to make new HDF5 models.
COBREXA.load_model
— Methodload_model(file_name::String; extension) -> Any
Generic function for loading models that chooses a specific loader function based on the extension
argument (e.g., ".xml"
chooses loading of the SBML model format), or throws an error. By default the extension from file_name
is used.
Currently, these model types are supported:
- SBML models (
*.xml
, loaded withload_sbml_model
) - JSON models (
*.json
, loaded withload_json_model
) - MATLAB models (
*.mat
, loaded withload_mat_model
) - HDF5 models (
*.h5
, loaded withload_h5_model
)
COBREXA.load_model
— Methodload_model(type::Type{T<:MetabolicModel}, file_name::String; extension) -> MetabolicModel
Helper function that loads the model using load_model
and returns it converted to type
.
Example:
load_model(CoreModel, "mySBMLModel.xml")
COBREXA.save_model
— Methodsave_model(model::MetabolicModel, file_name::String; extension) -> Maybe{HDF5Model}
Generic function for saving models that chooses a specific writer function from the extension
argument (such as ".xml"
for SBML format), or throws an error. By default the extension from file_name
is used.
Currently, these model types are supported:
- SBML models (
*.xml
, saved withsave_sbml_model
) - JSON models (
*.json
, saved withsave_json_model
) - MATLAB models (
*.mat
, saved withsave_mat_model
) - HDF5 models (
*.h5
, saved withsave_h5_model
)
COBREXA.load_json_model
— Methodload_json_model(filename::String) -> JSONModel
Load and return a JSON-formatted model that is stored in file_name
.
COBREXA.save_json_model
— Methodsave_json_model(model::MetabolicModel, file_name::String)
Save a JSONModel
in model
to a JSON file file_name
.
In case the model
is not JSONModel
, it will be converted automatically.
COBREXA.load_mat_model
— Methodload_mat_model(file_name::String) -> MATModel
Load and return a MATLAB file file_name
that contains a COBRA-compatible model.
COBREXA.save_mat_model
— Methodsave_mat_model(model::MetabolicModel, file_path::String; model_name)
Save a MATModel
in model
to a MATLAB file file_name
in a format compatible with other MATLAB-based COBRA software.
In case the model
is not MATModel
, it will be converted automatically.
model_name
is the identifier name for the whole model written to the MATLAB file; defaults to just "model".
COBREXA.load_sbml_model
— Methodload_sbml_model(file_name::String) -> SBMLModel
Load and return a SBML XML model in file_name
.
COBREXA.save_sbml_model
— Methodsave_sbml_model(model::MetabolicModel, file_name::String)
Write a given SBML model to file_name
.
Pretty printing
Base.show
— Methodshow(io::IO, _::MIME{Symbol("text/plain")}, m::MetabolicModel)
Pretty printing of everything metabolic-modelish.
COBREXA._pretty_substances
— Method_pretty_substances(ss::Vector{String}) -> String
Nicely format a substance list.
Base.show
— Methodshow(io::IO, _::MIME{Symbol("text/plain")}, m::Serialized{M})
Show the Serialized
model without unnecessarily loading it.
COBREXA._pretty_print_keyvals
— Method_pretty_print_keyvals(io, def::String, payload; kwargs...)
Nicely prints keys and values.
COBREXA._pretty_print_keyvals
— Method_pretty_print_keyvals(io, def::String, payload::Dict)
Specialization of _pretty_print_keyvals
for dictionaries.
COBREXA._pretty_print_keyvals
— Method_pretty_print_keyvals(io, def::String, payload::String)
Specialization of _pretty_print_keyvals
for plain strings.