We will be offering an R workshop December 18-20, 2019. Learn more.

Difference between revisions of "Sharedace"

From mothur
Jump to: navigation, search
(New page: Validate output by making calculations by hand '''Example Calculations''' '''*.sharedAce''' Example calculations below will be performed using data from the Eckburg 70.stool_compa...)
 
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Validate output by making calculations by hand]]
+
The [[sharedace]] calculator returns the shared ACE richness estimate for an OTU definition. This calculator can be used in the [[summary.shared]] and [[collect.shared]] commands.  The calculations for the shared ACE richness estimator are implemented as described by Chao in the user manual for her program [http://chao.stat.nthu.edu.tw/SPADE_UserGuide.pdf SPADE].
  
  
'''Example Calculations'''
+
<math>S_{A,B ACE} = S_{12 \left ( abund \right )} + \frac {S_{12 \left ( rare \right )}}{c_{12}} + \frac {1}{C_{12}} \left [ f_{\left ( rare \right )1+} {\Gamma}_1  + f_{\left ( rare \right )+1} {\Gamma}_2 + f_{11}{\Gamma}_3 \right ]</math>   
  
'''*.sharedAce'''
+
 +
where,
  
 +
<math>C_{12} = 1 - \frac {\sum_{i=1}^{S_{12\left ( rare \right )}} {\left \{Y_i I \left ( X_i = 1 \right ) + X_iI \left ( Y_i = 1 \right ) - I \left ( X_i = Y_i = 1 \right ) \right \}}} {T_{11}}</math>
  
Example calculations below will be performed using data from the Eckburg 70.stool_compare files with an OTU definition of 0.03.
 
  
 +
<math>{\Gamma}_1 = \frac{S_{12 \left (rare \right )} T_{21}}{C_{12} T_{10}T_{11}} - 1</math>
  
Estimating the richness of shared OTUs between two communities.  A Non-parametric richness estimator of the number of shared OTUs between two communities has been developed that is analogous to the ACE (3) single community richness estimator.  The <math>S_{A,B ACE},</math> (9), estimator is calculated as:
+
<math>{\Gamma}_2 = \frac{S_{12 \left (rare \right )} T_{12}}{C_{12} T_{01}T_{11}} - 1</math>
  
 +
<math>{\Gamma}_3 = \left[ \frac{S_{12\left( rare \right)}}{C_{12}}\right ]^2 \frac{T_{22}}{T_{10}T_{01}T_{11}} - \frac{S_{12 \left( rare \right)}T_{11}}{C_{12}T_{01}T_{10}}-{\Gamma}_1-{\Gamma}2</math>
  
<math>S_{A,B ACE} = S_{12 \left ( abund \right )} + \frac {S_{12 \left ( rare \right )}}{c_{12}} + \frac {1}{C_{12}} \left [ f_{\left ( rare \right )1+} {\Gamma}_1  + f_{\left ( rare \right )+1} {\Gamma}_2 + f_{11}{\Gamma}_3 \right ]</math>   
 
  
+
{| style="border-spacing:100px 10px"
where,
+
|<math>T_{10} = \sum_{i=1}^{S_{12\left( rare \right)}} X_i </math> || <math>T_{01} = \sum_{i=1}^{S_{12\left( rare \right)}} Y_i </math>
 +
|-
 +
|<math>T_{11} = \sum_{i=1}^{S_{12\left( rare \right)}} X_i Y_i </math> || <math>T_{21} = \sum_{i=1}^{S_{12\left( rare \right)}} X_i \left( X_i - 1 \right) Y_i </math>
 +
|-
 +
|<math>T_{12} = \sum_{i=1}^{S_{12\left( rare \right)}} X_i \left( Y_i - 1 \right) Y_i </math> || <math>T_{22} = \sum_{i=1}^{S_{12\left( rare \right)}} {X_i \left( X_i - 1 \right) Y_i \left( Y_i - 1 \right)}  </math>
 +
|}
  
<math>C_{12} = 1 - \frac {\sum_{i=1}^{S_{12\left ( rare \right )}} {\left \{Y_i I \left ( X_i = 1 \right ) + X_iI \left ( Y_i = 1 \right ) - I \left ( X_i = Y_i = 1 \right ) \right \}}} {T_{11}}</math>
+
<math>f_{11}</math> = number of shared OTUs with one observed individual in A and B
  
 +
<math>f_{\left(rare \right)1+}</math> = number of OTUs with one individual found in A and less than or equal to 10 in B.
  
<math>{\Gamma}_1 = \frac{S_{12 \left (rare \right )} n_{rare} T_{21}}{C_{12}\left( n_{rare} - 1\right)T_{10}T_{11}} - 1</math>,      <math>{\Gamma}_2 = \frac{S_{12 \left (rare \right )} m_{rare} T_{12}}{C_{12}\left( m_{rare} - 1\right)T_{01}T_{11}} - 1</math>
+
<math>f_{\left(rare \right)+1}</math> = number of OTUs with one individual found in B and less than or equal to 10 in A.
  
 +
<math>S_{12\left(rare\right)}</math>  = number of shared OTUs where both of the communities are represented by less than or equal to 10 sequences.
  
 +
<math>S_{12\left(abund\right)}</math> = number of shared OTUs where at least one of the communities is represented by more than 10 sequences.
  
<math>{\Gamma}_3 = \left[ \frac{S_{12\left( rare \right)}}{C_{12}}\right ]^2 \frac{n_{rare}m_{rare}T_{22}}{\left(n_{rare}-1\right)\left(m_{rare}-1\right)T_{10}T_{01}T_{11}} - \frac{S_{12 \left( rare \right)}T_{11}}{C_{12}T_{01}T_{10}}-{\Gamma}_1-{\Gamma}2</math>
+
<math>S_{12\left(obs\right)}</math> = number of shared OTUs in A and B.
  
 +
<math>I\left(\right)</math> = evaluates to 1 if the contents are true and to 0 if they are false
  
  
<math>T_{10} = \sum_{i=1}^{S_{12\left( rare \right)}} X_i </math>,  <math>T_{01} = \sum_{i=1}^{S_{12\left( rare \right)}} Y_i </math>,  <math>T_{11} = \sum_{i=1}^{S_{12\left( rare \right)}} X_i Y_i </math>,  <math>T_{21} = \sum_{i=1}^{S_{12\left( rare \right)}} X_i \left( X_i - 1 \right) Y_i </math>
+
Open the file 98_lt_phylip_amazon.fn.sabund generated using the [[Media:AmazonData.zip | Amazonian dataset]] with the following commands:
  
 +
mothur > cluster(phylip=98_lt_phylip_amazon.dist, cutoff=0.10)
 +
mothur > make.shared(list=98_lt_phylip_amazon.fn.list, group=amazon.groups, label=0.10)
  
<math>T_{12} = \sum_{i=1}^{S_{12\left( rare \right)}} X_i \left( Y_i - 1 \right) Y_i </math>,  <math>T_{22} = \sum_{i=1}^{S_{12\left( rare \right)}} {X_i \left( X_i - 1 \right) Y_i \left( Y_i - 1 \right)}  </math>
 
  
where, 
 
 
<math>f_{11}</math> = number of shared OTUs with one observed individual in A and B
 
  
<math>f_{1+}, f_{2+}</math> = number of shared OTUs with one or two individuals observed in A
+
The 98_lt_phylip_amazon.fn.[[shared file]] will contain the following two lines:
  
<math>f_{+1}, f_{+2}</math> = number of shared OTUs with one or two individuals observed in B
+
0.10 forest 55 1 1 1 1 1 1 3 3 2 2 1 1 3 2 1 1 1 1 2 1 1 2 5 1 1 1 1 2 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 +
0.10 pasture 55 0 0 0 1 1 0 1 0 0 5 0 0 0 0 0 2 0 0 0 3 0 0 2 1 0 1 0 0 0 0 0 0 1 2 1 1 1 1 1 7 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1
  
<math>f_{\left(rare \right)1+}</math> = number of OTUs with one individual found in A and less than or equal to 10 in B.
 
  
<math>f_{\left(rare \right)+1}</math> = number of OTUs with one individual found in B and less than or equal to 10 in A.
+
This indicates that the label for the OTU definition was 0.10.  The first line is from the forest  sample and the second is from the pasture sample.  There are a total of 55 OTUs between the two communities. Writing the data in a more presentable manner we see:
  
<math>n_{rare}</math> = number of sequences from A that contain less than 10 sequences.
 
  
<math>m_{rare}</math> = number of sequences from B that contain less than 10 sequences.
+
{| class="wikitable sortable" style="text-align:center"
 +
! index !! forest !! pasture !! S12 !! f1+ !! f+1 !! f2+ !! f+2 !! f11
 +
|-
 +
| 1 || 1 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 2 || 1 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 3 || 1 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 4 || 1 || 1 || X || X || X ||  ||  || X
 +
|-
 +
| 5 || 1 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 6 || 1 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 7 || 3 || 1 || X ||  || X ||  ||  ||
 +
|-
 +
| 8 || 3 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 9 || 2 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 10 || 2 || 5 || X ||  ||  || X ||  ||
 +
|-
 +
| 11 || 1 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 12 || 1 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 13 || 3 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 14 || 2 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 15 || 1 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 16 || 1 || 3 || X || X ||  ||  ||  ||
 +
|-
 +
| 17 || 1 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 18 || 1 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 19 || 2 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 20 || 1 || 3 || X || X ||  ||  ||  ||
 +
|-
 +
| 21 || 1 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 22 || 2 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 23 || 5 || 2 || X ||  ||  ||  || X ||
 +
|-
 +
| 24 || 1 || 1 || X || X || X ||  ||  || X
 +
|-
 +
| 25 || 1 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 26 || 1 || 1 || X || X || X ||  ||  || X
 +
|-
 +
| 27 || 1 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 28 || 2 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 29 || 1 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 30 || 1 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 31 || 1 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 32 || 1 || 0 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 33 || 1 || 1 || X || X || X ||  ||  || X
 +
|-
 +
| 34 || 0 || 2 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 35 || 0 || 1 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 36 || 0 || 1 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 37 || 0 || 1 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 38 || 0 || 1 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 39 || 0 || 1 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 40 || 0 || 7 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 41 || 0 || 1 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 42 || 0 || 1 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 43 || 0 || 2 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 44 || 0 || 1 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 45 || 0 || 1 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 46 || 0 || 1 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 47 || 0 || 1 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 48 || 0 || 1 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 49 || 0 || 1 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 50 || 0 || 1 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 51 || 0 || 1 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 52 || 0 || 1 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 53 || 0 || 2 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 54 || 0 || 1 ||  ||  ||  ||  ||  ||
 +
|-
 +
| 55 || 0 || 1 ||  ||  ||  ||  ||  ||
 +
|-
 +
! Total !! 33 !! 31 !! 9 !! 6 !! 5 !! 1 !! 1 !! 4
 +
|}
  
<math>S_{12\left(rare\right)}</math>  = number of shared OTUs where both of the communities are represented by less than or equal to 10 sequences.
 
  
<math>S_{12\left(abund\right)}</math> = number of shared OTUs where at least one of the communities is represented by more than 10 sequences.
+
Looking at the table and treating forest as X and pasture Y, we see that all of the shared OTUs are "rare" (i.e. abundances less than 10).  Let's start the calculations...
  
<math>S_{12\left(obs\right)}</math> = number of shared OTUs in A and B.
 
  
 +
<math>T_{10} = 1+3+2+1+1+5+1+1+1=16</math>
 +
 +
<math>T_{01} = 1+1+5+3+3+2+1+1+1=18</math>
 +
 +
<math>T_{11} = \left(1\right)\left(1\right)+\left(3\right)\left(1\right)+\left(2\right)\left(5\right)+\left(1\right)\left(3\right)+\left(1\right)\left(3\right)+\left(5\right)\left(2\right)+\left(1\right)\left(1\right)+\left(1\right)\left(1\right)+\left(1\right)\left(1\right)=33</math>
  
Calculation of <math>S_{A,B ACE}.</math> is considerably complicated to evaluate.  First, we determine that there are 23 rare shared OTUs and 37 abundant shared OTUs.  Next, considering only the rare OTUs, we calculate <math>C_{12}</math> as 0.845878.  We obtained the following T-values:
+
<math>T_{21} =1\left(1-1\right)1+3\left(3-1\right)1+2\left(2-1\right)5+1\left(1-1\right)3+1\left(1-1\right)3+5\left(5-1\right)2+1\left(1-1\right)1+1\left(1-1\right)1+1\left(1-1\right)1 = 56</math>
  
<math>T_{10} = 93</math>
+
<math>T_{12} =1\left(1-1\right)1+3\left(1-1\right)1+2\left(5-1\right)5+1\left(3-1\right)3+1\left(3-1\right)3+5\left(2-1\right)2+1\left(1-1\right)1+1\left(1-1\right)1+1\left(1-1\right)1 = 62</math>
  
<math>T_{01} = 64</math>
+
<math>T_{22} =1\left(1-1\right) 1\left(1-1\right)+3\left(3-1\right) 1\left(1-1\right)+2\left(2-1\right) 5\left(5-1\right)+1\left(1-1\right) 3\left(3-1\right)+1\left(1-1\right) 3\left(3-1\right)+5\left(5-1\right) 2\left(2-1\right)+1\left(1-1\right) 1\left(1-1\right)+1\left(1-1\right) 1\left(1-1\right)+1\left(1-1\right) 1\left(1-1\right)=80</math>
  
<math>T_{11} = 279</math>
+
<math>C_{12} = 1 - \frac {\left(1+1-1\right)+\left(0+3-0\right)+\left(0+0-0\right)+\left(3+0-0\right)+\left(3+0-0\right)+\left(0+0-0\right)+\left(1+1-1\right)+\left(1+1-1\right)+\left(1+1-1\right)} {33} = 0.606061</math>
  
<math>T_{21} = 1444</math>
 
  
<math>{T_{12}} = 988</math>
+
<math>{\Gamma}_1 = \frac{9 \left(56\right)}{0.606061 \left(16\right)33} - 1=0.575</math>
  
<math>T_{22} = 5440</math>
+
<math>{\Gamma}_2 = \frac{9 \left(62\right)}{0.606061 \left(18\right)33} - 1=0.550</math>
  
Next, calculation of the Γ-values requires knowing <math>f_{\left(rare \right)1+}, f_{\left(rare \right)+1} \mbox{ and } f_{\left(rare \right)11}</math>, which were 5, 8, and 2. Also, <math> n_{rare} \mbox{ and } m_{rare}</math>  were 185 and 167, respectively. Finally, calculation of the Γ-values gives <math>{\Gamma}_1=0.530409, {\Gamma}_2 = 0.523308 \mbox{ and } {\Gamma}_3 = 0.151840</math>.  This gives a <math>S_{A,B ACE}.</math> value of 72.3024 as seen below.
+
<math>{\Gamma}_3 = {\left[ \frac{9}{0.606061}\right ]^2}\frac{80}{16\left(18\right)33} - \frac{9\left(33\right)}{0.606061 \left(16\right)18}-0.575-0.550=-0.97031</math>
  
  
'''''File Samples on the Eckburg 70.stool_compare Dataset'''''
+
<math>S_{A,B ACE} = 0 + \frac {9}{0.606061} + \frac {1}{0.606061} \left [ 6\left(0.575\right)  + 5\left(0.550\right) + 4 \left(-0.97031\right)\right]=18.676</math>
  
*.shared
 
  
This file contains the frequency of sequences from each group found in each OTU. Each row consists of the distance being considered, group name, number of OTUS, and the abundance information separated by tabs. The abundance information is as follows. Each subsequent number represents a different OTU so that the number indicates the number of sequences in that group that clustered within that OTU. Note that OTU frequencies can only be compared within a distance definitionBelow is a link to the file used in the calculations.
+
Running...
 +
  mothur > summary.shared(calc=sharedace)
  
[[Media:/users/westcott/desktop/70.fn.shared]]
 
  
*.sharedAce
+
...and opening 98_lt_phylip_amazon.fn.shared.summary gives:
  
The first line contains the labels of all the columns. First sampled which shows the frequency of the <math>S_{A,B ACE}.</math> calculations. The frequency was set to 500, so after each 500 selected the <math>S_{A,B ACE}.</math> is calculated at each of the distances, with a calculation done after all are sampled. The following labels in the first line are the distances at which the calculations were made and the names of the groups compared. Each additional line starts with the number of sequences sampled followed by the <math>S_{A,B ACE}.</math> calculation at the column's distance. For instance, at distance 0.01, after 4392 samples <math>S_{A,B ACE}.</math> was 136.599.  
+
label comparison sharedace
 +
0.10 forest pasture 18.675936
  
sampled    0.01tissuestool  0.02tissuestool  0.03tissuestool  0.04tissuestool
+
These are the same values that we found above for a cutoff of 0.10.
1   0   0   0   0
+
500 44.2676 52.4249 43.9391 26.2499
+
1000 86.2691 53.7864 55.2556 60.1921
+
1500 114.238 106.452 45.6638 50.0418
+
2000 180.391 99.0382 57.2304 47.1769
+
2500 124.966 92.2403 48.1031 48.5068
+
3000 114.838 94.2194 56.2644 59.6396
+
3500 126.609 102.88 59.8571 71.1169
+
4000 134.213 98.837 56.6823 68.317
+
4392 136.599 86.5079 72.3024         62.117
+

Latest revision as of 13:29, 7 October 2011

The sharedace calculator returns the shared ACE richness estimate for an OTU definition. This calculator can be used in the summary.shared and collect.shared commands. The calculations for the shared ACE richness estimator are implemented as described by Chao in the user manual for her program SPADE.


<math>S_{A,B ACE} = S_{12 \left ( abund \right )} + \frac {S_{12 \left ( rare \right )}}{c_{12}} + \frac {1}{C_{12}} \left [ f_{\left ( rare \right )1+} {\Gamma}_1 + f_{\left ( rare \right )+1} {\Gamma}_2 + f_{11}{\Gamma}_3 \right ]</math>


where,

<math>C_{12} = 1 - \frac {\sum_{i=1}^{S_{12\left ( rare \right )}} {\left \{Y_i I \left ( X_i = 1 \right ) + X_iI \left ( Y_i = 1 \right ) - I \left ( X_i = Y_i = 1 \right ) \right \}}} {T_{11}}</math>


<math>{\Gamma}_1 = \frac{S_{12 \left (rare \right )} T_{21}}{C_{12} T_{10}T_{11}} - 1</math>

<math>{\Gamma}_2 = \frac{S_{12 \left (rare \right )} T_{12}}{C_{12} T_{01}T_{11}} - 1</math>

<math>{\Gamma}_3 = \left[ \frac{S_{12\left( rare \right)}}{C_{12}}\right ]^2 \frac{T_{22}}{T_{10}T_{01}T_{11}} - \frac{S_{12 \left( rare \right)}T_{11}}{C_{12}T_{01}T_{10}}-{\Gamma}_1-{\Gamma}2</math>


<math>T_{10} = \sum_{i=1}^{S_{12\left( rare \right)}} X_i </math> <math>T_{01} = \sum_{i=1}^{S_{12\left( rare \right)}} Y_i </math>
<math>T_{11} = \sum_{i=1}^{S_{12\left( rare \right)}} X_i Y_i </math> <math>T_{21} = \sum_{i=1}^{S_{12\left( rare \right)}} X_i \left( X_i - 1 \right) Y_i </math>
<math>T_{12} = \sum_{i=1}^{S_{12\left( rare \right)}} X_i \left( Y_i - 1 \right) Y_i </math> <math>T_{22} = \sum_{i=1}^{S_{12\left( rare \right)}} {X_i \left( X_i - 1 \right) Y_i \left( Y_i - 1 \right)} </math>

<math>f_{11}</math> = number of shared OTUs with one observed individual in A and B

<math>f_{\left(rare \right)1+}</math> = number of OTUs with one individual found in A and less than or equal to 10 in B.

<math>f_{\left(rare \right)+1}</math> = number of OTUs with one individual found in B and less than or equal to 10 in A.

<math>S_{12\left(rare\right)}</math> = number of shared OTUs where both of the communities are represented by less than or equal to 10 sequences.

<math>S_{12\left(abund\right)}</math> = number of shared OTUs where at least one of the communities is represented by more than 10 sequences.

<math>S_{12\left(obs\right)}</math> = number of shared OTUs in A and B.

<math>I\left(\right)</math> = evaluates to 1 if the contents are true and to 0 if they are false


Open the file 98_lt_phylip_amazon.fn.sabund generated using the Amazonian dataset with the following commands:

mothur > cluster(phylip=98_lt_phylip_amazon.dist, cutoff=0.10)
mothur > make.shared(list=98_lt_phylip_amazon.fn.list, group=amazon.groups, label=0.10)


The 98_lt_phylip_amazon.fn.shared file will contain the following two lines:

0.10	forest	55	1	1	1	1	1	1	3	3	2	2	1	1	3	2	1	1	1	1	2	1	1	2	5	1	1	1	1	2	1	1	1	1	1	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	
0.10	pasture	55	0	0	0	1	1	0	1	0	0	5	0	0	0	0	0	2	0	0	0	3	0	0	2	1	0	1	0	0	0	0	0	0	1	2	1	1	1	1	1	7	1	1	2	1	1	1	1	1	1	1	1	1	2	1	1	


This indicates that the label for the OTU definition was 0.10. The first line is from the forest sample and the second is from the pasture sample. There are a total of 55 OTUs between the two communities. Writing the data in a more presentable manner we see:


index forest pasture S12 f1+ f+1 f2+ f+2 f11
1 1 0
2 1 0
3 1 0
4 1 1 X X X X
5 1 0
6 1 0
7 3 1 X X
8 3 0
9 2 0
10 2 5 X X
11 1 0
12 1 0
13 3 0
14 2 0
15 1 0
16 1 3 X X
17 1 0
18 1 0
19 2 0
20 1 3 X X
21 1 0
22 2 0
23 5 2 X X
24 1 1 X X X X
25 1 0
26 1 1 X X X X
27 1 0
28 2 0
29 1 0
30 1 0
31 1 0
32 1 0
33 1 1 X X X X
34 0 2
35 0 1
36 0 1
37 0 1
38 0 1
39 0 1
40 0 7
41 0 1
42 0 1
43 0 2
44 0 1
45 0 1
46 0 1
47 0 1
48 0 1
49 0 1
50 0 1
51 0 1
52 0 1
53 0 2
54 0 1
55 0 1
Total 33 31 9 6 5 1 1 4


Looking at the table and treating forest as X and pasture Y, we see that all of the shared OTUs are "rare" (i.e. abundances less than 10). Let's start the calculations...


<math>T_{10} = 1+3+2+1+1+5+1+1+1=16</math>

<math>T_{01} = 1+1+5+3+3+2+1+1+1=18</math>

<math>T_{11} = \left(1\right)\left(1\right)+\left(3\right)\left(1\right)+\left(2\right)\left(5\right)+\left(1\right)\left(3\right)+\left(1\right)\left(3\right)+\left(5\right)\left(2\right)+\left(1\right)\left(1\right)+\left(1\right)\left(1\right)+\left(1\right)\left(1\right)=33</math>

<math>T_{21} =1\left(1-1\right)1+3\left(3-1\right)1+2\left(2-1\right)5+1\left(1-1\right)3+1\left(1-1\right)3+5\left(5-1\right)2+1\left(1-1\right)1+1\left(1-1\right)1+1\left(1-1\right)1 = 56</math>

<math>T_{12} =1\left(1-1\right)1+3\left(1-1\right)1+2\left(5-1\right)5+1\left(3-1\right)3+1\left(3-1\right)3+5\left(2-1\right)2+1\left(1-1\right)1+1\left(1-1\right)1+1\left(1-1\right)1 = 62</math>

<math>T_{22} =1\left(1-1\right) 1\left(1-1\right)+3\left(3-1\right) 1\left(1-1\right)+2\left(2-1\right) 5\left(5-1\right)+1\left(1-1\right) 3\left(3-1\right)+1\left(1-1\right) 3\left(3-1\right)+5\left(5-1\right) 2\left(2-1\right)+1\left(1-1\right) 1\left(1-1\right)+1\left(1-1\right) 1\left(1-1\right)+1\left(1-1\right) 1\left(1-1\right)=80</math>

<math>C_{12} = 1 - \frac {\left(1+1-1\right)+\left(0+3-0\right)+\left(0+0-0\right)+\left(3+0-0\right)+\left(3+0-0\right)+\left(0+0-0\right)+\left(1+1-1\right)+\left(1+1-1\right)+\left(1+1-1\right)} {33} = 0.606061</math>


<math>{\Gamma}_1 = \frac{9 \left(56\right)}{0.606061 \left(16\right)33} - 1=0.575</math>

<math>{\Gamma}_2 = \frac{9 \left(62\right)}{0.606061 \left(18\right)33} - 1=0.550</math>

<math>{\Gamma}_3 = {\left[ \frac{9}{0.606061}\right ]^2}\frac{80}{16\left(18\right)33} - \frac{9\left(33\right)}{0.606061 \left(16\right)18}-0.575-0.550=-0.97031</math>


<math>S_{A,B ACE} = 0 + \frac {9}{0.606061} + \frac {1}{0.606061} \left [ 6\left(0.575\right) + 5\left(0.550\right) + 4 \left(-0.97031\right)\right]=18.676</math>


Running...

mothur > summary.shared(calc=sharedace)


...and opening 98_lt_phylip_amazon.fn.shared.summary gives:

label	comparison		sharedace
0.10	forest	pasture		18.675936

These are the same values that we found above for a cutoff of 0.10.