I tried to use calcaulate_diversity.R for alpha and beta diversity. I have some issue with command line from tutorials.
When I ran metaphlan4, I had only two txt files: 1) bowtie2.txt and 2) profile.txt.
In the tutorial, however, tsv file is used. My question is how I can produce tsv file from metaphlan run.
Another question is when I used profile.txt file for calculate_diversity.R, I got the following errors.
Warning: unable to access index for repository http://cran.us.r-project.org/src/contrib:
Line starting ' install.packages → available.packages → readRDS
In addition: Warning message:
package âoptparseâ is not available (for R version 3.5.1)
Execution halted
Would someone please let me know how to calculate alpha and beta diversity from output of metaphlan?
Regarding the first point, the metaphlan run produces a profile.txt file for each sample, you can then merge the single profiles with the script merge_metaphlan_tables.py (here the tutorial: MetaPhlAn 4 · biobakery/MetaPhlAn Wiki · GitHub) to obtain a .tsv table on which you can then calculate alpha and beta diveristy.
Regarding the error message from R, are you running the script calculate_diversity.R inside a conda environment with metaphlan4? (here the installation tutorial MetaPhlAn 4 · biobakery/MetaPhlAn Wiki · GitHub), like that you should already have the requirements installed.
Hello @ElisaPiperni,
I too am having trouble running alpha and beta diversity on my metaphlan output. Our group received an xlsx merged abundance table directly from the Huttenhower lab; I converted it to a tsv file in RStudio and tried running it through the calculate_diversity.R script in a conda environment using metaphlan4, but received this warning: “321 samples with 100% unknown species were removed from the input table” which is our total number of samples.
Is there further processing I should have performed on the file our group received? Should I have restricted the clade name column to species only?
Thank you for any help!
Lisa
Greetings @nadelher,
I apologize for the delay in my response. I never received any information from the help forum regarding my question, so I used a different method…I calculated beta diversity with the beta.div function in the rbiom package. For alpha diversity I used the alpha function in the microbiome package.
Hope this helps,
Lisa