[adegenet-forum] DAPC microbiome data

Steffen Jørgensen stakkelsdreng at gmail.com
Tue Jan 3 15:39:39 CET 2017


Hi

So ive tried to search through the old posts in the forum to find 
answers to my problem. I am quite new in R, and I am not sure how to 
approach this.

Im working on 16s sequence data. Im looking into the possibles changes 
in the gut microbiome with 3 different treatments. So id like to do a 
DAPC on my data, which ive seen in several  papers, in order to see if 
there are any positive, negative correlation between any of the OTUs and 
how much impact these might have on the composition of the microbiome.

Ive extracted my OTU read frequencies, here in percent, in this small 
test sheet.

My problem is, the previous DAPC ive made have been on binary 1/0 data, 
while in this case, the data is numeric.

I have my data with sample names and OTUs, and i define the groups 
myself and feed the dapc with this. However, im not sure if im doing 
this the right way at all.


Id really apprichiateif anyone have any thoughts, tutorials, scripts or 
link to other forums, which could help me.


Many thanks Steffen


### ive added my code here, with some few notes in

 > data <- .....data.csv

 > data1<-as.data.frame(data)

 > row.names(data1)<-data$OTU

 > data2<-data1[,-1]

 > data2
            control1     control2     control3     control4 control5     
treat1.1     treat1.2     treat1.3     treat1.4 treat1.5
OTU1    0.970819772  0.539721819  3.417332782  0.830027744 1.205602589  
0.023624150  0.024030374  0.052820063  0.125134387 0.063626931
OTU2    0.000000000  0.001066644  0.006534097  0.001146447 0.002826735  
0.000000000  0.000000000  0.000000000  0.000881228 0.000000000
OTU3   12.873793430  8.137426402  3.530590465  4.747437691 12.686387860  
0.048275437  0.036846574  0.017958821  0.014099649 0.021535269
OTU4    0.037553200  0.015999659  0.023958356  0.040125651 0.038160926  
0.031841246  0.096121498  0.021128025  0.017624562 0.037197283
OTU5   11.617847510  4.246309412 42.157994470 12.318574740 13.695532340  
0.632716366  0.885919803  0.849346616  2.390771780 1.175629907
OTU6    0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU7    0.002781719  0.000000000  0.002178032  0.001146447 0.001413368  
0.000000000  0.000000000  0.000000000  0.000000000 0.001957752
OTU8    0.326851929  0.219728646  0.076231133  0.259097058 1.102426752  
0.003081411  0.001602025  0.002112803  0.005287368 0.004894379
OTU9    0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000881228 0.000000000
OTU10   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU11   2.218420540  0.217595358  0.008712129  3.276545984 0.643082272  
0.004108548  1.799074030  0.005282006  0.000000000 0.069500186
OTU12   0.000000000  0.001066644  0.008712129  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.003524912 0.000000000
OTU13   0.000000000  0.001066644  0.000000000  0.002292894 0.000000000  
0.001027137  0.000000000  0.000000000  0.002643684 0.000000000
OTU14   0.006954296  0.002133288  0.000000000  0.002292894 0.004240103  
0.001027137  0.001602025  0.000000000  0.001762456 0.000978876
OTU15   0.000000000  0.001066644  0.000000000  0.003439341 0.002826735  
0.000000000  0.000000000  0.000000000  0.000881228 0.000000000
OTU16   0.001390859  0.002133288  0.000000000  0.000000000 0.001413368  
0.000000000  0.000000000  0.000000000  0.026436842 0.000000000
OTU17   0.000000000  0.001066644  0.000000000  0.000000000 0.001413368  
0.002054274  0.000000000  0.002112803  0.007931053 0.015662014
OTU18   1.799771899  0.070398498  0.023958356  0.003439341 0.008480206  
0.009244233  0.003204050  0.004225605  0.003524912 0.009788759
OTU19   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.018505790 0.001957752
OTU20   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.001056401  0.000000000 0.000978876
OTU21   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU22   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU23   0.009736015  0.004266576  0.010890162  0.010318024 0.019787147  
0.006162822  0.001602025  0.003169204  0.022030702 0.004894379
OTU24   0.000000000  0.000000000  0.000000000  0.000000000 0.001413368  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU25   0.019472030  0.009599795  0.000000000  0.021782496 0.019787147  
0.009244233  0.004806075  0.001056401  0.006168597 0.017619765
OTU26   0.019472030  0.002133288  0.004356065  0.002292894 0.007066838  
0.006162822  0.003204050  0.002112803  0.002643684 0.011746510
OTU27   0.015299452  0.006399863  0.000000000  0.021782496 0.005653471  
0.003081411  0.008010125  0.000000000  0.004406140 0.006852131
OTU28   0.005563437  0.001066644  0.000000000  0.005732236 0.000000000  
0.001027137  0.000000000  0.000000000  0.000000000 0.000978876
OTU29   0.000000000  0.001066644  0.002178032  0.003439341 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU30   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU31   0.000000000  0.000000000  0.000000000  0.000000000 0.004240103  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU32   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU33   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000978876
OTU34   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU35   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU36   0.000000000  0.000000000  0.002178032  0.000000000 0.002826735  
0.002054274  0.000000000  0.000000000  0.000000000 0.000000000
OTU37   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU38   0.000000000  0.000000000  0.002178032  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000881228 0.000978876
OTU39   0.004172578  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU40   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU41   0.001390859  0.005333220  0.000000000  0.001146447 0.014133676  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU42   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU43   0.000000000  0.001066644  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000881228 0.000000000
OTU44   0.026426326  0.018132946  0.008712129  0.063054594 0.107415940  
0.005135685  0.003204050  0.001056401  0.007049825 0.021535269
OTU45   0.001390859  0.000000000  0.000000000  0.000000000 0.004240103  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU46   0.005563437  0.000000000  0.006534097  0.000000000 0.009893573  
0.005135685  0.001602025  0.006338408  0.005287368 0.013704262
OTU47   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU48   0.011126874  0.011733083  0.008712129  0.022928943 0.018373779  
0.004108548  0.003204050  0.003169204  0.002643684 0.008809883
OTU49   0.015299452  0.006399863  0.002178032  0.006878683 0.007066838  
0.002054274  0.000000000  0.001056401  0.003524912 0.008809883
OTU50   0.002781719  0.003199932  0.002178032  0.000000000 0.001413368  
0.000000000  0.000000000  0.000000000  0.000881228 0.000000000
            treat2.1     treat2.2     treat2.3     treat2.4 treat2.5     
