joey711 / phyloseq

phyloseq is a set of classes, wrappers, and tools (in R) to make it easier to import, store, and analyze phylogenetic sequencing data; and to reproducibly share that data and analysis with others. See the phyloseq front page:
http://joey711.github.io/phyloseq/
584 stars 187 forks source link

Infinite recursion problem #673

Closed LaserKate closed 7 years ago

LaserKate commented 8 years ago

Hello, I recently updated R and am now running R version 3.3.1 (2016-06-21).

However, I am still working with phyloseq_1.10.0and ggplot2_2.1.0 Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1

I am trying to reproduce an old figure that used to work, but now get the following error when using the function plot_bar or plot_tree with a phyloseq object:

"Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
Error during wrapup: evaluation nested too deeply: infinite recursion / options(expressions=)?"

plot_bar(phylo, fill="Species")+theme_classic()

Other functions work with the phylo object, namely, plot_ordination(). However,

Plot_tree also ends in the same error if I just write plot_tree(phylo) or plot_tree(phylo, label.tips="taxa_names") But works correctly with plot_tree(phylo, "treeonly")

Any idea how to fix this issue? I think it has something to do with updating R but some old packages dependencies are not properly communicating with phyloseq anymore...

Thanks in advance! Kate

joey711 commented 7 years ago

This looks like an issue with the latest update in ggplot2. Can you share a reproducible example that generates this error? Perhaps with the included example dataset GlobalPatterns?

thanks

LaserKate commented 7 years ago

Hi Paul, I finally found a fix to this problem. I was trying to run the older version of Phyloseq with the newest version of R. I can get everything to work nicely if I use an older version of R and Phyloseq or alternatively, the newest version of Phyloseq with the newest version of R. sorry for the hassle, cheers, Kate

On Tue, Nov 8, 2016 at 4:19 AM, Paul J. McMurdie notifications@github.com wrote:

This looks like an issue with the latest update in ggplot2. Can you share a reproducible example that generates this error? Perhaps with the included example dataset GlobalPatterns?

thanks

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/joey711/phyloseq/issues/673#issuecomment-258917070, or mute the thread https://github.com/notifications/unsubscribe-auth/AKqtEg5YZgRvUruZqKqpz2Mcpi9hkcb5ks5q72umgaJpZM4KQhcF .

Kate Quigley Cuerpo de Paz-Peru Voluntaria de Medio Ambiente 995974412 RPM:*377992

elsherbini commented 7 years ago

I am having the same issue for plot_bar and for plot_heatmap:

R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
>library(phyloseq)
> packageVersion('phyloseq')
[1] ‘1.19.1’
> packageVersion('ggplot2')
[1] ‘2.2.0’
> #from http://joey711.github.io/phyloseq/plot_bar-examples.html
> data("GlobalPatterns")
> gp.ch = subset_taxa(GlobalPatterns, Phylum == "Chlamydiae")
> plot_bar(gp.ch)
Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
> # from http://joey711.github.io/phyloseq/plot_heatmap-examples.html
> gpt <- subset_taxa(GlobalPatterns, Kingdom=="Bacteria")
> gpt <- prune_taxa(names(sort(taxa_sums(gpt),TRUE)[1:300]), gpt)
> plot_heatmap(gpt, sample.label="SampleType")
Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

If I increase the options(expressions), i get a protect() error for stack overflow:

> options("expressions"=20000)
> plot_heatmap(gpt, sample.label="SampleType")
Error: protect(): protection stack overflow

I've set my stack size to be unlimited with ulimit -s unlimited

Downgrading ggplot2 to 2.1.0 did not fix the issue.

> packageVersion('ggplot2')
[1] ‘2.1.0’
> plot_bar(gpt)
Error: evaluation nested too deeply: infinite recursion / options(expressions=)?
joey711 commented 7 years ago

I'm afraid that I cannot reproduce your error. Can you give a different example that does reproduce the error, or more system information if you believe it is a system-dependent error?

Also, note that you are on the development branch of bioconductor, or at least are using the development release of phyloseq according to your version number. The version of phyloseq indicated in my log of your example, below, shows the current release version of phyloseq.

I will close for now, as OP said this was resolved by updating R and packages, and your example of an error appears to run fine. Please feel free to post if this is actually a persisting issue, and I will re-open. The current recommendation is to use the release version of phyloseq.

R.version
##                _                           
## platform       x86_64-apple-darwin13.4.0   
## arch           x86_64                      
## os             darwin13.4.0                
## system         x86_64, darwin13.4.0        
## status                                     
## major          3                           
## minor          3.2                         
## year           2016                        
## month          10                          
## day            31                          
## svn rev        71607                       
## language       R                           
## version.string R version 3.3.2 (2016-10-31)
## nickname       Sincere Pumpkin Patch
library("phyloseq"); packageVersion("phyloseq")
## 
## This data.table install has not detected OpenMP support. It will work but slower in single threaded mode.
## [1] '1.18.1'
packageVersion('ggplot2')
## [1] '2.2.0'
data("GlobalPatterns")
gp.ch = subset_taxa(GlobalPatterns, Phylum == "Chlamydiae")
plot_bar(gp.ch)

unnamed-chunk-1-1

