Error "contrasts can be applied only to factors with 2 or more levels" while using generate_alpha_change_test_pair() #29
Labels
bug
Something isn't working
Not a Bug - Solution Provided
This behavior is intentional as part of our design. However, we've provided a solution to accommodat
Hello,
First of all, thank you for your work in MicrobiomeStat package. I have successfully created the MicrobiomeStat data object importing several .qza from QIIME2. While using generate_alpha_change_test_pair() , the following error occurs: Error in
contrasts<-
(*tmp*
, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels. As far as I know this is caused by the presence of a column containing only one value (hence generate_alpha_change_test_pair() cannot fit the data into a linear regression model)I have tried to troubleshoot the problem running : values_count <- sapply(lapply(data.obj, unique), length)
values_count to check for columns in my data object containing only 1 value but have not work so far.
This is the workflow I have used (I am afraid I cannot attach any .qza for you to reproduce the analysis, but If necessary I will be happy to provide it via email...)
Define paths to your QIIME2 files
otuqza_file <- "/path/merged-table.qza"
taxaqza_file <- "/path/taxonomy.qza"
sample_file <- "/path/metadata2.csv"
treeqza_file <- "/path/rooted-tree.qza"
Import QIIME2 data into a MicrobiomeStat data object
data.obj <- mStat_import_qiime2_as_data_obj(
otu_qza = otuqza_file,
taxa_qza = taxaqza_file,
sam_tab = sample_file,
tree_qza = treeqza_file
)
#Create alpha box plot
AlphaChangeTest <- generate_alpha_change_test_pair(
data.obj,
alpha.obj = NULL,
alpha.name = "shannon",
depth = NULL,
time.var = "time",
subject.var = "subject",
group.var = "group",
adj.vars = "Plastic.Type",
change.base ="1",
alpha.change.func = "log fold change"
)
Again, thank you very much for your work
The text was updated successfully, but these errors were encountered: