TreeShrink icon indicating copy to clipboard operation
TreeShrink copied to clipboard

Can R v4 be used?

Open baileyp1 opened this issue 5 years ago • 3 comments

Hello, Can we use R v4.0? I've just tried running the test data with R 4.0.1 and I get the error below. What version would you recommend? I'm using Python 2.7.16. Thanks

Paul

... Solving k-shrink with k = 7 Solving k-shrink with k = 7 Solving k-shrink with k = 7 Solving k-shrink with k = 7 Solving k-shrink with k = 7 Solving k-shrink with k = 7 Solving k-shrink with k = 7 TreeShrink will run in 'Per-species' mode ... During startup - Warning messages: 1: Setting LC_COLLATE failed, using "C" 2: Setting LC_TIME failed, using "C" 3: Setting LC_MESSAGES failed, using "C" 4: Setting LC_MONETARY failed, using "C" Error in rank(x, ties.method = "min", na.last = "keep") : unimplemented type 'list' in 'greater' Calls: threshold ... as.vector -> xtfrm -> xtfrm.default -> as.vector -> rank Execution halted Traceback (most recent call last): File "/usr/local/bin/run_treeshrink.py", line 4, in import('pkg_resources').run_script('TREESHRINK==1.3.4', 'run_treeshrink.py') File "/usr/local/lib/python2.7/site-packages/pkg_resources/init.py", line 666, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/local/lib/python2.7/site-packages/pkg_resources/init.py", line 1453, in run_script exec(code, namespace, namespace) File "/usr/local/lib/python2.7/site-packages/TREESHRINK-1.3.4-py2.7.egg/EGG-INFO/scripts/run_treeshrink.py", line 289, in main() File "/usr/local/lib/python2.7/site-packages/TREESHRINK-1.3.4-py2.7.egg/EGG-INFO/scripts/run_treeshrink.py", line 200, in main thresholds[i] = max(minImpact,float(check_output(["Rscript",normpath(join(libdir,"R_scripts","find_threshold_lkernel.R")),libdir,filename,q]).lstrip().rstrip()[5:])) File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 223, in check_output raise CalledProcessError(retcode, cmd, output=output) subprocess.CalledProcessError: Command '['Rscript', '/usr/local/lib/python2.7/site-packages/TREESHRINK-1.3.4-py2.7.egg/R_scripts/find_threshold_lkernel.R', '/usr/local/lib/python2.7/site-packages/TREESHRINK-1.3.4-py2.7.egg', '/var/folders/03/lqkq3k611rb7vs0fr0htxq9w0ffy_w/T/tmphztgwR/BOS.dat', '0.05']' returned non-zero exit status 1

baileyp1 avatar Jun 19 '20 17:06 baileyp1

Hi again, I managed to roll back to R v3.6.3 and the error went away and I got output with the test data so I think it was an R version issue. Best wishes

Paul

baileyp1 avatar Jun 20 '20 11:06 baileyp1

Hi Paul,

Thanks for letting us know about the issue. I will soon update TreeShrink to work with R v4.

Best, Uyen

uym2 avatar Jun 21 '20 02:06 uym2

It seems that the only "update" needed is just switching to an updated BMS package. Currently, the easiest quick fix is to install BMS system-wide and remove the lib.loc argument in require, such that it would pick up the default library location and not TREESHRINK-*.egg/Rlib/:

$ diff /usr/local/lib/python3*/dist-packages/TREESHRINK-*.egg/R_scripts/find_threshold_lkernel.R{.bak,}
7,8d6
< #libpath = paste(args[1],"/Rlib",sep="")
< libpath = file.path(args[1],"Rlib")
12c10
< suppressMessages(require(BMS,lib.loc=libpath))
---
> suppressPackageStartupMessages(require(BMS))

alephreish avatar Dec 29 '20 13:12 alephreish