phymbie HOWTOs

Listed here are info, scripts, and files for a few of the resources commonly used by members of the phymbie group:


In phymbie, all research write-ups (papers, posters, slide presentations) are done in LaTeX. Here are a few useful resources. First, you should buy yourself the wonderful Guide to LaTeX by Kopka and Daly. When you don't have it handy, you can consult the online Wikibook on LaTeX which is a very complete online LaTeX resource. If you can't remember the LaTeX code for a particular symbol, then the most awesome tool is detexify which allows you to draw the symbol (with your mouse or stylus) and it will give you the LaTeX command for it. If you're getting started and you'd like info that is more substantial than what I have here, you should check out Shawn Lankton's LaTeX page.

Compiling LaTeX documents

When compiling your documents, if you are sick of having to type pdflatex myfile.tex; bibtex myfile; pdflatex myfile.tex, etc. every time you compile your LaTeX document, you will find the following very useful. It is a rule file, called LaTeX.Rules allowing you to define a Makefile for compiling LaTeX documents, and replacing the repetitive typing of the above commands with just make. In the directory where myfile.tex is located, you create a Makefile containing the following lines:

DOCUMENT := myfile
LATEX := pdflatex     # or latex if you prefer
include /path/to/LaTeX.Rules

and you can now type make and it will take care of the rest. You can read more about it on the developer/maintainer's page HERE.

Ryerson thesis document class

To make things simpler for undergraduate and graduate students alike, I developed a Ryerson Thesis Document Class (RUthesis.cls) which is based on a class developed by several generation of UofAlberta students. You can look at a sample undergraduate or graduate thesis, or you can download the files that were used to produce these examples (ugrad-thesis.tar.bz2 and grad-thesis.tar.bz2), or you can browse all the files here. I have also recently learned someone else at Ryerson has developed a thesis class: check it out here.

Slide presentations

For slide presentations, there are several options. My personal favorite is pdfscreen, but the most popular one now is probably beamer. Just Google those up and you'll find examples and tutorials for both.


For posters, I have looked around and there are a few options, but none was quite what I needed so I made my own stylesheet: pdfposter.sty. It is actualy a modified version of something I found a long time ago on someone else's site. It is based on the LaTeX article class, it is flexible in that you can adjust the aspect ratio and the number of columns of textboxes, and it works with pdflatex. Here is an example poster:

You can download the actual PDF poster, pdfposter.pdf, or get the full source needed to reproduce the poster, pdfposter.tar.bz2, or even browse the directory containing all the necessary files here. The source code actually produces a PDF that is 12" wide by 16" high (as specified using \postersize{12in}{16in}). What I typically need is a poster that is 3 feet wide by 4 feet high (36" x 48") and this is done by rescaling the poster at printing time through the "Page setup..." or "Print setup..." menu when printing from your favorite PDF viewer/editor.

C programming help

You should consider buying the book C: A Reference Manual, which is a wonderful desk reference. For an online reference book, check out The C Book.

Phymbie bootcamp

This set of exercise is meant to prepare you for the set of tasks that come up a lot when you work in the phymbie group, namely model-solving and data fitting (octave), data plotting (xmgrace), and reporting results (LaTeX).

It might be worth first spending some time getting your computer setup to use octave, xmgrace and LaTeX. Note that both octave and LaTeX are available for Windows, but xmgrace is a problem. All three are available on a Mac if you first install Fink or Macports and use these tools to get the packages installed. But if you are just trying this out, just get your hands on MATLAB or octave for your operating system, and you can use a software of your choice to plot and present the results.

If you're going all out, I would recommend you install a debian-based operating system (Debian, Ubuntu/Kubuntu, Minty) on your computer because your work computer in the phymbie group will only be running debian-testing. If you decide to go this route, be sure to install all of these packages (the file lists their Debian name: name might be different for other distributions).

Now, get familiar with these tools by going through a set of things we do commonly:
  1. We primarily use octave (very very similar to MATLAB) for simulating our models. I would recommend you go through a simple tutorial (e.g. here or here) and enter the commands in octave as you go. Note that tutorials and help files for MATLAB (which are sometimes more extensive) directly apply to octave.

  2. To help you get even more familiar with octave/MATLAB, I suggest you try doing some or all of the exercises here: it's great practice.

  3. Read this paper by Baccam et al. It presents the simplest model for influenza and has a few patient data set which you will fit as part of your prep work. Reading the paper will also allow you to learn some basic things about flu and viral infections in general.

  4. When you are done reading/understanding the paper and feel comfortable with octave, have a look at the script model-fits.oct. Use it to fit the data in baccam.txt which is taken from the Baccam et al paper.

  5. We primarily use xmgrace for plotting. Please use xmgrace to reproduce the 6 plots in Figure 1 of the Baccam paper (for the model with delay only). These plots were made using xmgrace so you should be able to make the plots look identical if you're using xmgrace too.

  6. We use LaTeX to typeset everything we do. Once you have completed fitting all 6 patients, and have reproduced the 6 plots using xmgrace, create a very short LaTeX report (a page is fine) to report the result of your fit with very little text but be sure to include the equations of the model you fit to the data, a Table (reproduce Table 3) and a Figure (reproduce Figure 1).

  7. Congratulations! You have now acquired the basic skills you will use almost daily in phymbie.

