These example scripts are not part of ogaraK's core. They are provided as a supplement. The user is free to use them (or use completely different tools and scripts to process results).

You can find the scripts here.

There are 3 kinds of scripts: (i) standard, (ii) requiring external tools and (iii) not ogaraK related, but useful.

The main requirement is Python (2.6) along with the chart library matplotlib. The scripts requiring external tools need Biopython at least 1.55 (currently in beta) and Genepop (Biopython has to be properly configured to find Genepop, see Biopython's wiki for this).

These scripts are supplementary and similar versions can be done in many other languages like Perl, Java, etc...

The preferred way to analyse the results is in fact not with scripts but with widely used (and tested) applications like Genepop or Arlequin.

We are always updating the scripts (and adding new ones). The current versions might have minor differences from the descriptions below. Also, you will find many new scripts still not documented. Feel free to explore them!

Standard scripts

These scripts process okaraK output. They are based on the example scenarios provided. You can alter them to process your own scenarios.

First you will need to determine the place where projects are saved. Do this by consulting the menu "Help" and then "Data Directory". In the examples below replace PROJECTSDIR with the value reported. Also adapt the command line examples provided for your operating system.

The simplest case is plotting the frequencies of all genotypes over time:

python $PROJECTSDIR case.png 03 04 DGF2

This assumes that you have run DGF2

This will generate a file called case.png (it can generate a eps if you prefer, just by changing the extension). It will generate a colour figure for an s of 0.3 and a drug frequency of 0.4 (notice that the points are removed).

A possible output is:

There is a small variant, good for many haplotypes, that will print haplotypes with a colour that reflects the number of mutations, this is called plotCase2 and has the same parameters.

A possible output is:

The first script shows the frequency of non-mutatant parasites and its rate of change computed as the proportionate change per generation. The frequency of sensitive genotypes is depicted in dashed lines and the rate of change in solid lines. You can run it like this:

python $PROJECTSDIR speed.eps False 03 04 FullEpistasis

This assumes that you have run FullEpistasis1, FullEpistasis2 and FullEpistasis4

This will generate a filed called speed.eps (it can generate a png if you prefer, just by changing the extension). It will generate a colour figure (change False to True if you want black and white) for an s of 0.3 and a drug frequency of 0.4 (notice that the points are removed). Here is an example:

Linkage disequilibrium (r) patterns for single-drug models, 2 loci per drug.

Important note:This script only works for 1 drug and 2 loci, as it depends on a file that is generated by ogaraK only in this case. If you need LD (r) estimates for other cases, you should use external tools to calculate LD (see below for similar examples with Fst calculations).

Call the script like this:

python ld.eps False 03 04 "Full epistasis" $PROJECTSDIR/FullEpistasis2/LDMFT-12+03+04.txt "Duplicate gene function" $PROJECTSDIR/DGF2/LDMFT-12+03+04.txt "Full epistasis + DGF" $PROJECTSDIR/Full+DGF2/LDMFT-12+03+04.txt "SP-based" $PROJECTSDIR/Full+Asym2/LDMFT-12+03+04.txt

ld.eps is the file generated. If you prefer to generate a bitmap you might do ld.png. False means do figure in colour. 03 is the fitness penalty (note the dot absense). 04 is the drug usage. Then follows a list of descriptions and files, for instance there is a description "Full Epistasis" which will use file $PROJECTSDIR/FullEpistasis2/LDMFT-12+03+04.txt

Calling the example above requires running scenarios FullEpistasis2, Full+DGF2, Full+Asym2 and DGF2.

Script using external tools (Genepop format)

This script exemplifies using external tools (and the genepop export format).

The script requires Biopython, matplotlib and Genepop. It will present the Pairwise Fst between all generations. It requires 3 parameters: The file name (genepop file), a chart title and a locus, example

python $PROJECTSDIR/2RotFullEpistasis2/ThresRot-22+04+04.txt Rotation lc1

(do not forget to request ogaraK to dump a genepop file)

An example output is:

Other scripts

There are many other scripts still to be documented. See e.g. and (indeed most plot* scripts - around 15 - are usable with the current version of ogaraK - minor adjustments might be needed in some cases).

Other useful scripts

These scripts do not use ogaraK but might be useful for theoretical analysis.

Prevalence as a function of the frequency of the resistant allele with full epistasis for r of 0.0 and 0.5

python resInf.png False


Relationship between prevalence and frequency of resistance with multiplicity of infection (MOI) in the single locus model.

python prevalence.png False 500

The last parameter is the limit for the frequency of the resistant allele multiplied by 1000. In this case the limit is 0.5


Back to main page.