Teichlab / drug2cell

Gene group activity utility functions for Scanpy
Other
51 stars 3 forks source link

Issues with following demo #6

Open bykovam opened 8 months ago

bykovam commented 8 months ago

I've experienced the following issues with running the demo so far:

1) Importing scanpy withput downgrading matplotlib to 3.4 produces this error: imported three packages: --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[1], line 1 ----> 1 import scanpy as sc 2 import drug2cell as d2c 3 import blitzgsea as blitz

File ~\Documents\Experimental_Venv\lib\site-packages\scanpy__init__.py:16 14 from . import tools as tl 15 from . import preprocessing as pp ---> 16 from . import plotting as pl 17 from . import datasets, logging, queries, external, get, metrics, experimental 19 from anndata import AnnData, concat

File ~\Documents\Experimental_Venv\lib\site-packages\scanpy\plotting__init__.py:1 ----> 1 from ._anndata import ( 2 scatter, 3 violin, 4 ranking, 5 clustermap, 6 tracksplot, 7 dendrogram, 8 correlation_matrix, 9 heatmap, 10 ) 11 from ._dotplot import DotPlot, dotplot 12 from ._matrixplot import MatrixPlot, matrixplot

File ~\Documents\Experimental_Venv\lib\site-packages\scanpy\plotting_anndata.py:28 26 from .._utils import sanitize_anndata, _doc_params, _check_use_raw 27 from .._compat import Literal ---> 28 from . import _utils 29 from ._utils import scatter_base, scatter_group, setup_axes, check_colornorm 30 from ._utils import ColorLike, _FontWeight, _FontSize

File ~\Documents\Experimental_Venv\lib\site-packages\scanpy\plotting_utils.py:35 29 _FontSize = Literal[ 30 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large' 31 ] 32 VBound = Union[str, float, Callable[[Sequence[float]], float]] ---> 35 class _AxesSubplot(Axes, axes.SubplotBase, ABC): 36 """Intersection between Axes and SubplotBase: Has methods of both""" 39 # ------------------------------------------------------------------------------- 40 # Simple plotting functions 41 # -------------------------------------------------------------------------------

TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

2) targets["MHC CLASS II RECEPTOR ACTIVITY (GO:0032395)"] doesn't work anymore, it has to be targets["MHC class II receptor activity (GO:0032395)"]

3) Running

remove the score space object for illustration purposes

that it's really possible to run these functions with just the targets passed

del adata.uns['drug2cell']

enrichment, plot_gsea_args = d2c.gsea(adata, targets=targets) d2c.util.plot_gsea(enrichment, n=5, **plot_gsea_args)

without running beforehand %matplotlib notebook produces this error:

C:\Users\BYKOVAM\Documents\Experimental_Venv\lib\site-packages\drug2cell\util.py:143: UserWarning: Matplotlib is currently using module://matplotlib_inline.backend_inline, which is a non-GUI backend, so cannot show the figure. fig.show() C:\Users\BYKOVAM\Documents\Experimental_Venv\lib\site-packages\drug2cell\util.py:143: UserWarning: Matplotlib is currently using module://matplotlib_inline.backend_inline, which is a non-GUI backend, so cannot show the figure. fig.show() C:\Users\BYKOVAM\Documents\Experimental_Venv\lib\site-packages\drug2cell\util.py:143: UserWarning: Matplotlib is currently using module://matplotlib_inline.backend_inline, which is a non-GUI backend, so cannot show the figure. fig.show() C:\Users\BYKOVAM\Documents\Experimental_Venv\lib\site-packages\drug2cell\util.py:143: UserWarning: Matplotlib is currently using module://matplotlib_inline.backend_inline, which is a non-GUI backend, so cannot show the figure. fig.show() C:\Users\BYKOVAM\Documents\Experimental_Venv\lib\site-packages\drug2cell\util.py:143: UserWarning: Matplotlib is currently using module://matplotlib_inline.backend_inline, which is a non-GUI backend, so cannot show the figure. fig.show() C:\Users\BYKOVAM\Documents\Experimental_Venv\lib\site-packages\drug2cell\util.py:143: UserWarning: Matplotlib is currently using module://matplotlib_inline.backend_inline, which is a non-GUI backend, so cannot show the figure. fig.show() C:\Users\BYKOVAM\Documents\Experimental_Venv\lib\site-packages\drug2cell\util.py:143: UserWarning: Matplotlib is currently using module://matplotlib_inline.backend_inline, which is a non-GUI backend, so cannot show the figure. fig.show() C:\Users\BYKOVAM\Documents\Experimental_Venv\lib\site-packages\drug2cell\util.py:143: UserWarning: Matplotlib is currently using module://matplotlib_inline.backend_inline, which is a non-GUI backend, so cannot show the figure. fig.show()

ktpolanski commented 3 months ago

Thank you very much for the heads up! Seems some stuff changed around since I put the package together

ktpolanski commented 2 months ago

Turns out that blitzGSEA now has the argument interactive_plot which creates figures that are .show()able within a notebook. I adjusted the syntax accordingly.

Before noticing that, I stumbled upon the following syntax for getting the figures to show en masse in a notebook. Will leave it here for posterity, just in case some changes make it desirable in the future.

from IPython.display import display

figs = d2c.util.plot_gsea(enrichment, n=5, **plot_gsea_args, interactive_plot=False)
for fig in figs:
    display(fig)