# Hclust2.py error when generating heatmap

**URL:** <https://forum.biobakery.org/t/hclust2-py-error-when-generating-heatmap/1075>\
**Category:** MetaPhlAn\
**Created:** [September 24, 2020, 11:49am UTC](https://forum.biobakery.org/t/hclust2-py-error-when-generating-heatmap/1075 "2020-09-24T11:49:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mars](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/mars/32/1295_2.png) [@mars](https://forum.biobakery.org/u/mars)\
**Post date:** [September 24, 2020, 11:49am UTC](https://forum.biobakery.org/t/hclust2-py-error-when-generating-heatmap/1075/1 "2020-09-24T11:49:04Z")

</div>

Hi,

I have two projects that I used metaphlan to analyze and merge the abundance tables. Strangely, with one project, I do get the .png file showing heatmap. However, for the second project, I get the following error:

Traceback (most recent call last):  
File “/home/gencore/anaconda3/envs/mpa/bin/hclust2.py”, line 825, in   
hclust2\_main()  
File “/home/gencore/anaconda3/envs/mpa/bin/hclust2.py”, line 803, in hclust2\_main  
cl.shcluster()  
File “/home/gencore/anaconda3/envs/mpa/bin/hclust2.py”, line 380, in shcluster  
self.shclusters = sph.linkage(self.s\_dm, method=self.args.slinkage)  
File “/home/gencore/anaconda3/envs/mpa/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.

Not sure why it works for the one but not for the other even though I generated abundance tables exactly with the same method and even at the same time.

Please help in solving this issue. Many thanks in advance!

---

<div class="post-metadata">

**Author:** ![fbeghini](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/fbeghini/32/81_2.png) [@fbeghini](https://forum.biobakery.org/u/fbeghini)\
**Post date:** [September 28, 2020, 8:17am UTC](https://forum.biobakery.org/t/hclust2-py-error-when-generating-heatmap/1075/2 "2020-09-28T08:17:06Z")

</div>

Can you post the exact command line you used for running hclust2?

---

<div class="post-metadata">

**Author:** ![mars](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/mars/32/1295_2.png) [@mars](https://forum.biobakery.org/u/mars)\
**Post date:** [October 1, 2020, 11:36am UTC](https://forum.biobakery.org/t/hclust2-py-error-when-generating-heatmap/1075/3 "2020-10-01T11:36:09Z")

</div>

Dear fbeghini,

I had one file with zero count, therefore, I was getting this error. After excluding that file, I was able to generate heatmap. Thank you for your time.

---

<div class="post-metadata">

**Author:** ![paulokoroc](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@paulokoroc](https://forum.biobakery.org/u/paulokoroc)\
**Post date:** [October 2, 2020, 2:36pm UTC](https://forum.biobakery.org/t/hclust2-py-error-when-generating-heatmap/1075/4 "2020-10-02T14:36:54Z")

</div>

Hi,  
I am using the biobakery (Installed with the Basic Usage guide) for the first time, and following the metaphlan3 tutorial. However, on trying to create heatmap with hclust2 with the following code;

hclust2 -i merged\_abundance\_table\_species.txt -o abundance\_heatmap\_species.png --f\_dist\_f braycurtis --s\_dist\_f braycurtis --cell\_aspect\_ratio 0.5 -l --flabel\_size 10 --slabel\_size 10 --max\_flabel\_len 100 --max\_slabel\_len 100 --minv 0.1 --dpi 300

I got the following error;

Traceback (most recent call last):  
File “/usr/local/bin/hclust2”, line 11, in   
sys.exit(hclust2\_main())  
File “/usr/local/lib/python3.6/dist-packages/hclust2.py”, line 788, in hclust2\_main  
distm.compute\_s\_dists()  
File “/usr/local/lib/python3.6/dist-packages/hclust2.py”, line 277, in compute\_s\_dists  
if args.load\_pickled\_dist\_matrix\_s:  
NameError: name ‘args’ is not defined

I then skipped the above step, and went to create a cladogram with GraPhLAn.  
I ran the following code;

export2graphlan.py --skip\_rows 1 -i merged\_abundance\_table\_reformatted.txt --tree merged\_abundance.tree.txt --annotation merged\_abundance.annot.txt --most\_abundant 100 --abundance\_threshold 1 --least\_biomarkers 10 --annotations 5,6 --external\_annotations 7 --min\_clade\_size 1

And got the following error;

Traceback (most recent call last):  
File “/usr/local/bin/export2graphlan.py”, line 11, in   
from hclust2 import DataMatrix  
ImportError: No module named hclust2

Please, how do I go about resolving this?

Thank you
