vaquerizaslab / fanc

FAN-C: Framework for the ANalysis of C-like data
GNU General Public License v3.0
107 stars 14 forks source link

Problem with `region` in `fanc/bin/fancplot` #170

Closed kalavattam closed 1 year ago

kalavattam commented 1 year ago

Hi,

Thank you for the great program, which I'm in the midst of learning to use. I'm trying to plot an .mcool file. I am running the following command:

#!/bin/bash

f_Q=08_zoom/MC-2019_Q_WT_repM.standard-rDNA-complete.mcool
res=6400

fancplot \
    -o "test.png" \
    XII:100000-200000 \
    -p square \
    --title "6400 bp, XII:100000-200000" \
    --colormap "germany" \
    "${f_Q}@${res}"

I am getting the following error message, which I'm finding difficult to troubleshoot:

/home/kalavatt/miniconda3/envs/fanc_env/bin/fancplot:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  __import__('pkg_resources').require('fanc==0.9.26')
2023-09-29 12:52:47,947 INFO Using non-interactive backend
2023-09-29 12:52:48,324 INFO Found 1 regions
/fh/fast/tsukiyama_t/grp/tsukiyamalab/kalavatt/2023_rDNA/src/fanc/bin/fancplot:187: UserWarning: There was an error with plot 0, region XII:100000-200000 (Traceback (most recent call last):
  File "/fh/fast/tsukiyama_t/grp/tsukiyamalab/kalavatt/2023_rDNA/src/fanc/bin/fancplot", line 170, in __init__
    fig, axes = gf.plot(plot_region)
                ^^^^^^^^^^^^^^^^^^^^
  File "/fh/fast/tsukiyama_t/grp/tsukiyamalab/kalavatt/2023_rDNA/src/fanc/fanc/plotting/plotter.py", line 211, in plot
    p.plot(r)
  File "/fh/fast/tsukiyama_t/grp/tsukiyamalab/kalavatt/2023_rDNA/src/fanc/fanc/plotting/base_plotter.py", line 786, in plot
    self._after_plot((x_region, y_region))
  File "/fh/fast/tsukiyama_t/grp/tsukiyamalab/kalavatt/2023_rDNA/src/fanc/fanc/plotting/base_plotter.py", line 581, in _after_plot
    self.add_colorbar()
  File "/fh/fast/tsukiyama_t/grp/tsukiyamalab/kalavatt/2023_rDNA/src/fanc/fanc/plotting/base_plotter.py", line 651, in add_colorbar
    self.update_colorbar(vmin=self.vmin, vmax=self.vmax, baseline=baseline)
  File "/fh/fast/tsukiyama_t/grp/tsukiyamalab/kalavatt/2023_rDNA/src/fanc/fanc/plotting/base_plotter.py", line 669, in update_colorbar
    self.colorbar.draw_all()
    ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Colorbar' object has no attribute 'draw_all'
)
  warnings.warn("There was an error with plot {}, region {}:{}-{} ({})".format(i, region.chromosome,
2023-09-29 12:52:48,514 WARNING 'Colorbar' object has no attribute 'draw_all'

I see that this is associated with these portion of code:

The file is for Hi-C from S. cerevisiae, which have chromosomes with roman-numeral names. I can confirm that the chromosome name "XII" is correct and the regions 100000–200000 exist and contain data. I can also confirm that the resolution 6400 exists in the .mcool.

Do you have any advice on troubleshooting this? Thanks. –Kris

kalavattam commented 1 year ago

Specifying vmin, vmax, and a matplotlib color (with argument -c) results in the same error:

#!/bin/bash

fancplot \
    -o "test.pdf" \
    XII:100000-200000 \
    -p square \
    -vmin 0 -vmax 0.1 \
    --title "6400 bp, XII:100000-200000" \
    -c Reds \
    08_zoom/MC-2019_Q_WT_repM.standard-rDNA-complete.mcool@6400
/home/kalavatt/miniconda3/envs/fanc_env/bin/fancplot:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  __import__('pkg_resources').require('fanc==0.9.26')
2023-09-29 13:14:42,151 INFO Using non-interactive backend
2023-09-29 13:14:42,582 INFO Found 1 regions
/fh/fast/tsukiyama_t/grp/tsukiyamalab/kalavatt/2023_rDNA/src/fanc/bin/fancplot:187: UserWarning: There was an error with plot 0, region XII:100000-200000 (Traceback (most recent call last):
  File "/fh/fast/tsukiyama_t/grp/tsukiyamalab/kalavatt/2023_rDNA/src/fanc/bin/fancplot", line 170, in __init__
    fig, axes = gf.plot(plot_region)
                ^^^^^^^^^^^^^^^^^^^^
  File "/fh/fast/tsukiyama_t/grp/tsukiyamalab/kalavatt/2023_rDNA/src/fanc/fanc/plotting/plotter.py", line 211, in plot
    p.plot(r)
  File "/fh/fast/tsukiyama_t/grp/tsukiyamalab/kalavatt/2023_rDNA/src/fanc/fanc/plotting/base_plotter.py", line 786, in plot
    self._after_plot((x_region, y_region))
  File "/fh/fast/tsukiyama_t/grp/tsukiyamalab/kalavatt/2023_rDNA/src/fanc/fanc/plotting/base_plotter.py", line 581, in _after_plot
    self.add_colorbar()
  File "/fh/fast/tsukiyama_t/grp/tsukiyamalab/kalavatt/2023_rDNA/src/fanc/fanc/plotting/base_plotter.py", line 651, in add_colorbar
    self.update_colorbar(vmin=self.vmin, vmax=self.vmax, baseline=baseline)
  File "/fh/fast/tsukiyama_t/grp/tsukiyamalab/kalavatt/2023_rDNA/src/fanc/fanc/plotting/base_plotter.py", line 669, in update_colorbar
    self.colorbar.draw_all()
    ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Colorbar' object has no attribute 'draw_all'
)
  warnings.warn("There was an error with plot {}, region {}:{}-{} ({})".format(i, region.chromosome,
2023-09-29 13:14:42,775 WARNING 'Colorbar' object has no attribute 'draw_all'
kaukrise commented 1 year ago

This should be fixed in the latest available version, 0.9.27

kalavattam commented 1 year ago

Thank you—updating from 0.9.26 (pip install of git clone http://www.github.com/vaquerizaslab/fanc) to 0.9.27 (pip install of file posted here) resolved the issue. Closing now.