adw96 / DivNet

diversity estimation under ecological networks
83 stars 18 forks source link

Error in default_network(sigma) #117

Closed ivanllampy closed 2 years ago

ivanllampy commented 2 years ago

Hi all,

I got the error "Error in default_network(sigma)" when running the function divnet() to a phyloseq object. I checked similar issue in the past (https://github.com/adw96/DivNet/issues/22), and noticed the nature of data may be a problem, but my OTU_table is already in count data.

Here is the code I used: physeq<-phyloseq(asv.table,taxa.table,sam.table) # Create a phyloseq object fg_physeq <- subset_samples(physeq, type %in% c("f","si","li")) # Subset the phyloseq object fg_div <- DivNet::divnet(fg_physeq, X = NULL, base = "b3907c09c188482e501009dba187301d") # Run divnet() The error then occurred.

However, if I subset the phyloseq object at family level by fg_family <- fg_physeq %>% tax_glom(taxrank = "Family") And run divnet() again fg_family_div <- DivNet::divnet(fg_family, X = NULL, base = "14686351442a2f96c2c9632acbaed4b4") The error didn't occur.

So I am thinking is the error cause by the size of the phyloseq object? or related to memory usage in R?(currently I ran the code on a 16GB RAM computer). Not sure if this is relevant, I am trying to find a computer with more memory to re-run the code again.

Any help would be highly appreciated. Thank you.

ailurophilia commented 2 years ago

Hi,

Is your base OTU present in all samples? Does the model run if you let divnet choose the base taxon itself? (You can do this by running it without specifying base.)

ivanllampy commented 2 years ago

Hi,

Thanks for your quick reply!. If I run the code without specifying base, the following error occur: Error in pick_base(W) : Yikes! No taxa observed in all samples! Pick which taxon is to be the base So I guess I don't have a OTU present in all samples.

Refer to the discussion in (https://github.com/adw96/DivNet/issues/14), I tried to pick a few OTU to run the code again. The base I chose in the code above is the most abundant OTU. Would the choice of base lead to the error?

Many thanks!!!

ivanllampy commented 2 years ago

An update of using another computer (32GB RAM) to run divnet() with base specified. Have been waiting for half of the day, the "Removing absent taxa" step keep loading at 0% without any progress. Not sure if the error will occur, or just a longer time is needed to run the code.

Not sure if this piece of information help. Many thanks!

ailurophilia commented 2 years ago

Hi,

I apologize for the long delay in my response. It's difficult to say what may be going on on the basis of your description. How many samples and taxa are in your dataset? Divnet can be slow on larger datasets. It may also be worth trying a couple different base taxa to see if behavior of the model changes.

Hope this helps!

Best, David

adw96 commented 2 years ago

closing for now given we aren't sure how to action this. Feel free to provide more details and reopen!