Using the provided script “calculate_diversity.R” I am unable to calculate Weighted and Unweighted Unifrac. I am using the following command:
Rscript calculate_diversity.R -f Metaphlan4/T2DM_Taxonomic_Profiles/merged_abundance_table.txt -t mpa_vJan21_CHOCOPhlAnSGB_202103.nwk -d beta -m weighted-unifrac
I get the following error:
Error in FUN(X[[i]], …) : attempt to set index 0/0 in SET_STRING_ELT
Calls: → lapply → FUN
In addition: Warning message:
In FUN(X[[i]], …) : NAs introduced by coercion
Execution halted
I was able to calculate bray curtis and jaccard no problem.
Any help is greatly appreciated. Many thanks