Skip to content

Error in order samples #18

@bioinfo-dirty-jobs

Description

@bioinfo-dirty-jobs

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions