Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alpha-diversity assessed by richness (Chao1, ACE) #329

Open
biosciences opened this issue Dec 29, 2021 · 2 comments
Open

Alpha-diversity assessed by richness (Chao1, ACE) #329

biosciences opened this issue Dec 29, 2021 · 2 comments

Comments

@biosciences
Copy link

I can see you have done alpha-diversity assessment by using Inverse Simpson index, how could I assess the alpha-diversity by richness using Chao1 and ACE?

@zachary-foster
Copy link
Contributor

You can use other functions in vegan for that. The only challenge is finding the right on and converting the formatting between what the two packages expect. Here is an example using the tutorial data at https://grunwaldlab.github.io/metacoder_documentation/workshop--07--diversity_stats.html:

library(vegan)
#> Loading required package: permute
#> Loading required package: lattice
#> This is vegan 2.5-7
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
load("~/Desktop/clean_data.Rdata")

abund_mat <- obj$data$otu_rarefied[, sample_data$SampleID]
alpha_data <- t(estimateR(t(abund_mat))) # needs to be transposed with t because vegan expects columns to be taxa and then transposed back
sample_data <- bind_cols(sample_data, as.data.frame(alpha_data))

hist(sample_data$S.ACE)

hist(sample_data$S.chao1)

Created on 2022-01-05 by the reprex package (v2.0.1)

Does that make sense?

@biosciences
Copy link
Author

That made sense. Thank you for the suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants