Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: '<' not supported between instances of 'float' and 'str' #2

Open
ReneKat opened this issue Jul 10, 2020 · 3 comments
Open

Comments

@ReneKat
Copy link

ReneKat commented Jul 10, 2020

Hello hclust2 community,
I am running on Windows Subsystem Linux Ubuntu 20. hclust2 was installed using conda
conda install -c bioconda hclust2
conda update hclust2

$ hclust2.py -i abundance_table_species.txt -o abundance_heatmap_species.png --ftop 25 --f_dist_f braycurtis --s_dist_f braycurtis --cell_aspect_ratio 0.5 -l --flabel_size 6 --slabel_size 6 --max_flabel_len 100 --max_slabel_len 100 --minv 0.1 --dpi 300
Traceback (most recent call last):
  File "/home/renekat/anaconda3/envs/phlan/bin/hclust2.py", line 825, in <module>
    hclust2_main()
  File "/home/renekat/anaconda3/envs/phlan/bin/hclust2.py", line 784, in hclust2_main
    dm = DataMatrix( args.inp, args )
  File "/home/renekat/anaconda3/envs/phlan/bin/hclust2.py", line 174, in __init__
    select( self.args.fperc, self.args.ftop )
  File "/home/renekat/anaconda3/envs/phlan/bin/hclust2.py", line 159, in select
    self.table['perc'] = self.table.apply(lambda x: stats.scoreatpercentile(x,perc),axis=1)
  File "/home/renekat/anaconda3/envs/phlan/lib/python3.7/site-packages/pandas/core/frame.py", line 6878, in apply
    return op.get_result()
  File "/home/renekat/anaconda3/envs/phlan/lib/python3.7/site-packages/pandas/core/apply.py", line 186, in get_result
    return self.apply_standard()
  File "/home/renekat/anaconda3/envs/phlan/lib/python3.7/site-packages/pandas/core/apply.py", line 296, in apply_standard
    values, self.f, axis=self.axis, dummy=dummy, labels=labels
  File "pandas/_libs/reduction.pyx", line 620, in pandas._libs.reduction.compute_reduction
  File "pandas/_libs/reduction.pyx", line 128, in pandas._libs.reduction.Reducer.get_result
  File "/home/renekat/anaconda3/envs/phlan/bin/hclust2.py", line 159, in <lambda>
    self.table['perc'] = self.table.apply(lambda x: stats.scoreatpercentile(x,perc),axis=1)
  File "/home/renekat/anaconda3/envs/phlan/lib/python3.7/site-packages/scipy/stats/stats.py", line 1891, in scoreatpercentile
    sorted_ = np.sort(a, axis=axis)
  File "<__array_function__ internals>", line 6, in sort
  File "/home/renekat/anaconda3/envs/phlan/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 989, in sort
    a.sort(axis=axis, kind=kind, order=order)
TypeError: '<' not supported between instances of 'float' and 'str'

Any help with this error would be appreciated!
Best,
Rene

EDITED:
I am not sure if the two errors are related, but I tried to run on the example data and got this:

$ /mnt/c/Users/Student/github/hclust2/examples/HMP-MetaPhlAn/run.sh
Traceback (most recent call last):
  File "/home/renekat/anaconda3/envs/phlan/bin/hclust2.py", line 825, in <module>
    hclust2_main()
  File "/home/renekat/anaconda3/envs/phlan/bin/hclust2.py", line 803, in hclust2_main
    cl.shcluster()
  File "/home/renekat/anaconda3/envs/phlan/bin/hclust2.py", line 380, in shcluster
    self.shclusters = sph.linkage(self.s_dm, method=self.args.slinkage)
  File "/home/renekat/anaconda3/envs/phlan/lib/python3.7/site-packages/scipy/cluster/hierarchy.py", line 1057, in linkage
    raise ValueError("The condensed distance matrix must contain only "
ValueError: The condensed distance matrix must contain only finite values.
@nousiaso
Copy link

Hello ReneKat i experience exactly the same issue. And I did exactly what you did and got the same errors. So either our input table is wrong or we miss something

@ReneKat
Copy link
Author

ReneKat commented Jul 14, 2020

Hi @nousiaso,
Since the last line was an error in python I updated the python in my environment
conda update python -y

I just found this answer: biobakery/MetaPhlAn#87

The code i was running is actually different than my previous post:

hclust2.py -i merged_abundance_table.txt -o FCCHH.sqrt_scale.png --skip_rows 1 \
>   --ftop 50 \
>   --f_dist_f correlation \
>   --s_dist_f braycurtis \
>   --cell_aspect_ratio 9 \
>   -s --fperc 99 \
>   --flabel_size 4 \
>   --metadata_rows 2,3,4 \
>   --legend_file HMP.sqrt_scale.legend.png \
>   --max_flabel_len 100 \
>   --metadata_height 0.075 \
>   --minv 0.01 \
>   --no_slabels \
>   --dpi 300 \
>   --slinkage complete

And so when I removed the --skip_rows 1 the code finally ran.
Hopefully you have some success!

@nousiaso
Copy link

thanks a lot rene i will try it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants