We will be offering mothur and R workshops throughout 2019. Learn more.


From mothur
Revision as of 17:19, 18 May 2015 by Pschloss (Talk | contribs) (permute)

Jump to: navigation, search

The venn command generates a Venn diagram from data provided in a *.shared file. The command can generate diagrams (as SVG files) to compare the richness shared among 2, 3, or 4 groups. The SVG file that can be further modified in a program like Gimp or Adobe Illustrator to scale the areas to be proportional to the richness represented by the region. Options are available to measure richness based on the observed richness or the estimated richness using the chao and sharedchao calculators. This tutorial uses the data files in AbRecovery.zip.

Default settings

To execute venn(), shared data created:

mothur > cluster(phylip=abrecovery.dist, cutoff=0.10)  
mothur > make.shared(list=abrecovery.fn.list, group=abrecovery.groups)
mothur > venn(shared=abrecovery.fn.shared)

This will generate 12 SVG files - a venn diagram for each OTU definition between unique and 0.10 (because of the cutoff in the read.dist command). For example, the venn diagram that is generated for OTUs defined at the 0.10 level would be abrecovery.fn.0.10.venn.sobs.svg.



By default the venn() command will calculate the shared richness based on the observed OTUs. Alternatively, it is possible to use the chao and sharedchao or the ace and sharedace calculators to predict the richness of each region. This option can be implemented by the following command:

mothur > venn(shared=abrecovery.fn.shared, calc=sharedchao)

Alternatively the observed richness can be used with the command:

mothur > venn(shared=abrecovery.fn.shared, calc=sharedsobs)

Both can be run simultaneously by the command:

mothur > venn(shared=abrecovery.fn.shared, calc=sharedsobs-sharedchao)


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


At this point, if you run the following command:

mothur > get.group(shared=abrecovery.fn.shared)

You would have seen that there were 3 groups here: A, B, and C. If you just want the venn diagrams between groups A and B, A and C, or B and C enter the following:

mothur > venn(shared=abrecovery.fn.shared, groups=A-B)
mothur > venn(shared=abrecovery.fn.shared, groups=A-C)
mothur > venn(shared=abrecovery.fn.shared, 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.


The nseqs parameter will output the number of sequences represented by the otus in the picture, default=F.

mothur > venn(shared=abrecovery.fn.shared, nseqs=T)


If you have more than four groups and set permute=t, mothur will create pictures with all possible 4-way permutations. The permute option can also be set to 1,2,3, or 4 to create combinations of varying size.

mothur > venn(shared=abrecovery.fn.shared, permute=t)


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


The sharedotus parameter can be used with the sharedsobs calculator to get the names of the OTUs in each section of the venn diagram. Default=t.

mothur > venn(shared=abrecovery.fn.shared, label=0.03)

The abrecovery.fn.0.03.sharedsobs.sharedotus file contains:

Groups	NumShared	OTULabels
A-B	15	Otu001,Otu003,Otu005,Otu007,Otu011,Otu012,Otu013,Otu014,Otu015,Otu026,Otu028,Otu030,Otu032,Otu040,Otu041
A-C	8	Otu008,Otu014,Otu023,Otu027,Otu030,Otu031,Otu032,Otu040
B-C	6	Otu014,Otu030,Otu032,Otu040,Otu044,Otu048
A-B-C	4	Otu014,Otu030,Otu032,Otu040