microeco icon indicating copy to clipboard operation
microeco copied to clipboard

ancombc2 problems with taxa´s ?

Open Christian-Benjamin opened this issue 2 years ago • 11 comments

Dear everybody, I have an issue with the new updated ancombc2 integrated into microeco. the ancombc2 package version is 2.2.1 and microeco 0.20.0 R and Rstudio is fully updated running 4.3.

The issue arises when i have to perform the ancombc2 analysis on genus level. It does work and other taxonomical classes, like phylum forinstance. Here is the code and the output error:

t1_ancombc_meco_Physeq_PC_2019_ITS_September<- trans_diff$new(dataset = meco_Physeq_PC_2019_ITS_September, method = "ancombc2", group = "Treatment", taxa_level = "Genus", filter_thres = 0.1) No taxa_abund found. First calculate it with cal_abund function ... The result is stored in object$taxa_abund ... Total 1 paired groups for test ... Run 1 : Control - P. oligandrum ... Error in { : task 1 failed - "Zero variances have been detected for the following taxa: k__Fungi|p__Basidiomycota|c__Agaricomycetes|o__Agaricales|f__Psathyrellaceae|g__Coprinellus, k__Fungi|p__Ascomycota|c__Sordariomycetes|o__Sordariales|f__Lasiosphaeriaceae|g__Apiosordaria, k__Fungi|p__Ascomycota|c__Eurotiomycetes|o__Onygenales|f__Arthrodermataceae|g__Arthroderma, k__Fungi|p__Ascomycota|c__Leotiomycetes|o__Thelebolales|f__Pseudeurotiaceae|g__Pseudogymnoascus, k__Fungi|p__Ascomycota|c__Leotiomycetes|o__Helotiales|f__Sclerotiniaceae|g__Clarireedia, k__Fungi|p__Ascomycota|c__Sordariomycetes|o__Coniochaetales|f__Coniochaetaceae|g__Coniochaeta, k__Fungi|p__Ascomycota|c__Dothideomycetes|o__Pleosporales|f__Phaeosphaeriaceae|g__Pseudoophiobolus, k__Fungi|p__Basidiomycota|c__Agaricomycetes|o__Agaricales|f__Psathyrellaceae|g__Psathyrella, k__Fungi|p__Chytridiomycota|c__Spizellomycetes|o__Spizellomycetales|f__Spizellomycetaceae|g__, k__Fungi|p__Ascomycota|c__Pezizomycetes|o__Pezizales|f__Ascobolacea In addition: There were 50 or more warnings (use warnings() to see the first 50)

How should i proceed?

Christian-Benjamin avatar Aug 06 '23 16:08 Christian-Benjamin

Hi. Could you attach your meco_Physeq_PC_2019_ITS_September so that I can reproduce your issue? To save your dataset, please follow the steps in the tutorial (https://chiliubio.github.io/microeco_tutorial/notes.html#save-function) and attach the compressed object.

ChiLiubio avatar Aug 07 '23 03:08 ChiLiubio

Hi. I run the following steps sucessfully in a new created project with microeco v0.20.0 and ANCOMBC v2.2.0. The results show only "g__Mortierella" is remained in the test.

library(microeco)
load("meco_Physeq_PC_2019_ITS_September.RData")
t1_ancombc_meco_Physeq_PC_2019_ITS_September<- trans_diff$new(dataset = meco_Physeq_PC_2019_ITS_September, method = "ancombc2", group = "Treatment", taxa_level = "Genus", filter_thres = 0.1)

ChiLiubio avatar Aug 07 '23 14:08 ChiLiubio

Hej Chi! All right, seems to be a problem with a package, related to the version and packages loaded perhaps ? Since i fail to generate any trans_diff genera´? Thanks for looking into it so fast!

Christian-Benjamin avatar Aug 07 '23 14:08 Christian-Benjamin

Hi. I have updated the microeco package in github. Please reinstall the new microeco version from github and try again. In the new testing, I reinstalled the ANCOMBC package v2.2.1 and tested the following steps. All things are fine.

library(microeco)
load("meco_Physeq_PC_2019_ITS_September.RData")
t1_ancombc_meco_Physeq_PC_2019_ITS_September<- trans_diff$new(dataset = meco_Physeq_PC_2019_ITS_September, method = "ancombc2", group = "Treatment", taxa_level = "Genus", filter_thres = 0.001)
t2_ancombc_meco_Physeq_PC_2019_ITS_September<- trans_diff$new(dataset = meco_Physeq_PC_2019_ITS_September, method = "ancombc2", group = "Treatment", taxa_level = "Genus", filter_thres = 0.005)
t3_ancombc_meco_Physeq_PC_2019_ITS_September<- trans_diff$new(dataset = meco_Physeq_PC_2019_ITS_September, method = "ancombc2", group = "Treatment", taxa_level = "Genus", filter_thres = 0.01)

I find out the reason that leads to the error in your session. It comes from a minor bug that filter_thres parameter is failed to filter taxa with low abundance. In addition, the new ANCOMBC package has changed its default output format. I have also updated the microeco package to keep in line with it.

Best, Chi

ChiLiubio avatar Aug 08 '23 11:08 ChiLiubio

Hej Chi,

Well i have reinstalled ANCOMBC v. 2.2.1. I also reinstalled the Microeco package from github its version 0.20.0. However following your codes i still get the same mistake output. Should i filter my data first ? i thought the filter_thres function would take care of that.

Christian-Benjamin avatar Aug 08 '23 11:08 Christian-Benjamin

Please first make sure the installed version is 1.0.0 from github as the following steps show.

install.packages("devtools")
devtools::install_github("ChiLiubio/microeco")

In the new version, filter_thres is fine to do its thing. I have carefully test that.

ChiLiubio avatar Aug 08 '23 13:08 ChiLiubio

Hej Chi, Is it possible that i can try with the old ANCOMBC and the microeco package v.0.12.1 ? i have troubles generating the same output between the two versions ? if yes, do you have a repos for that version ?

Christian-Benjamin avatar Aug 25 '23 15:08 Christian-Benjamin

Hi. I strongly recommend installing the microeco v1.0.0 in development from github and ANCOMBC package v2.2.1. I have tested them recently. The updated microeco version is robust in terms of the data conversion and checking. In my viewpoint, ANCOMBC has been also changed in many parts, resulting in the hard comparison between different versions.

ChiLiubio avatar Aug 26 '23 03:08 ChiLiubio

Hej Chi ! I do understand, but do you still have access to the microeco version (0.12.1) forinstance the .tgz file or similar.

On Another note, your updated version of Microeco to 1.0.0 and the updated version of ancombc2 worked. I do get outputs from most of the microeco objects tested including the once that you have tested. However sometimes i would get this error: task 1 failed - "Zero variances have been detected for the following taxa: k__Fungi|p__Ascomycota|c__Dothideomycetes|o__Tubeufiales|f__Tubeufiaceae|g__, k__Fungi|p__Basidiomycota|c__Agaricomycetes|o__Agaricales|f__Entolomataceae|g__Clitopilus, k__Fungi|p__Mucoromycota|c__Umbelopsidomycetes|o__GS23|f__|g__, k__Fungi|p__Ascomycota|c__Pezizomycetes|o__Pezizales|f__|g__, k__Fungi|p__Ascomycota|c__Sordariomycetes|o__Myrmecridiales|f__|g__Goidanichiella, k__Fungi|p__Ascomycota|c__Sordariomycetes|o__Hypocreales|f__Nectriaceae|g__Neocosmospora, k__Fungi|p__Ascomycota|c__Saccharomycetes|o__Saccharomycetales|f__|g__Nadsonia, k__Fungi|p__Ascomycota|c__Leotiomycetes|o__Helotiales|f__|g__Cadophora, k__Fungi|p__Ascomycota|c__Dothideomycetes|o__Pleosporales|f__Phaeosphaeriaceae|g__, k__Fungi|p__Basidiomycota|c__Microbotryomycetes|o__Leucosporidiales|f__Leucosporidiaceae|g__Leucosporidium, k__Fungi|p__Ascomycota|c__Leotiomycetes|o__Phacidiales|f__Phacidiaceae|g__Gremmenia, k__Fungi|p__Chytrid Please remove these taxa or select a more parsimonious model" In addition: There were 50 or more warnings (use warnings() to see the first 50)

Could this perhaps be that some of the taxas/genera have a value of 0 thats why no variance is detected ? or What is wrong do you think ?

Christian-Benjamin avatar Aug 26 '23 07:08 Christian-Benjamin

Hi. Please find it in the release history (https://github.com/ChiLiubio/microeco/releases).

ChiLiubio avatar Aug 27 '23 01:08 ChiLiubio

For such error, please try to add filter_thres parameter to filter the features with very low abundance. The reason is probably that low abundance/many zeors lead to low variances.

ChiLiubio avatar Aug 27 '23 02:08 ChiLiubio