Copasi play testing
August 4, 2011 by Steve · Leave a Comment
I’ve been playing with the latest build of Copasi for a couple of weeks since the stable release (build 34). I still have the same freezing at startup on Ubuntu 10.10 that’s been there since build 32, but this could be a Qt problem (edit: seems to be sleeping on startup for some reason – looks like bad compilation by the author). Aside from the new tau leaping solver and the additional optimization algorithms there is little difference from build 32 in terms of functionality. The new version has an annoying tendency to jump around the list of species and reactions. Clicking on a reaction in a model with a long list of reactions results in the whole list jumping up, loosing your place in the list. This is quite annoying when trying to move sequentially through long lists of reactions. Also, in the previous versions the arrow keys used to move up and down through the list of reactions and species. The arrow keys do move up and down the list, but the main screen doesn’t update, so this is largely useless now. The interface also stops taking keyboard input sometimes after running simulations with output graphs. I have to click on the graph and then on the main Copasi window to get it to take keyboard inputs again. This could be a compiz or gnome problem though (I’ll probably go Xfce after September anyway so this problem might go away).
There’s still no ability to copy reactions, which would be nice for making models of systems like MAPK cascades with sequential reactions that are very similar to the previous reaction. It would also be handy to be able to highlight and copy the data in the various matrices that are produced into the clipboard. This which would make it quicker to move data around software like Excel without having to generate and import reports. The software does generate report ouputs though, so this is just an annoyance rather than a problem.
Copasi still lacks the capability to create 3D surface plots for multiple parameter scans, or find bifurcation points like xppaut, which considering this is one of xppaut’s primary strengths you would think the developers would incorporate into Copasi. As I said above though, Copasi can output reports, so you can attempt to wrestle the raw data through the python bindings and plot using matplotlib or just dump it into sigmaplot or origin.
There’s still no statistical analysis for stochastic simulations. It would be useful to generate mean and standard deviation values for repeats of stochastic simulations, as the raw data outputted in the reports is virtually useless, unless you can write your own scrupt to sort it and calculate the statistics. It’s impossible to do by hand. As stochastic simulations require multiple trajectories that are then compiled into mean and SD for things like signal:noise ratios this is a major pain. The developers did help me a while back though with a python script to do this, which was very much appreciated. This was about 2 years ago and it would have been nice to see this implemented in the software.
You still can’t program in custom rate laws and have the save if they’re not assigned to a reaction when you exit the software. This is annoying as I have different strength promoters that I was representing with different rate laws and switching between them between simulations. Now I have to have multiple models or code them each time I load the software. I ended up working around this though by assigning global quantities to parameters in a generic rate law. It’s a bit more elegant than having multiple unused rate laws in your model file I suppose. I can also then manipulate these global quantities with other rate laws and output them with the data so it does provide a lot of flexibility.
All things considered, Copasi still remains the best of the GUI based modelling tools with the amount of optimization algorithms and solvers, and it’s free, so you can’t really complain at the glacial development. The average Joe biologist (me) just couldn’t code this stuff in Matlab or Fortran. The Python bindings provide the potential to couple it up with xppy, to use Copasi’s solvers and optmization routines with Python as a hub and augment it with functions from PySces and xppaut. I hope to look more into using Python as a central controller for these tools once I get some time.
Copasi 4.7 build 34
July 18, 2011 by Steve · Leave a Comment
A new version of Copasi has been released. Version 4.7 (build 34) includes the following changes:
Graphical User Interface (CopasiUI)
- Enhanced parsing of mathematical expression to allow the comparison operator , >=, and == as well as the Boolean operators || and &&.
- Allowed calculation results to be selected as constraints for optimization and parameter estimation.
- Improved display of mass conservation results. The moieties are now displayed in amount if the user is in the concentration framework.
- Added Update Model button to the optimization result widget
- Notes in text or XHTML format are now available for compartments, species, reactions, global quantities, events, and kinetic functions.
- Support links in XHTML notes.
- Support of render informations in graphical model layouts.
Simulation Engine
- The calculation of statistics is now optional for optimization and parameter estimation tasks.
- Start values can now be randomized automatically for optimization and parameter estimation tasks.
- Enhanced MCA algorithm performance by applying a new selection criterion before each internal step.
- Added an stochastic algorithm (Adaptive SSA/Tau-Leap) which dynamically partitions the model into parts simulated by the direct algorithm and the Tau-Leap algorithm.
SBML
- Added support for constant conversion factors in Level 3.
- Import SBML Level 3 Version 1.
- Added SBML notes support for compartments, species, reactions, global quantities, events, and kinetic functions.
- Added MIRIAM annotation support for events.
- Support for the SBML Render Extension.
Copasi is available from www.copasi.org
free your white board
July 9, 2011 by Steve · Leave a Comment
I had to give a presentation this week at our weekly lab meeting on the developments of my project. I had been working 15 hour days in the lab and the prospect of having to spend hours putting powerpoint slides together was just frustrating. In the end I just didn’t get time to make any.
I’ve always believed that if you can’t talk about your work after doing 4 years of a Ph.D then you don’t deserve a Ph.D! There are plenty of students that still practise their material for hours (or days), which says to me they don’t really know what they’re doing to begin with.
Anyway, I turned up to the group meeting and there was some shocked gasps of disbelief as I approached the front with the projector switched off. The was further shock when I reached for fist full of coloured pens. I told the group I hadn’t had time to make slides and would instead tell them about my work using ye olde white board. I don’t think the boss was too sure what to make of this unexplored territory of meeting practices, but gave me a dubious benefit of the doubt.
I went through my work, illustrated with squeaky pen drawn diagrams and equations as I spoke, people interjected to ask questions, and I was getting feedback throughout the talk. There was audience participation both with me and between themselves. I found the experience much more challenging compared with having the electronic crutch of a slide of information, but I also found the presentation was much more concise and focused on the key points of my work, as this was what I wanted to tell people about. I also found I needed some new skills like working out where to stand and flipping between facing the board and the audience, whilst not covering the information up. Overall it was much more animated and forced more audience interaction as I checked people could see / read my scrawl. I managed to convey months of work in about 15 minutes and found that the presentation ended as more of a group discussion than the formal ending of a presentation.
Overall, the presentation went quite well and the boss even announced that he thought the format was much more engaging than powerpoint! For those brave enough to fly unaided I would recommend giving it a go. Overall preparation time was about 5 minutes of thinking on the way to the meeting room, and I actually enjoyed giving the presentation. Some people panicked at the boss’ suggestion of more white board talks, but there were suggestions to augment it with slides for more complicated diagrams or graphs of data (and I agree this would be much better for something like a scientific presentation). However, the general approach of using dozens of intervening slides with millions of dense bullet points (that are usually read to the audience) could be replaced with YOU and your interest in your subject.
So free the chalk boards and throw off the shackles of powerpoint!
mathematized
July 6, 2011 by Steve · Leave a Comment
I’ve been wrestling with modelling (as always). Without lab data 99% of it is just video gaming, but in the absence of devine data I’ve been trying to create a series of ODE’s to represent what I’m building in the lab (other than d[fubar]/dt = my_life).
I’ve trying to build a rate equation to represent basal levels of mRNA transcription from a promoter that is later up-regulated by a transcription factor when my circuit is activated. I read an excellent publication by Ajo-Franklin (2007). Rational design of memory in eukaryotic cells. Genes & Development 21:2271–2276. and borrowed equations [1], [2], and [3].
I attempted to use the following modification of the michaelis-menten equation to represent basal expression that is up-regulated by an activating signal:
Where s is the rate of constitutive expression, and [a] is the activating signal. Simple enough.
The 2nd part of the Anjo-Franklin equations represent degradation and dilution of the product by cell doubling:
Where is the doubling time of the cells.
Copasi can’t handle something like as it’s a measure of time. I could set this up as an event but I wanted to keep it in the rate equation, rather than having Copasi fudge it’s way through the simulation. I’m not sure how to get around this yet though and have (for now) left out the degradation function and used mass action to have the mRNA removed from the model with constant flux.
This is ok so far, but I have an additional component that is under the control of a constitutive promoter, and transcription is inhibited by the product of the first equation. I don’t know how to represent constitutive expression as in the 1st equation but with the addition of an inhibitor.
I understand the classical Michaelis Menten formalism for a competitive inhibitor is:
but I don’t know how to use Michaelis menten with Anjo-Franklin’s basal expression and . There’s no substrate to include in the rate equation:
Does anybody know how to write a michaelis menten rate equation that incorporates constitutive expression and also inhibition by a competitive inhibitor?
(I am wondering about having the same as the activation in the first equation but having a fixed concentration of activator for the constitutive promoter, but I don’t know if this is correct, or if it will just make the equation explode).
Also, I’ve added the WP Latex plugin to the blog and it will parse comments, so if you’re familiar with LaTeX you can use it to display equations as in this post. Instructions for inserting LaTeX into wordpress are in the link.
Cairoplot
June 16, 2011 by Steve · 2 Comments

