I noticed that match.args is little bit problematic in estimateDiversity functions' input check. It subsets indices that are supported without giving any notification if user inputted unsupported indices along with supported ones. Also, name parameter gets index as default value and it is not updated after match.args call which leads to missmatch and uninformative error.
library(mia)
data(GlobalPatterns)
tse <- GlobalPatterns
index <- c("shannon", "test")
# Uninformative error
res <- estimateDiversity(tse, index = index)
# "shannon" passes through in match.args call. Now this works
index <- c("shannon", "test")
name <- c("shannon")
res <- estimateDiversity(tse, index = index, name = name)
-->
Fix input check for index parameter. Instead of using match.args, check that all the indices are supported ones.
Related to this PR https://github.com/microbiome/mia/pull/514
I noticed that
match.args
is little bit problematic inestimateDiversity
functions' input check. It subsets indices that are supported without giving any notification if user inputted unsupported indices along with supported ones. Also,name
parameter getsindex
as default value and it is not updated aftermatch.args
call which leads to missmatch and uninformative error.-->
Fix input check for
index
parameter. Instead of usingmatch.args
, check that all the indices are supported ones.