ChiLiubio / microeco

An R package for data analysis in microbial community ecology
GNU General Public License v3.0
202 stars 58 forks source link

Error in is.factor(text) : object 't1' not found in "plot_diff_abund"? #209

Closed marwa38 closed 1 year ago

marwa38 commented 1 year ago

I have more than one t objects for the trans_diff classes for different differential abundance methods. In each method I ran plot_diff_bar and plot_diff_abund and I get outputs successfully for both except for t52 I get the following error for plot_diff_abund although I got the plot_diff_bar output:

Error in is.factor(text) : object 't1' not found

image attached rds of t52 and the scripts kindly see below

t52 <- readRDS("Robjects/t52.rds")
t52 <- trans_diff$new(dataset = dataset.intes.nonPBNP, method = "ANCOMBC", group = "Regime", taxa_level = "Genus")
t52$plot_diff_bar()
ggsave("figures/ANCOMBC_intes.nonPBNP.tiff", width = 6, height = 3,
       units = "in", dpi = 300, compression = "lzw")
t52$plot_diff_abund(select_taxa = t52$plot_diff_bar_taxa)
ggsave("figures/ANCOMBC_intes.nonPBNP_RA.tiff", width = 6, height = 5,
       units = "in", dpi = 300, compression = "lzw")

Could you please let me know why I might be getting this? knowing that I restarted R and removed all the environment and read the rds again.

My understanding is that plot_diff_bar plot the significant taxa that are differentially abundant in different groups, whereas plot_diff_abund plot relative abundances of the significant taxa in one group beside other taxa from other groups ... please comment.

marwa38 commented 1 year ago

t52.zip

ChiLiubio commented 1 year ago

Sorry. It is a bug. I have updated the package in github again. Please reinstall it from github and try again. Remember to use method = "ancombc2" instead of method = "ANCOMBC". Please rerun the result starting with creating the trans_diff project. Thanks for your finding.

marwa38 commented 1 year ago

Thanks Chi for this. I removed the package using remove.packages() I am still getting an error if I used eitherinstall.packages()ordevtools::install_github("ChiLiubio/microeco")` image

ChiLiubio commented 1 year ago

Hi. What is your version of ANCOMBC package? It seems like no ancombc2 function is found in your ANCOMBC package. I am using version 2.0.2. If it is old, please update ANCOMBC package too.

marwa38 commented 1 year ago

yes, I was using R before version R4.2 and thus ancombc2 was an older version switched to the R4.2.2 and it is working fine. Thanks Marwa