SearchLatest VersionsLogin |
In COPASI, most of the time there are several ways to do something and you just choose the way you prefer. This is especially true for defining the elements of the model. Actually if you are just defining a model that has a single compartment, you will most likely not even bother to add the compartment explicitly, but we will come back to this in the Species and Reactions sections. Although you will probably not add compartments to often, it is good to know how it is done, especially since adding other components of the model, e.g. species or reactions, works essentially the same. There are three methods to add a new compartment to a model, but for all three, we have to navigate to the branch of the object tree which is located under the branch. So first open the branch and there open the branch by clicking on the expansion sign in front of the branch name, or by double clicking on the branch name.
![]() Empty compartment table
If you start with a new model and you select the branch, you will get an empty table with eight columns (see above). The columns are named Status, Name, Type Initial Volume, Volume, Rate, Initial Expression and Expression. The meaning of the Status column will be explained below. Name is the actual name of the compartment. The Type specifies how the transient volume of the compartment is determined whereas the Initial Volume and the Volume columns show the volume of the compartment before any calculations and after re-calculation, respectively. These two values, given in the volume units defined in the model settings dialog, should be the same if the type is set to fixed. The Rate column show the rate of change of the compartment (if it has been set by a calculation). The Initial Expression and the Expression columns show the mathematical expressions used to calculate the initial compartments volume and the transient one, respectively. These fields are empty if no expressions has been set. The most obvious way to add a new compartment is to click the button on the bottom of the window. This will create a new compartment that is added to the table with a status of new (see below).
![]() Compartment table with new compartment
A status of new means that the compartment has been created, but it has not been added to the model yet. It will get added to the model if you either click on the button on the bottom of the screen, if you select another element in the object tree on the left, or if you double click on the table. In case of clicking on the button, you will notice that the status of the new compartment is no longer defined as new since it has been added to the model. While the status of a compartment is shown as new, you can remove the compartment from the table by clicking the button which will cancel all modifications you made to the compartments that have not been committed yet.
![]() Compartment table with deleted compartment
If you have already committed the compartment, you can delete it by selecting the table row (or one cell of the table row) that contains the compartment you want to delete and clicking the button. You will notice that the compartment does not get deleted at once, but rather the status changes to delete (see above). You can still undo the delete by clicking the button or the button, or you can finalize the delete action by clicking on the button. Again leaving this dialog by selecting another object in the object tree or double clicking on the table has the same effect as clicking on the button. The button is just a convenience function to delete all compartments. If you click on it, the status of all compartments in the table will be changed to delete and a subsequent will remove the compartments from the model. The most convenient way to add a compartment is to just click on an empty name cell in the table and type the name of the compartment. Once you leave the cell by either hitting the return or the tab key or by clicking somewhere else, the compartment appears in the table with a status of new. Actually hitting the return key after typing the name brings you directly into the next row and you can continue adding compartments until all compartments are defined. You now only have to commit your changes in one of the ways mentioned above and all the compartments get added to the model. The third way to add a new compartment is to double click on an empty row in the table. This is essentially the same as clicking the button and double clicking on the newly added compartment entry.
![]() Compartment definition dialog
Double clicking on any compartment entry in the table will bring you to another input dialog that lets you specify the parameters of the compartment (see above). For each compartment, you are able to change the name of the compartment, the type of simulation specifying how the compartment volume, or its rate of change, will be determined, and the initial volume. The field labeled Volume specifies the volume the compartment has right now, e.g. during or at the end of a simulation. Since the current version of COPASI does not support variable compartment volumes yet, this will always be the same as the initial volume. As stated above, compartment volumes don't have to have a constant value but they can be reassigned during e.g. a time course simulation depending the values of one or more model entities. In order to specify whether a compartment has a constant volume or the volume is calculated on the fly according to a mathematical expression, the drop down list called Simulation Type can be used. It contains three entries: Table 1.1. Compartments Simulation Types
If you want the compartment to be calculated from a given mathematical expression you select the entry called assignment from the drop down list. This enables a text field where the mathematical expression can be entered.
![]() Compartment widget with assignment rule
Caution
Please note, it is not possible in COPASI to calculate the volume of a compartment through an assignment based on the concentration of a species contained in the compartment. The reason for this restriction is that COPASI preserves the amount of a species during calculation, which leads to the following equation for the concentration
Likewise if you want the rate of change of the compartments volume to be determined by an ordinary differential equation (ode) you select the entry called ode from the drop down list. Not only the transient volume of a compartment can be specified as a mathematical expression (see above), but also the initial one (see below). If you want to specify such a mathematical expression for the initial volume of a compartment, check the check box called Use Initial Expression. An initial expression can only be specified if the Simulation Type drop down list is either set to fixed or to ode. If the list is set to assignment, the given assignment automatically acts as an initial assignment and there is no need to specify an additional initial assignment.
![]() Compartment widget with initial assignment
The mathematical expressions that can be specified for rules and initial assignments may contain the same elements as the expressions used to defined function definitions. For a detailed description of the elements see User Defined Functions. When it comes to referencing values of other model entities within mathematical expressions, there is a slight difference between the mathematical expression for a rule and that for an initial assignment. The mathematical expression for a rule may reference transient values of other model entities whereas the mathematical expression for an initial assignment may only reference initial values of other model entities. As you might already have noticed, this dialog for changing compartment parameters is associated with the individual compartment leaves in the object tree. So if you want to change the parameters, you can also navigate to the leave in the object tree that represents the compartment you want to change instead of double clicking on an entry in the compartment table.
![]() Compartment widget with ode rule and initial assignment
If there are already species defined that are part of the compartment being edited, they will be listed in the text widget at the bottom of the dialog called Contained Species. Otherwise, you should add new species. |