Cairoplot is a Python API that uses the Cairo graphics package to plot nice looking graphs for presentations and websites. You can do bar charts, pie charts, function plots, gantt charts etc.
I stumbled over a couple of blogs explaining how it’s possible to embed Python code into LaTeX, using python.sty programmed by Martin R. Ehmsen (another good tutorial is here as well). The author’s website is producing 404 errors and there is no download for python.sty. I found a copy on the web and have it available here, purely because I can’t link to it from the author.
There is some example code for embedding Python script, from over at the texexample.net blog:
%& -shell-escape
\documentclass{article}
\usepackage{python}
\begin{document}
Say hello Python:
\begin{python}%
print r"Hello \LaTeX!"
\end{python}%
\end{document}
You have to remember to compile your LaTeX script with –shell-escape option. The post also continues to do some plotting with PyX.
For embedding Cairoplot in LaTeX there is some example code at Michael Wayne Goodman’s blog (goodmami.org)
Some example code for a dot plot from the Cairoplot web page is below:
dot_line_plot (name,
data,
width,
height,
background = None,
border = 0,
axis = False,
grid = False,
h_legend = None,
v_legend = None,
h_bounds = None,
v_bounds = None)
name – Name of the desired output file, no need to input the .svg as it will be added at runtim;
data – The list, list of lists or dictionary holding the data to be plotted;
width, height – Dimensions of the output image;
background – A 3 element tuple representing the rgb color expected for the background. If left None, a gray to white gradient will be generated;
border – Distance in pixels of a square border into which the graphics will be drawn;
axis – Whether or not the axis are to be drawn;
grid – Whether or not the gris is to be drawn;
h_legend, v_legend – lists of strings containing the horizontal and vertical legends for the axis;
h_bounds, v_bounds – tuples containing the lower and upper value bounds for the data to be plotted.
They use the following example:
teste_data_2 = {"john" : [10, 10, 10, 10, 30], "mary" : [0, 0, 3, 5, 15], "philip" : [13, 33, 11, 25, 2]}
teste_h_legend = ["jan/2008", "feb/2008", "mar/2008", "apr/2008", "may/2008"]
CairoPlot.dot_line_plot('teste2', teste_data_2, 400, 300, h_legend = teste_h_legend, axis = True, grid = True)
to plot an example line type plot with multiple lines, such as used quite often in biology publications.
I recreate the code here to keep a record for myself, the original should be viewed on the Cairoplot page with the output images.
But now you too can have opengl rendered graphs in your thesis! :p
datatools
June 15, 2011 by Steve · Leave a Comment
Copasi et al like to output data as csv files. Writing a thesis in LaTeX means eventually you will have to input a table of this data, particularly lists of parameter values etc. Tables aren’t easy to do. Well, they are but they can be a pain to format and bug hunt if it’s a big one. Fortunately, there is the datatool package that can read in a csv file and produce a table from it automagically. There is comprehensive documentation over at the ctan, but to do it simply, you need a csv file (obviously), and the \usepackage{datatool} in your header.
\DTLloaddb{my-table}{./path-to-your-csv-file/my-table.csv}
\DTLdisplaydb{my-table}
will display your csv in a default table in your document.
Simple as.
regulation for internships and Phd’s?
June 6, 2011 by Steve · 2 Comments