By the way, if you would like to familiarize yourself with basic bash commands, you could check out this online tutorial.

Setting up PyAPEMoST

Here are the steps to set yourself up to use PyAPEMoST:

    It is the MCMC engine written in C for which pymultinest provides a wrapper module called pyapemost. Once you have the APEMoST source directory, you can compile the APEMoST library component required by pymultinest by simply typing (within the APEMoST directory you just downloaded)


    and then copy the file to local/lib in your home directory, or wherever you usually put your user libraries.

  2. GETTING ctypesGSL

    The pyapemost python module depends on ctypesGSL. Once you have the ctypesGSL source directory, you can install it by typing

    python install --user

    into the ctypesgsl untar-ed directory. When I used this command, it actually installed in ./local/lib rather than in local/lib/python2.7/site-packages/ so I manually moved it there after the fact.

  3. GETTING PyMultiNest

    It provides the python wrapper module for APEMoST. Once you have the pymultinest directory (either using git or tar -xzf), you can follow the instructions on the PyMultiNest website to install pyapemost. Since you've already "Installed the bridge to APEMoST" in STEP 1 above, you don't need to worry about that. But you will need to do the export thing if python is to see/find your file which is required to import the pyapemost module. As the documentation states, if you can type import pyapemost at the python prompt and get no error, your installation was a success.

  4. TESTING pyapemost

    You should test out pyapemost by running the so you can get a feel for how pyapemost behaves, what types of files it creates and what types of files it takes in. You'll notice that it requires the existence of a data file called data and a parameter file called params the specs of which are described in the APEMoST documentation. For our purposes, the data file can be empty or contain random numbers since our scripts don't actually make use of it in computing our SSR.

If you are planning on using PyAPEMoST on SHARCNET, consider the following:
  • you might need to load a newer python with:    module load python/2.7.2    (or whatever newer version)
  • you can verify that this worked with:    python -V
  • no need for the ctypesGSL module (doesn't seem needed)
  • the other instructions are unchanged, and the runs to completion if one changes all the matplotlib calls to show() with savefig('blabla.pdf'), so one doesn't have to interact with the remote X windows (optional).


Getting started

This info is for the specific use of SHARCNET by phymbie members. Before you do anything, before you even request a SHARCNET account, you need to read:
  1. The online tutorial Getting Started with SHARCNET
  2. The entire FAQ from start to finish (no skipping! I'm not kidding)
If you have any questions, please come see me so we can discuss it. Once you've read and understood everything, you are ready to apply for a Compute Canada account. Follow the instructions here. You'll need to know my CCRI (ask me for this via email), and I'll need to approve your application before you can get an account. As part of the process, you will be applying for a SHARCNET consortium account. DO NOT SHARE these accounts with ANYONE!

Submitting jobs

Given the type of codes we run in phymbie, all jobs should be submitted to saw. When unavailable, you should consider using requin or goblin as alternatives. If you think you should be using a different cluster, please consult with me first.

For security reasons, it is best to use ssh keys to log on. I can explain to you how ssh keys work, or you can just Google it.

Once logged into the cluster, you should place your files in your /home directory. But when running jobs, you should have your output written to the /scratch directory which is local to a given cluster (e.g., saw, goblin, requin) so all write operations will be more rapid. BUT keep in mind that files on /scratch are not backed up and they expire (are deleted) after 2 months: so don't leave your files there when you're done.

To run jobs, you would type something like:

sqsub -q serial -r 80m -e sqsub-jobname -o sqsub-jobname ./run.ma_virions
where -q serial submits your job to the serial-computing queue, -r 80m means that you estimate your job will take 80 min to run (estimated running time is required), and the -e and -o option specify the name of the file to which stderr and stdout from the qsub and/or your programme will be redirected.

To use our dedicated queue on goblin ONLY, use the following submit command:

sqsub -q cbeau -r 80m -e sqsub-jobname -o sqsub-jobname ./run.ma_virions

Last modified: May 16, 2013, 16:15.