biosimulators_copasi package#
- biosimulators_copasi.exec_sed_doc(doc: SedDocument | str, working_dir: str, base_out_path: str, rel_out_path: str | None = None, apply_xml_model_changes: bool = True, log: SedDocumentLog | None = None, indent: int = 0, pretty_print_modified_xml_models: bool = False, log_level: StandardOutputErrorCapturerLevel | None = StandardOutputErrorCapturerLevel.c, config: Config | None = None) Tuple[ReportResults, SedDocumentLog] [source]#
Execute the tasks specified in a SED document and generate the specified outputs
- Parameters:
doc (
SedDocument
orstr
) – 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}.csv
HDF5: 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_path
to 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_copasi.exec_sed_task(task: Task, variables: List[Variable], preprocessed_task: Dict | None = None, log: TaskLog | None = None, config: Config | None = None) Tuple[VariableResults, TaskLog] [source]#
Execute a task and save its results
- Parameters:
task (
Task
) – taskvariables (
list
ofVariable
) – 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
- Raises:
ValueError – if the task or an aspect of the task is not valid, or the requested output variables could not be recorded
NotImplementedError – if the task is not of a supported type or involves an unsupported feature
- biosimulators_copasi.exec_sedml_docs_in_combine_archive(archive_filename: str, out_dir: str, config: Config | None = None, fix_copasi_generated_combine_archive: bool | None = None) Tuple[SedDocumentResults, CombineArchiveLog] [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 }.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
config (
Config
, optional) – BioSimulators common configurationshould_fix_copasi_generated_combine_archive (
bool
, optional) – Whether to make COPASI-generated COMBINE archives compatible with the specifications of the OMEX manifest and SED-ML standards
- Returns:
SedDocumentResults
: resultsCombineArchiveLog
: log
- Return type:
tuple
- biosimulators_copasi.get_simulator_version()[source]#
Get the version of COPASI
- Returns:
version
- Return type:
str
- biosimulators_copasi.preprocess_sed_task(task: Task, variables: list[Variable], config: Config | None = None) BasicoInitialization [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 (
list
ofVariable
) – variables that should be recordedconfig (
Config
, optional) – BioSimulators common configuration
- Returns:
prepared information about the task
- Return type:
BasicoInitialization
Submodules#
biosimulators_copasi.core module#
Methods for executing SED tasks in COMBINE archives and saving their outputs
- Author:
Jonathan Karr <karr@mssm.edu>
- Author:
Akhil Marupilla <akhilmteja@gmail.com>
- Date:
2020-11-17
- Copyright:
2020, Center for Reproducible Biomedical Modeling
- License:
MIT
- biosimulators_copasi.core.exec_sed_doc(doc: SedDocument | str, working_dir: str, base_out_path: str, rel_out_path: str | None = None, apply_xml_model_changes: bool = True, log: SedDocumentLog | None = None, indent: int = 0, pretty_print_modified_xml_models: bool = False, log_level: StandardOutputErrorCapturerLevel | None = StandardOutputErrorCapturerLevel.c, config: Config | None = None) Tuple[ReportResults, SedDocumentLog] [source]#
Execute the tasks specified in a SED document and generate the specified outputs
- Parameters:
doc (
SedDocument
orstr
) – 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}.csv
HDF5: 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_path
to 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_copasi.core.exec_sed_task(task: Task, variables: List[Variable], preprocessed_task: Dict | None = None, log: TaskLog | None = None, config: Config | None = None) Tuple[VariableResults, TaskLog] [source]#
Execute a task and save its results
- Parameters:
task (
Task
) – taskvariables (
list
ofVariable
) – 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
- Raises:
ValueError – if the task or an aspect of the task is not valid, or the requested output variables could not be recorded
NotImplementedError – if the task is not of a supported type or involves an unsupported feature
- biosimulators_copasi.core.exec_sedml_docs_in_combine_archive(archive_filename: str, out_dir: str, config: Config | None = None, fix_copasi_generated_combine_archive: bool | None = None) Tuple[SedDocumentResults, CombineArchiveLog] [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 }.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
config (
Config
, optional) – BioSimulators common configurationshould_fix_copasi_generated_combine_archive (
bool
, optional) – Whether to make COPASI-generated COMBINE archives compatible with the specifications of the OMEX manifest and SED-ML standards
- Returns:
SedDocumentResults
: resultsCombineArchiveLog
: log
- Return type:
tuple
- biosimulators_copasi.core.get_simulator_version()[source]#
Get the version of COPASI
- Returns:
version
- Return type:
str
- biosimulators_copasi.core.preprocess_sed_task(task: Task, variables: list[Variable], config: Config | None = None) BasicoInitialization [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 (
list
ofVariable
) – variables that should be recordedconfig (
Config
, optional) – BioSimulators common configuration
- Returns:
prepared information about the task
- Return type:
BasicoInitialization
biosimulators_copasi.data_model module#
Data model for maps from KiSAO terms to COPASI algorithms and their arguments
- Author:
Jonathan Karr <karr@mssm.edu>
- Date:
2020-12-13
- Copyright:
2020, BioSimulators Team
- License:
MIT
- class biosimulators_copasi.data_model.AbsoluteToleranceParameter(value: float | None = None)[source]#
Bases:
CopasiAlgorithmParameter
- class biosimulators_copasi.data_model.AdaptiveSSATauLeapAlgorithm(max_internal_steps: int | None = None, random_seed: int | None = None, epsilon: float | None = None, units: Units = Units.discrete)[source]#
Bases:
CopasiAlgorithm
- class biosimulators_copasi.data_model.CopasiAlgorithm[source]#
Bases:
object
- get_parameters_by_kisao() dict[str, CopasiAlgorithmParameter] [source]#
- class biosimulators_copasi.data_model.CopasiAlgorithmParameter[source]#
Bases:
object
- static get_value_type(cls: CopasiAlgorithmParameter)[source]#
- class biosimulators_copasi.data_model.CopasiAlgorithmType(value)[source]#
Bases:
Enum
An enumeration.
- class biosimulators_copasi.data_model.DeterministicReactionsParameter(value: list | None = None)[source]#
Bases:
CopasiAlgorithmParameter
- class biosimulators_copasi.data_model.DirectMethodAlgorithm(max_internal_steps: int | None = None, random_seed: int | None = None, units: Units = Units.discrete)[source]#
Bases:
CopasiAlgorithm
- class biosimulators_copasi.data_model.EpsilonParameter(value: float | None = None)[source]#
Bases:
CopasiAlgorithmParameter
- class biosimulators_copasi.data_model.ForcePhysicalCorrectnessParameter(value: bool | None = None)[source]#
Bases:
CopasiAlgorithmParameter
- class biosimulators_copasi.data_model.GibsonBruckAlgorithm(max_internal_steps: int | None = None, random_seed: int | None = None, units: Units = Units.discrete)[source]#
Bases:
CopasiAlgorithm
- class biosimulators_copasi.data_model.HybridLsodaAlgorithm(relative_tolerance: float | None = None, absolute_tolerance: float | None = None, integrate_reduced_model: bool | None = None, max_internal_steps: int | None = None, max_internal_step_size: float | None = None, random_seed: int | None = None, lower_limit: float | None = None, upper_limit: float | None = None, partitioning_interval: float | None = None, units: Units = Units.discrete)[source]#
Bases:
CopasiAlgorithm
- class biosimulators_copasi.data_model.HybridRK45Algorithm(relative_tolerance: float | None = None, absolute_tolerance: float | None = None, max_internal_steps: int | None = None, random_seed: int | None = None, deterministic_reactions: list | None = None, units: Units = Units.discrete)[source]#
Bases:
CopasiAlgorithm
- class biosimulators_copasi.data_model.HybridRungeKuttaAlgorithm(max_internal_steps: int | None = None, random_seed: int | None = None, lower_limit: float | None = None, upper_limit: float | None = None, step_size: float | None = None, partitioning_interval: float | None = None, units: Units = Units.discrete)[source]#
Bases:
CopasiAlgorithm
- class biosimulators_copasi.data_model.InitialStepSizeParameter(value: float | None = None)[source]#
Bases:
CopasiAlgorithmParameter
- class biosimulators_copasi.data_model.IntegrateReducedModelParameter(value: bool | None = None)[source]#
Bases:
CopasiAlgorithmParameter
- class biosimulators_copasi.data_model.InternalStepParameter(value: float | None = None)[source]#
Bases:
StepSizeParameter
- class biosimulators_copasi.data_model.LowerLimitParameter(value: float | None = None)[source]#
Bases:
CopasiAlgorithmParameter
- class biosimulators_copasi.data_model.LsodaAlgorithm(relative_tolerance: float | None = None, absolute_tolerance: float | None = None, integrate_reduced_model: bool | None = None, max_internal_steps: int | None = None, max_internal_step_size: float | None = None, units: Units = Units.continuous)[source]#
Bases:
CopasiAlgorithm
- class biosimulators_copasi.data_model.MaximumInternalStepSizeParameter(value: float | None = None)[source]#
Bases:
CopasiAlgorithmParameter
- class biosimulators_copasi.data_model.MaximumInternalStepsParameter(value: int | None = None)[source]#
Bases:
CopasiAlgorithmParameter
- class biosimulators_copasi.data_model.PartitioningIntervalParameter(value: int | None = None)[source]#
Bases:
CopasiAlgorithmParameter
- class biosimulators_copasi.data_model.Radau5Algorithm(relative_tolerance: float | None = None, absolute_tolerance: float | None = None, integrate_reduced_model: bool | None = None, max_internal_steps: int | None = None, initial_step_size: float | None = None, units: Units = Units.continuous)[source]#
Bases:
CopasiAlgorithm
- class biosimulators_copasi.data_model.RandomSeedParameter(value: int | None = None)[source]#
Bases:
CopasiAlgorithmParameter
- class biosimulators_copasi.data_model.RelativeToleranceParameter(value: float | None = None)[source]#
Bases:
CopasiAlgorithmParameter
- class biosimulators_copasi.data_model.RungeKuttaStepSizeParameter(value: float | None = None)[source]#
Bases:
StepSizeParameter
- class biosimulators_copasi.data_model.SDESolveRI5Algorithm(absolute_tolerance: float | None = None, max_internal_steps: int | None = None, step_size: float | None = None, tolerance_for_root_finder: float | None = None, force_physical_correctness: bool | None = None, units: Units = Units.continuous)[source]#
Bases:
CopasiAlgorithm
- class biosimulators_copasi.data_model.StepSizeParameter[source]#
Bases:
CopasiAlgorithmParameter
- class biosimulators_copasi.data_model.TauLeapAlgorithm(max_internal_steps: int | None = None, random_seed: int | None = None, epsilon: float | None = None, units: Units = Units.discrete)[source]#
Bases:
CopasiAlgorithm
- class biosimulators_copasi.data_model.ToleranceForRootFinderParameter(value: float)[source]#
Bases:
CopasiAlgorithmParameter
biosimulators_copasi.utils module#
Utilities for working with the maps from KiSAO ids to COPASI methods and their arguments
- Author:
Jonathan Karr <karr@mssm.edu>
- Date:
2020-12-13
- Copyright:
2020, BioSimulators Team
- License:
MIT
- biosimulators_copasi.utils.convert_sedml_reactions_to_copasi_reactions(sedml_reactions: list[str]) list[str] [source]#
- biosimulators_copasi.utils.fix_copasi_generated_combine_archive(in_filename: str, out_filename: str, config: Config | None = None) None [source]#
Utility function that corrects COMBINE/OMEX archives generated by COPASI so they are compatible with other tools.
All currently released versions of COPASI export COMBINE archive files. However, these archives presently diverge from the specifications of the SED-ML format.
Format in OMEX manifests is not a valid PURL media type URI
SED-ML files lack namespaces for SBML
- Parameters:
in_filename (
str
) – path to a COMBINE archive to correctout_filename (
str
) – path to save corrected COMBINE archiveconfig (
Config
, optional) – BioSimulators-utils configuration
- biosimulators_copasi.utils.get_algorithm(kisao_id: str, events_were_requested: bool = False, config: Config | None = None) CopasiAlgorithm [source]#
Get the algorithm wrapper for a COPASI algorithm
- Parameters:
kisao_id (
str
) – KiSAO algorithm idevents_were_requested (
bool
, optional) – whether an algorithm that supports events is neededconfig (
Config
, optional) – configuration
- Returns:
The copasi algorithm deemed suitable
- Return type:
CopasiAlgorithm
- biosimulators_copasi.utils.set_algorithm_parameter_values(copasi_algorithm: CopasiAlgorithm, requested_changes: list) tuple[list[AlgorithmParameterChange], list[AlgorithmParameterChange]] [source]#
Set a parameter of a COPASI simulation function
- Parameters:
algorithm_kisao_id (
str
) – KiSAO algorithm idalgorithm_function (
types.FunctionType
) – algorithm functionparameter_kisao_id (
str
) – KiSAO parameter idvalue (
string
) – parameter value
- Returns:
names of the COPASI parameters that were set and their values
- Return type:
dict