BBC Radio 4′s Start the Week radio program featured Ross Perlin who has recently written Intern Nation: How to Earn Nothing and Learn Little in the Brave New Economy. On the program he discussed the current trend for, particularly politics students to undertake multiple unpaid internships in order to gain employment after University. In Washington DC (as well as Whitehall), internships are now a pre-requisite to working in government. Starting out as a short piece of unpaid work undertaken by newly qualified medics, this phenomenom has now taken off across nearly all industries across the western world. The promise of tutoring / training in the profession as the interm “learns the ropes” is replaced with interns doing regular roles within the company without the wage, putting further pressure on the full time staff who are being replaced with free labourers.
After my recent “phd? ph don’t” article, I found many similarities with internships and the current rise in non-funded Ph.D projects (694 on findaphd.com), not to mention post doctoral researchers being steadily replaced with cheaper (or free) Ph.D students. Students sign up for a Ph.D project that has no grant funding associated with it and get no pay from their supervisor or institution as they undertake the work. The student then works part time somewhere (usually in the service industry) to get enough money to pay for food and lodgings, or is sponsored by a wealthy family. There is no guarantee of training or a successful Ph.D outcome at the end and the student works any number of hours in any conditions towards the promise of one day having the illusive qualification.
The minimum wage law was mentioned in relation to internships, and that under normal circumstances it would be illegal to employ a person for no pay. However “students” and “internships” are a loophole that doesn’t apply. The radio program called for an investigation or regulation of internships to prevent exploitation, and it would be interesting if this regulation was extended to cover Ph.D students.
It would be interesting to me to see an independant auditor monitoring skills development and progression within the Ph.D program, as well as corporate governance of the project as it would put much needed pressure on academia to clean up the system and ensure students don’t wash out through no fault of their own, or drive themselves to bankruptcy before they ever start working. Not to mention an honest days pay for an honest days work.
XPPPad
May 6, 2011 by Steve · 3 Comments

