dendextend icon indicating copy to clipboard operation
dendextend copied to clipboard

Getting an infinite recursion error in get_branches_heights

Open ndrubins opened this issue 8 years ago • 6 comments

Hi dendextend team,

I have a: 'dendrogram' with 2 branches and 4872 members total, at height 10.11295 (called dendro) for which I'm calling: get_branches_heights(dendro, include_leaves=T) On my linux cluster I'm getting this error message: Error: evaluation nested too deeply: infinite recursion / options(expressions=)? And on my mac I'm getting this error message: Error: C stack usage 7969900 is too close to the limit Does this look familiar to you? Any idea what can be done to avoid this?

Thanks a lot

ndrubins avatar Aug 08 '17 08:08 ndrubins

This is because the function works with recursion which is not very robust to large nested trees. One solution is to rewrite the function using a loop (something I will not do any time soon). Another is to see if there are ways to increase the stack, but I didn't play with it and am not sure if it would work for your tree. Sorry.

talgalili avatar Aug 08 '17 08:08 talgalili

Thanks

ndrubins avatar Aug 08 '17 08:08 ndrubins

@ndrubins, from the help page for options():

     ‘expressions’: sets a limit on the number of nested expressions
          that will be evaluated.  Valid values are 25...500000 with
          default 5000.  If you increase it, you may also want to start
          R with a larger protection stack; see ‘--max-ppsize’ in
          ‘Memory’.  Note too that you may cause a segfault from
          overflow of the C stack, and on OSes where it is possible you
          may want to increase that.  Once the limit is reached an
          error is thrown.  The current number under evaluation can be
          found by calling ‘Cstack_info’.

alanocallaghan avatar Sep 16 '17 10:09 alanocallaghan

Thanks

ndrubins avatar Sep 16 '17 19:09 ndrubins

Just to say, exactly the same error is preventing me from running color_branches on a tree with 10k members.

Increasing expressions has not had any effect, and as this is a managed instance (R Workbench server) I don't think I can increase the C stack myself (if it's possible at all).

tomwagstaff-health avatar Nov 03 '22 10:11 tomwagstaff-health