perslab / CELLEX

CELLEX (CELL-type EXpression-specificity)
GNU General Public License v3.0
38 stars 9 forks source link

Can not generate n_es_gene plot #12

Open liubovpashkova opened 4 years ago

liubovpashkova commented 4 years ago

Trying to generate a n_es_gene plot, I get the following error:

PlotnineError                             Traceback (most recent call last)
/tools/anaconda/envs/kfm338/jp/lib/python3.7/site-packages/IPython/core/formatters.py in __call__(self, obj)
    700                 type_pprinters=self.type_printers,
    701                 deferred_pprinters=self.deferred_printers)
--> 702             printer.pretty(obj)
    703             printer.flush()
    704             return stream.getvalue()

/tools/anaconda/envs/kfm338/jp/lib/python3.7/site-packages/IPython/lib/pretty.py in pretty(self, obj)
    400                         if cls is not object \
    401                                 and callable(cls.__dict__.get('__repr__')):
--> 402                             return _repr_pprint(obj, self, cycle)
    403 
    404             return _default_pprint(obj, self, cycle)

/tools/anaconda/envs/kfm338/jp/lib/python3.7/site-packages/IPython/lib/pretty.py in _repr_pprint(obj, p, cycle)
    695     """A pprint that just redirects to the normal repr function."""
    696     # Find newlines and replace them with p.break_()
--> 697     output = repr(obj)
    698     for idx,output_line in enumerate(output.splitlines()):
    699         if idx:

/tools/anaconda/envs/kfm338/jp/lib/python3.7/site-packages/plotnine/ggplot.py in __repr__(self)
     93         # in the jupyter notebook.
     94         if not self.figure:
---> 95             self.draw()
     96         plt.show()
     97         return '<ggplot: (%d)>' % self.__hash__()

/tools/anaconda/envs/kfm338/jp/lib/python3.7/site-packages/plotnine/ggplot.py in draw(self, return_ggplot)
    186         # new frames knowing that they are separate from the original.
    187         with pd.option_context('mode.chained_assignment', None):
--> 188             return self._draw(return_ggplot)
    189 
    190     def _draw(self, return_ggplot=False):

/tools/anaconda/envs/kfm338/jp/lib/python3.7/site-packages/plotnine/ggplot.py in _draw(self, return_ggplot)
    193         # assign a default theme
    194         self = deepcopy(self)
--> 195         self._build()
    196 
    197         # If no theme we use the default

/tools/anaconda/envs/kfm338/jp/lib/python3.7/site-packages/plotnine/ggplot.py in _build(self)
    312 
    313         # Apply position adjustments
--> 314         layers.compute_position(layout)
    315 
    316         # Reset position scales, then re-train and map.  This

/tools/anaconda/envs/kfm338/jp/lib/python3.7/site-packages/plotnine/layer.py in compute_position(self, layout)
     90     def compute_position(self, layout):
     91         for l in self:
---> 92             l.compute_position(layout)
     93 
     94     def use_defaults(self):

/tools/anaconda/envs/kfm338/jp/lib/python3.7/site-packages/plotnine/layer.py in compute_position(self, layout)
    427         in concert with the other objects in the panel
    428         """
--> 429         params = self.position.setup_params(self.data)
    430         data = self.position.setup_data(self.data, params)
    431         data = self.position.compute_layer(data, params, layout)

/tools/anaconda/envs/kfm338/jp/lib/python3.7/site-packages/plotnine/positions/position_dodge.py in setup_params(self, data)
     33             msg = ("Width not defined. "
     34                    "Set with `position_dodge(width = ?)`")
---> 35             raise PlotnineError(msg)
     36 
     37         params = copy(self.params)

PlotnineError: 'Width not defined. Set with `position_dodge(width = ?)`'

Probably, this is due to the fact that I have many metadata classes (tried both 37 cell annotations and 10 main trajectories as metadata classes) and therefore the generated plot is going to be too wide.