gpt <- subset_taxa(GlobalPatterns, Kingdom=="Bacteria")
gpt <- prune_taxa(names(sort(taxa_sums(gpt),TRUE)[1:300]), gpt)
plot_heatmap(gpt, sample.label="SampleType")
## Warning: Transformation introduced infinite values in discrete y-axis

unnamed-chunk-1-2

elsherbini commented 7 years ago

Hmm, I am running this stuff on my personal computer. I just restarted and installed the current release version of phyloseq. I have the same problem with that release (though if I don't set the stack size to unlimited I get a stack size error rather than infinite recursion error.

I'll let you know if I find a solution.

> R.version
               _                           
platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          3                           
minor          3.2                         
year           2016                        
month          10                          
day            31                          
svn rev        71607                       
language       R                           
version.string R version 3.3.2 (2016-10-31)
nickname       Sincere Pumpkin Patch       
> library("phyloseq"); packageVersion("phyloseq")
[1] ‘1.18.1’
> packageVersion('ggplot2')
[1] ‘2.2.0’
> data("GlobalPatterns")
> gp.ch = subset_taxa(GlobalPatterns, Phylum == "Chlamydiae")
> plot_bar(gp.ch)
Error: C stack usage  7969476 is too close to the limit
> gpt <- subset_taxa(GlobalPatterns, Kingdom=="Bacteria")
> gpt <- prune_taxa(names(sort(taxa_sums(gpt),TRUE)[1:300]), gpt)
> plot_heatmap(gpt, sample.label="SampleType")
Error: C stack usage  7969476 is too close to the limit
joey711 commented 7 years ago

is this a resource-constrained machine? That limit, if memory, looks to be very small...

elsherbini commented 7 years ago

That is the stack size, and I think that size is the default for most linux systems. I have 16GB RAM, does that seem like enough for the example?

On Thu, Dec 1, 2016 at 8:47 PM, Paul J. McMurdie notifications@github.com wrote:

is this a resource-constrained machine? That limit, if memory, looks to be very small...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/joey711/phyloseq/issues/673#issuecomment-264351114, or mute the thread https://github.com/notifications/unsubscribe-auth/ACkgvRQfvyvWJTyyRC8hSGvuQIK4SEsDks5rD3i3gaJpZM4KQhcF .

elsherbini commented 7 years ago

As an update, this does appear to be a system issue of some sort. Still haven't tracked it down.

On the cluster I have access to I can produce the bar plot. On my personal computer I cannot, though I can produce ordination plots and diversity estimate plots.

joey711 commented 7 years ago

Thanks for the update. I think this is out of the scope of the phyloseq issue tracker unless it appears to be more pervasive. If I'm remembering correctly, these plots are even checked in phyloseq's unit tests, which are run on all three of Bioconductor's testing servers before release (Ubuntu, MacOS, Win)... 16GB RAM should be plenty of total RAM, so my guess is it is a setting for your OS that has limited the stack to something that honestly seems a bit small, and this error is probably not the only reason you'd want to increase it.

Hope you solve the problem! For what it is worth, I do A LOT of my work on an Amazon AWS instance running Ubuntu and RStudio Server, even though I'm happy with the performance of my Macbook Pro. Pretty much the same user interface, so not a bad option at all.

ZellaD commented 7 years ago

elsherbini did you ever figure out how to change the C stack limit? I am running into the same problem and not sure how to change it. Everything online says to change it with ulimit -s but this has not worked for me. Any suggestions?

elsherbini commented 7 years ago

I never did solve it on that machine. It works fine on the cluster I have access to. I'm convinced that there is another silent error that leads to the infinite recursion problem, and so it's difficult to track down whats going wrong. Even with an unlimited stack size the problem isn't fixed, so I don't think that's the real issue.

apascualgarcia commented 6 years ago

Hi there, I have the same issue running in a 8GB laptop with Ubuntu 16, and it happens to me with plot_bar() but also using as.character() with tax_table() (see below). I thought that the problem was rstudio, because I'm running an old version (1.0.43), but then I updated the packages in my machine (excluding r studio and R, the latter is in the latest version) and the problem dissapears. Then I'm a little bit confused because with the problem present both R and rstudio were in the same version that the one I'm running now without problems, so it may be any library causing the problem that I now updated. I think this issue may also be related so merging them would help (I found the other issue first because the error is explicit in the title).

> library(phyloseq)
> data("GlobalPatterns")
> gp.ch = subset_taxa(GlobalPatterns, Phylum == "Chlamydiae")
> plot_bar(gp.ch)
Error: C stack usage  7970212 is too close to the limit

> topESVs = names(sort(taxa_sums(gp.ch), TRUE)[1:19])
> taxTop = cbind(tax_table(gp.ch), family = NA, genus=NA)
> taxTop[topESVs, "family"] <- as(tax_table(taxTop)[topESVs, "Family"], 
...                                 "character") #
Error: C stack usage  7970372 is too close to the limit

> R.version
           _                           
platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          3                           
minor          4.4                         
year           2018                        
month          03                          
day            15                          
svn rev        74408                       
language       R                           
version.string R version 3.4.4 (2018-03-15)
nickname       Someone to Lean On          

> packageVersion('phyloseq')
[1] ‘1.22.3’
> packageVersion('ggplot2')
[1] ‘3.0.0’