sbmlutils.manipulation.merge

Merging of SBML models.

The following is a helper function for merging multiple SBML models into a single model.

Module Contents

Functions

merge_models(model_paths, output_dir[, merged_id, ...])

Merge SBML models.

_create_merged_doc(model_paths[, merged_id, ...])

Create a comp model from given model paths.

Attributes

logger

sbmlutils.manipulation.merge.logger[source]
sbmlutils.manipulation.merge.merge_models(model_paths, output_dir, merged_id='merged', flatten=True, validate=True, validate_input=True, validation_options=None, sbml_level=3, sbml_version=1)[source]

Merge SBML models.

Merges SBML models given in model_paths in the output_dir. Models are provided as dictionary {

‘model1_id’: model1_path, ‘model2_id’: model2_path, …

} The model ids are used as ids for the ExternalModelDefinitions. Relative paths are set in the merged models.

The created model is either in SBML L3V1 (default) or SBML L3V2.

Parameters:
  • model_paths (Dict[str, pathlib.Path]) – absolute paths to models

  • output_dir (pathlib.Path) – output directory for merged model

  • merged_id (str) – model id of the merged model

  • flatten (bool) – flattens the merged model

  • validate (bool) – boolean flag to validate the merged model

  • validate_input (bool) – boolean flag to validate the input models

  • validation_options (Optional[sbmlutils.validation.ValidationOptions]) – ValidationOptions

  • sbml_level (int) – SBML Level of the merged model in [3]

  • sbml_version (int) – SBML Version of the merged model in [1, 2]

Returns:

SBMLDocument of the merged models

Return type:

libsbml.SBMLDocument

sbmlutils.manipulation.merge._create_merged_doc(model_paths, merged_id='merged', sbml_level=3, sbml_version=1)[source]

Create a comp model from given model paths.

Warning: This only works if all models are in the same directory.

Parameters:
  • model_paths (Dict[str, pathlib.Path]) –

  • merged_id (str) –

  • sbml_level (int) –

  • sbml_version (int) –

Return type:

libsbml.SBMLDocument