uym2 / TreeShrink

Implementation of the TreeShrink problem
https://uym2.github.io/TreeShrink/
GNU General Public License v3.0
36 stars 11 forks source link

Failed with error in density.default #37

Open mesti90 opened 1 year ago

mesti90 commented 1 year ago

When launching treeshrink 1.3.9, the software died with the following error:

Error in density.default(log(x), adjust = 1) : 
  need at least 2 points to select a bandwidth automatically
Calls: threshold ... is.element -> as.vector -> density -> density.default

The software was called with run_treeshrink.py --tree fasttree.txt

I use python 3.11.1.

Here is the tree: tree.txt

What can be the problem?

Here is the full error message:

Launching TREESHRINK version 1.3.9
TREESHRINK was called as follow
/usr/local/bin/run_treeshrink.py --tree tree.txt
Testing R and BMS installation ...
There are only 1 gene trees in the dataset.
TreeShrink will run in 'All-genes' mode
Solving k-shrink with k = 1
Error in density.default(log(x), adjust = 1) : 
  need at least 2 points to select a bandwidth automatically
Calls: threshold ... is.element -> as.vector -> density -> density.default
Execution halted
Traceback (most recent call last):
  File "/usr/local/bin/run_treeshrink.py", line 4, in <module>
    __import__('pkg_resources').run_script('TREESHRINK==1.3.9', 'run_treeshrink.py')
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 708, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1517, in run_script
    exec(code, namespace, namespace)
  File "/usr/local/lib/python3.11/dist-packages/TREESHRINK-1.3.9-py3.11.egg/EGG-INFO/scripts/run_treeshrink.py", line 363, in <module>
    main()
  File "/usr/local/lib/python3.11/dist-packages/TREESHRINK-1.3.9-py3.11.egg/EGG-INFO/scripts/run_treeshrink.py", line 264, in main
    threshold = float(check_output(["Rscript",normpath(join(libdir,"R_scripts","find_threshold_lkernel.R")),libdir,filename,q]).lstrip().rstrip()[5:])
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['Rscript', '/usr/local/lib/python3.11/dist-packages/TREESHRINK-1.3.9-py3.11.egg/R_scripts/find_threshold_lkernel.R', '/usr/local/lib/python3.11/dist-packages/TREESHRINK-1.3.9-py3.11.egg', '/tmp/tmprkigvvvw/all_genes.dat', '0.05']' returned non-zero exit status 1.
fredjaya commented 1 year ago

I think it may be due to the input tree being too small? I've only encountered this error when trees have less than 8 tips.