R: Generalized UniFrac distance for comparing microbial...
GUniFrac-package
R Documentation
Generalized UniFrac distance for comparing microbial communities.
Description
A generalized version of commonly used UniFrac distance. Generalized UniFrac
distance contains an extra parameter controlling the weight on abundant
lineages so the distance is not dominated by highly abundant lineages. The
unweighted and weighted UniFrac, and variance adjusted weighted UniFrac distances
are also implemented. The package also implements a permutation-based multivariate
analysis of variance using MULTIPLE distance matrices.
Details
Package:
GUniFrac
Type:
Package
Version:
1.0
Date:
2012-04-27
License:
GPL-2
LazyLoad:
yes
Author(s)
Jun Chen <chenjun@mail.med.upenn.edu>
References
Jun Chen and Hongzhe Li(2012). Associating microbiome composition with
environmental covariates using generalized UniFrac distances. (Submitted)
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(GUniFrac)
Loading required package: vegan
Loading required package: permute
Loading required package: lattice
This is vegan 2.4-0
Loading required package: ape
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/GUniFrac/GUniFrac-package.Rd_%03d_medium.png", width=480, height=480)
> ### Name: GUniFrac-package
> ### Title: Generalized UniFrac distance for comparing microbial
> ### communities.
> ### Aliases: GUniFrac-package
> ### Keywords: package distance ecology htest multivariate regression
> ### nonparametric
>
> ### ** Examples
>
> data(throat.otu.tab)
> data(throat.tree)
> data(throat.meta)
>
> groups <- throat.meta$SmokingStatus
>
> # Rarefaction
> otu.tab.rff <- Rarefy(throat.otu.tab)$otu.tab.rff
>
> # Calculate the UniFracs
> unifracs <- GUniFrac(otu.tab.rff, throat.tree, alpha=c(0, 0.5, 1))$unifracs
>
> dw <- unifracs[, , "d_1"] # Weighted UniFrac
> du <- unifracs[, , "d_UW"] # Unweighted UniFrac
> dv <- unifracs[, , "d_VAW"] # Variance adjusted weighted UniFrac
> d0 <- unifracs[, , "d_0"] # GUniFrac with alpha 0
> d5 <- unifracs[, , "d_0.5"] # GUniFrac with alpha 0.5
>
> # Permanova - Distance based multivariate analysis of variance
> adonis(as.dist(d5) ~ groups)
Call:
adonis(formula = as.dist(d5) ~ groups)
Permutation: free
Number of permutations: 999
Terms added sequentially (first to last)
Df SumsOfSqs MeanSqs F.Model R2 Pr(>F)
groups 1 0.3503 0.35035 2.4973 0.04128 0.003 **
Residuals 58 8.1368 0.14029 0.95872
Total 59 8.4871 1.00000
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
> # Combine d(0), d(0.5), d(1) for testing
> PermanovaG(unifracs[, , c("d_0", "d_0.5", "d_1")] ~ groups)
$aov.tab
F.Model p.value
groups 3.218223 0.006
>
>
>
>
>
> dev.off()
null device
1
>