Hi all,
I found a bug in coocur when I wanted to adapt the code to phyloseq object. Here is a minimal example.
library(cooccur)
library(MiscMetabar)
# There is a bug when abundance dataset is given
mat_otu <- data.frame(unclass(data_fungi@otu_table)) %>%
mutate_if(is.numeric, as.integer)
res_cooccur_data_fungi <-
cooccur(t(mat_otu)[1:200, ], spp_names = TRUE, prob = "comb")
summary(res_cooccur_data_fungi)
The code is running but the summary gives the same number of positive and negative interactions (with 100% of non-random) and a negative value for Unclassifiable. When I convert the otu_table into a binary table (0/1; no abundance information), the bug disappears. How the cooccur package process the abundance data? I saw that both example datasets (beetles and finches) are binary matrix.
# For binary otu_table, it seems to works well
mat_otu_bin <- data.frame(unclass(as_binary_otu_table(data_fungi)@otu_table)) %>%
mutate_if(is.numeric, as.integer)
res_cooccur_data_fungi_bin <-
cooccur(t(mat_otu_bin)[1:200, ], spp_names = TRUE, prob = "comb")
summary(res_cooccur_data_fungi_bin)
Thanks in advance for your reply,
Adrien Taudière, maintainer of the MiscMetabar package
Hi all, I found a bug in coocur when I wanted to adapt the code to phyloseq object. Here is a minimal example.
The code is running but the summary gives the same number of positive and negative interactions (with 100% of non-random) and a negative value for Unclassifiable. When I convert the otu_table into a binary table (0/1; no abundance information), the bug disappears. How the cooccur package process the abundance data? I saw that both example datasets (beetles and finches) are binary matrix.
Thanks in advance for your reply, Adrien Taudière, maintainer of the MiscMetabar package