biosimulators_amici package#
- biosimulators_amici.exec_sed_doc(doc, working_dir, base_out_path, rel_out_path=None, apply_xml_model_changes=True, log=None, indent=0, pretty_print_modified_xml_models=False, log_level=StandardOutputErrorCapturerLevel.c, config=None)[source]#
Execute the tasks specified in a SED document and generate the specified outputs
- Parameters:
doc (
SedDocumentorstr) – SED document or a path to SED-ML file which defines a SED documentworking_dir (
str) – working directory of the SED document (path relative to which models are located)base_out_path (
str) –path to store the outputs
CSV: directory in which to save outputs to files
{base_out_path}/{rel_out_path}/{report.id}.csvHDF5: directory in which to save a single HDF5 file (
{base_out_path}/reports.h5), with reports at keys{rel_out_path}/{report.id}within the HDF5 file
rel_out_path (
str, optional) – path relative tobase_out_pathto store the outputsapply_xml_model_changes (
bool, optional) – ifTrue, apply any model changes specified in the SED-ML file before callingtask_executer.log (
SedDocumentLog, optional) – log of the documentindent (
int, optional) – degree to indent status messagespretty_print_modified_xml_models (
bool, optional) – ifTrue, pretty print modified XML modelslog_level (
StandardOutputErrorCapturerLevel, optional) – level at which to log outputconfig (
Config, optional) – BioSimulators common configurationsimulator_config (
SimulatorConfig, optional) – tellurium configuration
- Returns:
ReportResults: results of each reportSedDocumentLog: log of the document
- Return type:
tuple
- biosimulators_amici.exec_sed_task(task, variables, preprocessed_task=None, log=None, config=None)[source]#
Execute a task and save its results
- Parameters:
task (
Task) – taskvariables (
listofVariable) – variables that should be recordedpreprocessed_task (
dict, optional) – preprocessed information about the task, including possible model changes and variables. This can be used to avoid repeatedly executing the same initialization for repeated calls to this method.log (
TaskLog, optional) – log for the taskconfig (
Config, optional) – BioSimulators common configuration
- Returns:
VariableResults: results of variablesTaskLog: log- Return type:
tuple
- biosimulators_amici.exec_sedml_docs_in_combine_archive(archive_filename, out_dir, config=None)[source]#
Execute the SED tasks defined in a COMBINE/OMEX archive and save the outputs
- Parameters:
archive_filename (
str) – path to COMBINE/OMEX archiveout_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 }.csvHDF5: 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
config (
Config, optional) – BioSimulators common configuration
- Returns:
log
- Return type:
CombineArchiveLog
- biosimulators_amici.get_simulator_version()[source]#
Get the version of AMICI
- Returns:
version
- Return type:
str
- biosimulators_amici.preprocess_sed_task(task, variables, config=None)[source]#
Preprocess a SED task, including its possible model changes and variables. This is useful for avoiding repeatedly initializing tasks on repeated calls of
exec_sed_task.- Parameters:
task (
Task) – taskvariables (
listofVariable) – variables that should be recordedconfig (
Config, optional) – BioSimulators common configuration
- Returns:
preprocessed information about the task
- Return type:
dict
Submodules#
biosimulators_amici.core module#
Methods for executing SED tasks in COMBINE archives and saving their outputs
- Author:
Jonathan Karr <karr@mssm.edu>
- Date:
2020-12-16
- Copyright:
2020, BioSimulators Team
- License:
MIT
- biosimulators_amici.core.cleanup_model(model_name, model_dir)[source]#
Cleanup model created with
import_model_from_sbml- Parameters:
model_name (
str) – name of the Python module for modelmodel_dir (
str) – directory which contains the files for the model
- biosimulators_amici.core.config_task(task, model, config=None)[source]#
Configure an AMICI model for a SED task
- Parameters:
task (
Task) – taskmodel (
amici.amici.ModelPtr) – AMICI modelconfig (
Config) – configuration
- Returns:
amici.amici.SolverPtr: solverstr: KiSAO id of the solverdict: dictionary of arguments for the solver
- Return type:
tuple- Raises:
NotImplementedError – the task involves and unsupported algorithm or parameter
ValueError – the task involves an invalid value of a parameter
- biosimulators_amici.core.exec_sed_doc(doc, working_dir, base_out_path, rel_out_path=None, apply_xml_model_changes=True, log=None, indent=0, pretty_print_modified_xml_models=False, log_level=StandardOutputErrorCapturerLevel.c, config=None)[source]#
Execute the tasks specified in a SED document and generate the specified outputs
- Parameters:
doc (
SedDocumentorstr) – SED document or a path to SED-ML file which defines a SED documentworking_dir (
str) – working directory of the SED document (path relative to which models are located)base_out_path (
str) –path to store the outputs
CSV: directory in which to save outputs to files
{base_out_path}/{rel_out_path}/{report.id}.csvHDF5: directory in which to save a single HDF5 file (
{base_out_path}/reports.h5), with reports at keys{rel_out_path}/{report.id}within the HDF5 file
rel_out_path (
str, optional) – path relative tobase_out_pathto store the outputsapply_xml_model_changes (
bool, optional) – ifTrue, apply any model changes specified in the SED-ML file before callingtask_executer.log (
SedDocumentLog, optional) – log of the documentindent (
int, optional) – degree to indent status messagespretty_print_modified_xml_models (
bool, optional) – ifTrue, pretty print modified XML modelslog_level (
StandardOutputErrorCapturerLevel, optional) – level at which to log outputconfig (
Config, optional) – BioSimulators common configurationsimulator_config (
SimulatorConfig, optional) – tellurium configuration
- Returns:
ReportResults: results of each reportSedDocumentLog: log of the document
- Return type:
tuple
- biosimulators_amici.core.exec_sed_task(task, variables, preprocessed_task=None, log=None, config=None)[source]#
Execute a task and save its results
- Parameters:
task (
Task) – taskvariables (
listofVariable) – variables that should be recordedpreprocessed_task (
dict, optional) – preprocessed information about the task, including possible model changes and variables. This can be used to avoid repeatedly executing the same initialization for repeated calls to this method.log (
TaskLog, optional) – log for the taskconfig (
Config, optional) – BioSimulators common configuration
- Returns:
VariableResults: results of variablesTaskLog: log- Return type:
tuple
- biosimulators_amici.core.exec_sedml_docs_in_combine_archive(archive_filename, out_dir, config=None)[source]#
Execute the SED tasks defined in a COMBINE/OMEX archive and save the outputs
- Parameters:
archive_filename (
str) – path to COMBINE/OMEX archiveout_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 }.csvHDF5: 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
config (
Config, optional) – BioSimulators common configuration
- Returns:
log
- Return type:
CombineArchiveLog
- biosimulators_amici.core.exec_task(model, solver)[source]#
Execute a SED task for an AMICI model and return its results
- Parameters:
model (
amici.amici.ModelPtr) – AMICI modelsolver (
amici.amici.SolverPtr) – solver
- Returns:
simulation results
- Return type:
amici.numpy.ReturnDataView
- biosimulators_amici.core.extract_variables_from_results(variables, variable_observable_map, results)[source]#
Extract data generator variables from results
- Parameters:
variables (
listofVariable) – variables that should be recordedvariable_observable_map (
dict) – dictionary that maps the targets and symbols of variables to AMICI observablesresults (
amici.numpy.ReturnDataView) – simulation results
- Returns:
results of variables
- Return type:
VariableResults
- biosimulators_amici.core.import_model_from_sbml(filename, variables)[source]#
Generate an AMICI model from a SBML file
- Parameters:
filename (
str) – path to SBML filevariables (
listofstr) – ids of SBML objects to observe
- Returns:
amici.amici.ModelPtr: AMICI modellibsbml.Model: SBML modelstr: name of the Python module for modelstr: directory which contains the files for the model
- Return type:
tuple
- biosimulators_amici.core.preprocess_sed_task(task, variables, config=None)[source]#
Preprocess a SED task, including its possible model changes and variables. This is useful for avoiding repeatedly initializing tasks on repeated calls of
exec_sed_task.- Parameters:
task (
Task) – taskvariables (
listofVariable) – variables that should be recordedconfig (
Config, optional) – BioSimulators common configuration
- Returns:
preprocessed information about the task
- Return type:
dict
- biosimulators_amici.core.validate_model_changes(model, changes, change_sbml_id_map)[source]#
Validate model changes
- Parameters:
model (
amici.amici.ModelPtr) – AMICI modelchanges (
listofModelAttributeChange) – model changeschange_sbml_id_map (
dictofstrtostr) – dictionary that maps each XPath to the value of the attribute of the object in the XML file that matches the XPath
- Returns:
dictionary that maps the targets of changes to AMICI setters
- Return type:
dict- Raises:
ValueError – if a change could not be applied
- biosimulators_amici.core.validate_task(task, variables, config=None)[source]#
Validate that AMICI can support a SED task
- Parameters:
task (
Task) – taskvariables (
listofVariable) – variables that should be recordedconfig (
Config, optional) – BioSimulators common configuration
- Returns:
dictofstrtostr: dictionary that maps the XPath of each target of eachmodel change to the SBML id of the associated model object
dictofstrtostr: dictionary that maps the XPath of each variable targetto the SBML id of the associated model object
- Return type:
tuple
- biosimulators_amici.core.validate_variables(model, variables, variable_target_sbml_id_map)[source]#
Validate variables
- Parameters:
model (
amici.amici.ModelPtr) – AMICI modelvariables (
listofVariable) – variables that should be recordedvariable_target_sbml_id_map (
dictofstrtostr) – dictionary that maps each XPath to the value of the attribute of the object in the XML file that matches the XPath
- Returns:
dictionary that maps the targets and symbols of variables to AMICI observables
- Return type:
dict- Raises:
NotImplementedError – if a symbol could not be recorded
ValueError – if a target could not be recorded
biosimulators_amici.data_model module#
Mappings from KiSAO terms to methods and arguments
- Author:
Jonathan Karr <karr@mssm.edu>
- Date:
2020-12-16
- Copyright:
2020, BioSimulators Team
- License:
MIT