biosimulators_boolnet package

biosimulators_boolnet.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 (SedDocument or str) – SED document or a path to SED-ML file which defines a SED document

  • working_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 to base_out_path to store the outputs

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

  • log (SedDocumentLog, optional) – log of the document

  • indent (int, optional) – degree to indent status messages

  • pretty_print_modified_xml_models (bool, optional) – if True, pretty print modified XML models

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

  • config (Config, optional) – BioSimulators common configuration

  • simulator_config (SimulatorConfig, optional) – tellurium configuration

Returns

  • ReportResults: results of each report

  • SedDocumentLog: log of the document

Return type

tuple

biosimulators_boolnet.exec_sed_task(task, variables, preprocessed_task=None, log=None, config=None)[source]

Execute a task and save its results

Parameters
  • task (Task) – task

  • variables (list of Variable) – variables that should be recorded

  • preprocessed_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 task

  • config (Config, optional) – BioSimulators common configuration

Returns

VariableResults: results of variables TaskLog: log

Return type

tuple

Raises

NotImplementedError

  • Task requires a time course that BoolNet doesn’t support * Task requires an algorithm that BoolNet doesn’t support

biosimulators_boolnet.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 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

  • config (Config, optional) – BioSimulators common configuration

Returns

  • SedDocumentResults: results

  • CombineArchiveLog: log

Return type

tuple

biosimulators_boolnet.get_simulator_version()[source]

Get the version of BoolNet

Returns

version

Return type

str

biosimulators_boolnet.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) – task

  • variables (list of Variable) – variables that should be recorded

  • config (Config, optional) – BioSimulators common configuration

Returns

preprocessed information about the task

Return type

dict

Submodules

biosimulators_boolnet.config module

Configuration for BioSimulators-BoolNet

Author

Jonathan Karr <karr@mssm.edu>

Date

2021-01-08

Copyright

2020-2021, Center for Reproducible Biomedical Modeling

License

MIT

class biosimulators_boolnet.config.Config[source]

Bases: object

Configuration

boolnet_version[source]

specific version of BoolNet to use

Type

str

biosimulators_boolnet.core module

BioSimulators-compliant command-line interface to the BoolNet simulation program.

Author

Jonathan Karr <karr@mssm.edu>

Date

2021-01-05

Copyright

2020-2021, Center for Reproducible Biomedical Modeling

License

MIT

biosimulators_boolnet.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 (SedDocument or str) – SED document or a path to SED-ML file which defines a SED document

  • working_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 to base_out_path to store the outputs

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

  • log (SedDocumentLog, optional) – log of the document

  • indent (int, optional) – degree to indent status messages

  • pretty_print_modified_xml_models (bool, optional) – if True, pretty print modified XML models

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

  • config (Config, optional) – BioSimulators common configuration

  • simulator_config (SimulatorConfig, optional) – tellurium configuration

Returns

  • ReportResults: results of each report

  • SedDocumentLog: log of the document

Return type

tuple

biosimulators_boolnet.core.exec_sed_task(task, variables, preprocessed_task=None, log=None, config=None)[source]

Execute a task and save its results

Parameters
  • task (Task) – task

  • variables (list of Variable) – variables that should be recorded

  • preprocessed_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 task

  • config (Config, optional) – BioSimulators common configuration

Returns

VariableResults: results of variables TaskLog: log

Return type

tuple

Raises

NotImplementedError

  • Task requires a time course that BoolNet doesn’t support * Task requires an algorithm that BoolNet doesn’t support

biosimulators_boolnet.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 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

  • config (Config, optional) – BioSimulators common configuration

Returns

  • SedDocumentResults: results

  • CombineArchiveLog: log

Return type

tuple

biosimulators_boolnet.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) – task

  • variables (list of Variable) – variables that should be recorded

  • config (Config, optional) – BioSimulators common configuration

Returns

preprocessed information about the task

Return type

dict

biosimulators_boolnet.data_model module

Data structures for representing the mapping from KISAO terms to BoolNet methods and their arguments

Author

Jonathan Karr <karr@mssm.edu>

Date

2021-01-08

Copyright

2021, Center for Reproducible Biomedical Modeling

License

MIT

biosimulators_boolnet.data_model.transform_gene_probabilities(dict_value, model)[source]

Validate a dictionary that maps the id of each species to its probability to be chosen for the next state transition, and transform the dictonary into a vector.

Parameters
  • dict_value (dict of str to float) – dictionary that maps the id of each species to its probability to be chosen for the next state transition

  • model (ListVector) – model

Returns

species state transition probabilities

Return type

FloatVector

Raises

ValueError – if the value is dictionary of the transition probability of each species

biosimulators_boolnet.data_model.transform_noise_level(value, model)[source]

Validate a noise level

Parameters
  • value (float) – value

  • model (ListVector) – model

Returns

value

Return type

float

Raises

ValueError – if the value is not a non-negative float

biosimulators_boolnet.utils module

Utilities for working with BoolNet

Author

Jonathan Karr <karr@mssm.edu>

Date

2021-01-08

Copyright

2020-2021, Center for Reproducible Biomedical Modeling

License

MIT

biosimulators_boolnet.utils.get_boolnet()[source]

Get the BoolNet R package

Returns

BoolNet R package

Return type

InstalledSTPackage

biosimulators_boolnet.utils.get_variable_results(simulation, variables, target_x_paths_keys, species_results)[source]

Get the predicted values of the desired variables

Parameters
  • simulation (UniformTimeCourseSimulation) – simulation

  • variables (list of Variable) – variables of data generators

  • target_x_paths_keys (dict) – dictionary that maps each variable target to the BoolNet key of the corresponding qualitative species

  • species_results (dict of str to numpy.ndarray) – dictionary that maps the id of each species to its predicted values

Returns

VariableResults

biosimulators_boolnet.utils.get_variable_target_x_path_keys(variables, model_etree)[source]

Get the BoolNet key for each XML XPath target of a SED-ML variable

Parameters
  • variables (list of Variable) – variables of data generators

  • model_etree (lxml.etree._ElementTree) – element tree for model

Returns

dictionary that maps each variable target to the BoolNet key

of the corresponding qualitative species

Return type

dict

biosimulators_boolnet.utils.install_boolnet()[source]

Install the BoolNet R package if its not already installed

Raises

RuntimeError – if BoolNet could not be installed

biosimulators_boolnet.utils.set_simulation_method_arg(model, algorithm_kisao_id, parameter_change, simulation_method_args)[source]

Set the value of an argument of BoolNet’s generateTimeSeries method based on a SED parameter object (represented by an instance of AlgorithmParameterChange).

Parameters
  • model (ListVector) – model

  • algorithm_kisao_id (str) – KiSAO id of the algorithm

  • parameter_change (AlgorithmParameterChange) – desired value of a parameter of the algorithm

  • sim_method_args (dict) – arguments for BoolNet’s generateTimeSeries method

biosimulators_boolnet.utils.validate_data_generator_variables(variables, algorithm_kisao_id)[source]

Validate that BoolNet can produce the desired variables of the desired data generators

Parameters
  • variables (list of Variable) – variables of data generators

  • algorithm_kisao_id (str) – KiSAO id of the algorithm

Raises
  • NotImplementedError – a variable requires an unsupported symbol

  • ValueError – a variable requires an unsupported type of target

biosimulators_boolnet.utils.validate_time_course(simulation)[source]

Validate that BoolNet can execute the desired time course

Parameters

simulation (UniformTimeCourseSimulation) – simulation

Returns

errors

Return type

nested of list of str