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

SampCompDB plot position error #193

Open
samir-watson opened this issue Nov 4, 2021 · 2 comments
Open

SampCompDB plot position error #193

samir-watson opened this issue Nov 4, 2021 · 2 comments

Comments

@samir-watson
Copy link

Hi,
I've upgraded to the newest version of nanocompore which I installed using the conda installation and I'm now getting an error when I try to use the db.plot_position function using the code

pl.rcParams['lines.linewidth'] = 3
fig, ax = db.plot_position ("ENST00000215754.8", palette= "Set1", pos=513, scatter = False,alpha = 0.8, ylim = (-3, 3), xlim = (-2, 2))
ax.set_facecolor('white')
ax.spines['bottom'].set_color('black')
ax.spines['left'].set_color('black')

It also gives me an error if i just use the minimal code fig, ax = db.plot_position ("ENST00000215754.8", pos=513)

It seems there might be a problem with seaborn as it gives the following warning:

/home/samirwatson/miniconda3/envs/nanocompore_stable2/lib/python3.7/site-packages/seaborn/distributions.py:1681: FutureWarning: Use x and y rather than data and data2
  warnings.warn(msg, FutureWarning)
IndexError                                Traceback (most recent call last)
<ipython-input-4-9ad3f7175770> in <module>
      1 pl.rcParams['lines.linewidth'] = 3
----> 2 fig, ax = db.plot_position ("ENST00000215754.8", palette= "Set1", pos=513, scatter = False,alpha = 0.8, ylim = (-3, 3), xlim = (-2, 2))
      3 ax.set_facecolor('white')
      4 ax.spines['bottom'].set_color('black')
      5 ax.spines['left'].set_color('black')


~/miniconda3/envs/nanocompore_stable2/lib/python3.7/site-packages/nanocompore/SampCompDB.py in plot_position(self, ref_id, pos, split_samples, figsize, palette, plot_style, xlim, ylim, alpha, pointSize, scatter, kde, model, gmm_levels)
    868                         cmap=sns.light_palette(d["color"], as_cmap=True),
    869                         ax=ax,
--> 870                         clip=((min(d["intensity"]), max(d["intensity"])), (min(d["dwell"]),max(d["dwell"]))))
    871                 if scatter:
    872                     _ = ax.scatter(

~/miniconda3/envs/nanocompore_stable2/lib/python3.7/site-packages/seaborn/_decorators.py in inner_f(*args, **kwargs)
     44             )
     45         kwargs.update({k: arg for k, arg in zip(sig.parameters, args)})
---> 46         return f(**kwargs)
     47     return inner_f
     48 

~/miniconda3/envs/nanocompore_stable2/lib/python3.7/site-packages/seaborn/distributions.py in kdeplot(x, y, shade, vertical, kernel, bw, gridsize, cut, clip, legend, cumulative, shade_lowest, cbar, cbar_ax, cbar_kws, ax, weights, hue, palette, hue_order, hue_norm, multiple, common_norm, common_grid, levels, thresh, bw_method, bw_adjust, log_scale, color, fill, data, data2, warn_singular, **kwargs)
   1738     p = _DistributionPlotter(
   1739         data=data,
-> 1740         variables=_DistributionPlotter.get_semantics(locals()),
   1741     )
   1742 

~/miniconda3/envs/nanocompore_stable2/lib/python3.7/site-packages/seaborn/distributions.py in __init__(self, data, variables)
    109     ):
    110 
--> 111         super().__init__(data=data, variables=variables)
    112 
    113     @property

~/miniconda3/envs/nanocompore_stable2/lib/python3.7/site-packages/seaborn/_core.py in __init__(self, data, variables)
    603     def __init__(self, data=None, variables={}):
    604 
--> 605         self.assign_variables(data, variables)
    606 
    607         for var, cls in self._semantic_mappings.items():

~/miniconda3/envs/nanocompore_stable2/lib/python3.7/site-packages/seaborn/_core.py in assign_variables(self, data, variables)
    667             self.input_format = "long"
    668             plot_data, variables = self._assign_variables_longform(
--> 669                 data, **variables,
    670             )
    671 

