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

Error in order samples #18

Open
bioinfo-dirty-jobs opened this issue Oct 25, 2021 · 0 comments
Open

Error in order samples #18

bioinfo-dirty-jobs opened this issue Oct 25, 2021 · 0 comments

Comments

@bioinfo-dirty-jobs
Copy link

I would like to plot mutation and other categorical data. I'm not able to use the sample order. I use object type but not working this is the code and the error:

sample_order=list(all_plusrna['ID'])
sample_order
['Sample361',
 'Sample671',
 'Sample646',
 'Sample677',
 'Sample675',
 'Sample662']


aut_comut = comut.CoMut()
# define order of comut BEFORE any data is added
aut_comut.samples = sample_order
aut_comut.add_categorical_data(mut2, name='Mutation')

aut_comut.plot_comut()

typeError: 'int' object is not iterable
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/tmp/ipykernel_3276/2140078995.py in <module>
      4 aut_comut.add_categorical_data(mut2, name='Mutation')
      5 
----> 6 aut_comut.plot_comut()

~/anaconda3/envs/beatrix/lib/python3.9/site-packages/comut/comut.py in plot_comut(self, fig, spec, x_padding, y_padding, tri_padding, heights, hspace, subplot_hspace, widths, wspace, structure, figsize)
   1496                 plot_name = plot[0]
   1497                 ax = fig.add_subplot(spec[num_subplots - i - 1, comut_idx], sharex=sharex)
-> 1498                 ax = self._plot_data_on_axis(ax=ax, plot_name=plot_name, x_padding=x_padding, y_padding=y_padding, tri_padding=tri_padding)
   1499 
   1500                 # extract all sideplots on this axis

~/anaconda3/envs/beatrix/lib/python3.9/site-packages/comut/comut.py in _plot_data_on_axis(self, ax, plot_name, x_padding, y_padding, tri_padding)
   1188             borders = self._plots[plot_name]['borders'] if plot_type == 'categorical' else []
   1189             tick_style = self._plots[plot_name]['tick_style']
-> 1190             ax = self._plot_patch_data(ax=ax, data=data, name=plot_name, mapping=mapping, borders=borders,
   1191                                       x_padding=x_padding, y_padding=y_padding, tri_padding=tri_padding,
   1192                                       tick_style=tick_style)

~/anaconda3/envs/beatrix/lib/python3.9/site-packages/comut/comut.py in _plot_patch_data(self, ax, data, name, mapping, borders, tick_style, x_padding, y_padding, tri_padding)
    731                 x_base, y_base = j + x_padding, i + y_padding
    732 
--> 733                 cell_tuple = tuple(data.iloc[i, j])
    734 
    735                 # remove box borders from cell tuple

TypeError: 'int' object is not iterable

I use this version:

Python version:
3.9.7 | packaged by conda-forge | (default, Sep  2 2021, 17:58:34) 
[GCC 9.4.0]

matplotlib version: 3.4.3
pandas version: 1.3.3
numpy version: 1.21.2

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

1 participant