Colonyzer: quantifying the size of microbial cultures
Colonyzer is an image analysis tool for quantifying the cell density of arrays of independent micro-organism cultures growing on solid agar. It specialises in being sensitive enough to detect the presence of cultures with extremely low cell density arising after dilute liquid inoculation onto agar from photographs of plates. Identifying cultures with few cells growing on an agar surface by photography or after scanning is difficult because culture opacity might not be high enough for colour differences between agar and cells to be apparent. In order to achieve its high levels of sensitivity, it relies on sophisticated algorithms for the identification and detection of lighting gradients in the photograph, and for the detection of thin, semi-translucent developing cultures in the corrected images.
Colonyzer is suitable for high-throughput screening of libraries of yeast mutants for example, and has proven extremely useful in the estimation of phenotypes such as exponential growth rate, appropriate for genome-wide investigations of genetic interaction. Colonyzer was used for cell density estimation in Addinall et al. 2011 and Chang et al. 2011 for example. A detailed description of Colonyzer, its algorithms, the motivation for its development, and some example analysis can be found in Lawless et al. 2010, and an example of how Colonyzer fits into the Quantitative Fitness Analysis workflow can be seen in Banks et al. 2012.
Colonyzer has been developed using Python and several Python modules: numpy, scipy, pandas, pil, matplotlib & optionally pygame. The Colonyzer GitHub pages contain the latest development code. The Colonyzer PyPI pages include a version which is easy to install using pip. The easiest way to get up and running with Colonyzer is to install Python, install the pip package manager for Python and then use pip to install the required modules and Colonyzer itself. To install Python under Windows or OSX, download and run the installer appropriate for your machine here. Python is included with most versions of Linux by default. Python3 includes the pip package manager by default. Instructions for installing pip for earlier versions of python can be found here though Windows users might find these instructions clearer.
Installation under Microsoft Windows
After installing python and pip, you will need to ensure that the python installation directory (e.g. "C:\Python27" and "C:\Python27\Scripts") are included in your path. See this FAQ for a description of how to set your path under Windows 7.
Once both Python 2.7 and pip are installed, the required packages (including Colonyzer itself) can be installed by typing the following at the command prompt. You can typically get a command terminal in Windows by searching for the
cmd program (e.g. Start -> Search -> Cmd). Note that Windows users will have to right click on the Cmd icon and Run As Administrator. Once you have a command terminal window open, type or paste the following command and press enter at the end of the line:
pip install numpy scipy pandas pil matplotlib pygame Colonyzer2
If you are having problems installing packages directly with pip, please download the relevant .whl files from the Unofficial Windows Binaries for Python Extension Packages page. .whl files can be installed by navigating to the directory containing the relevant file and executing the following command, for example:
pip install numpy-1.9.2+mkl-cp27-none-win32.whl
Unfortunately, it is not possible to install 64-bit versions of several Python packages using Pip under windows. As such, even with a 64-bit machine, it is probably easier to just install 32 bit Python and Python packages under windows.
If you do need to install 64-bit versions, you should install packages manually, locate and install the .whl files for the following packages from the Unofficial Windows Binaries for Python Extension Packages website:
numpy scipy pandas pil matplotlib pygame
Note that Numpy-MKL requires installation of a Visual C++ compiler as well (instructions at the webpage above). Once the required packages, including pip are installed, Colonyzer can be installed by typing the following at the command prompt. You can typically get a command terminal in Windows by searching for the
cmd program (e.g. Start -> Search -> Cmd). Note that Windows Vista users will have to right click on the Cmd icon and Run As Administrator. Once you have a command terminal window open, type or paste the following command and press enter at the end of the line:
pip install Colonyzer2
Installation under Linux
Linux users might prefer to allow their OS package management system install the required python packages instead of pip. To do this under Debian (e.g. Ubuntu), first install pip and all required packages using the OS package management system. Then, use pip to install Colonyzer, as follows:
sudo apt-get install python-pip python-numpy python-scipy python-pandas python-matplotlib python-pygame
sudo pip install Colonyzer2
Installation under OSX
It is quite tricky to set up a scientific computing environment under OSX. However, it is possible to install Colonyzer and the required packages. Some tips and hints can be found on this page.
Upgrading to latest version
Colonyzer is continuously being improved. To upgrade an existing installation to the latest version, simply execute the following command in terminal (as administrator or using
sudo where appropriate):
pip install --upgrade Colonyzer2
Colonyzer can be used to analyse single timepoint plate images or image timecourses. Capturing a timecourse allows generation of microbial growth curves and allows us to infer strain fitnesses (using the QFA R package for example.
- Capture a timecourse series of photographs of microbial cultures spotted in onto a solid agar plate (some demo image files here) or equivalent single snapshots.
- Name the photographs using the first 15 characters as a plate identifier, with further characters for identifying particular images in a series. For timecourse images the chronological order of the image identifiers should correspond to their alphabetical order (e.g. a timestamp YYYY-MM-DD_HH-MM-SS would be appropriate). Image names following this patten are ideal: W000155_030_001_2009-06-30_14-36-26.jpg.
- Collect all image files to be analysed (can be multiple images of multiple plates) into one directory.
Once Python and the relevant packages (including Colonyzer itself) are installed, and once your Python path has been set up correctly, to analyse images with Colonyzer, simply navigate to the directory containing the images and execute the colonyzer program by typing
colonyzer followed by a range of optional arguments. Colonyzer will search the current directory for image files and begin analysing. The default analysis assumes a 384-format plate where lighting correction is not required and both image segmentation and spot location are automatic. Available options can be seen by accessing help from the commandline
colonyzer -h and are also listed here
For example, you can run some analysis on a 96-format plate with lighting correction turned on, fixing the segmentation threshold at 100 by executing the following:
colonyzer -o 96 -c -f 100
For some images, automatic location of arrayed cultures can prove difficult. For example, if there are so few strong growers on a plate that it is difficult to figure out unambiguously where the grid is, or if the plate wall has been imaged along with cells and its signal strength is as strong as that of the colonies, it can interfere with automatic location. In that case, you can provide a calibration file, providing a first guess at the position of the gridded array of spots on the plate. An example calibration file, including its own format instructions (and which must be named Colonyzer.txt) can be seen here. These files can be generated/edited manually using a text editor if required.
Instead of writing a calibration file manually, Parametryzer is a GUI tool to help you generate one semi-automatically by clicking on images. Simply navigate to the directory containing your images, execute:
and follow the on-screen instructions. Once this program has run its course it writes a Colonyzer.txt file into the directory, ready for fixedpos to read. Once you have such a file in the same directory as the images to be analysed, you can now execute Colonyzer using the spot location calibrations as initial guesses like this:
Colonyzer generates three directories:
- Output_Data: Contains one .out file for every image in the root directory. These are tab-delimited text files, some headers described below. A historical .dat file containing essentially the same information is also generated.
- Output_Images: Contains .png previews of the original data, indicating how Colonyzer segments the image (cells are white, agar is black) and where it estimates spots are located (coloured squares)
- Output_Reports: .pdf files summarising global spot location steps and image segmentation procedure.
The main data output is the set of .out files in the Output_Data directory. These are tab-delimited text files with a column header, some of which are described below.
- Column, Row: Coordinates specifying location of individual spot (and surrounding rectangular tile) on a plate.
- Intensity: Sum of pixel intensities within tile, scaled by the maximum theoretical intensity (255*width*height).
- Area: Number of pixels classified as cell after segmentation (white pixels in Output_Images images) within tile.
- Trimmed: Sum of pixel intensities within tile that are also classified as cell after segmentation.
- FeatureMedian: Median intensity of pixels classified as cells within tile.
- FeatureVariance: Variance in intensity between pixels classified as cells within tile.
- red,green,blueMean: Mean RGB channel intensities in pixels classified as cells within tile.
- red,green,blueMeanBack: Mean RGB channel intensities in pixels classified as agar/background within tile.
- red,green,blueMedian: Median RGB channel intensities in pixels classified as cells within tile.
- red,green,blueMedianBack: Median RGB channel intensities in pixels classified as agar/background within tile.
- Barcode: Image identifier (essentially filename with timestamp stripped). Useful for associating metadata with plate.
Associating output with metadata
Colonyzer output can be associated with metadata and used to generate growthcurves using the QFA R package package. You can also do the same using the
merge script. This script concatenates all available .out files in a directory, while also optionally appending metadata columns from up to three metadata files:
- ExptDescription.txt: Tab-delimited text file containing columns labelled Barcode, Start.Time (timestamp in the same format as that used to construct filenames during image capture), Treatment (applied to plates), Medium (within agar on plates), Screen (useful identifier), Library (identifier specifying which collection of strains being analysed, should match identifier in LibraryDescription.txt below), Plate (number identifying which plate of multi-plate library corresponds to Barcode), RepQuad (for plates pinned from 1536 format, specify which quadrant, else set to 1)
- LibraryDescription.txt: Tab-delimited text file containing columns labelled Library (identifier specifying a collection of strains), ORF (strain identifier, systematic identifier preferable, but not compulsory), Plate (number identifying which plate in series making up library), Row, Column (coordinates of spot on given plate), Notes (optional)
- ORF2GENE.txt: Tab-delimited text file containing two unlabelled columns: one for ORF name (strain name specified in LibraryDescription.txt file, typically systematic gene name) and one for a standard name. This file is (optionally) used to attach a standard name to a (systematic) ORF name.
Colonyzer2 is under development on github. Feel free to fork the repo and to submit pull requests. Marcin Plech has contributed many useful bugfixes to the latest version of the software. Katja Luck and Adriana San Miguel have provided useful documentation for installation under OSX.
If you use Colonyzer in research leading to a publication, please cite our open access article:
Conor Lawless, Darren J Wilkinson, Alexander Young, Stephen G Addinall and David A Lydall Colonyzer: automated quantification of micro-organism growth characteristics on solid agar BMC Bioinformatics 2010, 11:287
The original source code, installation instructions, a library of example images, and some auxiliary scripts for analyzing batches of images as presented in Lawless et al. 2010 and used in Addinall et al. 2011 and Chang et al. 2011 and demonstrated in Banks et al. 2012 can be found on sourceforge. However, the current version is recommended for new users. In particular the current version is faster and easier to install and use.
The qfa R package has been developed to further analyse the data, construct growth curves and infer culture fitnesses, and is compatible with either version of Colonyzer.