This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Vegan beta diversity and permutation analysis

Hi,

I am trying to use vegan bioconductor package for beta diversity and permutation analysis for amplicon data but it is giving distance according to OTU instead of sample names, please help me with it.Is it also possible to give phyloseq object to vegan command instead of txt files?

#OTU count data file
> werra_sp <- read.table("convent.fert.root.count.txt",header=T,sep='\t',check.names=F,row.names=1)

#metadata data file
> werra_env <- read.table("werra.env.txt",header=T,sep='\t',check.names=F,row.names=1)
> str(werra_sp)
'data.frame':   1327 obs. of  18 variables:

 $ Root-19.S46.L001: int  44 0 52 16 13 0 0 32 7 0 ...

 $ Root-22.S56.L001: int  0 0 114 0 0 0 0 40 7 0 ...

 $ Root-24.S66.L001: int  43 0 484 24 0 6 0 17 0 0 ...

 $ Root-25.S76.L001: int  22 0 82 19 0 0 0 31 0 22 ...

 $ Root-26.S6.L001 : int  0 14 0 0 0 0 0 10 0 0 ...


> str(werra_env)

'data.frame':   18 obs. of  2 variables:

 $ Treatment: Factor w/ 1 level "convent.fert.": 1 1 1 1 1 1 1 1 1 1 ...

 $ Region   : Factor w/ 2 levels "Mymensingh","Rajshahi": 1 1 1 1 1 1 1 1 1 2

> dist_werra <- vegdist(werra_sp^0.25, method= 'bray')
> dis

> dist_werra
                                 270d52396ceaab2f1506f5a6c6100c10
d644684b08ae9b136307d9d2ce8975c0                       0.89217116

aed34f36d535976c247278bec289fd12                       0.36933629

731354d360c13253dfe2ad2d2b0cd971                       0.41469186

030329dbd6777daa2f0a75400b60b583                       0.59543568
vegan bioconductor r

It's spelled bioconductor, not biocunducter. Always prefer = TRUE and = FALSE instead of =T and =F. All it takes is one T=0 to break the script.

1 answer

Thanks, It is resolved, I just need to transpose the count data.

Log in to answer this question.