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

Heatmap generation fails #54

Open
mherold1 opened this issue Dec 2, 2016 · 2 comments
Open

Heatmap generation fails #54

mherold1 opened this issue Dec 2, 2016 · 2 comments

Comments

@mherold1
Copy link

mherold1 commented Dec 2, 2016

Hi,

I'm using the v.1.11 release, installed in a virtual environment alongisde the python dependencies, using python 2.7.3.

It works until heatmap generation, I get the following error message:

[...]
running heatmap generation
traitar/local/lib/python2.7/site-packages/matplotlib/colorbar.py:789: RuntimeWarning: divide by zero encountered in double_scalars
  automin = (y[2] - y[1]) / clen
traitar/local/lib/python2.7/site-packages/matplotlib/colorbar.py:790: RuntimeWarning: divide by zero encountered in double_scalars
  automax = (y[-2] - y[-3]) / clen
Traceback (most recent call last):
  File "traitar/bin/heatmap.py", line 482, in <module>
    heatmap(matrix, row_header, column_header, primary_pt_models, args.color_f, args.row_method, args.column_method, args.row_metric, args.column_metric,   args.out_f, args.sample_f, secondary_pt_models)
  File "traitar/bin/heatmap.py", line 288, in heatmap
    cb = mpl.colorbar.ColorbarBase(axsl, cmap=cmap_p, norm=norm, spacing='proportional', ticks=bounds, boundaries=bounds)
  File "traitar/local/lib/python2.7/site-packages/matplotlib/colorbar.py", line 323, in __init__
    self.draw_all()
  File "traitar/local/lib/python2.7/site-packages/matplotlib/colorbar.py", line 346, in draw_all
    X, Y = self._mesh()
  File "traitar/local/lib/python2.7/site-packages/matplotlib/colorbar.py", line 814, in _mesh
    y = self._proportional_y()
  File "traitar/local/lib/python2.7/site-packages/matplotlib/colorbar.py", line 789, in _proportional_y
    automin = (y[2] - y[1]) / clen
IndexError: index 2 is out of bounds for axis 0 with size 2
traitar/local/lib/python2.7/site-packages/matplotlib/colorbar.py:789: RuntimeWarning: divide by zero encountered in double_scalars
  automin = (y[2] - y[1]) / clen
traitar/local/lib/python2.7/site-packages/matplotlib/colorbar.py:790: RuntimeWarning: divide by zero encountered in double_scalars
  automax = (y[-2] - y[-3]) / clen
Traceback (most recent call last):
  File "traitar/bin/heatmap.py", line 482, in <module>
    heatmap(matrix, row_header, column_header, primary_pt_models, args.color_f, args.row_method, args.column_method, args.row_metric, args.column_metric,   args.out_f, args.sample_f, secondary_pt_models)
  File "traitar/bin/heatmap.py", line 288, in heatmap
    cb = mpl.colorbar.ColorbarBase(axsl, cmap=cmap_p, norm=norm, spacing='proportional', ticks=bounds, boundaries=bounds)
  File "traitar/local/lib/python2.7/site-packages/matplotlib/colorbar.py", line 323, in __init__
    self.draw_all()
  File "traitar/local/lib/python2.7/site-packages/matplotlib/colorbar.py", line 346, in draw_all
    X, Y = self._mesh()
  File "traitar/local/lib/python2.7/site-packages/matplotlib/colorbar.py", line 814, in _mesh
    y = self._proportional_y()
  File "traitar/local/lib/python2.7/site-packages/matplotlib/colorbar.py", line 789, in _proportional_y
    automin = (y[2] - y[1]) / clen
IndexError: index 2 is out of bounds for axis 0 with size 2
Traceback (most recent call last):
  File "traitar/bin/heatmap.py", line 482, in <module>
    heatmap(matrix, row_header, column_header, primary_pt_models, args.color_f, args.row_method, args.column_method, args.row_metric, args.column_metric,   args.out_f, args.sample_f, secondary_pt_models)
  File "traitar/bin/heatmap.py", line 288, in heatmap
    cb = mpl.colorbar.ColorbarBase(axsl, cmap=cmap_p, norm=norm, spacing='proportional', ticks=bounds, boundaries=bounds)
  File "traitar/local/lib/python2.7/site-packages/matplotlib/colorbar.py", line 323, in __init__
    self.draw_all()
  File "traitar/local/lib/python2.7/site-packages/matplotlib/colorbar.py", line 346, in draw_all
    X, Y = self._mesh()
  File "traitar/local/lib/python2.7/site-packages/matplotlib/colorbar.py", line 814, in _mesh
    y = self._proportional_y()
  File "traitar/local/lib/python2.7/site-packages/matplotlib/colorbar.py", line 789, in _proportional_y
    automin = (y[2] - y[1]) / clen
IndexError: index 2 is out of bounds for axis 0 with size 2

I am using the following command:

traitar phenotype traitar_lao traitar_lao_sub/samples.txt from_genes traitar_lao_sub_OUT/ -c 1

For the test data set heatmap generation works.

Attached a subset of the dataset I'm using (first 4 samples instead of 33), as otherwise the file couldn't be uploaded.
traitar_lao_sub.zip

Is this maybe related to the fact that I only have 1 category in the samples.txt file?

@mherold1
Copy link
Author

mherold1 commented Dec 2, 2016

Is this maybe related to the fact that I only have 1 category in the samples.txt file?

This seemed indeed to be the reason for the above error. I changed categories in the samples.txt file from env1 for all to something specific for each sample and it worked. (unless there are more than 15 categories)

@aweimann
Copy link
Owner

aweimann commented Dec 5, 2016

Thanks a lot for reporting that issue. I will add an additional check of the samples file in the next version of Traitar. In the mean time this walk around should work fine (I will take a look into the > 15 categories problem).

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