vaquerizaslab / fanc

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

fancplot / -region parameter : KeyError #155

Open matteozoia4 opened 1 year ago

matteozoia4 commented 1 year ago

Dear FAN-C providers,

I am encountering an issue while trying to plot my .cool file via fancplot. As I understood in the latest FAN-C version, .cool files can be employed as inputs. I unfortunately find a mismatch/error while setting the chr:start-end region format syntax.

Here I share the insulation and .cool files download, coupled to the error details.

Many thanks for your help!

Ps: Let me know whether the link works properly.

fancplot -o /../LB_insulation.png chr3:65.1mb-68.6mb \
-p triangular /../LB_5kb.cool -m 3500000 -vmin 0 -vmax 0.05 \
-p scores /../LB_5kb.insulation
2023-04-22 14:04:06,489 INFO Using non-interactive backend
2023-04-22 14:04:09,298 INFO Found 1 regions
/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/fanc/bin/fancplot:187: UserWarning: There was an error with plot 0, region chr3:65099999-68600000 (Traceback (most recent call last):
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/venv/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3652, in get_loc
    return self._engine.get_loc(casted_key)
  File "pandas/_libs/index.pyx", line 147, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/index.pyx", line 176, in pandas._libs.index.IndexEngine.get_loc
  File "pandas/_libs/hashtable_class_helper.pxi", line 7080, in pandas._libs.hashtable.PyObjectHashTable.get_item
  File "pandas/_libs/hashtable_class_helper.pxi", line 7088, in pandas._libs.hashtable.PyObjectHashTable.get_item
**KeyError: 'chr3'**

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/venv/lib/python3.9/site-packages/cooler/util.py", line 164, in parse_region
    clen = chromsizes[chrom] if chromsizes is not None else None
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/venv/lib/python3.9/site-packages/pandas/core/series.py", line 1012, in __getitem__
    return self._get_value(key)
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/venv/lib/python3.9/site-packages/pandas/core/series.py", line 1121, in _get_value
    loc = self.index.get_loc(label)
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/venv/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3654, in get_loc
    raise KeyError(key) from err
KeyError: 'chr3'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/fanc/fanc/compatibility/cooler.py", line 355, in _region_subset
    df = self.bins().fetch(query)
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/venv/lib/python3.9/site-packages/cooler/core/_selectors.py", line 115, in fetch
    lo, hi = self._fetch(*args, **kwargs)
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/venv/lib/python3.9/site-packages/cooler/api.py", line 268, in _fetch
    parse_region(region, self._chromsizes),
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/venv/lib/python3.9/site-packages/cooler/util.py", line 166, in parse_region
    raise ValueError(f"Unknown sequence label: {chrom}") from e
ValueError: Unknown sequence label: chr3

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/fanc/bin/fancplot", line 170, in __init__
    fig, axes = gf.plot(plot_region)
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/fanc/fanc/plotting/plotter.py", line 211, in plot
    p.plot(r)
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/fanc/fanc/plotting/base_plotter.py", line 292, in plot
    plot_output = self._plot(region)
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/fanc/fanc/plotting/hic_plotter.py", line 509, in _plot
    self._refresh(region)
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/fanc/fanc/plotting/hic_plotter.py", line 556, in _refresh
    x_, y_, hm = self._mesh_data(region)
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/fanc/fanc/plotting/hic_plotter.py", line 528, in _mesh_data
    hm = self.hic_buffer.get_matrix(region, region)
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/fanc/fanc/plotting/hic_plotter.py", line 143, in get_matrix
    self._BUFFERING_STRATEGIES[self.buffering_strategy](self, *regions)
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/fanc/fanc/plotting/hic_plotter.py", line 183, in _buffer_relative
    self.buffered_matrix = self.data.matrix(tuple(self.buffered_region),
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/fanc/fanc/matrix.py", line 1023, in matrix
    row_regions, col_regions, matrix_entries = self.regions_and_matrix_entries(key,
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/fanc/fanc/matrix.py", line 963, in regions_and_matrix_entries
    row_regions, col_regions, edges_iter = self.regions_and_edges(key, *args, **kwargs)
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/fanc/fanc/matrix.py", line 869, in regions_and_edges
    row_regions = list(row_regions)
  File "/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/fanc/fanc/compatibility/cooler.py", line 358, in _region_subset
    chromosome_end = self.chromosome_lengths[region.chromosome]
KeyError: 'chr3'
)
  warnings.warn("There was an error with plot {}, region {}:{}-{} ({})".format(i, region.chromosome,
2023-04-22 14:04:09,592 WARNING 'chr3'
Closing remaining open files:/data/projects/p616_Cis-regulatory_landscapes_in_heart_development/hdf5-build/hdf5-1.8.23/fanc/LB_5kb.insulation...done
kaukrise commented 1 year ago

Hi, I did not yet receive a link to the files - did you send it to me elsewhere?

Please also have a look here for Cooler syntax in FAN-C: https://fan-c.readthedocs.io/en/latest/fanc-executable/compatibility.html

matteozoia4 commented 1 year ago

Dear Vaquerizaslab,

I was not sure the attached link worked properly on the page indeed.

I could visualise it but then it was not visible in the final page - while editing it was still visible to me though.

Here the files I tried to use, it is probably an issue in the region asked to be plotted but for me it was fine using those coordinates with previous tool.

My best regards and many thanks for your time,

MZ

Matteo Zoia, Ph.D. Student Gene Regulation & Cardiac Development Osterwalder Lab Department for BioMedical Research (DBMR) University of Bern Murtenstrasse 28, 369 CH - 3008 Bern SWITZERLAND


Da: kaukrise @.***> Inviato: martedì, 25. aprile 2023 07:57:22 A: vaquerizaslab/fanc Cc: Zoia, Matteo (DBMR); Author Oggetto: Re: [vaquerizaslab/fanc] fancplot / -region parameter : KeyError (Issue #155)

Hi, I did not yet receive a link to the files - did you send it to me elsewhere?

Please also have a look here for Cooler syntax in FAN-C: https://fan-c.readthedocs.io/en/latest/fanc-executable/compatibility.html

— Reply to this email directly, view it on GitHubhttps://github.com/vaquerizaslab/fanc/issues/155#issuecomment-1521191770, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUBHT3D6LJ2NSDJSPRVTN4LXC5RUFANCNFSM6AAAAAAXH27PQU. You are receiving this because you authored the thread.Message ID: @.***>

kaukrise commented 1 year ago

There are still no files - my best guess is that it is 3 and not chr3.

matteozoia4 commented 1 year ago

I shared within the previous mail the files. The format is not accepted as attachment in github.

I can try with a WeTransfer link then.

Best,

M.

Matteo Zoia, Ph.D. Student Gene Regulation & Cardiac Development Osterwalder Lab Department for BioMedical Research (DBMR) University of Bern Murtenstrasse 28, 369 CH - 3008 Bern SWITZERLAND


Da: kaukrise @.***> Inviato: martedì, 25. aprile 2023 09:17:31 A: vaquerizaslab/fanc Cc: Zoia, Matteo (DBMR); Author Oggetto: Re: [vaquerizaslab/fanc] fancplot / -region parameter : KeyError (Issue #155)

There are still no files - my best guess is that it is 3 and not chr3.

— Reply to this email directly, view it on GitHubhttps://github.com/vaquerizaslab/fanc/issues/155#issuecomment-1521272210, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUBHT3CG64LFLYKA6OWDESLXC53AXANCNFSM6AAAAAAXH27PQU. You are receiving this because you authored the thread.Message ID: @.***>

kaukrise commented 1 year ago

There was also no email attachment

matteozoia4 commented 1 year ago

Answering to the message by mail (not directly on the GitHub interface) I was able to attach the files but afterwards are not visible here indeed, my bad. I answer directly on the GitHub window now hoping with this link it will be possible.

https://we.tl/t-AGovLIH7TD

Many thanks for your time!

kaukrise commented 1 year ago

It is as I wrote above, the chromosome name in the file is 3, not chr3:

fancplot 3:65.1mb-68.6mb -p triangular LB_5kb.cool -vmin 0 -vmax 0.01
Screenshot 2023-04-25 at 09 57 43
matteozoia4 commented 1 year ago

I tried to employ the "3" alone but for me it was still not plotting.

I am currently working with the latest FAN-C version following HDF5 installation as suggested.

May I have used an obsolete plotting command?

I will try again and eventually re-install.

Thank you so much for your time!

My best regards,

MZ

Matteo Zoia, Ph.D. Student Gene Regulation & Cardiac Development Osterwalder Lab Department for BioMedical Research (DBMR) University of Bern Murtenstrasse 28, 369 CH - 3008 Bern SWITZERLAND


Da: kaukrise @.***> Inviato: martedì, 25. aprile 2023 09:59:04 A: vaquerizaslab/fanc Cc: Zoia, Matteo (DBMR); Author Oggetto: Re: [vaquerizaslab/fanc] fancplot / -region parameter : KeyError (Issue #155)

It is as I wrote above, the chromosome name in the file is 3, not chr3:

fancplot 3:65.1mb-68.6mb -p triangular LB_5kb.cool -vmin 0 -vmax 0.01

[Screenshot 2023-04-25 at 09 57 43]https://user-images.githubusercontent.com/1540112/234212441-20939daf-fbf9-4772-b1c2-d490f79056c5.png

— Reply to this email directly, view it on GitHubhttps://github.com/vaquerizaslab/fanc/issues/155#issuecomment-1521337790, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUBHT3GT6U6BADKIDK3NWDLXC574RANCNFSM6AAAAAAXH27PQU. You are receiving this because you authored the thread.Message ID: @.***>