treat3.1     treat3.2     treat3.3     treat3.4 treat3.5
OTU1    0.071290944  0.025272583  0.028065955  0.177536027 0.028360174  
0.073765453  0.059841719  0.052010194  0.073526837 0.082378786
OTU2    0.005780347  0.000000000  0.002004711  0.000000000 0.000000000  
0.016392323  0.043385246  0.010402039  0.029760863 0.007845599
OTU3    1.013487476  0.624593833  0.503182479  0.370181502 0.217765623  
2.685608906 12.695420610  7.049114960  5.423479570 1.766567289
OTU4    0.023121387  0.060172816  0.108254398  3.562052619 0.040514535  
0.310088109  0.124171566  0.024271424  0.642484507 1.442282546
OTU5    1.192678227  0.645052591  0.766801985 10.990235520 0.463891421  
1.784031145  2.523824484  1.035002861  3.184412310 3.427218997
OTU6    0.000000000  0.000000000  0.001002356  0.039662304 0.000000000  
0.009562188  0.000000000  0.000000000  0.000000000 0.000000000
OTU7    0.000000000  0.002406913  0.017040044  0.109543506 0.001012863  
0.010928215  0.005984172  0.000000000  0.183817093 0.011768398
OTU8    0.017341040  0.004813825  0.049115421  0.084990651 0.005064317  
0.017758350  0.038897117  0.069346925  0.154056231 0.075840787
OTU9    0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
1.055938802  0.000000000  0.001733673  0.000000000 0.000000000
OTU10   0.000000000  0.000000000  0.000000000  0.000000000 0.003038590  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU11   0.021194605  0.150432041  1.186788954  4.381740231 5.629494581  
0.040980807  0.031416902  0.504498882  0.073526837 0.179141168
OTU12   0.000000000  0.000000000  0.006014133  0.003777362 0.000000000  
0.010928215  0.002992086  0.000000000  0.001750639 0.023536796
OTU13   0.000000000  0.000000000  0.001002356  0.000000000 0.000000000  
0.025954511  0.002992086  0.008668366  0.000000000 0.000000000
OTU14   0.003853565  0.045731340  0.025058888  0.092545376 0.011141497  
0.008196161  0.000000000  0.003467346  0.017506390 0.111145980
OTU15   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.024588484  0.001496043  0.000000000  0.001750639 0.000000000
OTU16   0.000000000  0.000000000  0.000000000  0.018886811 0.000000000  
0.016392323  0.011968344  0.001733673  0.008753195 0.000000000
OTU17   0.001926782  0.001203456  0.000000000  0.000000000 0.000000000  
0.006830135  0.001496043  0.000000000  0.003501278 0.000000000
OTU18   0.001926782  0.007220738  0.085200221  0.000000000 0.006077180  
0.570999249  0.372514699  1.991990430  0.390392493 0.847324651
OTU19   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.004098081  0.000000000  0.001733673  0.001750639 0.000000000
OTU20   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.001366027  0.002992086  0.000000000  0.000000000 0.000000000
OTU21   0.000000000  0.001203456  0.000000000  0.069881202 0.000000000  
0.002732054  0.000000000  0.000000000  0.008753195 0.000000000
OTU22   0.000000000  0.000000000  0.000000000  0.001888681 0.001012863  
0.000000000  0.001496043  0.000000000  0.000000000 0.000000000
OTU23   0.125240848  0.028882952  0.040094221  0.649706310 0.013167224  
0.215832252  0.127163652  0.039874482  0.236336263 0.171295570
OTU24   0.000000000  0.003610369  0.006014133  0.016998130 0.001012863  
0.013660269  0.020944602  0.000000000  0.028010224 0.096762383
OTU25   0.040462428  0.423616627  0.292687816  0.759249816 0.031398764  
0.143432826  0.010472301  0.013869385  0.180315815 1.159840996
OTU26   0.001926782  0.002406913  0.000000000  0.001888681 0.014180087  
0.057373130  0.016456473  0.022537751  0.012254473 0.045765992
OTU27   0.036608863  0.197366838  0.153360397  0.421175893 0.015192950  
0.058739157  0.001496043  0.003467346  0.084030671 0.478581516
OTU28   0.000000000  0.002406913  0.000000000  0.003777362 0.003038590  
0.023222457  0.005984172  0.000000000  0.014005112 0.009153198
OTU29   0.000000000  0.000000000  0.000000000  0.000000000 0.002025727  
0.006830135  0.046377332  0.001733673  0.000000000 0.000000000
OTU30   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.002992086  0.000000000  0.000000000 0.000000000
OTU31   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU32   0.000000000  0.000000000  0.000000000  0.015109449 0.000000000  
0.000000000  0.001496043  0.000000000  0.000000000 0.000000000
OTU33   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.084993985
OTU34   0.000000000  0.001203456  0.006014133  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.008753195 0.000000000
OTU35   0.000000000  0.000000000  0.000000000  0.009443406 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU36   0.000000000  0.000000000  0.016037689  0.000000000 0.001012863  
0.020490404  0.002992086  0.000000000  0.003501278 0.000000000
OTU37   0.000000000  0.000000000  0.000000000  0.001888681 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU38   0.001926782  0.002406913  0.000000000  0.226641736 0.001012863  
0.001366027  0.000000000  0.001733673  0.015755751 0.062764789
OTU39   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.001733673  0.000000000 0.000000000
OTU40   0.000000000  0.000000000  0.000000000  0.000000000 0.002025727  
0.000000000  0.000000000  0.000000000  0.014005112 0.000000000
OTU41   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU42   0.000000000  0.001203456  0.000000000  0.137873723 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.000000000
OTU43   0.000000000  0.000000000  0.001002356  0.353183372 0.000000000  
0.013660269  0.019448559  0.001733673  0.001750639 0.018306397
OTU44   0.055876686  0.363443811  0.363855059  0.846129148 0.018231541  
0.105184072  0.001496043  0.013869385  0.176814537 0.929703436
OTU45   0.000000000  0.000000000  0.001002356  0.092545376 0.005064317  
0.015026296  0.004488129  0.001733673  0.008753195 0.015691197
OTU46   0.001926782  0.000000000  0.002004711  0.003777362 0.000000000  
0.079229561  0.026928773  0.000000000  0.035012780 0.011768398
OTU47   0.003853565  0.000000000  0.000000000  0.013220768 0.000000000  
0.000000000  0.000000000  0.000000000  0.000000000 0.002615200
OTU48   0.003853565  0.016848389  0.003007067  0.000000000 0.001012863  
0.140700772  0.083778406  0.015603058  0.108539617 0.023536796
OTU49   0.003853565  0.021662214  0.003007067  0.000000000 0.001012863  
0.045078888  0.008976258  0.003467346  0.028010224 0.011768398
OTU50   0.000000000  0.000000000  0.000000000  0.000000000 0.000000000  
0.021856431  0.019448559  0.005201019  0.022758307 0.099377583
  [ reached getOption("max.print") -- omitted 213 rows ]


 > groups<- c(rep("control", 5), rep("treat1", 5), rep("treat2", 5), 
rep("treat3", 5))            ##so here i define my own groups which id 
like the DAPC to be base the analysis on - im sure if i can do this?

 > data.frame(names(data2), groups)
    names.data2.  groups
1      control1 control
2      control2 control
3      control3 control
4      control4 control
5      control5 control
6      treat1.1  treat1
7      treat1.2  treat1
8      treat1.3  treat1
9      treat1.4  treat1
10     treat1.5  treat1
11     treat2.1  treat2
12     treat2.2  treat2
13     treat2.3  treat2
14     treat2.4  treat2
15     treat2.5  treat2
16     treat3.1  treat3
17     treat3.2  treat3
18     treat3.3  treat3
19     treat3.4  treat3
20     treat3.5  treat3
 > otu <- as.data.frame(t(data2))

 > treattype <- factor(groups)


 > dapc1 <- dapc(otu, treattype)                                         
     ## so im not sure if its dapc() or dapc.matrix(), furthermore i not 
sure if i fed the command right?!



-------------- next part --------------
A non-text attachment was scrubbed...
Name: data.csv
Type: text/csv
Size: 35006 bytes
Desc: not available
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20170103/ce977dee/attachment-0001.csv>


More information about the adegenet-forum mailing list