Skip to content

Commit

Permalink
html page update
Browse files Browse the repository at this point in the history
  • Loading branch information
antagomir committed Jul 19, 2020
2 parents a07857d + 53eba0b commit 89aac92
Show file tree
Hide file tree
Showing 34 changed files with 2,982 additions and 8,202 deletions.
1,895 changes: 149 additions & 1,746 deletions Betadiversity.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Bimodality.html

Large diffs are not rendered by default.

85 changes: 85 additions & 0 deletions CoAbundantTaxa.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
title: "Identify Co-abundant taxa groups"
author: "Leo Lahti, Sudarshan Shetty et al."
bibliography:
- bibliography.bib
output:
BiocStyle::html_document:
number_sections: no
toc: yes
toc_depth: 4
toc_float: true
self_contained: true
thumbnails: true
lightbox: true
gallery: true
use_bookdown: false
highlight: haddock
---
<!--
%\VignetteIndexEntry{microbiome tutorial}
%\VignetteEngine{knitr::rmarkdown}
%\usepackage[utf8]{inputenc}
%\VignetteEncoding{UTF-8}
-->

**Co-abundant groups of taxa**

Get data
```{r cag-1}
library(microbiome)
pseq <- atlas1006
pseq.rel <- microbiome::transform(pseq, "compositional")
```

Identify co-abundant taxa.
```{r cag-2}
# get median abundances
median_abund = apply(abundances(pseq.rel), MARGIN = 1, FUN = median)
# select taxa with median abundance of more than or equal to 0.01
abundant_taxa = abundances(pseq)[median_abund >= 0.01, ]
# check how many taxa
nrow(abundant_taxa)
# check which taxa
rownames(abundant_taxa)
```


Use Spearman's correlation to identify which of the co-abundant groups show correlation.
```{r cag-1b}
# cor() is from `stats` package
spearman_matrix = cor(t(abundant_taxa), method = "spearman")
# hclust() is from `stats` package
spearman_tree = hclust(dist(spearman_matrix), method = "ward")
plot(spearman_tree)
```

Using the `heat` function in `microbiome pkg` now compare the correlation with the tree above.
```{r plot-heat}
spearman_long_df <- reshape2::melt(spearman_matrix)
head(spearman_long_df)
heat(spearman_long_df, "Var1","Var2",
order.rows = TRUE, order.cols = TRUE) +
theme_bw() + theme(axis.text.x = element_text(angle = 90))
```

Validation of CAGs
```{r}
# Validation of CAGs
# Randomly split the dataset, compute a correlation matrix and run a Mantel test
subsample = sample(c(1:300), size = 220, replace = F)
train_data = abundant_taxa[,subsample]
test_data = abundant_taxa[,-subsample]
train_spearman = cor(t(train_data), method = "spearman")
test_spearman = cor(t(test_data), method = "spearman")
vegan::mantel(as.dist(train_spearman), as.dist(test_spearman), permutations=999)
```

Further reading:

[de la Cuesta-Zuluaga, J., Corrales-Agudelo, V., Velásquez-Mejía, E.P. et al. Gut microbiota is associated with obesity and cardiometabolic disease in a population in the midst of Westernization. Sci Rep 8, 11356 (2018).](https://doi.org/10.1038/s41598-018-29687-x)

[Claesson, M., Jeffery, I., Conde, S. et al. Gut microbiota composition correlates with diet and health in the elderly. Nature 488, 178–184 (2012).](https://doi.org/10.1038/nature11319)
501 changes: 501 additions & 0 deletions CoAbundantTaxa.html

Large diffs are not rendered by default.

0 comments on commit 89aac92

Please sign in to comment.