We will be offering mothur and R workshops throughout 2019. Learn more.
The heatmap.bin command generates a heat map from data provided in either a *.list or a *.shared file. Each row in the heatmap represents a different OTU and the color of the OTU in each group scaled between black and red according to the relative abundance of that OTU within the group. The command will generate a SVG file that can be further modified in a program like Gimp or Adobe Illustrator. Options are available to scale the relative abundance for each OTU using different approaches. This tutorial uses the data files in AbRecovery.zip.
To execute the heatmap.bin command first generate the shared data and run the heatmap.bin command:
mothur > read.dist(phylip=abrecovery.dist, cutoff=0.10) mothur > cluster() mothur > read.otu(list=abrecovery.fn.list, group=abrecovery.groups) mothur > heatmap.bin()
This will generate 12 SVG files - a heat map for each OTU definition between unique and 0.10 (because of the cutoff in the read.dist command). For example, the heatmap that is generated for OTUs defined at the 0.10 level would be abrecovery.fn.0.10.heatmap.svg.
Alternatively, the following commands will generate a heatmap for group B:
mothur > read.otu(list=abrecovery.fn.B.list) mothur > heatmap.bin()
For the purposes of this tutorial, however, we will work with the heatmaps generated from multiple samples.
Because communities typically follow some type of skewed distribution, it may be desirable to scale the abundance data to flatten the distribution so that the data is easier to visualize. By default, for each group the abundance of each OTU is transformed using log10 and the result is scaled to the largest log10 abundance value. Alternatively, the ability to scale by log2 or to turn off scaling is possible as well:
mothur > heatmap.bin(scale=log2)
mothur > heatmap.bin(scale=linear)
Default behavior is achieved as follows:
mothur > heatmap.bin(scale=log10)
Other scaling options could be incorporated if you have a suggestion.
There may only be a couple of lines in your OTU data that you are interested in generating a heatmap for. There are two options. You could: (i) manually delete the lines you aren't interested in from you list or shared file; (ii) or use the label option. If you only want to read in the data for the lines labeled unique, 0.03, 0.05 and 0.10 you would enter:
mothur > heatmap.bin(label=unique-0.03-0.05-0.10)
If you use the get.group command with this dataset, you will seen that there were 3 groups here: A, B, and C. If you just want the heat map between groups A and B, A and C, or B and C enter the following:
mothur > heatmap.bin(groups=A-B) mothur > heatmap.bin(groups=A-C) mothur > heatmap.bin(groups=B-C)
Note that if you run these commands, the SVG files will have the same name and will be written over for each execution. You will need to rename the file between executions.
By default the heatmap.bin command will sort the rows of the heatmap first by those that are shared and then by abundance. Alternatively, if you want to sort the lines by the order in the list file, use the sorted option:
mothur > heatmap.bin(sorted=F)
mothur > heatmap.bin(sorted=T)
Will give the default behavior.