The bioBakery help forum

Hclust2.py error when generating heatmap

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!

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

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.

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