Browse to http://www.cellml.org/models/ in Mozilla Firefox (or Internet Explorer). You will see a long list of CellML models. Some, but not all, of these models will work in PCEnv (model curation is an on going process and our ultimate aim is to get all these models to run in PCEnv). For this tutorial we will use the 'Beeler-Reuter, 1977' example. Click on this model and at the top of the page under 'model status' load the sample session into PCEnv. Click on 'Browse', and choose the PCEnv executable (pcenv.exe, in the directory where you chose to install PCEnv).
Once you have selected pcenv.exe, click 'OK' in the 'Open with' dialog box. PCEnv should appear with the Beeler-Reuter 1977 example model loaded in it.
To change the default simulation duration of 5000 ms to 10000 ms (10 seconds), in the middle bottom pane in PCEnv, change the text field next to 'End time point' from 5000 to 10000. Now, click the 'Integrate' button at the bottom of the same pane. The button will briefly change to 'Cancel Integration, and then on to 'Export CSV'.
Now we are going to define some graphs. Right click in the white area at the bottom right corner of the screen and select 'New Trace' from the popup menu. Now, left click on the '(click to select)' text under the heading 'Y' and choose Membrane, and then V, from the menu that pops up. Now, repeat for the 'X' column, but choose Environment => Time. The graph will now appear. Note that the colour of the trace is picked randomly, but you can change it by left-clicking on the coloured square at the start of the 'Link selected' row.
To change the title of the graph, simply select 'Untitled' in the white area above the graph and type in 'Voltage vs time'.
To compare this voltage vs time plot with a current vs time plot first click on the 'Two graphs' button which is on the toolbar beneath the main menu and is the second icon from the right. Clicking on this icon provides a two graph view. Now change the name of the bottom graph to 'Current vs time'.
Next, click on the picture of the key, which is to the right of the box where you just typed in 'Current vs time', and the key for the current vs time graph will appear. Using the same method you used previously to create a voltage against time trace on the first graph, create a current against time trace (New Trace, choose i_x1 in time_dependent_outward_current on the Y axis, and time in environment on the X axis). Now, create another new trace, this time with i_s in slow_inward_current on the Y axis, and time on the X axis. If the colours are too similar (or poor contrast on black), you can change the colour by clicking on the coloured square next to the 'link selected' label.
Now, suppose that we want to zoom in on a particular section of data, but we still want to be able to compare the two graphs. To do this, go to the 'View' menu, and select 'Tie X Axis'. Also check 'Grid lines' on the same 'View' menu, because this will help to compare data. To make the graphs bigger, drag the line separating the right pane from the middle pane to the left, until the middle pane disappears completely. Then remove the model trace key from the bottom pane by clicking on the key button again (the same button you used to turn it on). Next, on the Voltage vs time graph, hold down the shift key and use the right mouse to drag a box around an action potential. Both graphs change such that you will now be able to see the shape of the action potential for both the currents and the voltage.
Next, we are going to make a change to the model, and see what effect this has on the results. To restore the screen to the original layout, turn off the 'Tie X Axis' values through the View menu, by repeating the process you used to turn it on, and click on the 'One graph button' (which is one left of the 'Two graph button' you used before).
On the model trace key below the graph left click on the 'link selected' text and choose 'Copy selected model'. This binds the trace to the current model, so that when we change the model, the current graph will stay as a reference.
Finally, drag the separator that you previously dragged left, back to the right, so you can see the middle pane again.
Next, we are going to clone the model. Cloning models allows changes to be made to the model, but the original version and the results are retained. To clone a model, right click on the model name in the left hand pane and select 'Clone'. A new model appears in the tree, underneath the original model. Initially it is named by the date it was created. To re-name this new model right-click on the model name and choose 'Rename'. In the 'Rename to what' dialog box, type in 'Modified'.
At the top of the top-centre pane of PCEnv, there are two small buttons. One, which is selected by default, is a blue circle with a 'V' next to it. This presents a view of all constants and initial conditions defined in the model. The other button, which has a cartoon of a cell inside a set of angle brackets (<>), corresponds to a view of the entire CellML model. Click on this button to choose the latter view.
You will now see a 'Tree' representation of the entire CellML model. We are going to add in a very rudimentary component representing a leak in the membrane. Right click on the first line of the tree, titled 'Components', and choose 'New'. A new component called 'New_component' appears at the bottom of the list. Click on it, and change the value in the text box from 'New_component' to 'leak_current'. Click on the '+' sign next to 'leak_current', and you will see it is empty. Now right click on 'leak_current', and choose 'New Variable'. Click on 'New_variable' and change its name to 'i_leak'. We are going to make i_leak a constant current, so in the box to the right, type in a value, '1E-3'. Click on the '+' next to 'i_leak', and now click on 'Public Interface'[. Change the drop-down value from 'None' to 'Out'. This means that other components can connect to 'i_leak'. Also, click on 'Units', and choose 'uA_per_mm2' from the drop-down menu.
Now, we are going to alter the mathematics for the membrane voltage to account for the new leak current. Click on the '+' next to membrane (third row of the tree). Right click on membrane, and choose 'New Variable'. Again, rename 'New_variable' to 'i_leak'. Click on the '+' next to 'i_leak', and change 'Public Interface' to 'In' (not out this time!), and 'Units' to uA_per_mm2 again.
Now, we will update the mathematics to include 'i_leak'. Click on the '+' next to 'Mathematics', and then on 'Equation'. The bottom middle pane of the screen will change to a mathematical editor. The intention here is that you will see a display of mathematics and an editable text form of the MathML in a model (however, due to a bug in our underlying architecture, a wrong font gets selected so the math display is not useful right now).
At the end of the equation you will see i_K1)) / C. Change this to d(V)/d(time) ={id="membrane_voltage_diff_eq"} (Istim - (i_Na + i_s + i_x1 + i_K1 + i_leak)) / C
Now, click on the '-' next to components to hide them. We will now add a connection between 'i_leak' in 'membrane' and 'i_leak' in 'leak_current'. To do this, right click on 'Connections' and choose 'New'. Click on the '+' next to the connection at the bottom of the list. Now click on 'Component_1'. From the drop-down menu choose 'membrane'. Repeat the process, but for 'Component_2', choose 'leak_current'. Now right click on the connection, and choose 'New Variable Mapping'. When the variable mapping comes up, choose 'i_leak' from the dropdown for both 'Variable_1' and 'Variable_2'.
To integrate the modified model, click on the 'Integrate' button. Next, create a new trace by right clicking on the key of the graph and choosing 'New Trace'. Set up a new Voltage vs Time graph as before, and you will get something which resembles the following output:
Finally, to save our modified model choose 'File => Save As', and save the model to somewhere on your local file system (we will be submitting it to a model repository later).
The next part of the tutorial will use PCEnv to open a session file. Eventually, PCEnv sessions will be available from the CellML repository. In the meantime there is a page with links to session files which can be found at http://www.cellml.org/Members/miller/model-sharing-tutorial/
Go to this page in your web-browser and click on the Beeler-Reuter session. You will be prompted by PCEnv to confirm you want to load the session, to replace your current session. Select 'OK' and you will now have the Beeler-Reuter model loaded from the repository and laid out in PCEnv. Click the 'Integrate' button and you will immediately see some graphs which resemble those in the published paper, as well as a figure describing the model.
To look at the diagram more closely click on the 'One graph' button and from the drop-down menu at the top of the graph where it says 'Voltage vs time', choose 'Topology figure'. Drag the pane splitter bars to the left so the figure takes up the entire screen. You can now see, in good detail, a scalable figure from the session. This could also be used to visualise a CellML model as a pathway diagram.
You can also try this with the Saucerman-McCulloch session to see an example of this (although please note that the CellML model itself doesn't work yet).
The live CellML repository is at http://www.cellml.org/models. At this repository, you can browse a large collection of models.
If you would like to practice submitting a model to the repository, you can use the test repository at http://www.cellml.org/Members/miller/models . Type this address in your browser. Click on 'Submit a new model to the model repository'. You will have to log in. You can use the username 'Tutorial' and the password 'tutorial'. Please note that this log-in is case sensitive. Now follow the one screen instructions to submit your model.
If you want to upload real models to the real repository (not your test model!) you can contact Tommy Yu at tommy.yu@auckland.ac.nz, and he will issue you with a username which can be used to upload your models to http://www.cellml.org/models/