We will be hosting mothur and R workshops throughout 2018. Learn more.


From mothur
Jump to: navigation, search

The heatmap.sim command will generate a heatmap indicating the pairwise similarity between multiple samples using a variety of calculators comparing community membership and structure. As an example, we will use the example from the Sogin data analysis example.

Default settings

Sample Similarity

Before running the heatmap.sim command shared OTU data must be created by mothur:

mothur > make.shared(list=sogin.unique.good.filter.fn.list, group=sogin.good.groups)

Then running the following command will generate the heatmaps for the jest and thetayc calculators for each line in the list or shared file

mothur > heatmap.sim(shared=sogin.unique.good.filter.fn.shared)


The calc parameter will allow you to use any of the similarity calculators provided within mothur to generate heatmaps comparing the membership or structure of your samples. For example, the following command will generate heatmaps for the classical Sorenson index, Yue & Clayton's theta, and the Morisita-Horn index:

mothur > heatmap.sim(shared=sogin.unique.good.filter.fn.shared, calc=sorclass-thetayc-morisitahorn)


There may only be a couple of lines in your OTU data that you are interested in generating a heatmap diagram 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.sim(shared=sogin.unique.good.filter.fn.shared, label=unique-0.03-0.05-0.10)

Raw Distance Matrix


To read in a phylip-formatted distance matrix you need to use the phylip option:

mothur > dist.shared(shared=sogin.unique.good.filter.fn.shared, label=0.10)
mothur > heatmap.sim(phylip=sogin.unique.good.filter.fn.jclass.0.10.lt.dist)

column & name or count

To read in a column-formatted distance matrix you must provide a filename for the name option or count file:

mothur > heatmap.sim(column=..., name=...)


mothur > heatmap.sim(column=..., count=...)



At this point, if you run the following command:

mothur > get.group(shared=sogin.unique.good.filter.fn.shared)

You would have seen that there were 8 groups here: 112R, 115R, 137, 138, 53R, 55R, FS312, and FS396. Say you just wanted to generate a heatmap for the seawater samples without the diffuse flow samples (i.e. FS312 and FS396). You could then use the groups option:

mothur > heatmap.sim(shared=sogin.unique.good.filter.fn.shared, groups=112R-115R-137-138-53R-55R)


The fontsize parameter allows you to adjust the fontsize in the picture mothur creates. The default is 24.


  • 1.23.0 - Added fontsize parameter.
  • 1.28.0 - Added count parameter
  • 1.38.0 - Fixes gradient bar
  • 1.40.0 - Speed and memory improvements for shared files. #357 , #347
  • 1.40.0 - Bug Fix: Fixes out of bounds error. #363