-
Notifications
You must be signed in to change notification settings - Fork 70
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
hicPlotMatrix cannot be --log transformed #359
Comments
Hi, can you try Best, Joachim |
Dont give it vmin and vmax and run the default to see the range of your values. |
@LeilyR Right, I haven't saw that. First, Hi-C uses count data which can never be smaller 0. Second, the log function is not defined for negative values. |
The -2 to 2 is an observed vs. expected matrix, and so log2 transforming it is appropirate for it, as that matrix has fully positive values ranging from 0.02 to 100 (or so). So log2 transforming it makes perfect sense. Anyway, having a --vMin and --vMax, and a --log flag kicks back an issue:
Then, changing some of the other commands gave varying results:
gave a matrix that was fully black (max scale)
It certainly seems like the log transform function is not working or not being applied correctly... I hope these conditions help diagnose the problem. |
PS. the "--log1p" flag kicks back a similar error: "float division by zero" |
An observed / expect matrix can never have values < 0. The log transformed of it can have values <0, you are right here. However, using vMin and vMax the interaction counts are first transformed to vMin/vMax value range and in a second step the Log function is applied. The Log is a log10 and not a log2.
Expected behaviour, the difference in the values diagonal vs off-diagonal are so large that all other, smaller differences in the count data is not displayed. Therefore log or log1p should be used. The rest I have to test it on my own and check src, can take a while. |
Thanks for clarifying the order of operations within the program; that helps to make sense for why the vMin/vMax are applied first and gave heatmaps with count ranges for the vMin/vMax, and then the log10 (not log2; sorry, my mistake) function seems to have an error. I have always used the log10 function to display my data. Thanks for looking into the error. |
Hi,
I am running hicexplorer=2.2.2 (latest version??), with all the dependencies updated, on a MacOS 10.12.6. I can plot a heatmap from a matrix just fine (without log tranformation):
hicPlotMatrix --matrix my-matrix.h5 --colorMap coolwarm --chromosomeOrder chromosome-2 --vMin -2 --vMax 2 --dpi 300 --outFileName my-matrix-pic.png
and it gives a picture.
but if I go to --log tranform it
hicPlotMatrix --matrix my-matrix.h5 --colorMap coolwarm --chromosomeOrder chromosome-2 --vMin -2 --vMax 2 --dpi 300 --log --outFileName my-matrix-pic.png
it runs into this error:
Traceback (most recent call last): File "/Users/my-computer/anaconda2/bin/hicPlotMatrix", line 7, in <module> main() File "/Users/my-computer/anaconda2/lib/python2.7/site-packages/hicexplorer/hicPlotMatrix.py", line 614, in main start_pos=start_pos1, start_pos2=start_pos2, pNorm=norm, pAxis=ax1, pBigwig=bigwig_info) File "/Users/my-computeranaconda2/lib/python2.7/site-packages/hicexplorer/hicPlotMatrix.py", line 241, in plotHeatmap cbar = fig.colorbar(img3, cax=cax) File "/Users/my-computer/anaconda2/lib/python2.7/site-packages/matplotlib/figure.py", line 2098, in colorbar cb = cbar.colorbar_factory(cax, mappable, **cb_kw) File "/Users/my-computeranaconda2/lib/python2.7/site-packages/matplotlib/colorbar.py", line 1399, in colorbar_factory cb = Colorbar(cax, mappable, **kwargs) File "/Users/my-computer/anaconda2/lib/python2.7/site-packages/matplotlib/colorbar.py", line 945, in __init__ ColorbarBase.__init__(self, ax, **kw) File "/Users/my-computer/anaconda2/lib/python2.7/site-packages/matplotlib/colorbar.py", line 327, in __init__ self.draw_all() File "/Users/my-computer/anaconda2/lib/python2.7/site-packages/matplotlib/colorbar.py", line 353, in draw_all self._config_axes(X, Y) File "/Users/my-computer/anaconda2/lib/python2.7/site-packages/matplotlib/colorbar.py", line 461, in _config_axes self.update_ticks() File "/Users/my-computeranaconda2/lib/python2.7/site-packages/matplotlib/colorbar.py", line 378, in update_ticks ticks, ticklabels, offset_string = self._ticker() File "/Users/my-computer/anaconda2/lib/python2.7/site-packages/matplotlib/colorbar.py", line 622, in _ticker b = np.array(locator()) File "/Users/my-computeranaconda2/lib/python2.7/site-packages/matplotlib/ticker.py", line 2098, in __call__ return self.tick_values(vmin, vmax) File "/Users/my-computer/anaconda2/lib/python2.7/site-packages/matplotlib/ticker.py", line 2124, in tick_values "Data has no positive values, and therefore can not be " ValueError: Data has no positive values, and therefore can not be log-scaled.
Even though it looks like my matplotlib is the error, I am running version 2.2.3
Any ideas would be most helpful.
The text was updated successfully, but these errors were encountered: