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

TypeError: Dimensions of C (100, 50) are incompatible with X (51) and/or Y (100); see help(pcolormesh) #28

Open
pna059 opened this issue Aug 4, 2022 · 8 comments

Comments

@pna059
Copy link

pna059 commented Aug 4, 2022

Hi,
I am processing HiC-Pro (iced, split by chromosome) output to call TADs.
The tadtool tads work, but I don`t know how to determine the parameters without plot function.
However, i keep getting this error when using tadtool plot:

tadtool/bin/tadtool plot leaf_20000_iced_chr1H.matrix leaf_20000_iced_chr1H_abs.bed chr1H:1-1000000
[sudo] password for pavla: 
2022-08-05 08:58:40,039 INFO Loading regions...
2022-08-05 08:58:40,111 INFO Checking plotting region in matrix...
2022-08-05 08:58:40,111 INFO Loading matrix...
2022-08-05 08:59:14,519 INFO Getting window sizes...
2022-08-05 08:59:14,600 INFO Calculating index...
100% (100 of 100) |###################################################################################| Elapsed Time: 0:06:35 Time:  0:06:35
2022-08-05 09:05:51,284 INFO Done. Showing plot...
/usr/local/lib/python3.10/dist-packages/numpy-1.23.1-py3.10-linux-x86_64.egg/numpy/lib/function_base.py:4691: UserWarning: Warning: 'partition' will ignore the 'mask' of the MaskedArray.
  arr.partition(
Traceback (most recent call last):
  File "/home/pavla/Documents/Barley_HiC/Tadtool/tadtool/bin/tadtool", line 448, in <module>
    TADtool()
  File "/home/pavla/Documents/Barley_HiC/Tadtool/tadtool/bin/tadtool", line 44, in __init__
    getattr(self, args.command)()
  File "/home/pavla/Documents/Barley_HiC/Tadtool/tadtool/bin/tadtool", line 207, in plot
    fig, axes = tad_plot.plot(plotting_region)
  File "/usr/local/lib/python3.10/dist-packages/tadtool-0.82-py3.10.egg/tadtool/plot.py", line 677, in plot
  File "/usr/local/lib/python3.10/dist-packages/tadtool-0.82-py3.10.egg/tadtool/plot.py", line 202, in plot
  File "/usr/local/lib/python3.10/dist-packages/tadtool-0.82-py3.10.egg/tadtool/plot.py", line 357, in _plot
  File "/usr/local/lib/python3.10/dist-packages/matplotlib-3.5.2-py3.10-linux-x86_64.egg/matplotlib/__init__.py", line 1412, in inner
    return func(ax, *map(sanitize_sequence, args), **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/matplotlib-3.5.2-py3.10-linux-x86_64.egg/matplotlib/axes/_axes.py", line 6058, in pcolormesh
    X, Y, C, shading = self._pcolorargs('pcolormesh', *args,
  File "/usr/local/lib/python3.10/dist-packages/matplotlib-3.5.2-py3.10-linux-x86_64.egg/matplotlib/axes/_axes.py", line 5568, in _pcolorargs
    raise TypeError('Dimensions of C %s are incompatible with'
TypeError: Dimensions of C (100, 50) are incompatible with X (51) and/or Y (100); see help(pcolormesh)

The two input files look like this:

head leaf_20000_iced_chr1H_abs.bed 
chr1H	0	20000	1
chr1H	20000	40000	2
chr1H	40000	60000	3
chr1H	60000	80000	4
chr1H	80000	100000	5
chr1H	100000	120000	6
chr1H	120000	140000	7
chr1H	140000	160000	8
chr1H	160000	180000	9
chr1H	180000	200000	10

head leaf_20000_iced_chr1H.matrix
2	2	29.285
2	3	38.969
2	4	20.755
2	5	13.023
2	6	5.271
2	7	2.195
2	8	7.402
2	9	0.626
2	10	2.692
2	11	3.763

What can I do to make it working?

Thank you!

@pna059 pna059 changed the title ValueError: output array is read-only TypeError: Dimensions of C (100, 50) are incompatible with X (51) and/or Y (100); see help(pcolormesh) Aug 5, 2022
@porpheria
Copy link

Hello,
I am also having the same error, while using the tadtool plot.
Is there any update regarding this ?

@kaukrise
Copy link
Collaborator

kaukrise commented Nov 15, 2022

Thanks for reminding me of this. Please try version 0.83 from Pypi

pip install tadtool==0.83

@porpheria
Copy link

Thank you for your quick reply.
tadtool plot is working now. Thanks once again.

@porpheria
Copy link

Hello again,
I am facing another issue for tadtool plot.
While using the -w option for providing the custom window size, I am having this below error.
"ValueError: Cannot load file containing pickled data when allow_pickle=False".
I was providing a text file with two window size, 100000 and 200000, separated by space.
Thank you in advance.

@kaukrise
Copy link
Collaborator

Can you please post the complete error? It contains valuable information for debugging.

@porpheria
Copy link

porpheria commented Nov 15, 2022

Below is the command I used and the error,

porpheria$ tadtool plot siCon_Un_Rep2n3_chr1.matrix siCon_Un_Rep2n3_chr1_abs.bed chr1:30500000-40500000 -n 248956422 -w WindowSize.txt
2022-11-15 14:30:12,677 INFO Loading regions...
2022-11-15 14:30:12,767 INFO Checking plotting region in matrix...
2022-11-15 14:30:12,768 INFO Loading matrix...
2022-11-15 14:30:17,598 INFO Getting window sizes...
Traceback (most recent call last):
File "/Users/porpheria/miniconda3/envs/Tadtool/bin/tadtool", line 448, in
TADtool()
File "/Users/porpheria/miniconda3/envs/Tadtool/bin/tadtool", line 44, in init
getattr(self, args.command)()
File "/Users/porpheria/miniconda3/envs/Tadtool/bin/tadtool", line 163, in plot
window_sizes = np.load(args.window_sizes[0])
File "/Users/porpheria/miniconda3/envs/Tadtool/lib/python3.9/site-packages/numpy/lib/npyio.py", line 418, in load
raise ValueError("Cannot load file containing pickled data "
ValueError: Cannot load file containing pickled data when allow_pickle=False

@kaukrise
Copy link
Collaborator

Thanks for bringing this to my attention, it seems as though numpy changed one of the exception types. I uploaded version 0.84, which should work with window size files again.

@porpheria
Copy link

Thank you Kaukrise,
It's working fine withe window size file.

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

3 participants