basico package

Submodules

basico.array_tools module

basico.biomodels module

basico.compartment_array_tools module

basico.jws_online module

basico.model_info module

The model_info module contains basic functionality for interrogating the model.

Here all functionality for interrogating and manipulating the model is hosted. For each of the elements:

  • compartments

  • species

  • parameters

  • events

  • reactions

you will find functions to add, get, set, and remove them.

class basico.model_info.T

Bases: object

Constants for Task names

Convert between task names to enums

>>> T.from_enum(0)
Steady-State
>>> T.to_enum('Steady-State')
0
CROSS_SECTION = 'Cross Section'
EFM = 'Elementary Flux Modes'
LNA = 'Linear Noise Approximation'
LYAPUNOV_EXPONENTS = 'Lyapunov Exponents'
MCA = 'Metabolic Control Analysis'
MOIETIES = 'Moieties'
OPTIMIZATION = 'Optimization'
PARAMETER_ESTIMATION = 'Parameter Estimation'
SCAN = 'Scan'
SENSITIVITIES = 'Sensitivities'
STEADY_STATE = 'Steady-State'
TIME_COURSE = 'Time-Course'
TIME_COURSE_SENSITIVITIES = 'Time-Course Sensitivities'
TIME_SCALE_SEPARATION = 'Time Scale Separation Analysis'
classmethod all_task_names()
classmethod from_enum(int_value)
classmethod to_enum(value)
basico.model_info.add_amount_expressions(**kwargs)

Utility function that adds model values for all metabolites to the model to compute the amount

The global parameters created will be named amount(metab_name), and so can be accessed at any time. Should the amount already exist, it will not be modified.

Parameters:

kwargs

optional parameters

  • model: to specify the data model to be used (if not specified
    the one from get_current_model() will be taken)

Returns:

None

basico.model_info.add_compartment(name, initial_size=1.0, **kwargs)

Adds a new compartment to the model.

Parameters:
  • name (str) – the name for the new compartment

  • initial_size (float) – the initial size for the compartment

  • kwargs

    optional parameters, recognized are:

Returns:

the compartment added

basico.model_info.add_default_plot(name, **kwargs)

Adds a default plot to the list of plots

Parameters:
  • name (str) – name of the default plot

  • kwargs

    optional arguments

    • new_name: to rename the plot specification
    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

none or the name of the plot created

Return type:

str or None

basico.model_info.add_equation(eqn, time_symbol='t', **kwargs)

This function allows to add arbitrary equations to the current model.

This function allows adding arbitrary ODE’s / assignments to the model. Nonexisting model entities will be created.

Parameters:
  • eqn (str) – the equation for example of form: d[X]/dt = k1 * exp({Time})

  • time_symbol (str) – optional symbol that will be used for time (defaults to t)

  • kwargs

Returns:

basico.model_info.add_event(name, trigger, assignments, **kwargs)

Adds a new event to the model.

Parameters:
  • name (str) – the name for the new event

  • trigger (str) – the trigger expression to be used. The expression can consist of all display names. for example Time > 10 would make the event trigger at time 10.

  • assignments ([(str,str)]) – All the assignments that should be made, when the event fires. This should be a list of tuples where the first element is the name of the element to change, and the second element the assignment expression.

  • kwargs

    optional parameters, recognized are:

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)
    • ’new_name’: the new name for the event

    • ’delay’: the delay expression

    • ’priority’: the priority expression

    • ’persistent’: boolean indicating if the event is persistent

    • ’delay_calculation’: boolean indicating whether just the assignment is delayed, or the calculation as well

    • ’fire_at_initial_time’: boolean indicating if the event should fire at the initial time

Returns:

the newly created event

basico.model_info.add_event_assignment(name, assignment, exact=False, **kwargs)

Adds an event assignment to the named event

Parameters:
  • name (str) – the name (or substring of name) of an event

  • assignment ([(str,str)] or (str, str)) – tuple or list of tuples of event assignments of form (target, expression)

  • exact (bool) – boolean indicating whether the named expression has to be exact

Returns:

None

basico.model_info.add_function(name, infix, type='general', mapping=None, **kwargs)

Adds a new function definition if none with that name already exists