~/miniconda3/envs/nanocompore_stable2/lib/python3.7/site-packages/seaborn/_core.py in _assign_variables_longform(self, data, **kwargs)
    891 
    892                 if val in data:
--> 893                     plot_data[key] = data[val]
    894                 elif val in index:
    895                     plot_data[key] = index[val]

IndexError: arrays used as indices must be of integer (or boolean) typeIndexError                                Traceback (most recent call last)
<ipython-input-4-9ad3f7175770> in <module>
      1 pl.rcParams['lines.linewidth'] = 3
----> 2 fig, ax = db.plot_position ("ENST00000215754.8", palette= "Set1", pos=513, scatter = False,alpha = 0.8, ylim = (-3, 3), xlim = (-2, 2))
      3 ax.set_facecolor('white')
      4 ax.spines['bottom'].set_color('black')
      5 ax.spines['left'].set_color('black')

~/miniconda3/envs/nanocompore_stable2/lib/python3.7/site-packages/nanocompore/SampCompDB.py in plot_position(self, ref_id, pos, split_samples, figsize, palette, plot_style, xlim, ylim, alpha, pointSize, scatter, kde, model, gmm_levels)
    868                         cmap=sns.light_palette(d["color"], as_cmap=True),
    869                         ax=ax,
--> 870                         clip=((min(d["intensity"]), max(d["intensity"])), (min(d["dwell"]),max(d["dwell"]))))
    871                 if scatter:
    872                     _ = ax.scatter(

~/miniconda3/envs/nanocompore_stable2/lib/python3.7/site-packages/seaborn/_decorators.py in inner_f(*args, **kwargs)
     44             )
     45         kwargs.update({k: arg for k, arg in zip(sig.parameters, args)})
---> 46         return f(**kwargs)
     47     return inner_f
     48 

~/miniconda3/envs/nanocompore_stable2/lib/python3.7/site-packages/seaborn/distributions.py in kdeplot(x, y, shade, vertical, kernel, bw, gridsize, cut, clip, legend, cumulative, shade_lowest, cbar, cbar_ax, cbar_kws, ax, weights, hue, palette, hue_order, hue_norm, multiple, common_norm, common_grid, levels, thresh, bw_method, bw_adjust, log_scale, color, fill, data, data2, warn_singular, **kwargs)
   1738     p = _DistributionPlotter(
   1739         data=data,
-> 1740         variables=_DistributionPlotter.get_semantics(locals()),
   1741     )
   1742 

~/miniconda3/envs/nanocompore_stable2/lib/python3.7/site-packages/seaborn/distributions.py in __init__(self, data, variables)
    109     ):
    110 
--> 111         super().__init__(data=data, variables=variables)
    112 
    113     @property

~/miniconda3/envs/nanocompore_stable2/lib/python3.7/site-packages/seaborn/_core.py in __init__(self, data, variables)
    603     def __init__(self, data=None, variables={}):
    604 
--> 605         self.assign_variables(data, variables)
    606 
    607         for var, cls in self._semantic_mappings.items():

~/miniconda3/envs/nanocompore_stable2/lib/python3.7/site-packages/seaborn/_core.py in assign_variables(self, data, variables)
    667             self.input_format = "long"
    668             plot_data, variables = self._assign_variables_longform(
--> 669                 data, **variables,
    670             )
    671 

~/miniconda3/envs/nanocompore_stable2/lib/python3.7/site-packages/seaborn/_core.py in _assign_variables_longform(self, data, **kwargs)
    891 
    892                 if val in data:
--> 893                     plot_data[key] = data[val]
    894                 elif val in index:
    895                     plot_data[key] = index[val]

IndexError: arrays used as indices must be of integer (or boolean) type
@samir-watson
Copy link
Author

Hi, do you have any suggestions for this error?

@tleonardi
Copy link
Owner

Hi, sorry for the lack of activity. Do you get an error also if you plot different positions?
If you do, can you share a minimal SampCompDB so that I can reproduce the error?

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

2 participants