Git Product home page Git Product logo

Comments (5)

lmulroney avatar lmulroney commented on August 28, 2024

Hi Muhammad5577,

Can you confirm for me which version of seaborn you're using?

from nanocompore.

Muhammad5577 avatar Muhammad5577 commented on August 28, 2024

Hi lmulroney
seaborn is v 0.11.2

from nanocompore.

Muhammad5577 avatar Muhammad5577 commented on August 28, 2024

Hi lmulroney
After updating to seaborn 0.12.2 i get this error now


ValueError Traceback (most recent call last)
Cell In [12], line 1
----> 1 fig, ax = db.plot_position ("YKL096W_mRNA",pos=1)

File ~/.local/lib/python3.8/site-packages/nanocompore/SampCompDB.py:865, in SampCompDB.plot_position(self, ref_id, pos, split_samples, figsize, palette, plot_style, xlim, ylim, alpha, pointSize, scatter, kde, model, gmm_levels)
863 for label, d in plot_data_dict.items():
864 if kde:
--> 865 _ = sns.kdeplot(
866 data=d["intensity"],
867 data2=d["dwell"],
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(
873 x=d["intensity"],
874 y=d["dwell"],
(...)
877 alpha=alpha,
878 s=pointSize)

File ~/.local/lib/python3.8/site-packages/seaborn/distributions.py:1717, in kdeplot(data, x, y, hue, weights, palette, hue_order, hue_norm, color, fill, multiple, common_norm, common_grid, cumulative, bw_method, bw_adjust, warn_singular, log_scale, levels, thresh, gridsize, cut, clip, legend, cbar, cbar_ax, cbar_kws, ax, **kwargs)
1713 if p.univariate:
1715 plot_kws = kwargs.copy()
-> 1717 p.plot_univariate_density(
1718 multiple=multiple,
1719 common_norm=common_norm,
1720 common_grid=common_grid,
1721 fill=fill,
1722 color=color,
1723 legend=legend,
1724 warn_singular=warn_singular,
1725 estimate_kws=estimate_kws,
1726 **plot_kws,
1727 )
1729 else:
1731 p.plot_bivariate_density(
1732 common_norm=common_norm,
1733 fill=fill,
(...)
1743 **kwargs,
1744 )

File ~/.local/lib/python3.8/site-packages/seaborn/distributions.py:937, in _DistributionPlotter.plot_univariate_density(self, multiple, common_norm, common_grid, warn_singular, fill, color, legend, estimate_kws, **plot_kws)
934 log_scale = self._log_scaled(self.data_variable)
936 # Do the computation
--> 937 densities = self._compute_univariate_density(
938 self.data_variable,
939 common_norm,
940 common_grid,
941 estimate_kws,
942 log_scale,
943 warn_singular,
944 )
946 # Adjust densities based on the multiple rule
947 densities, baselines = self._resolve_multiple(densities, multiple)

File ~/.local/lib/python3.8/site-packages/seaborn/distributions.py:349, in _DistributionPlotter._compute_univariate_density(self, data_variable, common_norm, common_grid, estimate_kws, log_scale, warn_singular)
345 try:
346 if not singular:
347 # Convoluted approach needed because numerical failures
348 # can manifest in a few different ways.
--> 349 density, support = estimator(observations, weights=weights)
350 except np.linalg.LinAlgError:
351 singular = True

File ~/.local/lib/python3.8/site-packages/seaborn/_statistics.py:192, in KDE.call(self, x1, x2, weights)
190 """Fit and evaluate on univariate or bivariate data."""
191 if x2 is None:
--> 192 return self._eval_univariate(x1, weights)
193 else:
194 return self._eval_bivariate(x1, x2, weights)

File ~/.local/lib/python3.8/site-packages/seaborn/_statistics.py:151, in KDE._eval_univariate(self, x, weights)
149 support = self.support
150 if support is None:
--> 151 support = self.define_support(x, cache=False)
153 kde = self._fit(x, weights)
155 if self.cumulative:

File ~/.local/lib/python3.8/site-packages/seaborn/_statistics.py:127, in KDE.define_support(self, x1, x2, weights, cache)
125 """Create the evaluation grid for a given data set."""
126 if x2 is None:
--> 127 support = self._define_support_univariate(x1, weights)
128 else:
129 support = self._define_support_bivariate(x1, x2, weights)

File ~/.local/lib/python3.8/site-packages/seaborn/_statistics.py:101, in KDE._define_support_univariate(self, x, weights)
99 kde = self._fit(x, weights)
100 bw = np.sqrt(kde.covariance.squeeze())
--> 101 grid = self._define_support_grid(
102 x, bw, self.cut, self.clip, self.gridsize
103 )
104 return grid

File ~/.local/lib/python3.8/site-packages/seaborn/_statistics.py:93, in KDE._define_support_grid(self, x, bw, cut, clip, gridsize)
91 clip_lo = -np.inf if clip[0] is None else clip[0]
92 clip_hi = +np.inf if clip[1] is None else clip[1]
---> 93 gridmin = max(x.min() - bw * cut, clip_lo)
94 gridmax = min(x.max() + bw * cut, clip_hi)
95 return np.linspace(gridmin, gridmax, gridsize)

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

from nanocompore.

lmulroney avatar lmulroney commented on August 28, 2024

It looks like seaborn changed the way that the do internal indexing in the versions you're using compared to the version recommended in nanocompore. Can you try using version 0.11.0 instead of 0.11.2 or 0.12.2?

Also, just to make sure, do you have data at position 1 of YKL096W_mRNA or pos 456 of YAL003W_mRNA? It might be throwing the error due to no data at those positions?

from nanocompore.

Muhammad5577 avatar Muhammad5577 commented on August 28, 2024

Hi lmulroney
thank you for your help.
after reinstalling seaborn 0.11 it worked !
cheers for the support !

from nanocompore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.