We will be offering mothur and R workshops throughout 2019. Learn more.
The dist.shared command will generate a phylip-formatted distance matrix that describes the dissimilarity (1-similarity) among multiple groups. This command will calculate any of the calculators describing the similarity in community membership or structure. This tutorial uses the data files in AbRecovery.zip.
Using the antibiotic recover data do the following:
mothur > cluster(phylip=abrecovery.dist, cutoff=0.10) mothur > make.shared(list=abrecovery.fn.list, group=abrecovery.groups, label=0.03) mothur > dist.shared(shared=abrecovery.fn.shared)
3 A B 0.733333 C 0.846154 0.878049
3 A B 0.69455 C 0.953499 0.93937
Using the calc option allows one to select any of the calculators of similarity of community membership and structure. The different calculators can be separated with hyphens (i.e. "-"). For example the following command will generate distance matrices for the Jaccard coefficient using richness estimators, the Yue & Clayton theta, and the Bray-Curtis index:
mothur > dist.shared(shared=abrecovery.fn.shared, calc=jest-thetayc-braycurtis)
Keep in mind that these are distances, which are calculated as one minus the similarity value.
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 distances between groups A and B, A and C, or B and C enter the following (this is an admittedly silly example):
mothur > dist.shared(shared=abrecovery.fn.shared, groups=A-B) mothur > dist.shared(shared=abrecovery.fn.shared, groups=A-C) mothur > dist.shared(shared=abrecovery.fn.shared, groups=B-C)
Keep in mind that these will output to files with the same name. So, it is important to change the file name between commands. The following reverts to the default behavior:
mothur > dist.shared(shared=abrecovery.fn.shared, groups=all)
This is the same as:
mothur > dist.shared(shared=abrecovery.fn.shared, groups=A-B-C)
There may only be a couple of lines in your OTU data that you are interested in summarizing. There are two options. You could: (i) manually delete the lines you aren't interested in from you rabund, sabund, 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 > dist.shared(shared=abrecovery.fn.shared, label=unique-0.03-0.05-0.10)
The output option allows you specify the form of the matrix generated by dist.shared. By default, dist.shared will generate a phylip formatted lower triangle matrix. If you set output to "square" a phylip formatted square matrix will be generated. If you set output to "column" a column formatted distance matrix will be produced.
mothur > dist.shared(shared=abrecovery.fn.shared, output=square)
The subsample parameter allows you to enter the size pergroup of the sample or you can set subsample=T and mothur will use the size of your smallest group.
The iters parameter allows you to choose the number of times you would like to run the subsample. Default=1000.
The processors option allows you to reduce the processing time by using multiple processors. You are able to use as many processors as your computer has with the following option:
mothur > dist.shared(shared=abrecovery.fn.shared, label=unique-0.03-0.05-0.10, processors=2)
Running this command on my laptop doesn't exactly cut the time in half, but it's pretty close. There is no software limit on the number of processors that you can use.