deeptools / HiCExplorer

HiCExplorer is a powerful and easy to use set of tools to process, normalize and visualize Hi-C data.
https://hicexplorer.readthedocs.org
GNU General Public License v3.0
233 stars 70 forks source link

diagnostic plot #602

Closed LeilyR closed 4 years ago

LeilyR commented 4 years ago

hicCorrectMatrix diagnostic_plot -m HiC_matrices/matrix.cool -o HiC_matrices/diagnostic_plot.pdf

Traceback (most recent call last):
  File "/package/anaconda3/envs/6e9a864907ee9a26a372a0947ad77cf4/bin/hicCorrectMatrix", line 7, in <module>
    main()
  File "/package/anaconda3/envs/6e9a864907ee9a26a372a0947ad77cf4/lib/python3.7/site-packages/hicexplorer/hicCorrectMatrix.py", line 627, in main
    plot_total_contact_dist(ma, args)
  File "/package/anaconda3/envs/6e9a864907ee9a26a372a0947ad77cf4/lib/python3.7/site-packages/hicexplorer/hicCorrectMatrix.py", line 531, in plot_total_contact_dist
    plot_histogram(row_sum, mad, ax)
  File "/package/anaconda3/envs/6e9a864907ee9a26a372a0947ad77cf4/lib/python3.7/site-packages/hicexplorer/hicCorrectMatrix.py", line 465, in plot_histogram
    ax2.set_xlim(mad_values.value_to_mad(np.array(ax1.get_xlim())))
  File "/package/anaconda3/envs/6e9a864907ee9a26a372a0947ad77cf4/lib/python3.7/site-packages/matplotlib/axes/_base.py", line 3297, in set_xlim
    left = self._validate_converted_limits(left, self.convert_xunits)
  File "/package/anaconda3/envs/6e9a864907ee9a26a372a0947ad77cf4/lib/python3.7/site-packages/matplotlib/axes/_base.py", line 3214, in _validate_converted_limits
    raise ValueError("Axis limits cannot be NaN or Inf")
ValueError: Axis limits cannot be NaN or Inf
LeilyR commented 4 years ago

Update: The reason was that row_sum = row_sum[modified_z_score < 5] returned an empty [] because modified_z_score == [nan ... nan]. The input matrix was really sparse so I suspect that was the reason. I think throwing some meaningful error message would be enough.

joachimwolff commented 4 years ago

Should be fixed with release 3.5.2. Please reopen if the error still occurs.