pertpy icon indicating copy to clipboard operation
pertpy copied to clipboard

Bootstrap not running

Open aterceros opened this issue 1 year ago • 6 comments

Report

Hi,

I've been trying to run "Distance.bootstrap(X, Y)" but I get the error: "AttributeError: 'Distance' object has no attribute 'bootstrap'". Any leads as to how to solve will be greatly appreciated.

Here my session_info

anndata 0.10.5.post1 gseapy 1.0.6 matplotlib 3.7.0 numpy 1.26.4 pandas 2.2.2 pertpy 0.7.0 phenograph 1.5.7 scanpy 1.9.8 scipy 1.11.4 seaborn 0.13.2 session_info 1.0.0 sklearn 1.1.3

Cython 3.0.8 PIL 10.2.0 absl NA adjustText 1.1.1 aiohttp 3.9.3 aiosignal 1.3.1 annotated_types 0.6.0 anyio NA appnope 0.1.4 arrow 1.3.0 arviz 0.18.0 asttokens NA attr 23.2.0 attrs 23.2.0 babel 2.14.0 backoff 2.2.1 blitzgsea NA bs4 4.12.3 certifi 2024.02.02 cffi 1.16.0 chardet 5.2.0 charset_normalizer 3.3.2 chex 0.1.85 click 8.1.7 comm 0.2.1 contextlib2 NA croniter NA custom_inherit 2.4.1 cycler 0.12.1 cython 3.0.8 cython_runtime NA dateutil 2.8.2 debugpy 1.8.1 decorator 5.1.1 decoupler 1.7.0 deepdiff 6.7.1 defusedxml 0.7.1 docrep 0.3.2 etils 1.6.0 executing 2.0.1 fastapi 0.109.2 fastjsonschema NA filelock 3.13.1 flax 0.8.1 fqdn NA frozenlist 1.4.1 fsspec 2024.2.0 h5py 3.10.0 idna 3.6 igraph 0.11.3 importlib_resources NA ipykernel 6.29.2 isoduration NA jax 0.4.30 jaxlib 0.4.30 jaxopt NA jedi 0.19.1 jinja2 3.0.3 joblib 1.3.2 json5 NA jsonpointer 2.4 jsonschema 4.21.1 jsonschema_specifications NA jupyter_events 0.9.0 jupyter_server 2.12.5 jupyterlab_server 2.25.2 kiwisolver 1.4.5 leidenalg 0.10.2 lightning 2.0.9.post0 lightning_cloud 0.5.64 lightning_fabric 2.2.0.post0 lightning_utilities 0.10.1 llvmlite 0.43.0 markupsafe 2.1.5 matplotlib_inline 0.1.6 ml_collections NA ml_dtypes 0.3.2 mpl_toolkits NA mpmath 1.3.0 msgpack 1.0.7 mudata 0.2.3 multidict 6.0.5 multipart 0.0.9 multipledispatch 0.6.0 natsort 8.4.0 nbformat 5.9.2 numba 0.60.0 numpyro 0.13.2 opt_einsum v3.3.0 optax 0.1.9 ordered_set 4.1.0 ott 0.4.6 overrides NA packaging 23.2 parso 0.8.3 patsy 0.5.6 pkg_resources NA platformdirs 4.2.0 ply 3.11 png 0.20220715.0 prometheus_client NA prompt_toolkit 3.0.43 psutil 5.9.8 pubchempy 1.0.4 pure_eval 0.2.2 pyarrow 16.1.0 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 pygments 2.17.2 pynndescent 0.5.11 pyomo 6.7.3 pyparsing 3.1.1 pyro 1.8.6 pythonjsonlogger NA pytorch_lightning 2.2.0.post0 pytz 2024.1 pytz_deprecation_shim NA referencing NA reportlab 4.2.0 requests 2.31.0 rfc3339_validator 0.1.4 rfc3986_validator 0.1.1 rich NA rpds NA rpy2 3.5.12 scvi 1.1.0.post2 send2trash NA six 1.16.0 skmisc 0.3.1 sniffio 1.3.0 soupsieve 2.5 sparse 0.15.1 sparsecca 0.3.1 stack_data 0.6.3 starlette 0.36.3 statsmodels 0.14.1 sympy 1.12 texttable 1.7.0 threadpoolctl 3.2.0 toolz 0.12.1 torch 2.2.0 torchgen NA torchmetrics 1.3.1 tornado 6.4 toyplot 1.0.3 toytree 2.0.5 tqdm 4.66.4 traitlets 5.14.1 tree 0.1.8 typing_extensions NA tzlocal NA uri_template NA urllib3 2.0.7 uvicorn 0.27.1 wcwidth 0.2.13 webcolors 1.13 websocket 1.7.0 websockets 12.0 wrapt 1.16.0 xarray 2024.1.1 xarray_einstats 0.7.0 yaml 6.0.1 yarl 1.9.4 zmq 25.1.2

IPython 8.21.0 jupyter_client 8.6.0 jupyter_core 5.7.1 jupyterlab 4.1.1 notebook 7.1.0

Python 3.11.7 | packaged by conda-forge | (main, Dec 23 2023, 14:38:07) [Clang 16.0.6 ] macOS-13.4-arm64-arm-64bit

Version information

No response

aterceros avatar Aug 14 '24 15:08 aterceros

The example here:

https://pertpy.readthedocs.io/en/stable/usage/tools/pertpy.tools.Distance.html#pertpy.tools.Distance.bootstrap

works. Could you please provide more information on how you are running the code?

Zethson avatar Aug 14 '24 15:08 Zethson

Thanks for your answer, sure, here what I'm trying to run: distance = pt.tl.Distance("wasserstein", obsm_key="X_pca") X = adatap.obsm["X_pca"][adatap.obs["condition"] == "2HR"] Y = adatap.obsm["X_pca"][adatap.obs["condition"] == "8HR"] dfd_variance = distance.bootstrap(X, Y)

Thanks!

aterceros avatar Aug 14 '24 15:08 aterceros

I think it might be something related to installing the GitHub version...

aterceros avatar Aug 14 '24 16:08 aterceros

pertpy 0.7.0

this is also not the latest version. Could you try installing the latest version with ``pip install -U pertpy`, please? I also advise you to use Python 3.10 or 3.11+

Zethson avatar Aug 14 '24 17:08 Zethson

I just upgraded to 0.8 but still getting the "no attribute 'bootstrap'" error, do you recommend using python 3.10 to fix this?

aterceros avatar Aug 14 '24 17:08 aterceros

Hi @aterceros! I wasn't able to reproduce your error either, everything works fine on my end. Yes, please try using python >= 3.10 and let me know if that resolves the issue. Also, you could try running our pertpy example for the bootstrap method to make sure we're running the same code:

adata = pt.dt.distance_example()
Distance = pt.tl.Distance(metric="edistance")
X = adata.obsm["X_pca"][adata.obs["perturbation"] == "p-sgCREB1-2"]
Y = adata.obsm["X_pca"][adata.obs["perturbation"] == "control"]
D = Distance.bootstrap(X, Y)

Lilly-May avatar Aug 16 '24 14:08 Lilly-May

@aterceros is this still a problem and can we help you further?

Zethson avatar Aug 29 '24 14:08 Zethson

I'll close this issue for now. @aterceros, please feel free to reopen it if you're still facing the issue.

Lilly-May avatar Sep 09 '24 12:09 Lilly-May

Sorry for the delay! I wasn't able to test on python 3.10 yet as I have some code running, but I can respond once I test this, thank you for your help!

aterceros avatar Sep 12 '24 18:09 aterceros