ECGen / ComGenR

Tools for community genetics analyses using R.
GNU General Public License v3.0
0 stars 0 forks source link

Genetic effect on co-occurrence patterns #25

Open MKLau opened 10 years ago

MKLau commented 10 years ago

0) needs replication at the tree scale 1) for each tree, build a vector of the number of n-wise co-occurrences 2) build a tree by co-occurrence pairs/groups matrix 3) test for genotypic effects using Bray-Curtis PerMANOVA

MKLau commented 10 years ago

This can be done by getting the co-occurrence matrix, which is a tree by unique, non-recursive species pairs matrix, and testing for the genetic effect using PerMANOVA.

MKLau commented 10 years ago

coMat = function(x){ y=list() k=0 for (i in 1:ncol(x)){ for (j in i:ncol(x)){ k=k+1 if (i!=j){ y[[k]]=sign(x[,i]+x[,j]) names(y)[k]=paste(colnames(x)[i],colnames(x)[j],sep='_') } } } y=do.call(cbind,y) return(y) }

MKLau commented 10 years ago

Results from Art's 2009 data

adonis(formula = com ~ g) Source Df SumsOfSqs MeanSqs F.Model R2 Pr(>F)
g 9 2.6272 0.29191 1.3968 0.2953 0.009 ** Residuals 30 6.2696 0.20899 0.7047
Total 39 8.8968 1.0000

adonis(formula = test ~ g) Source Df SumsOfSqs MeanSqs F.Model R2 Pr(>F)
g 9 1.8614 0.20682 1.2643 0.27499 0.028 * Residuals 30 4.9075 0.16359 0.72501
Total 39 6.7690 1.00000