Edinburgh-Genome-Foundry / DnaFeaturesViewer

:eye: Python library to plot DNA sequence features (e.g. from Genbank files)
https://edinburgh-genome-foundry.github.io/DnaFeaturesViewer/
MIT License
584 stars 90 forks source link

LinAlgError #1

Closed zhaouu closed 7 years ago

zhaouu commented 7 years ago

Hi, I think DnaFeaturesViewer is a very good tool to plot gene features. But when I try to use it, I get some error massage, I don't know how to solve it. `In [61]: x = [GraphicFeature(start=20, end=500, strand=+1, color="#ffcccc", ...: label="Gene 1")]

In [62]: record = GraphicRecord(sequence_length=600, features=x)

In [63]: record.plot(fig_width=5)

LinAlgError Traceback (most recent call last)

in () ----> 1 record.plot(fig_width=5) /home/hzhao/lib/python2.7/site-packages/dna_features_viewer/dna_features_viewer.pyc in plot(self, ax, fig_width, draw_line, with_ruler) 166 overflowing_annotations = [] 167 for feature, level in levels.items(): --> 168 feature.plot(ax=ax, level=level) 169 text, overflowing, (x1, x2) = feature.annotate(ax=ax, level=level) 170 if overflowing: /home/hzhao/lib/python2.7/site-packages/dna_features_viewer/dna_features_viewer.pyc in plot(self, ax, level) 124 def plot(self, ax, level=0): 125 """Plot the feature's Matplotlib patch on a Matplotlib ax.""" --> 126 ax.add_patch(self.create_patch(level=level)) 127 128 def __repr__(self): /home/hzhao/lib/python2.7/site-packages/matplotlib/axes/_base.pyc in add_patch(self, p) 1776 if p.get_clip_path() is None: 1777 p.set_clip_path(self.patch) -> 1778 self._update_patch_limits(p) 1779 self.patches.append(p) 1780 p._remove_method = lambda h: self.patches.remove(h) /home/hzhao/lib/python2.7/site-packages/matplotlib/axes/_base.pyc in _update_patch_limits(self, patch) 1794 ((not patch.get_width()) and (not patch.get_height()))): 1795 return -> 1796 vertices = patch.get_path().vertices 1797 if vertices.size > 0: 1798 xys = patch.get_patch_transform().transform(vertices) /home/hzhao/lib/python2.7/site-packages/matplotlib/patches.pyc in get_path(self) 4181 _path = concatenate_paths(_path) 4182 -> 4183 return self.get_transform().inverted().transform_path(_path) 4184 4185 def get_path_in_displaycoord(self): /home/hzhao/lib/python2.7/site-packages/matplotlib/transforms.pyc in inverted(self) 2377 2378 def inverted(self): -> 2379 return CompositeGenericTransform(self._b.inverted(), self._a.inverted()) 2380 inverted.__doc__ = Transform.inverted.__doc__ 2381 /home/hzhao/lib/python2.7/site-packages/matplotlib/transforms.pyc in inverted(self) 2377 2378 def inverted(self): -> 2379 return CompositeGenericTransform(self._b.inverted(), self._a.inverted()) 2380 inverted.__doc__ = Transform.inverted.__doc__ 2381 /home/hzhao/lib/python2.7/site-packages/matplotlib/transforms.pyc in inverted(self) 2377 2378 def inverted(self): -> 2379 return CompositeGenericTransform(self._b.inverted(), self._a.inverted()) 2380 inverted.__doc__ = Transform.inverted.__doc__ 2381 /home/hzhao/lib/python2.7/site-packages/matplotlib/transforms.pyc in inverted(self) 1773 if self._shorthand_name: 1774 shorthand_name = '(%s)-1' % self._shorthand_name -> 1775 self._inverted = Affine2D(inv(mtx), shorthand_name=shorthand_name) 1776 self._invalid = 0 1777 return self._inverted /home/hzhao/lib/python2.7/site-packages/numpy/linalg/linalg.pyc in inv(a) 524 signature = 'D->D' if isComplexType(t) else 'd->d' 525 extobj = get_linalg_error_extobj(_raise_linalgerror_singular) --> 526 ainv = _umath_linalg.inv(a, signature=signature, extobj=extobj) 527 return wrap(ainv.astype(result_t, copy=False)) 528 /home/hzhao/lib/python2.7/site-packages/numpy/linalg/linalg.pyc in _raise_linalgerror_singular(err, flag) 88 89 def _raise_linalgerror_singular(err, flag): ---> 90 raise LinAlgError("Singular matrix") 91 92 def _raise_linalgerror_nonposdef(err, flag): LinAlgError: Singular matrix` Thank you very much.
Zulko commented 7 years ago

Hey thanks for the report. Your code works for me, that's weird. Are you using the latest version from github ? Also, can you provide your version of matplotlib and numpy ?

Zulko commented 7 years ago

closing for lack of activity. Please reopen if the issue persists in more recent versions.