Dsuite icon indicating copy to clipboard operation
Dsuite copied to clipboard

cannot plot fbranch statistics

Open bnsacks opened this issue 2 years ago • 11 comments

This is a fantastic set of tools. However, I am hitting a snag I cannot seem to solve. I can run

.../Dsuite Fbranch -Z Allprunedr2-50thinned100.nex.partsroot2.txt SETS_tree-guided_tree.txt > fbranch1.txt

and I get the file with lots of values and 'nan's but then when I try the next command:

.../utils/dtools.py fbranch1.txt Allprunedr2-50thinned100.nex.partsroot2.txt

I get the following error:

Traceback (most recent call last): File "/home/yote/bin/Dsuite/utils/dtools.py", line 3654, in sys.exit(main()) File "/home/yote/bin/Dsuite/utils/dtools.py", line 3624, in main fb[fb<0] = 0 File "/home/yote/.local/lib/python3.9/site-packages/pandas-1.4.2-py3.9-linux-x86_64.egg/pandas/core/ops/common.py", line 70, in new_method return method(self, other) File "/home/yote/.local/lib/python3.9/site-packages/pandas-1.4.2-py3.9-linux-x86_64.egg/pandas/core/arraylike.py", line 48, in lt return self._cmp_method(other, operator.lt) File "/home/yote/.local/lib/python3.9/site-packages/pandas-1.4.2-py3.9-linux-x86_64.egg/pandas/core/frame.py", line 6934, in _cmp_method new_data = self._dispatch_frame_op(other, op, axis=axis) File "/home/yote/.local/lib/python3.9/site-packages/pandas-1.4.2-py3.9-linux-x86_64.egg/pandas/core/frame.py", line 6973, in _dispatch_frame_op bm = self._mgr.apply(array_op, right=right) File "/home/yote/.local/lib/python3.9/site-packages/pandas-1.4.2-py3.9-linux-x86_64.egg/pandas/core/internals/managers.py", line 302, in apply applied = b.apply(f, **kwargs) File "/home/yote/.local/lib/python3.9/site-packages/pandas-1.4.2-py3.9-linux-x86_64.egg/pandas/core/internals/blocks.py", line 402, in apply result = func(self.values, **kwargs) File "/home/yote/.local/lib/python3.9/site-packages/pandas-1.4.2-py3.9-linux-x86_64.egg/pandas/core/ops/array_ops.py", line 283, in comparison_op res_values = comp_method_OBJECT_ARRAY(op, lvalues, rvalues) File "/home/yote/.local/lib/python3.9/site-packages/pandas-1.4.2-py3.9-linux-x86_64.egg/pandas/core/ops/array_ops.py", line 73, in comp_method_OBJECT_ARRAY result = libops.scalar_compare(x.ravel(), y, op) File "pandas/_libs/ops.pyx", line 107, in pandas._libs.ops.scalar_compare TypeError: '<' not supported between instances of 'str' and 'int'

The files are attached below: Allprunedr2-50thinned100.nex.partsroot2.txt SETS_tree-guided_tree.txt fbranch1.txt

bnsacks avatar Jun 22 '22 01:06 bnsacks

Hi, have you found a solution to this problem? I'm having the same issue. Thanks!

ACColin avatar Oct 14 '22 06:10 ACColin

No, I gave up on it, but would still be interested if you find a solution.

bnsacks avatar Oct 14 '22 12:10 bnsacks

Right. so I think we found the solution, at least it work for our data and looking at your 'fbranch1.txt' file it should work for yours as well. If you selected the -z option with the Fbranch command, you get the Z-scores added in the final Fbranch.txt file. However it seems that the dtools script is meant to parse data without the Z-scores and will try to parse those as well if included in the input file therefore throwing an error. You can either rerun without adding the optional -z flag, or remove the Z-scores from the in file to avoid it. This should do :) hope it helps. Cheers

ACColin avatar Oct 19 '22 22:10 ACColin

Fantastic! Thank you. I will save your comment where i left off and try this when I am able to get back to it. Cheers!

bnsacks avatar Oct 19 '22 23:10 bnsacks

Hello,

I'm also having issues plotting the Fbranch stats, but I get a different error. I think that might be a python error, but I'm not familiar with it so I'm not sure how it relates to the program. Has anyone seen this happen? And what would that mean for my Fbranch file?

