Type: | Package |
Title: | Covariate Adjusted PCoA Plot |
Version: | 1.3 |
Date: | 2021-12-12 |
Author: | Yushu Shi |
Maintainer: | Yushu Shi <shiyushu2006@gmail.com> |
Description: | In fields such as ecology, microbiology, and genomics, non-Euclidean distances are widely applied to describe pairwise dissimilarity between samples. Given these pairwise distances, principal coordinates analysis (PCoA) is commonly used to construct a visualization of the data. However, confounding covariates can make patterns related to the scientific question of interest difficult to observe. We provide 'aPCoA' as an easy-to-use tool to improve data visualization in this context, enabling enhanced presentation of the effects of interest. Details are described in Yushu Shi, Liangliang Zhang, Kim-Anh Do, Christine Peterson and Robert Jenq (2020) Bioinformatics, Volume 36, Issue 13, 4099-4101. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Depends: | R (≥ 3.5.0) |
Imports: | vegan, randomcoloR, ape, car, cluster |
NeedsCompilation: | no |
Repository: | CRAN |
Packaged: | 2021-12-12 20:47:35 UTC; ys8wp |
Date/Publication: | 2021-12-13 08:10:02 UTC |
Tasmania Dataset
Description
A classic dataset used in the R package mvabund. This is a study on the effects of disturbance from a soldier crab on 56 species of meiobenthos, which are small invertebrates. Eight of the sixteen observations in the data set correspond to crab disturbances. Besides the crab disturbance, there are also four different locations in the study design, where observations from each location are comprised of two disturbed and two undisturbed ones.
Usage
data(Tasmania)
Format
- abund
The counts of 56 Meibenthos species.
- treatment
This observation has been disturbed by a crab or not.
- block
The location indicator of the observation.
References
Wang, Y., Naumann, U., Wright, S.T. and Warton, D.I. (2012), mvabund - an R package for model-based analysis of multivariate abundance data. Methods in Ecology and Evolution, 3: 471-474. doi:10.1111/j.2041-210X.2012.00190.x
Warwick, R. M., Clarke, K. R. and Gee, J. M. (1990). The effect of disturbance by soldier crabs Mictyris platycheles H. Milne Edwards on meiobenthic communiy structure. J. Exp. Mar. Biol. Ecol., 135, 19-33.
Examples
data("Tasmania")
Covariate Adjusted PCoA Plot
Description
Adjusted confounding covariates to show the effect of the primary covariate in a PCoA plot. This method is designed for non-Euclidean distance. This function will plot the original PCoA plot along with the covariate adjusted PCoA plot.
Usage
aPCoA(formula,data,maincov,drawEllipse=TRUE,drawCenter=TRUE,
pch=19,cex=2,lwd=3,col=NULL,...)
Arguments
formula |
A typical formula such as Y~ A, but here Y is a dissimilarity distance. The formula has the same requirements as in adonis function of the vegan package. |
data |
A dataset with the rownames the same as the rownames in distance. This dataset should include both the confounding covariate and the primary covariate. |
maincov |
the covariate of interest in the dataset, must be a factor |
drawEllipse |
Do you want to draw the 95% confidence elipse for each cluster? |
drawCenter |
Do you want to show the connection between cluster center (medoid) and cluster members? |
pch |
Point shapes |
cex |
Number indicating the amount by which plotting text and symbols should be scaled relative to the default. |
lwd |
Line width of the ellipses |
col |
Color for plot. If not provided by user, will use default distinct colors |
... |
Arguments passed to 'dataEllipse'. |
Value
Two PCoA plots. One is the original one, while the other is the PCoA plot after adjusting for the confounding covariate.
plotMatrix |
The matrix for plotting the adjusted PCoA plot. |
References
Yushu Shi, Liangliang Zhang, Kim-Anh Do, Christine Peterson and Robert Jenq. (2020) aPCoA: Covariate Adjusted Principal Coordinates Analysis <arXiv:2003.09544>
Examples
library(vegan)
library(aPCoA)
data("Tasmania")
data<-data.frame(treatment=Tasmania$treatment,block=Tasmania$block)
bray<-vegdist(Tasmania$abund, method="bray")
rownames(data)<-rownames(as.matrix(bray))
opar<-par(mfrow=c(1,2),
mar=c(3.1, 3.1, 3.1, 5.1),
mgp=c(2, 0.5, 0),
oma=c(0, 0, 0, 4))
result<-aPCoA(bray~block,data,treatment)
par(opar)