nanocompore
nanocompore copied to clipboard
SampCompDB plot position error
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
Hi, do you have any suggestions for this error?
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?