Traceback (most recent call last):
  File "/u/home/r/rturba/programs/Dsuite/utils/dtools.py", line 3654, in <module>
    sys.exit(main())
  File "/u/home/r/rturba/programs/Dsuite/utils/dtools.py", line 3629, in main
    fb1, tree_no_outgroup = align_fbranch_with_tree(fb, tree,
  File "/u/home/r/rturba/programs/Dsuite/utils/dtools.py", line 3482, in align_fbranch_with_tree
    fb = fb.loc[row_order, col_order].iloc[::-1]  # ,::-1
  File "/u/home/r/rturba/.conda/envs/dsuite/lib/python3.10/site-packages/pandas-1.5.2-py3.10-linux-x86_64.egg/pandas/core/indexing.py", line 1067, in __getitem__
    return self._getitem_tuple(key)
  File "/u/home/r/rturba/.conda/envs/dsuite/lib/python3.10/site-packages/pandas-1.5.2-py3.10-linux-x86_64.egg/pandas/core/indexing.py", line 1254, in _getitem_tuple
    return self._multi_take(tup)
  File "/u/home/r/rturba/.conda/envs/dsuite/lib/python3.10/site-packages/pandas-1.5.2-py3.10-linux-x86_64.egg/pandas/core/indexing.py", line 1205, in _multi_take
    d = {
  File "/u/home/r/rturba/.conda/envs/dsuite/lib/python3.10/site-packages/pandas-1.5.2-py3.10-linux-x86_64.egg/pandas/core/indexing.py", line 1206, in <dictcomp>
    axis: self._get_listlike_indexer(key, axis)
  File "/u/home/r/rturba/.conda/envs/dsuite/lib/python3.10/site-packages/pandas-1.5.2-py3.10-linux-x86_64.egg/pandas/core/indexing.py", line 1432, in _get_listlike_indexer
    keyarr, indexer = ax._get_indexer_strict(key, axis_name)
  File "/u/home/r/rturba/.conda/envs/dsuite/lib/python3.10/site-packages/pandas-1.5.2-py3.10-linux-x86_64.egg/pandas/core/indexes/base.py", line 6105, in _get_indexer_strict
    keyarr = com.asarray_tuplesafe(keyarr)
  File "/u/home/r/rturba/.conda/envs/dsuite/lib/python3.10/site-packages/pandas-1.5.2-py3.10-linux-x86_64.egg/pandas/core/common.py", line 245, in asarray_tuplesafe
    result = np.asarray(values, dtype=dtype)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (72,) + inhomogeneous part.

Fbranch file tree file

Thank you!

rturba avatar Feb 28 '23 04:02 rturba

Hello rturba

I have the same issue as you, I even run again the Dtrios, do you have a soulution?

Best Xuexue

xuefenfei712 avatar May 30 '23 14:05 xuefenfei712

I still haven't solved the problem, and you?

At 2023-05-30 22:05:06, "xuefenfei712" @.***> wrote:

Hello rturba

I have the same issue as you, I even run again the Dtrios, do you have a soulution?

Best Xuexue

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

yangwukaidi avatar Sep 05 '23 09:09 yangwukaidi

I still haven't solved the problem, and you? At 2023-05-30 22:05:06, "xuefenfei712" @.> wrote: Hello rturba I have the same issue as you, I even run again the Dtrios, do you have a soulution? Best Xuexue — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.>

Hi, there! So sorry for not replying with a solution earlier. I've discovered that the python environment where I had installed DSuite was the problem. For sure some version incompatibility. Just running the plot command outside of my virtual environment with python3 worked fine. Try checking the python version you're using and try with another one. I hope that helps!

rturba avatar Sep 05 '23 18:09 rturba

Ok, I'll follow your advice. Best wishes to you!

At 2023-09-06 02:08:14, "rturba" @.***> wrote:

I still haven't solved the problem, and you? At 2023-05-30 22:05:06, "xuefenfei712" @.> wrote: Hello rturba I have the same issue as you, I even run again the Dtrios, do you have a soulution? Best Xuexue — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.>

Hi, there! So sorry for not replying with a solution earlier. I've discovered that the python environment where I had installed DSuite was the problem. For sure some version incompatibility. Just running the plot command outside of my virtual environment with python3 worked fine. Try checking the python version you're using and try with another one. I hope that helps!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

yangwukaidi avatar Sep 07 '23 08:09 yangwukaidi

hello! I have a new errow in plotting fbranch, like this:

python3 Dsuite/utils/dtools.py fbranch.txt nwk.txt Traceback (most recent call last): File "/home/lingjiang/liyf/china_analyses/dsuit/Dsuite/utils/dtools.py", line 3654, in sys.exit(main()) ^^^^^^ File "/home/lingjiang/liyf/china_analyses/dsuit/Dsuite/utils/dtools.py", line 3629, in main fb1, tree_no_outgroup = align_fbranch_with_tree(fb, tree, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/lingjiang/liyf/china_analyses/dsuit/Dsuite/utils/dtools.py", line 3465, in align_fbranch_with_tree fb = fb.drop(outgroup, axis=1) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/lingjiang/anaconda3/lib/python3.11/site-packages/pandas/core/frame.py", line 5344, in drop return super().drop( ^^^^^^^^^^^^^ File "/home/lingjiang/anaconda3/lib/python3.11/site-packages/pandas/core/generic.py", line 4711, in drop obj = obj._drop_axis(labels, axis, level=level, errors=errors) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/lingjiang/anaconda3/lib/python3.11/site-packages/pandas/core/generic.py", line 4753, in _drop_axis new_axis = axis.drop(labels, errors=errors) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/lingjiang/anaconda3/lib/python3.11/site-packages/pandas/core/indexes/base.py", line 7000, in drop raise KeyError(f"{labels[mask].tolist()} not found in axis") KeyError: "['Outgroup'] not found in axis"

I tried python3.7, 3.9 and 3.11, and pandas 1.5 and 2.1.4. they all didn't work.

yefanglee avatar Dec 20 '23 03:12 yefanglee

yefanglee

Hello,yefanglee!

I have got the same issue with you. Have you figure out how to deal with it?

se420 avatar Mar 13 '24 14:03 se420