Starlitnightly / omicverse

A python library for multi omics included bulk, single cell and spatial RNA-seq analysis.
https://starlitnightly.github.io/omicverse/
GNU General Public License v3.0
431 stars 46 forks source link

Pathway analysis with AUCell 'content-length' #15

Closed qwelongh closed 4 months ago

qwelongh commented 1 year ago

hi, i encounter a trouble when i using Pathway analysis with AUCell.

KeyError Traceback (most recent call last) Cell In[127], line 1 ----> 1 ov.utils.download_pathway_database()

File /opt/conda/lib/python3.10/site-packages/omicverse/utils/_data.py:156, in download_pathway_database() 154 for datasets_name in _datasets.keys(): 155 print('......Pathway Geneset download start:',datasets_name) --> 156 model_path = data_downloader(url=_datasets[datasets_name],path='genesets/{}.txt'.format(datasets_name),title=datasets_name) 157 print('......Pathway Geneset download finished!') 158 print('......Other Genesets can be dowload in [https://maayanlab.cloud/Enrichr/#libraries](https://maayanlab.cloud/Enrichr/#libraries%60)')

File /opt/conda/lib/python3.10/site-packages/omicverse/utils/_data.py:85, in data_downloader(url, path, title) 82 res = requests.get(url, stream=True) 84 chunk_size = 1024000 ---> 85 content_size = int(res.headers["content-length"]) 86 if res.status_code == 200: 87 print('......[%s Size of file]: %0.2f MB' % (title, content_size/chunk_size/10.24))

File /opt/conda/lib/python3.10/site-packages/requests/structures.py:52, in CaseInsensitiveDict.getitem(self, key) 51 def getitem(self, key): ---> 52 return self._store[key.lower()][1]

KeyError: 'content-length'

my environment as below

anndata 0.9.1 scanpy 1.9.3 PIL 10.0.0 absl NA annoy NA anyio NA asciitree NA astor 0.8.1 asttokens NA attr 23.1.0 autograd NA autograd_gamma NA babel 2.12.1 backcall 0.2.0 boltons NA bs4 4.12.2 cairo 1.24.0 celltypist 1.5.3 certifi 2023.05.07 cffi 1.15.1 charset_normalizer 3.1.0 chex 0.1.81 cloudpickle 2.2.1 colorama 0.4.6 comm 0.1.3 contextlib2 NA cycler 0.10.0 cython_runtime NA cytoolz 0.12.1 dask 2023.7.0 datashader 0.15.1 datashape 0.5.2 dateutil 2.8.2 debugpy 1.6.7 decorator 5.1.1 defusedxml 0.7.1 dill 0.3.6 diopy NA docrep 0.3.2 entrypoints 0.4 etils 1.3.0 executing 1.2.0 fasteners 0.18 fastjsonschema NA filelock 3.12.2 flax 0.6.1 fontTools 4.41.0 formulaic 0.6.4 fsspec 2023.6.0 future 0.18.3 gdown 4.7.1 gmpy2 2.1.2 google NA graphlib NA h5py 3.9.0 harmonypy NA hnswlib NA idna 3.4 igraph 0.10.6 importlib_resources NA interface_meta 1.3.0 ipykernel 6.23.1 ipython_genutils 0.2.0 ipywidgets 8.0.7 jax 0.4.13 jaxlib 0.4.12 jedi 0.18.2 jinja2 3.1.2 joblib 1.3.0 json5 NA jsonpointer 2.0 jsonschema 4.17.3 jupyter_events 0.6.3 jupyter_server 2.6.0 jupyterlab_server 2.22.1 kiwisolver 1.4.4 lazy_loader NA leidenalg 0.10.0 lifelines 0.27.7 lightning_fabric 1.9.4 lightning_utilities 0.9.0 llvmlite 0.40.1 lxml 4.9.3 lz4 4.3.2 markupsafe 2.1.2 matplotlib 3.7.2 matplotlib_inline 0.1.6 ml_collections NA ml_dtypes 0.2.0 mpl_toolkits NA mpmath 1.3.0 msgpack 1.0.5 mudata 0.2.3 multipledispatch 0.6.0 multiprocess 0.70.14 natsort 8.4.0 nbformat 5.8.0 networkx 3.1 numba 0.57.1 numcodecs 0.11.0 numexpr 2.7.3 numpy 1.24.4 numpyro 0.12.1 omicverse 1.4.12 opt_einsum v3.3.0 optax 0.1.5 overrides NA packaging 23.1 pandas 2.0.3 param 1.13.0 parso 0.8.3 patsy 0.5.3 pexpect 4.8.0 pickleshare 0.7.5 pkg_resources NA platformdirs 3.5.1 plotly 5.15.0 plottable 0.1.5 pooch v1.7.0 progressbar 4.2.0 prometheus_client NA prompt_toolkit 3.0.38 psutil 5.9.5 ptyprocess 0.7.0 pure_eval 0.2.2 pvectorc NA pyarrow 12.0.1 pycparser 2.21 pyct 0.5.0 pydev_ipython NA pydevconsole NA pydevd 2.9.5 pydevd_file_utils NA pydevd_plugins NA pydevd_tracing NA pygam 0.8.0 pygments 2.15.1 pynndescent 0.5.10 pyparsing 3.0.9 pyro 1.8.4+9ed468d pyrsistent NA python_utils NA pythonjsonlogger NA pytorch_lightning 1.9.4 pytz 2023.3 pywt 1.4.1 requests 2.31.0 rfc3339_validator 0.1.4 rfc3986_validator 0.1.1 rich NA sc_py_function_set NA scib_metrics 0.3.3 scipy 1.11.1 scvelo 0.2.5 scvi 0.20.3 scvi_colab 0.12.0 seaborn 0.12.2 send2trash NA session_info 1.0.0 setuptools 67.7.2 six 1.16.0 skimage 0.20.0 sklearn 1.3.0 skmisc 0.3.0 sniffio 1.3.0 socks 1.7.1 soupsieve 2.3.2.post1 sparse 0.14.0 stack_data 0.6.2 statsmodels 0.14.0 sympy 1.12 tblib 2.0.0 tensorboard 2.13.0 termcolor NA texttable 1.6.7 threadpoolctl 3.2.0 tlz 0.12.1 toolz 0.12.0 torch 2.0.0 torchmetrics 0.11.4 tornado 6.3.2 tqdm 4.65.0 traitlets 5.9.0 trajectory NA tree 0.1.7 typing_extensions NA umap 0.5.3 urllib3 1.26.16 wcwidth 0.2.6 websocket 1.5.2 wrapt 1.15.0 xarray 2023.6.0 yaml 6.0 zarr 2.15.0 zipp NA zmq 25.0.2 zoneinfo NA zope NA zstandard 0.19.0