Parameters:
  • name (str) – the name for the new function

  • infix (str) – the formula for the new function (e.g: V * S / ( K + S ))

  • type (str) – optional flag specifying whether the function is ‘reversible’, ‘irreversible’ or ‘general’

  • mapping (dict) –

    optional dictionary mapping the elements of the infix to their usage. If not specified, the usage will default to parameter, other values possible would be substrate, product, modifier, volume or `time. One example for the infix for the infix above we would specify that S is substrate:

    { ‘S’: ‘substrate’ }

  • kwargs

    optional parameters, recognized are:

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

basico.model_info.add_parameter(name, initial_value=1.0, **kwargs)

Adds a new global parameter to the model.

Parameters:
  • name (str) – the name for the new global parameter

  • initial_value (float) – optional the initial value of the parameter (defaults to 1)

  • kwargs

    optional parameters, recognized are:

Returns:

the newly created parameter

basico.model_info.add_parameter_set(name, param_set_dict=None, **kwargs)

Adds a new parameter set to the model with the values from the dictionary

Parameters:
  • name (str) – name of the parameter set to add

  • param_set_dict (dict or None) – dictionary with the parameter set values if empty, the current state of the model will be used

  • kwargs

    optional parameters

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

basico.model_info.add_plot(name, **kwargs)

Adds a new plot specification to the model.

Parameters:
  • name (str) – the name for the new plot specification

  • kwargs

    optional parameters, recognized are:

Returns:

the plot

basico.model_info.add_reaction(name, scheme, **kwargs)

Adds a new reaction to the model

Parameters:
  • name (str) – the name for the new reaction

  • scheme (str) – the reaction scheme for the new reaction, if it includes Species that do not exist yet in the model they will be created. So for example a scheme of A -> B would create species A and B if they would not exist in the model, before creating the irreversible reaction.

  • kwargs

    optional parameters, recognized are:

Returns:

the newly created reaction

basico.model_info.add_report(name, **kwargs)

Adds a new report specification to the model.

Examples

The following would adds a report definition ‘Time Course’ to include Time and the concentration of S, in a report that is separated by tabs.

>>> add_report('Time Course', body=['Time', '[S]']
The following defines a report for the Steady State concentration of S. To disambiguate, that the

string ‘[S]’ in the header should be used literally, we call the function wrap_copasi_string.

>>> add_report('Steady State', task=T.STEADY_STATE, header=[wrap_copasi_string('[S]')], footer=['[S]'])
Parameters:
  • name (str) – the name for the new plot specification

  • kwargs

    optional parameters, recognized are:

Returns:

the report definition

basico.model_info.add_species(name, compartment_name='', initial_concentration=1.0, **kwargs)

Adds a new species to the model.

Parameters:
  • name (str) – the name for the new species

  • compartment_name (str) – optional the name of the compartment in which the species should be created, it will default to the first compartment. If no compartment is present, a unit compartment named compartment will be created.

  • initial_concentration (float) – optional the initial concentration of the species

  • kwargs

    optional parameters, recognized are:

Returns:

the newly created species

basico.model_info.apply_parameter_set(name, exact=False, **kwargs)

Applies the parameter set with the given name to the model

Parameters:
  • name – the name of the parameter set or a substring of the name

  • exact – boolean indicating whether the name has to match exactly

  • kwargs

    optional parameters

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

basico.model_info.as_dict(df)

Convenience function returning the data frame as dictionary

Parameters:

df (pd.DataFrame) – the data frame

Returns:

the contents of the dataframe as [{}] if there are multiple ones, otherwise the dictionary if just one, or None

Return type:

List[Dict] or Dict or None

basico.model_info.assign_report(name, task, filename='', append=True, confirm_overwrite=True, **kwargs)

Assigns the named report to the specified task

Parameters:
  • name (str) – the name of the report definition to assign

  • task (Union[int, str, COPASI.CCopasiTask]) – the task to assign the report to

  • filename (str) – the filename to write the result to or ‘’, if it is the empty, it resets the target of the task, and COPASI will not create that report

  • append (bool) – boolean indicating whether output should be appended (defaults to True)

  • confirm_overwrite (bool) – boolean indicating whether the copasi should ask before overwriting a file

  • kwargs

    optional parameters

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

None

basico.model_info.get_cn(name_or_reference, initial=False, **kwargs)

Gets the cn of the named element or none

Parameters:
  • name_or_reference (str or COPASI.CDataObject) – display name of model element

  • initial (bool) – if True, an initial reference cn will be returned, rather than a transient one

  • kwargs

    optional parameters

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

the cn if found or None

Return type:

str or None

basico.model_info.get_compartments(name=None, exact=False, **kwargs)

Returns all information about the compartments as pandas dataframe.

Parameters:
  • name (str) – optional filter expression for the compartment, if it is not included in the name, the compartment will not be added to the data set.

  • exact (bool) – boolean indicating, that the name has to be exact

  • kwargs

    optional arguments:

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

a pandas dataframe with the information about the compartment

Return type:

pandas.DataFrame

basico.model_info.get_default_plot_names(filter=None, **kwargs)

Returns a list of default plot names

Parameters:
  • filter – optional filter of substring to be in the name

  • kwargs

Returns:

basico.model_info.get_events(name=None, exact=False, **kwargs)

Returns all information about the events as pandas dataframe.

Parameters:
  • name (str) – optional filter expression for the event, if it is not included in the event name, the event will not be added to the data set.

  • exact (bool) – boolean indicating whether the name has to be exact

  • kwargs

    optional arguments:

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

a pandas dataframe with the information about the event

Return type:

pandas.DataFrame

basico.model_info.get_functions(name=None, **kwargs)

Returns all available functions as pandas dataframe.

Parameters:
  • name (str) – optional filter expression for the functions, if it is not included in the name, the function will not be added to the data set.

  • kwargs

    optional arguments:

    • reversible: to further filter for functions that are only reversible

    • suitable_for: an optional reaction for which to filter the function list. Only functions
      suitable for the reaction will be returned
    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

a pandas dataframe with the information about the functions

Return type:

pandas.DataFrame

basico.model_info.get_jacobian_matrix(apply_initial_values=False, **kwargs)

Returns the jacobian matrix of the model at the current state

Parameters:
  • apply_initial_values (bool) – if set to the the initial values will be applied, otherwise the jacobian from the current state will be returned

  • kwargs

    optional parameters

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

the stoichiometry matrix of the current model

Return type:

pd.DataFrame

basico.model_info.get_miriam_annotation(**kwargs)

Returns the elements miriam annotations as dictionary of the form:

{

‘created’: datetime, ‘creators’: [{

‘first_name’: ‘…’, ‘last_name’: ‘…’, ‘email’: ‘…’, ‘organization’: ‘…’

},…],

‘references’: [{

‘id’: ‘…’, ‘uri’: ‘identifiers.org uri’, ‘resource’: ‘human readable name of resource’, ‘description’, ‘…’

},…],

‘descriptions’: [{

‘id’: ‘…’, ‘qualifier’: ‘human readable qualifier string’, ‘uri’: ‘identifiers.org uri’, ‘resource’: ‘name of the resource referenced’

},…], ‘modifications’: [datetime,…]

}

Parameters:

kwargs

optional parameters, recognized are:

  • model: to specify the data model to be used (if not specified
    the one from get_current_model() will be taken)
  • name: the display name of the element to set the notes on.
    otherwise the main model will be taken.
  • element: any model element

Returns:

the elements annotation as dictionary as described

Return type:

{}

basico.model_info.get_miriam_resources()

Retrieves the current MIRIAM resources from the configuration

Returns:

dataframe with the list of current miriam resources

Return type:

pandas.DataFrame

basico.model_info.get_model_units(**kwargs)

Returns all model units as dictionary.

Parameters:

kwargs

optional parameters

  • model: to specify the data model to be used (if not specified
    the one from get_current_model() will be taken)

Returns:

a dictionary containing the model units in the form: | { | ‘time_unit’: ‘’, | ‘quantity_unit’: ‘’, | ‘length_unit’: ‘’, | ‘area_unit’: ‘’, | ‘volume_unit’: ‘’, | }

basico.model_info.get_notes(**kwargs)

Returns all notes on the element or model.

Parameters:

kwargs

optional parameters, recognized are:

  • model: to specify the data model to be used (if not specified
    the one from get_current_model() will be taken)
  • name: the display name of the element to set the notes on.
    otherwise the main model will be taken.
  • element: any model element

Returns:

the notes string (plain text, or xhtml)

Return type:

str

basico.model_info.get_parameter_sets(name=None, exact=False, values_only=False, **kwargs)

Returns the list of parameter sets

Parameters:
  • name (str) – name of the parameter set to return (or a substring of the name)

  • exact (bool) – boolean indicating whether the name has to be exact or not (default: False)

  • values_only (bool) – boolean indicating whether to return only the values of the entries of the parameter set or a dictionary describing it (default: False)

  • kwargs

    optional parameters

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

basico.model_info.get_parameters(name=None, exact=False, **kwargs)

Returns all information about the global parameters as pandas dataframe.

Parameters:
  • name (str) – optional filter expression for the parameters, if it is not included in the name, the parameter will not be added to the data set.

  • exact (bool) – boolean indicating that the name has to be exact

  • kwargs

    optional arguments:

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

a pandas dataframe with the information about the parameter

Return type:

pandas.DataFrame

basico.model_info.get_plot_dict(plot_spec, **kwargs)

Returns the information for the specified plot

Parameters:
  • plot_spec (Union[str,int,COPASI.CPlotSpecification]) – the name, index or plot specification object

  • kwargs

    optional arguments

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

dictionary of the form: | { | ‘name’: ‘Phase Plot’, | ‘active’: True, | ‘log_x’: False, | ‘log_y’: False, | ‘tasks’: ‘’, | ‘curves’: | [ | { | ‘name’: ‘[Y]|[X]’, # the name of the curve | ‘type’: ‘curve2d’,# type of the curve (one of curve2d, histoItem1d, bandedGraph | or spectogram) | ‘channels’: [‘[X]’, ‘[Y]’], # display names of all the items to be plotted | ‘color’: ‘auto’, # color as hex rgb value (i.e ‘#ff0000’ for red) or ‘auto’ | ‘line_type’: ‘lines’,# the line type (one of lines, points, symbols or | lines_and_symbols) | ‘line_subtype’: ‘solid’, # line subtype (one of solid, dotted, dashed, dot_dash or | dot_dot_dash) | ‘line_width’: 2.0, # line width | ‘symbol’: ‘small_cross’, # the symbol to be used (one of small_cross, large_cross | or circle ) | ‘activity’: ‘during’ # when the data should be collected (one of ‘before’, ‘during’, ‘after’) | from task | } | ] | }

basico.model_info.get_plots(name=None, **kwargs)

Returns all information about the plot definitions as pandas dataframe.

Parameters:
  • name (str) – optional filter expression for the plots, if it is not included in the plot name, the plot will not be added to the data set.

  • kwargs

    optional arguments:

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

a pandas dataframe with the information about the plot see also get_plot_dict()

Return type:

pandas.DataFrame

basico.model_info.get_reaction_mapping(reaction, **kwargs)

Returns the reaction mapping of the given reaction

Parameters:
  • reaction (str or COPASI.CReaction) – name of a reaction, or the reaction object

  • kwargs

    optional arguments

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

the dictionary with the reaction mapping

Return type:

{}

basico.model_info.get_reaction_parameters(name=None, **kwargs)

Returns all local parameters as pandas dataframe.

This also includes global parameters that are mapped to local ones.

Parameters:
  • name (str) – optional filter expression, if it is not included in the name, the function will not be added to the data set.

  • kwargs

    optional arguments:

    • reaction_name: to further filter for local parameters of only certain reactions
      (that contain the substring)
    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

a pandas dataframe with the information about local parameters

Return type:

pandas.DataFrame

basico.model_info.get_reactions(name=None, exact=False, **kwargs)

Returns all reactions as pandas dataframe.

Parameters:
  • name (str) – optional filter expression, if it is not included in the name, the reaction will not be added to the data set.

  • exact (bool) – boolean indicating, that the name has to be exact

  • kwargs

    optional arguments:

    • reaction_name: to further filter for local parameters of only certain reactions
      (that contain the substring)
    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

a pandas dataframe with the information about local parameters

Return type:

pandas.DataFrame

basico.model_info.get_reduced_jacobian_matrix(apply_initial_values=False, **kwargs)

Returns the jacobian matrix of the reduced model at the current state

Parameters:
  • apply_initial_values (bool) – if set to the the initial values will be applied, otherwise the jacobian from the current state will be returned

  • kwargs

    optional parameters

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

the stoichiometry matrix of the reduced current model

Return type:

pd.DataFrame

basico.model_info.get_reduced_stoichiometry_matrix(**kwargs)

Returns the reduced stoichiometry matrix of the model

Returns:

the stoichiometry matrix of the current model

Return type:

pd.DataFrame

basico.model_info.get_report_dict(report, **kwargs)

Returns all information about the plot as dictionary

Parameters:
  • report (COPASI.CReportDefinition or int or str) – report definition, index or name

  • kwargs

    optional arguments

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

a dictionary with all information about the plot

Return type:

dict

basico.model_info.get_reports(name=None, ignore_automatic=False, task=None, **kwargs)

Returns the reports as dataframe

Parameters:
  • name – optional filter by name

  • ignore_automatic – if true, only manually created reports are returned

  • task – optional task name, to the get the report for

  • kwargs

    optional arguments:

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

a data frame with all the report information

Return type:

pd.DataFrame

basico.model_info.get_scheduled_tasks(**kwargs)

Returns the list of scheduled tasks

Parameters:

kwargs

optional parameters

  • model: to specify the data model to be used (if not specified
    the one from get_current_model() will be taken)

Returns:

list of tasks that are scheduled

Return type:

[str]

basico.model_info.get_species(name=None, exact=False, **kwargs)

Returns all information about the species as pandas dataframe.

Example:

Assume you have the brusselator example loaded load_example(‘brusselator’)

>>> get_species()

returns you a dataframe of all species with the species name as index.

>>> get_species('X')

returns you only those species, that include X in the name.

Parameters:
  • name (str) – optional filter expression for the species, if it is not included in the species name, the species will not be added to the data set.

  • exact (bool) – if true, the name has to match precisely the name of the species

  • kwargs

    optional arguments to further filter down the species. recognized are:

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)
    • compartment: to filter down only species in specific compartments

    • type: to filter for species of specific simulation type

Returns:

a pandas dataframe with the information about the species

Return type:

pandas.DataFrame

basico.model_info.get_stoichiometry_matrix(**kwargs)

Returns the stoichiometry matrix of the model

Returns:

the stoichiometry matrix of the current model

Return type:

pd.DataFrame

basico.model_info.get_task_settings(task, basic_only=True, **kwargs)

Returns the settings of the given task

Parameters:
  • task (COPASI.CCopasiTask or str) – the task to read the settings of

  • basic_only (bool) – boolean flag, indicating that only the basic parameters should be returned

  • kwargs

    optional parameters

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

dict of task settings

Return type:

{}

basico.model_info.get_time_unit(**kwargs)

Returns the time unit of the model

basico.model_info.get_value(name_or_reference, initial=False, **kwargs)

Gets the value of the named element or nones

Parameters:
  • name_or_reference (str or COPASI.CDataObject) – display name of model element

  • initial (bool or None) – if True, an initial value will be returned, rather than a transient one. If set to None, the default reference will be returned and not coerced.

  • kwargs

    optional parameters

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

the value if found or None

Return type:

float or None

basico.model_info.have_miriam_resources()

Utility function returning whether MIRIAM resources are avaialble

Returns:

boolean indicating whether there are MIRIAM resources available or not

Return type:

bool

basico.model_info.remove_amount_expressions(**kwargs)

Utility function that removes model values created using add_amount_expressions.

The global parameters created will be named amount(metab_name), and so can be accessed at any time.

Parameters:

kwargs

optional parameters

  • model: to specify the data model to be used (if not specified
    the one from get_current_model() will be taken)

Returns:

None

basico.model_info.remove_compartment(name, **kwargs)

Deletes the named compartment (and everything included)

Parameters:
  • name (str) – the name of a compartment in the model

  • kwargs

    optional arguments

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

None

basico.model_info.remove_event(name, **kwargs)

Deletes the named event

Parameters:
  • name (str) – the name of an event in the model

  • kwargs

    optional arguments

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

None

basico.model_info.remove_function(name, **kwargs)

Removes the function with the given name

Parameters:
  • name (str) – the name of the function to be removed

  • kwargs

    optional parameters, recognized are:

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

basico.model_info.remove_parameter(name, **kwargs)

Deletes the named global parameter

Parameters:
  • name (str) – the name of a parameter in the model

  • kwargs

    optional arguments

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

None

basico.model_info.remove_parameter_sets(name=None, exact=False, **kwargs)

remove the named parameter set(s)

Parameters:
  • name (str) – name of the parameter set to remove (or a substring of the name)

  • exact (bool) – boolean indicating whether the name has to be exact

  • kwargs

    optional parameters

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

basico.model_info.remove_plot(name, **kwargs)

Deletes the named plot

Parameters:
  • name (str) – the name of an plot in the model

  • kwargs

    optional arguments

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

None

basico.model_info.remove_reaction(name, **kwargs)

Deletes the named reaction

Parameters:
  • name (str) – the name of a reaction in the model

  • kwargs

    optional arguments

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

None

basico.model_info.remove_report(name, **kwargs)

Deletes the named report

Parameters:
  • name (str) – the name of a report in the model

  • kwargs

    optional arguments

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

None

basico.model_info.remove_report_from_task(task, **kwargs)

Clears the report filename from the specified task

Parameters:
  • task (Union[int, str, COPASI.CCopasiTask]) – the task to assign the report to

  • kwargs

    optional parameters

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

None

basico.model_info.remove_species(name, **kwargs)

Deletes the named species

Parameters:
  • name (str) – the name of a species in the model

  • kwargs

    optional arguments

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

None

basico.model_info.remove_user_defined_functions()

Removes all user defined functions along with all elements that still use them

basico.model_info.set_compartment(name=None, exact=False, **kwargs)

Sets properties of the named compartment

Parameters:
  • name (str) – the name of the compartment (or a substring of the name)

  • exact (bool) – boolean indicating whether the name has to be exact

  • kwargs

    optional arguments

    • new_name: the new name for the compartment
    • initial_value or initial_size: to set the initial size of the compartment
    • value or size: to set the transient size of the compartment
    • initial_expression: the initial expression for the compartment
    • status or type: the type of the compartment one of fixed, assignment or ode
    • expression: the expression for the compartment (only valid when type is ode or assignment)
    • dimensionality: sets the dimensionality of the compartment (int value 1..3)
    • notes: sets notes for the compartment (either plain text, or valid xhtml)
    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

None

basico.model_info.set_element_name(element, new_name, **kwargs)

Sets the name of the element

Parameters:
  • element (COPASI.CDataObject or str) – the element whose name to change

  • new_name (str) – the new name for the element

  • kwargs

    optional parameters

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

basico.model_info.set_event(name, exact=False, trigger=None, assignments=None, **kwargs)

Sets properties of the named event

Parameters:
  • name (str) – the name of the event (or a substring of the name)

  • exact (bool) – boolean indicating, that the name has to be exact

  • trigger (str or None) – the trigger expression to be used. The expression can consist of all display names. for example Time > 10 would make the event trigger at time 10.

  • assignments ([(str,str)] or None) – All the assignments that should be made, when the event fires. This should be a list of tuples where the first element is the name of the element to change, and the second element the assignment expression.

  • kwargs

    optional parameters, recognized are:

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)
    • ’new_name’: the new name for the event

    • ’delay’: the delay expression

    • ’priority’: the priority expression

    • ’persistent’: boolean indicating if the event is persistent

    • ’delay_calculation’: boolean indicating whether just the assignment is delayed, or the calculation as well

    • ’fire_at_initial_time’: boolean indicating if the event should fire at the initial time

Returns:

basico.model_info.set_miriam_annotation(created=None, creators=None, references=None, descriptions=None, modifications=None, replace=True, **kwargs)

Sets the MIRIAM annotations for the provided element or model

Parameters:
  • created (datetime.datetime or None) – the date/time to set as the objects creation time or None, if not to be set

  • creators (list or None) –

    None, if not to be modified, otherwise list of creators of the form:
    {
    ‘first_name’: ‘…’,
    ’last_name’: ‘…’,
    ’email’: ‘…’,
    ’organization’: ‘…’
    }

  • references (list or None) –

    None if not to be modified, otherwise list of references of the form:

    {
    ‘resource’: ‘human readable name of resource’,
    ’id’: ‘…’,
    ’uri’: ‘identifiers.org uri’,
    ’description’, ‘…’
    }

    only the uri needs to be provided, or alternatively id + resource.

  • descriptions (list or None) –

    None if not to be modified, otherwise list of descriptions of the form:

    {
    ‘resource’: ‘human readable name of resource’,
    ’id’: ‘…’,
    ’qualifier’: ‘…’,
    ’uri’: ‘identifiers.org uri’,
    }

    only the uri needs to be provided, or alternatively id + resource.

  • modifications (list or None) –

    None if not to be modified, otherwise list of datetime objects representing
    modification dates

  • replace – Boolean indicating whether existing entries should be removed.

Returns:

None

basico.model_info.set_model_name(new_name, **kwargs)

Renames the model to the provided new name

Parameters:
  • new_name (str) – the new name of the model

  • kwargs

    optional parameters

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

None

basico.model_info.set_model_unit(**kwargs)

Sets the model units.

Parameters:

kwargs

optional parameters

  • time_unit: time unit expression
  • substance_unit or quantity_unit: substance unit expression
  • length_unit: length unit expression
  • area_unit: area unit expression
  • volume_unit: volume unit expression
  • model: to specify the data model to be used (if not specified
    the one from get_current_model() will be taken)

basico.model_info.set_notes(notes, **kwargs)

Sets notes on the provided element

Parameters:
  • notes (str) – the notes to be set, can be either plain text, or valid xhtml

  • kwargs

    optional parameters, recognized are:

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)
    • name: the display name of the element to set the notes on.
      otherwise the main model will be taken.
    • element: any model element

Returns:

None

basico.model_info.set_parameter_set(name, exact=False, param_set_dict=None, remove_others=False, **kwargs)

sets the named parameter sets to the given dictionary values

Parameters:
  • name (str) – name of the parameter set to change (or a substring of the name)

  • exact (bool) – boolean indicating whether the name has to be exact

  • param_set_dict (dict or None) – dictionary with the parameter set values

  • remove_others (bool) – boolean indicating whether to remove entries, that are not specified in the dictionary (default: False)

  • kwargs

    optional parameters

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

basico.model_info.set_parameters(name=None, exact=False, **kwargs)

Sets properties of the named parameter(s).

Parameters:
  • name (str) – the name of the parameter (or a substring of the name)

  • exact (bool) – boolean indicating whether the name has to be exact or not

  • kwargs

    optional arguments

    • new_name: the new name for the parameter
    • unit: the unit expression to be set
    • initial_value: to set the initial value for the parameter
    • value: set the transient value for the parameter
    • initial_expression: the initial expression
    • status or type: the type of the parameter one of fixed, assignment or ode
    • expression: the expression for the parameter (only valid when type is ode or assignment)
    • notes: sets notes for the parameter (either plain text, or valid xhtml)
    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

None

basico.model_info.set_plot_curves(plot_spec, curves, **kwargs)

Sets all curves of the named plot specification (all curves will be replaced)

Parameters:
  • plot_spec (Union[str,int,COPASI.CPlotSpecification]) – the name, index or plot specification object

  • curves ([{}]) –

    list of dictionaries of curve items to be added. For example

    [
    {
    ‘name’: ‘[Y]|[X]’, # the name of the curve
    ’type’: ‘curve2d’, # type of the curve (one of curve2d, histoItem1d, bandedGraph
    or spectogram)
    ’channels’: [‘[X]’, ‘[Y]’], # display names of all the items to be plotted
    ’color’: ‘auto’, # color as hex rgb value (i.e ‘#ff0000’ for red) or ‘auto’
    ’line_type’: ‘lines’, # the line type (one of lines, points, symbols or
    lines_and_symbols)
    ’line_subtype’: ‘solid’, # line subtype (one of solid, dotted, dashed, dot_dash or
    dot_dot_dash)
    ’line_width’: 2.0, # line width
    ’symbol’: ‘small_cross’, # the symbol to be used (one of small_cross, large_cross or circle)
    ’activity’: ‘during’ # when the data should be collected (one of ‘before’, ‘during’, ‘after’)
    }
    ]

    Additionally, histograms may have the bin size in a increment element. Spectograms can have
    log_z, color_map (one of ‘Default’, ‘Yellow-Red’, ‘Grayscale’ or ‘Blue-White-Red’),
    ’bilinear’ (should the plot interpolate between values), ‘contours’ (at which values to draw contours)
    ’max_z’ (max z value).

  • kwargs

    optional arguments

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

None

basico.model_info.set_plot_dict(plot_spec, active=True, log_x=False, log_y=False, tasks='', **kwargs)

Sets properties of the named plot specification.

Parameters:
  • plot_spec (Union[str,int,COPASI.CPlotSpecification]) – the name, index or plot specification object

  • active (bool) – boolean indicating whether plot should be active (defaults to true)

  • log_x (bool) – boolean indicating that the x axis should be logarithmic

  • log_y (bool) – boolean indicating that the y axis should be logarithmic

  • tasks (str) –

    task type (or colon separated list of task types) for which the plot
    should be brought up

  • kwargs

    optional arguments

    • new_name: to rename the plot specification
    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)
    • curves: dictionary in the format as described in set_plot_curves().

Returns:

None

basico.model_info.set_reaction(name=None, exact=False, **kwargs)

Sets attributes of the named reaction.

Parameters:
  • name (str) – the name of the reaction (or a substring of the name)

  • exact (bool) – boolean indicating whether the name has to be exact

  • kwargs

    optional arguments

    • new_name: new name of the reaction
    • scheme: the reaction scheme, new species will be created automatically
    • function: the function from the function database to set
    • mapping: an optional dictionary that maps model elements to the function
      parameters. (can be any volume, species, modelvalue or in case of
      local parameters a value)
    • notes: sets notes for the reaction (either plain text, or valid xhtml)
    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

None

basico.model_info.set_reaction_mapping(reaction, mapping, **kwargs)

Sets the reaction mapping of the parameters as specified in the mapping dictionary

Parameters:
  • reaction (str or COPASI.CReaction) – the name of the reaction (or reaction object)

  • mapping ({}) –

    dictionary that maps model elements to the function

    parameters. (can be any volume, species, modelvalue or in case of

    local parameters a value)

  • kwargs

    optional arguments

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

boolean indicating whether the reaction was changed

Return type:

bool

basico.model_info.set_reaction_parameters(name=None, **kwargs)

Sets local parameter values.

Parameters:
  • name (str) – the name of the parameter (or a substring of the name)

  • kwargs

    optional arguments

    • reaction_name: if specified only parameters of the named reaction will be changed
    • value: the new value of the parameter to set. (only one of value / mapped_to should be defined)
    • mapped_to: the name of a global parameter to map the local parameter to
    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

None

basico.model_info.set_report_dict(spec, precision=None, separator=None, table=None, print_headers=True, header=None, body=None, footer=None, task=None, comment=None, add_separator=None, **kwargs)

Sets properties of the named report definition.

Examples:

The following would set a report definition ‘Time Course’ to include Time and the concentration of S, in a report that is separated by tabs.

>>> set_report_dict('Time Course', body=['Time', '[S]']
The following defines a report for the Steady State concentration of S. To disambiguate, that the

string ‘[S]’ in the header should be used literally, we call the function wrap_copasi_string.

>>> set_report_dict('Steady State', task=T.STEADY_STATE, header=[wrap_copasi_string('[S]')], footer=['[S]'])
Parameters:
  • spec (Union[str,int,COPASI.CReportDefinition]) – the name, index or report definition object

  • precision (Optional[int]) – number of digits to print (defaults to 6)

  • separator (Optional[str]) – the separator to use between elements (defaults to )

  • table ([str]) – a list of CNs or display names of elements to collect in a table. If table is specified the header, body, footer argument will be ignored. Note that setting table elements is only useful for tasks that generate output during the task. If that is not the case, you will have to specify the footer and header element directly.

  • print_headers (bool) – optional arguments, indicating whether table headers will be printed (only applies when the table argument is given

  • header ([str]) – a list of CNs or display names of elements to collect in the header column

  • body ([str]) – a list of CNs or display names of elements to collect in the body rows

  • footer ([str]) – a list of CNs or display names of elements to collect in the footer column

  • task (Optional[str]) –

    task name for which the report should be used

  • comment (Optional[str]) – a documentation string for the report (can bei either string, or xhtml string)

  • add_separator (Optional[bool]) – an optional boolean flag, to automatically add seprators between header, body and footer entries since this is not necessary for table entries.

  • kwargs

    optional arguments

    • new_name: to rename the report
    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

None

basico.model_info.set_scheduled_tasks(task_name, **kwargs)

Sets the scheduled tasks

Only the tasks with the listed names will be set to be scheduled.

Parameters:
  • task_name (str or [str]) – name or list of names of tasks set to be scheduled

  • kwargs

    optional parameters

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

None

basico.model_info.set_species(name=None, exact=False, **kwargs)

Sets properties of the named species

Parameters:
  • name (str) – the name of the species (or a substring of the name)

  • exact (bool) – boolean indicating, that the name has to be exact

  • kwargs

    optional arguments

    • new_name: the new name for the species
    • initial_concentration: to set the initial concentration for the species
    • initial_particle_number: to set the initial particle number for the species
    • initial_expression: the initial expression for the species
    • concentration: the new transient concentration for the species
    • particle_number: the new transient particle number for the species
    • status or type: the type of the species one of fixed, assignment or ode
    • expression: the expression for the species (only valid when type is ode or assignment)
    • notes: sets notes for the species (either plain text, or valid xhtml)
    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

None

basico.model_info.set_task_settings(task, settings, **kwargs)

Applies the task settings present in the settings object

Parameters:
  • task (COPASI.CCopasiTask or str) – the task to set

  • settings (dict) – dictionary in the same format as the ones obtained from get_task_settings()

  • kwargs

    optional parameters

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

None

basico.model_info.set_time_unit(unit, **kwargs)

Sets the time unit of the model.

Parameters:
  • unit (str) – the time unit expression

  • kwargs

    optional parameters

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

basico.model_info.set_value(name_or_reference, new_value, initial=False, **kwargs)

Gets the value of the named element or nones

Parameters:
  • name_or_reference (str or COPASI.CDataObject) – display name of model element

  • initial (bool or None) – if True, an initial value will be set, rather than a transient one. If set to None, the default reference will be returned and not coerced.

  • kwargs

    optional parameters

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

the value if found or None

Return type:

float or None

basico.model_info.update_miriam_resources()

This method downloads the latest miriam resources from the COPASI website and stores the configuration

basico.model_info.update_parameter_set(name, exact=False, **kwargs)

Updates the specified parameter set with values from the model

Parameters:
  • name – the name of the parameter set or a substring of the name

  • exact – boolean indicating whether the name has to match exactly

  • kwargs

    optional parameters

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)

Returns:

basico.model_info.wrap_copasi_string(text)

Utility function wrapping the given text into a COPASI string

Parameters:

text – the text to wrap

Returns:

an escaped COPASI string, that can be used in reports

basico.model_io module

This module hosts all method for loading/saving new models.

All methods for loading / saving a new model are within this module. As well as the functionality to get/set the currently loaded model. Whenever a function needs the currently loaded model, and no model was provided in the kwargs, the get_current_model() function retrieves the model loaded last. There are also convenience methods to load models directly from BioModels or from url.

basico.model_io.create_datamodel()

creates a new data model

Returns:

new data model

Return type:

COPASI.CDataModel

basico.model_io.get_current_model()

Returns the current model.

This function returns the current model. That is the model loaded / created last. If no model exists a new one will be created first.

Returns:

the current model

Return type:

COPASI.CDataModel

basico.model_io.get_examples(selector='')

Returns the filenames of examples bundled with this version.

A number of example models are included with the distribution. This method returns the filenames to those examples. Filtered by the argument.

Parameters:

selector (str) – a filter expression to be used, only files matching *{selector}.[cps|xml] will be returned

Returns:

the list of examples matching

Return type:

[str]

basico.model_io.get_model_from_dict_or_default(d, key='model')

Convenience function returning the data model from the dictionary

Parameters:
  • d – the dictionary optionally containing the data model

  • key – the key that the model is under (defaults to ‘model’)

Returns:

the data model if found, or the one from get_current_model()

Return type:

COPASI.CDataModel

basico.model_io.get_num_loaded_models()
Returns:

the number of loaded models

basico.model_io.load_biomodel(model_id, remove_user_defined_functions=False)

Loads a model from the BioModels Database.

Parameters:
  • model_id (Union[int,str]) – either an integer of the biomodels id, or a valid biomodels id

  • remove_user_defined_functions (bool) – optional flag, indicating that user defined functions should be removed before loading the model. Since function definitions are global, this can be helpful to ensure that function names remain the same as in the loaded file. (default: False)

Returns:

Return type:

COPASI.CDataModel

basico.model_io.load_example(selector)

Loads the example matching the selector.

Parameters:

selector (str) – the filter expression to use for the examples see get_examples()

Returns:

the loaded model, or None, if none matched

Return type:

COPASI.CDataModel or None

basico.model_io.load_model(location, remove_user_defined_functions=False)

Loads the model and sets it as current

Parameters:
  • location (str) – either a filename, url or raw string of a COPASI / SBML model

  • remove_user_defined_functions (bool) – optional flag, indicating that user defined functions should be removed before loading the model. Since function definitions are global, this can be helpful to ensure that function names remain the same as in the loaded file. (default: False)

Returns:

the loaded model

Return type:

COPASI.CDataModel

basico.model_io.load_model_from_string(content)

Loads either COPASI model / SBML model from the raw string given.

Parameters:

content (str or bytes) – the copasi / sbml model serialized as string

Returns:

the loaded model

Return type:

COPASI.CDataModel

basico.model_io.load_model_from_url(url)

Loads either COPASI model / SBML model from the url.

Parameters:

url (str) – url to a copasi / sbml model

Returns:

the loaded model

Return type:

COPASI.CDataModel

basico.model_io.new_model(**kwargs)

Creates a new model and sets it as current.

Parameters:

kwargs – optional arguments

  • name (str): the name for the new model

  • quantity_unit (str): the unit to use for species

  • time_unit (str): the time unit to use

  • volume_unit (str): the unit to use for 3D compartments

  • area_unit (str): the unit to use for 2D compartments

  • length_unit (str): the unit to use for 1D compartments

  • remove_user_defined_functions (bool): whether to remove user defined functions when creating the model

  • notes: sets notes for the model (either plain text, or valid xhtml)
Returns:

the new model

Return type:

COPASI.CDataModel

basico.model_io.open_copasi(filename='', **kwargs)

Saves the model as COPASI file and opens it in COPASI.

The file will be written to a temporary file, and then it will be executed, so that the application registered to open it will start.

Parameters:
  • filename (str) – the file name to write to, if not given a temp file will be created that will be deleted at the end of the python session.

  • kwargs – optional arguments:

  • model: to specify the data model to be used (if not specified
    the one from get_current_model() will be taken)
Returns:

None

basico.model_io.overview(model=None)

Returns a basic representation of the model.

Parameters:

model (COPASI.CDataModel or None) – the model to get the overview for

Returns:

a string, consisting of name, # compartments, # species, # parameters, # reaction

Return type:

str

basico.model_io.print_model(model=None)

Prints the model overview.

See also overview()

Parameters:

model (COPASI.CDataModel) – the model

Returns:

None

basico.model_io.remove_datamodel(model)

Removes the model from the internal list of loaded models.

The model is removed from the list of models, and current model, before it is freed

Parameters:

model – the model to be removed

:type model:COPASI.CDataModel :return: None

basico.model_io.save_model(filename, **kwargs)

Saves the model to the given filename.

Parameters:
  • filename (str) – the file to be written

  • kwargs – optional arguments:

  • model: to specify the data model to be used (if not specified
    the one from get_current_model() will be taken)
  • type (str): copasi to write COPASI files, sbml to write SBML files (defaults to copasi), sedml to write SED-ML files, omex to write a COMBINE archive

  • overwrite (bool): whether the file should be overwritten if present (defaults to True)

  • sbml_level (int): SBML level to export

  • sbml_version (int): SBML version to export

  • sedml_level (int): SEDML level to export

  • sedml_version (int): SEDML version to export

  • export_copasi_miriam (bool): whether to export copasi miriam annotations

  • export_incomplete (bool): whether to export incomplete SBML model

  • include_copasi (bool): whether to include the COPASI file in the COMBINE archive (defaults to True)

  • include_data (bool): whether to include the data file in the COMBINE archive (defaults to True)

  • include_sbml (bool): whether to include the SBML file in the COMBINE archive (defaults to True)

  • include_sedml (bool): whether to include the SED-ML file in the COMBINE archive (defaults to False)

Returns:

None

basico.model_io.save_model_and_data(filename, **kwargs)

Saves the model to the give filename, along with all experimental data files.

Parameters:
  • filename – the filename of the COPASI file to write

  • filename – str

  • kwargs – optional arguments:

  • model: to specify the data model to be used (if not specified
    the one from get_current_model() will be taken)
  • delete_data_on_exit (bool): a flag indicating whether the files should be deleted at the end of the
    python session (defaults to False)
Returns:

None

basico.model_io.save_model_to_string(**kwargs)

Saves the current model to string

Parameters:

kwargs – optional arguments:

  • model: to specify the data model to be used (if not specified
    the one from get_current_model() will be taken)
  • type (str): copasi to write COPASI files, sbml to write SBML files (defaults to copasi), sedml to write SED-ML files

  • sbml_level (int): SBML level to export

  • sbml_version (int): SBML version to export

  • sedml_level (int): SEDML level to export

  • sedml_version (int): SEDML version to export

Returns:

the copasi model as string

Return type:

str

basico.model_io.set_current_model(model)

Sets the current model.

The current model, is the one that all functions will use if not is provided explicitly.

Parameters:

model (COPASI.CDataModel) – the model to be set as current

Returns:

the model

Return type:

COPASI.CDataModel

basico.task_parameterestimation module

basico.task_steadystate module

basico.task_timecourse module

This module encapsulates methods for running time course simulations.

main method provided is the run_time_course() method, that will simulate the given model (or the current get_current_model()).

Examples

To run a time course for the duration of 10 time units use

>>> run_time_course(10)

To run a time course for the duration of 10 time units, in 50 simulation steps use

>>> run_time_course(10, 50)

To run a time course from 0, for the duration of 10 time units, in 50 simulation steps use:

>>> run_time_course(0, 10, 50)

all parameters can also be given as key value pairs.

basico.task_timecourse.create_data_handler(output_selection, during=None, after=None, before=None, model=None)

Creates an output handler for the given selection

Parameters:
  • output_selection ([str]) – list of display names or cns, of elements to capture

  • during ([str]) – optional list of elements from the output selection, that should be collected during the run of the task

  • after ([str]) – optional list of elements from the output selection, that should be collected after the run of the task

  • before ([str]) – optional list of elements from the output selection, that should be collected before the run of the task

  • model – the model in which to resolve the display names

Returns:

tuple of the data handler from which to retrieve output later, and their columns

Return type:

(COPASI.CDataHandler, [])

basico.task_timecourse.get_data_from_data_handler(dh, columns)
basico.task_timecourse.run_time_course(*args, **kwargs)

Simulates the current or given model, returning a data frame with the results

Parameters:
  • args

    positional arguments

    • 1 argument: the duration to simulate the model

    • 2 arguments: the duration and number of steps to take

    • 3 arguments: start time, duration, number of steps

  • kwargs

    additional arguments

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)
    • use_initial_values (bool): whether to use initial values

    • scheduled (bool): sets whether the task is scheduled or not

    • update_model (bool): sets whether the model should be updated, or reset to initial conditions.

    • method (str): sets the simulation method to use (otherwise the previously set method will be used)
      support methods:

      * deterministic / lsoda: the LSODA implementation
      * stochastic: the Gibson & Bruck Gillespie implementation
      * directMethod: Gillespie Direct Method
      * others: hybrid, hybridode45, hybridlsoda, adaptivesa, tauleap, radau5, sde
    • duration (float): the duration in time units for how long to simulate

    • automatic (bool): whether to use automatic determined steps (True), or the specified interval / number of steps

    • output_event (bool): if true, output will be collected at the time a discrete event occurs.

    • values ([float]): if given, output will only returned at the output points specified
      for example use values=[0, 1, 4] to return output only for those three times
    • start_time (float): the output start time. If the model is not at that start time, a simulation
      will be performed in one step, to reach it before starting to collect output.
    • step_number or intervals (int): the number of output steps. (will only be used if automatic
      or stepsize is not used.
    • stepsize (float): the output step size (will only be used if automatic is False).
    • seed (int): set the seed that will be used if use_seed is true, using this stochastic trajectories can
      be repeated
    • ’use_seed’ (bool): if true, the specified seed will be used.
    • a_tol (float): the absolute tolerance to be used
    • r_tol (float): the relative tolerance to be used
    • max_steps (int): the maximum number of internal steps the integrator is allowed to use.
    • use_concentrations (bool): whether to return just the concentrations (default)
    • use_numbers (bool): return all elements collected

Returns:

data frame with simulation results

Return type:

pandas.DataFrame

basico.task_timecourse.run_time_course_with_output(output_selection, *args, **kwargs)

Simulates the current model, returning only the data specified in the output_selection array

Parameters:
  • output_selection – selection of elements to return, for example [‘Time’, ‘[ATP]’, ‘ATP.Rate’] to return the time column, ATP concentration and the rate of change of ATP. The strings can be either the Display names as can be found in COPASI, or the CN’s of the elements.

  • args

    positional arguments

    • 1 argument: the duration to simulate the model

    • 2 arguments: the duration and number of steps to take

    • 3 arguments: start time, duration, number of steps

  • kwargs

    additional arguments

    • model: to specify the data model to be used (if not specified
      the one from get_current_model() will be taken)
    • use_initial_values (bool): whether to use initial values

    • scheduled (bool): sets whether the task is scheduled or not

    • update_model (bool): sets whether the model should be updated, or reset to initial conditions.

    • method (str): sets the simulation method to use (otherwise the previously set method will be used)
      support methods:

      * deterministic / lsoda: the LSODA implementation
      * stochastic: the Gibson & Bruck Gillespie implementation
      * directMethod: Gillespie Direct Method
      * others: hybrid, hybridode45, hybridlsoda, adaptivesa, tauleap, radau5, sde
    • duration (float): the duration in time units for how long to simulate

    • automatic (bool): whether to use automatic determined steps (True), or the specified interval / number of steps

    • output_event (bool): if true, output will be collected at the time a discrete event occurs.

    • values ([float]): if given, output will only returned at the output points specified
      for example use values=[0, 1, 4] to return output only for those three times
    • start_time (float): the output start time. If the model is not at that start time, a simulation
      will be performed in one step, to reach it before starting to collect output.
    • step_number or intervals (int): the number of output steps. (will only be used if automatic
      or stepsize is not used.
    • stepsize (float): the output step size (will only be used if automatic is False).
    • seed (int): set the seed that will be used if use_seed is true, using this stochastic trajectories can
      be repeated
    • ’use_seed’ (bool): if true, the specified seed will be used.
    • a_tol (float): the absolute tolerance to be used
    • r_tol (float): the relative tolerance to be used
    • max_steps (int): the maximum number of internal steps the integrator is allowed to use.

basico.task_scan module

basico.task_optimization module