Although as a loyal Linux user I can’t condone the spread of Apple :p , Bard Ermentrout & Ashutosh Mohan have been busy and created an iPad version of XPPAUT. I don’t own an iPad so haven’t tested it out (if anybody wants to donate one I will!!
). The interface has had an overhaul for the new tablet format, but it looks like it retains all the same functionality. I would be interested to see how the iPad hardware copes with number crunching.
A comment by Herbert Sauro below also points out that it would be interesting to see if it still links with AUTO, as the most popular functionality in the desktop edition of XPPAUT is bifurcation analysis.
XPP for iPad is interesting though as Universities are considering supplying undergrad programs with tablets, pre-loading them with XPP would be ideal for computer science and systems biology students.
Ph.D? Ph. don’t.
A recent post over at techcrunch caught my attention: “Obama: I Want People To Feel The Same About The Next Internet Breakthrough As They Did About The Moonwalk“, and was also picked up on slashdot in an article “why science is a lousy career“.
This reminded me of an article from a few months ago about women and careers in science, that also got picked up on Radio 4. It looks as though many of the issues affecting the scientific field is common irrespective of location or gender. Obama’s call for more people to train as scientists is very similar to Cameron’s call for scientific entrepreneurs to save their nations from the current economic collapse.
The discussions that emerge around these stories all echo each other in the unanimous view that while the politicians tout these skills as building the foundation of a future with a prosperous society, those in the field view a career in science is a waste of time. Under-paid, over-worked, and under-appreciated are common terms that crop up in the accompanying forums. There are many articles that document the extraordinary impact on work-life balance for academics, and even this morning as I was continuing to write this post, a nature article was released that continues to debate the issues.
My own feeling is that Ph.D students are being exploited for their funding, presented with under-prepared, under-staffed, under-equipped projects that the PI can walk away from if it fails, having enjoyed the funding and absolved from guilt by attributing the failure to the incompetent student. Even if the student is fortunate enough to graduate and leaves academia the years of training are then used to propel them into a low level technician role which now demands a doctorate. There are many issues that have contributed to a massive systems level abuse of science over the last decade. A push by the last UK government to raise the level of education for all began increasing the levels of degree places. I can’t really complain about this because it gave people like myself from poorer working class backgrounds access to higher education. However, this has consequently elevated the basic requirement for jobs in a supply and demand market, presenting a self-perpetuating problem that has erupted in the wake of the global financial collapse.
While the government was busy selling “education for all”, universities were enjoying their increased business. While students were enjoying the new opportunity to study for a degree, there were more graduates hitting the job markets which meant the students quickly needed a method of differentiating themselves to get the better jobs. The universities were presented with an opportunity to hold onto the students business a bit longer and, dressing it up as seeking to give their students a competitive advantage, they bolted a masters degree straight on the end of the undergrad degree. The masters degree then became expected from job applicants and students required further qualifications to differentiate themselves. Some masters programs are now offering automatic progression to Ph.D, again locking in the student (and their money) for 3-4 years, and placing the doctorate as the new selection criteria for employers. Meanwhile, the new cash injection transformed university buildings from dusty old poorly equipped faculties to state of the art, award winning buildings. The age of the dusty old professor have also passed as those at the top of the academic tree also enjoy the fruits of the recent success.
For a while there seemed to be a symbiotic relationship developing between academia and industry with industry contracting out their R&D to academia, funding Ph.D and masters programs, as well as post doctoral research. Academic institutions began to create biotechnology centres were academic research could be rolled out to business start-up ventures and for a while there was a bright future of well funded, next generation science and entrepreneurial ventures poised to feed back into the governments coffers with tax and employment. Industry was also enjoying the flood of post docs and could flaunt the prestige of exclusively staffing their departments with doctorate level employees to their customers. However, the sudden economic collapse has crippled the public funding sources, and industry is contracting R&D out to cheaper labour in China and India. Academia is faced with reverting back to it’s old lifestyle as the suddenly rich revenue streams have just as suddenly turned barren. Cuts in academic research is pushing increasing numbers of academic researchers into the private sector, increasing the number of highly qualified applicants in the job market where the Ph.D grows as the minimum level of qualification for a scientific role. This leaves new students without funding for their Ph.D and unable to gain private sector employment without having at least a masters degree. Increased tuition fees to maintain the university infrastructure is locking out students at the very beginning. In time, this may reduce the general level of qualifications in the market place and force industry to recruit less academically qualified personnel, thus restoring the value of academic qualifications. However in the medium term, there are enough post doctoral graduates to lock a generation out of the job market.
Back in academia there are still ongoing problems even if universities cut the number of Ph.D studentships. Many academic projects in Europe rely on entirely staffing labs with Ph.D students. Quite often labs have a 10:1 ratio of student:post doc. This reduces the number of post doc positions and the “training process” of the Ph.D has been replaced with grunt labour, and not the cloning process described in Nature. From my own perspective Ph.D students are just ideal cheap labour and expected to be fully trained on admission (at my own Ph.D studentship interview I was asked how many publications and grant applications I had obtained). Ph.D students also have no rights as employees, they can be forced to work unlimited hours in any conditions, with any form of abuse deemed necessary to maintain motivation, and you can dismiss them at will claiming incompetence. Some labs will offer 1 Ph.D between numerous students and watch them fight it out amongst themselves for the eventual winner, working beyond breaking point for those elusive magic letters.
Even if achieved, the Ph.D is just the beginning. Without a steady stream of high impact publications from successful projects the next research post can be almost impossible, and if you’re over 30 and not a PI then you’re washed up already. Publications are the currency of academia, and if you’re on a bad project and miss a publication then you’re behind and may never catch up with your colleagues. This has lead to a stampede of publications with the numbers of pubmed records increasing exponentially. Paradoxically, 50% are never read and 90% are never cited. However, they serve their purpose in propelling the researchers along the ladder as they collect up their numbers to get to the next posting. Some have advocated the use of citation scores to weed out the junk but ultimately it’s the raw number that still counts. Even if you maintain the high impact publications and gain a 2nd post doc you start all over again for another 3 years of instability and blind chance. I’ve often heard that a career in science is similar to a crapshoot. You simply roll the dice and see what happens. If it’s snake eyes you’re out and it’s so long, and thanks for all the fish.
So if you’re reading this considering your next career path, consider whether this lifestyle is really worth the £25-30k salary with no Christmas bonus, no stock option, and if you’re a student, often no pay at all, no sick pay, no cost of living rise, no maternity leave, no rights, and no representation, then think long and hard about whether that Ph.D really is worth the bragging rights on the cheque book.
Yep, then you’ll apply anyway because there’s no other option.
Evince hand panning
April 13, 2011 by Steve · Leave a Comment
![]()
Ubuntu and its spin off distributions come with the Evince document viewer. It’s much lighter than Adobe reader and supports many document formats so has been my reader of choice for articles.
One of the things I liked about the Windows versions of Adobe and Foxit readers is the click and drag scroll feature. You can use the mouse to slowly pan down the document as you read. I find this easier than having to move my hands to the keyboard arrows because I’m terminally lazy and my eyes lose the line I’m on as I scroll. Unfortunately this feature doesn’t exist in the stock Evince installation. However! I stumbled over this blog post over at TechiTalk.info that details a patched version of Evince with the drag scroll option by IRIE Shinsuke.
Add the PPA with: sudo add-apt-repository ppa:irie/evince
Once installed just add the hand drag icon to the tool bar and have it selectable as your scroll method. More detailed info is available over at TechiTalk blog or the Shinsuke’s launchpad page if required.
Happy days.