IPython 8.13.2 jupyter_client 8.2.0 jupyter_core 5.3.0 jupyterlab 4.0.3 notebook 6.5.4

Python 3.10.11 | packaged by conda-forge | (main, May 10 2023, 18:58:44) [GCC 11.3.0] Linux-3.10.0-957.el7.x86_64-x86_64-with-glibc2.35

Session information updated at 2023-07-20 06:56

Starlitnightly commented 1 year ago

Hi,

This error looks like a network error, you can refer to #9 to solve this problem.

you can donwload it manually also.

_datasets = {
        'GO_Biological_Process_2021':'https://figshare.com/ndownloader/files/39820720',
        'GO_Cellular_Component_2021':'https://figshare.com/ndownloader/files/39820714',
        'GO_Molecular_Function_2021':'https://figshare.com/ndownloader/files/39820711',
        'WikiPathway_2021_Human':'https://figshare.com/ndownloader/files/39820705',
        'WikiPathways_2019_Mouse':'https://figshare.com/ndownloader/files/39820717',
        'Reactome_2022':'https://figshare.com/ndownloader/files/39820702',
    }

Sincerely,

Zehua

qwelongh commented 1 year ago

thanks for answer. another trouble. I encountered the 'DataFrame' object has no attribute 'append' error when using the gseapy package directly. However, the issue was resolved by updating the gseapy package using the command "pip install gseapy -U". I wonder if the author is considering upgrading the dependencies of the gseapy package?

Starlitnightly commented 1 year ago

thanks for answer. another trouble. I encountered the 'DataFrame' object has no attribute 'append' error when using the gseapy package directly. However, the issue was resolved by updating the gseapy package using the command "pip install gseapy -U". I wonder if the author is considering upgrading the dependencies of the gseapy package?

Hi,

This is an issue I've thought about before, stemming from the fact that when gseapy version 1.0 was first released there were a lot of api incompatibilities, so I backed out of the version to make mandatory dependencies. If the latest version you have no problem with all my enrichment functions, I will consider changing the dependency, thanks for the reply!

qwelongh commented 1 year ago

Perhaps you can consider localizing gseapy