Instructions for how to analyze fluctuation test data using the command line. Please see this page for information regarding how to conduct a fluctuation analysis.

Installing rSalvador

rSalvador needs to be installed locally before it can be used. Unfortunately this can't be done using normal R commands (in other words install.packages("rsalvador") doesn't work) rSalvador should be cloned from github and installed with the following commands.

  1. git clone
  2. cd rSalvador
  3. R CMD cherck rsalvador
  4. R CMD INSTALL rsalvador

For more information see the github page.

Analysis using rSalvador

Analysis of fluctuation data comes in 3 key parts. (1) Getting your count data into the format that is needed by the R functions, (2) the calculation of the rate itself, and (3) the calculation of the confidence interval. The following commands are expected to be executed on an R command line or in an interpreter such as Rstudio. Commands listed next to numbers can be copy pasted, while commands next to bullet points should be edited according to your results.


Load the rSalvador library

  1. library(rsalvador)

Generate vectors for how many colonies you saw on the selective plates. For example if you had 3 selective plates and saw 1, 2 and 3 colonies:

  • selective_counts = c(1,2,3)
rSalvador requires the number of cells in the original culture, NOT the number of colonies plated so it is a bit more complicated. For example if you saw 100, 105, 110 colonies on 3 non-selective plates, and plated 50µl of a 2E-6 dilution, and the original culture volume was 200µl:
  • nonselective_counts = c(100, 105, 110)
  • vol_plated = 50
  • dilution_factor = 2e-6
  • original_volume = 200
  1. original_cells = <- rep((mean(non_selective_counts) / vol_plated / dilution_factor) * original_volume, length(selective_counts))
Alternatively, you could calculate the original concentration of the cells in another program such as excel, and enter the vector directly:
  • original_cells = c(2.1e8, 2.1e8, 2.1e8)
NOTE that in either case, the "original_cells" vector must have the same number of entries as the number of selective plates you have. So in this case it has to be repeated 3 times, if you had 12 selective plates 12 times (and so on). Additionally, if you had seen 107 instead of 105 colonies you'd have to enter 211333333 three times in this instance, or 12 times if that was the number of selective plates you had.

Calculating the mutation rate:

  1. golden.benchmark.LD(selective_counts, original_cells)

Calculating the confidence interval:

  1. confint.LD(selective_counts)/original_cells[1]

Expected output:

Assuming everything works correctly, the example listed below should give you a mutation rate of 6.926804e-09 and a confidence interval of 1.898544e-09 to 1.635834e-08
> library("rsalvador")
Loading required package: hypergeo
Loading required package: gdata
gdata: read.xls support for 'XLS' (Excel 97-2004) files ENABLED.

gdata: read.xls support for 'XLSX' (Excel 2007+) files ENABLED.

Attaching package: ‘gdata’

The following object is masked from ‘package:stats’:


The following object is masked from ‘package:utils’:


The following object is masked from ‘package:base’:


> selective_counts = c(1,2,3)
> non_selective_counts = c(100, 105, 110)
> vol_plated = 50
> dilution_factor = 2e-6
> original_volume = 200
> original_cells <- rep((mean(non_selective_counts) / vol_plated / dilution_factor) * original_volume, length(selective_counts))
> golden.benchmark.LD(selective_counts, original_cells)
[1] 6.926804e-09
> confint.LD(selective_counts)/original_cells[1]
[1] 1.898544e-09 1.635834e-08

Using the fluxxer.R script

Note that this method is not currently favored as the required formats are non-intuative and rather ugly.

Things you need

  1. fluxxer.R script
  2. A .csv file contianing count data.
  3. Knowledge of the following as it relates to the non-selctive plates (if they differ from the default values).
    1. Original culture volume
    2. Dilution factor
    3. Volume plated
  4. Desired prefix for output files.

Getting the fluxxer.R script

The simplest way to do this is to clone the barricklab github repository. It is assumed that you install it in ~/src but it can be installed anywhere and adjusted accordingly. Github project is located here.

  1. git clone
  2. As this script relies on the rSalvador package, you must also follow instructions at the top of the page to install that package if you have not already done so

The following refers to the 'legacy script' ... and will be deleted once the above section is finished.

Input.csv file

The script is designed to read in all count data from a .csv file formated as follows.

  • Columns: Each column represents a single sample and will contain both selective and non-selective counts. Sample order determines graph output.
  • Row 1: Name of sample.
    • This will be displayed verbatim on the resulting graph.
  • Row 2-n: Selective plate counts.
    • Single plate per row, as many rows as plates were counted.
  • Row n+1: Non_Selective
    • Text must appear exactly as typed above (capital N and S with single underscore between).
    • Can appear on different rows for different samples if different numbers of selective plates were counted.
  • Row n+2-last: Non_Selective plate counts.
    • Single plate per row, as many rows as plates were counted.
    • Rows should be actual counts, without any calculation of what the original culture concentration was.


-- Main.DanielDeatherage - 07 Dec 2017

 Barrick Lab  >  ProtocolsFluctuationTests  >  FluctuationAnalysis

Topic revision: r5 - 25 Oct 2018 - 19:56:09 - Main.DanielDeatherage
This site is powered by the TWiki collaboration platformCopyright ©2018 Barrick Lab contributing authors. Ideas, requests, problems? Send feedback