replicate alpha-rarefaction plots in R

Hi all. Does anyone have code for running rarefaction curves in R after you have downloaded the .csv file from

Hi @Heather_E,
Phyloseq in R does have its own rarefaction command (see this tutorial)
Here’s a good tutorial with vegan also.

Thanks for the response. I have looked at both of those tutorials, but neither tutorial calculates the rarefaction curves in the same manner as Qiime. The phyloseq one showed how to calculate individual samples, and the vegan one calculates on a total OTU basis, but I really like how Qiime is calculating rarefaction on an average per sample basis. That rarefaction takes more calculations than the tutorials are showing. Alternatively, If I could figure out how import the Qiime data directly into a plot function, that would work, too,

Hi @Heather_E,
Thanks for the clarification!
Unfortunately I personally don’t have a custom code that replicates the QIIME 2 plots in R, I just use the QIIME 2 ones, speaking of which, why not just use the QIIME 2 plots? :slight_smile:

There is a csv button at the top of the q2 visualization plot that lets you download the values used to create the plot, perhaps this might help with your custom plotting?

1 Like

Yes, that is exactly what I would like to do - import the values I download from the Qiime .csv file and then plot in R. I tried in excel but the curves look fairly choppy. The Qiime plot isn’t downloadable itself, you can only take a screenshot which is not exactly publication quality. I am a novice to R and not familiar enough with the plotting functions to get the Qiime file to plot nicely in R. I was hoping someone had done this before and could share their code…

Hi @Heather_E,
Actually turns out this question was very recently answer elsewhere on the forum. There is an example code from @timanix using Python to recreate the plot from the .csv file. Hope that helps out!

Yes! That is perfect, thank you.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.