pertpy: AttributeError: module 'pertpy.plot' has no attribute 'coda on google colab
Report
Hi, I’m using google colab and trying to follow the code from this documentation: https://pertpy.readthedocs.io/en/latest/usage/usage.html. I’ve run into this error: AttributeError: module ‘pertpy.plot’ has no attribute 'coda
from this line of code:
pt.pl.coda.effects_barplot( sccoda_data, modality_key="coda_salm", parameter="Final Parameter" )
Environment setup and code below:
!pip -qq install ete3
!pip -qq install pertpy==0.5.0
import pertpy as pt
haber_cells = pt.dt.haber_2017_regions()
sccoda_model = pt.tl.Sccoda()
sccoda_data = sccoda_model.load(
haber_cells,
type="cell_level",
generate_sample_level=True,
cell_type_identifier="cell_label",
sample_identifier="batch",
covariate_obs=["condition"],
)
sccoda_data.mod["coda_salm"] = sccoda_data["coda"][
sccoda_data["coda"].obs["condition"].isin(["Control", "Salmonella"])
].copy()
sccoda_data = sccoda_model.prepare(
sccoda_data,
modality_key="coda_salm",
formula="condition",
reference_cell_type="Goblet",
)
sccoda_model.run_nuts(sccoda_data, modality_key="coda_salm")
sccoda_model.summary(sccoda_data, modality_key="coda_salm")
pt.pl.coda.effects_barplot(
sccoda_data, modality_key="coda_salm", parameter="Final Parameter"
)
Version information
anndata 0.9.2 mudata 0.2.3 pertpy 0.5.0 session_info 1.0.0
Cython 0.29.36 PIL 9.4.0 PyQt5 NA absl NA adjustText 0.8 aiohttp 3.8.5 aiosignal 1.3.1 annotated_types 0.5.0 anyio NA arrow 1.2.3 arviz 0.15.1 astunparse 1.6.3 async_timeout 4.0.3 attr 23.1.0 backcall 0.2.0 backoff 2.2.1 bokeh 3.2.2 bs4 4.11.2 certifi 2023.07.22 cffi 1.15.1 chardet 5.2.0 charset_normalizer 3.2.0 chex 0.1.7 click 8.1.7 cloudpickle 2.2.1 colorcet 3.0.1 contextlib2 NA croniter NA custom_inherit 2.4.1 cvxopt 1.3.2 cycler 0.10.0 cython 0.29.36 cython_runtime NA dask 2023.8.0 dateutil 2.8.2 debugpy 1.6.6 decorator 4.4.2 decoupler 1.4.0 deepdiff 6.3.1 defusedxml 0.7.1 docrep 0.3.2 dot_parser NA ete3 3.1.3 etils 1.4.1 fastapi 0.101.1 flax 0.7.2 frozenlist 1.4.0 fsspec 2023.6.0 google NA graphviz 0.20.1 h5py 3.9.0 html5lib 1.1 httplib2 0.22.0 idna 3.4 igraph 0.10.6 importlib_metadata NA importlib_resources NA ipykernel 5.5.6 ipython_genutils 0.2.0 ipywidgets 7.7.1 jax 0.4.14 jaxlib 0.4.14 jaxopt NA jinja2 3.1.2 joblib 1.3.2 jsonpickle 3.0.2 kiwisolver 1.4.4 leidenalg 0.10.1 lightning 2.0.7 lightning_cloud NA lightning_fabric 2.0.7 lightning_utilities 0.9.0 llvmlite 0.40.1 lxml 4.9.3 markupsafe 2.1.3 matplotlib 3.7.1 matplotlib_inline 0.1.6 mizani 0.9.2 ml_collections NA ml_dtypes 0.2.0 mpl_toolkits NA mpmath 1.3.0 msgpack 1.0.5 multidict 6.0.4 multipart 0.0.6 multipledispatch 0.6.0 natsort 8.4.0 numba 0.57.1 numexpr 2.8.5 numpy 1.23.5 numpyro 0.13.0 nvfuser NA opt_einsum v3.3.0 optax 0.1.7 ordered_set 4.1.0 ott 0.4.3 packaging 23.1 pandas 1.5.3 param 1.13.0 patsy 0.5.3 pexpect 4.8.0 pickleshare 0.7.5 pkg_resources NA platformdirs 3.10.0 plotly 5.15.0 plotnine 0.12.2 ply 3.11 png 0.20220715.0 portpicker NA prompt_toolkit 3.0.39 psutil 5.9.5 ptyprocess 0.7.0 pyarrow 9.0.0 pycocotools NA pycparser 2.21 pydantic 2.1.1 pydantic_core 2.4.0 pydev_ipython NA pydevconsole NA pydevd 2.9.5 pydevd_file_utils NA pydevd_plugins NA pydevd_tracing NA pydot 1.4.2 pygments 2.16.1 pyomo 6.6.2 pyparsing 3.1.1 pyro 1.8.6 pytorch_lightning 2.0.7 pytz 2023.3 regex 2.5.129 reportlab 4.0.4 requests 2.31.0 rich NA rpy2 3.4.2 scanpy 1.9.4 scipy 1.10.1 scvi 1.0.3 seaborn 0.11.2 setuptools 67.7.2 sip NA sitecustomize NA six 1.16.0 sklearn 1.2.2 skmisc 0.3.0 sniffio 1.3.0 socks 1.7.1 soundfile 0.12.1 soupsieve 2.4.1 sparse 0.14.0 sparsecca 0.3.0 sphinxcontrib NA starlette 0.27.0 statannotations 0.5.0 statsmodels 0.14.0 storemagic NA switchlang 0.1.0 sympy 1.12 tblib 2.0.0 texttable 1.6.7 threadpoolctl 3.2.0 tlz 0.12.0 tomli 2.0.1 toolz 0.12.0 torch 2.0.1+cu118 torchaudio 2.0.2+cu118 torchmetrics 1.1.0 torchvision 0.15.2+cu118 tornado 6.3.2 toyplot 1.0.3 toytree 2.0.1 tqdm 4.66.1 traitlets 5.7.1 tree 0.1.8 typing_extensions NA tzlocal NA urllib3 2.0.4 uvicorn 0.23.2 wcwidth 0.2.6 webencodings 0.5.1 websocket 1.6.1 websockets 11.0.3 wrapt 1.14.1 xarray 2023.7.0 xarray_einstats 0.6.0 xyzservices 2023.7.0 yaml 6.0.1 yarl 1.9.2 zipp NA zmq 23.2.1 zoneinfo NA
IPython 7.34.0 jupyter_client 6.1.12 jupyter_core 5.3.1 notebook 6.5.5
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] Linux-5.15.109±x86_64-with-glibc2.35
Session information updated at 2023-08-24 22:50
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 18 (11 by maintainers)
Have same issue in jupyter notebook
pertpy==0.8.0So, apparently, theplotfolder and_init_file are just empty. SOLUTION: after all, I realized it’s an old mechanic. The updated code is:sccoda_model.plot_stacked_barplot(sccoda_data, feature_name="samples")or put you name of the plotThat’s a zsh issue.
Run it with
pip install "pertpy[coda]"or however zsh expects the command to be. See https://stackoverflow.com/questions/30539798/zsh-no-matches-found-requestssecurity@pandaqiuqiu I drafted a solution that should at least allow you to use scCODA on colab: https://github.com/theislab/pertpy/pull/422
!pip install -U git+https://github.com/theislab/pertpy@feature/ete3_simplefor now. Please report back if it doesn’t work!