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

HicPlotDistVSCount fail : local variable 'lgd' referenced before assignement #836

Open Mia0509 opened 1 year ago

Mia0509 commented 1 year ago

Hello, I was using HicPlotDistVSCount and got the following error :

Command executed:

  hicPlotDistVsCounts --matrices HIC_ES_4.250000_balanced.cool                         --plotFile HIC_ES_4_distcount.png                         --outFileData HIC_ES_4_distcount.txt

Command exit status:
  1

Command output:
  (empty)

Command error:
  INFO:hicexplorer.hicPlotDistVsCounts:processing chromosome all

  INFO:hicexplorer.hicPlotDistVsCounts:The scale factors used are: {'HIC_ES_4.250000_balanced.cool': 1.0}
  Traceback (most recent call last):
    File "/usr/local/bin/hicPlotDistVsCounts", line 7, in <module>
      main()
    File "/usr/local/lib/python3.9/site-packages/hicexplorer/hicPlotDistVsCounts.py", line 516, in main
      plt.savefig(args.plotFile.name, bbox_inches='tight', bbox_extra_artists=(lgd,))
  UnboundLocalError: local variable 'lgd' referenced before assignment

I assume it's caused by non entering the for loop line 507 and then lgd is never initialized.

Maybe we can add a small check before plotting? Like if lgd is None : ... ?

ieres-amgen commented 1 year ago

I encountered the exact same error; has there been any fix for this? Thanks!

ieres-amgen commented 1 year ago

FYI, the error seems sporadic--it did not occur in a re-run using the exact same data & parameters.

Mia0509 commented 1 year ago

FYI, the error seems sporadic--it did not occur in a re-run using the exact same data & parameters.

I'm using a nextflow pipeline and I keep having this error, even when re-rennig using -resume

This is the nf-core/hic pipeline, I am using the up to date version. But funny thing, when running it with nf-core I don't have this error (with the exact same data and parameters).

nservant commented 1 year ago

Hi @Mia0509, I indeed have the same error while testing the next version of the nf-core-hic pipeline.
And I did not find any solution so far to fix it ... I'm not sure to understand what you mean by "when running it with nf-core I don't have this error" ? Thanks Nicolas

Mia0509 commented 1 year ago

Hi @Mia0509, I indeed have the same error while testing the next version of the nf-core-hic pipeline. And I did not find any solution so far to fix it ... I'm not sure to understand what you mean by "when running it with nf-core I don't have this error" ? Thanks Nicolas

Hi @nservant, When I run nextflow run nf-core/hic -profile docker,test -r 2.0.0 outside my pulled repo of the pipeline, it works well. I guess the version that is directly pulled form nf-core works well, but I don't know why.

Actually when running the exact same command in the git directory of the pipeline, it fails.