Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aplantin/pldist
R package for paired and longitudinal ecological dissimilarities.
https://github.com/aplantin/pldist
Last synced: about 2 months ago
JSON representation
R package for paired and longitudinal ecological dissimilarities.
- Host: GitHub
- URL: https://github.com/aplantin/pldist
- Owner: aplantin
- License: other
- Created: 2018-08-25T01:08:41.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-02-23T19:17:09.000Z (almost 4 years ago)
- Last Synced: 2024-08-01T16:18:40.416Z (5 months ago)
- Language: R
- Size: 194 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rm-omics - **pldist** - Plantinga - [pldist: ecological dissimilarities for paired and longitudinal microbiome association analysis](https://doi.org/10.1093/bioinformatics/btz120) (Software packages and methods / Ecology Literature)
README
# pldist: Paired and Longitudinal Ecological Dissimilarities
**Author:** Anna Plantinga## Introduction
`pldist` allows distance-based analysis of paired and longitudinal microbiome data. In particular, the package supports both paired and longitudinal versions of unweighted UniFrac, generalized UniFrac, Bray-Curtis, Jaccard, Gower, and Kulczynski distances or dissimilarities. Functions implementing the transformations that underlie these distances are also provided so that transformed OTU data may be included in analyses beyond distance-based methods. The code can handle paired data, balanced longitudinal data, and unbalanced longitudinal data, although use for highly unbalanced designs is not recommended.
## Issues
If you encounter any bugs or have any specific feature requests, please [file an issue](https://github.com/aplantin/pldist/issues).
## Installation
You may install `pldist` from GitHub using the following code:
```{r install}
## install.packages("devtools") # run this line if devtools is not installed
devtools::install_github(repo = "aplantin/pldist")
```## Example
This example demonstrates usage of `pldist` in a simple setting with simulated data. For more examples and details, please see the [vignette](https://github.com/aplantin/pldist/blob/master/vignettes/introduction.Rmd).
```{r example}
library(pldist)
library(ape)
data(sim.tree)
data(paired.otus)
data(paired.meta)
data(bal.long.otus)
data(bal.long.meta)# Look at the OTU data:
# row names are sample IDs, column names are OTU IDs
paired.otus[1:4,1:4]# Look at the metadata:
# columns are subjID, sampID, time
# One row per sample
paired.meta[1:4, ]# Gower distance, paired quantitative transformation, with/without CLR
pldist(paired.otus, paired.meta, paired = TRUE, binary = FALSE, clr = FALSE, method = "gower")$D
pldist(paired.otus, paired.meta, paired = TRUE, binary = FALSE, clr = TRUE, method = "gower")$D# Gower distance, paired qualitative/binary transformation
pldist(paired.otus, paired.meta, paired = TRUE, binary = TRUE, method = "gower")$D# Gower distance, longitudinal quantitative transformation
pldist(bal.long.otus, bal.long.meta, paired = FALSE, binary = FALSE, method = "gower")$D# Gower distance, longitudinal qualitative/binary transformation
pldist(bal.long.otus, bal.long.meta, paired = FALSE, binary = TRUE, method = "gower")$D# Other distances
pldist(paired.otus, paired.meta, paired = TRUE, binary = FALSE, method = "bray")$D
pldist(paired.otus, paired.meta, paired = TRUE, binary = FALSE, method = "kulczynski")$D
pldist(paired.otus, paired.meta, paired = TRUE, binary = FALSE, method = "jaccard")$D# UniFrac also requires a phylogenetic tree and gamma values
# (Gamma controls weight placed on abundant lineages)
pldist(paired.otus, paired.meta, paired = TRUE, binary = FALSE,
method = "unifrac", tree = sim.tree, gam = c(0, 0.5, 1))$D
pldist(paired.otus, paired.meta, paired = TRUE, binary = FALSE, clr = TRUE,
method = "unifrac", tree = sim.tree, gam = c(0, 0.5, 1))$D
```