Tang-Lab-super / PROST

PROST: A quantitative pattern recognition framework for spatial transcriptomics.
MIT License
5 stars 1 forks source link

PROST.prepare_for_PI no progress on Linux Unbuntu #7

Closed rocketeer1998 closed 1 week ago

rocketeer1998 commented 1 month ago

Hi @Sicrve11 , based on the same dataset, why I can successfully run all processes on Windows10 but fail on PROST.cal_PI step on Linux? I saw that the PROST.cal_PI on Linux didn't show any progress but was directly finished. However, the next step PROST.cal_PI threw an error as follows.

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/tmp/ipykernel_200466/115960891.py in <module>
----> 1 adata = PROST.cal_PI(adata, platform="HybISS")

/mnt/data/tool/miniconda3/envs/prost/lib/python3.7/site-packages/PROST-1.1.2-py3.7.egg/PROST/calculate_PI.py in cal_PI(adata, platform)
    269 
    270 def cal_PI(adata,platform="visium"):
--> 271     data = adata.uns['nor_counts']
    272     subregions = adata.uns['subregions']
    273     del_idx = adata.uns['del_index']

/mnt/data/tool/miniconda3/envs/prost/lib/python3.7/site-packages/anndata/compat/_overloaded_dict.py in __getitem__(self, key)
     98             return self.overloaded[key].get()
     99         else:
--> 100             return self.data[key]
    101 
    102     def __setitem__(self, key, value):

KeyError: 'nor_counts'

I assume it is a dependency problem, but I don't know how to fix it. Below is my session info.

-----
PROST                1.1.2 
anndata             0.8.0
matplotlib          3.5.3
numpy               1.21.6
pandas              1.3.5
scanpy              1.8.2
session_info        1.0.0
-----
Click to view modules imported as dependencies
PIL                 9.5.0
backcall            0.2.0
beta_ufunc          NA
binom_ufunc         NA
cffi                1.15.1
cv2                 4.6.0
cycler              0.10.0
cython_runtime      NA
dateutil            2.9.0.post0
debugpy             1.7.0
decorator           5.1.1
entrypoints         0.4
h5py                3.7.0
igraph              0.10.8
importlib_metadata  NA
ipykernel           6.16.2
jedi                0.19.1
joblib              1.3.2
kiwisolver          1.4.5
leidenalg           0.9.0
llvmlite            0.39.1
mpl_toolkits        NA
natsort             8.2.0
nbinom_ufunc        NA
numba               0.56.3
numexpr             2.8.6
packaging           24.0
parso               0.8.4
pexpect             4.9.0
pickleshare         0.7.5
pkg_resources       NA
prompt_toolkit      3.0.45
psutil              5.9.8
ptyprocess          0.7.0
pycparser           2.21
pydev_ipython       NA
pydevconsole        NA
pydevd              2.9.5
pydevd_file_utils   NA
pydevd_plugins      NA
pydevd_tracing      NA
pygments            2.17.2
pyparsing           3.1.2
pytz                2024.1
scipy               1.7.3
sinfo               0.3.4
six                 1.16.0
skimage             0.19.2
sklearn             0.24.2
storemagic          NA
tables              3.7.0
texttable           1.7.0
threadpoolctl       3.1.0
torch               1.8.1+cu102
tornado             6.2
tqdm                4.66.4
traitlets           5.9.0
typing_extensions   NA
wcwidth             0.2.13
zipp                NA
zmq                 26.0.3
-----
IPython             7.34.0
jupyter_client      7.4.9
jupyter_core        4.12.0
-----
Python 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 06:08:21) [GCC 9.4.0]
Linux-5.15.0-86-generic-x86_64-with-debian-bookworm-sid
-----
Session information updated at 2024-06-03 09:12
Sicrve11 commented 1 month ago

Yes, this could be a problem with the package installation, because I see the function cal_PI in your error message doesn't match cal_PI in our package, and you need to make sure that no changes have been made to calculate_PI.py or you need to reinstall PROST.

rocketeer1998 commented 4 weeks ago

I've reinstalled PROST according to your documentation, but the same error was still ouccured. One thing to note is that I've updated the anndata version from 0.7.6 (which is clarified in your requirement.txt) to 0.8.0. because otherwise I can't read my anndata where the error was as follows.

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/mnt/data/tool/miniconda3/envs/prost/lib/python3.7/site-packages/anndata/_io/utils.py in func_wrapper(elem, *args, **kwargs)
    176         try:
--> 177             return func(elem, *args, **kwargs)
    178         except Exception as e:

/mnt/data/tool/miniconda3/envs/prost/lib/python3.7/site-packages/anndata/_io/h5ad.py in read_group(group)
    526     if encoding_type:
--> 527         EncodingVersions[encoding_type].check(
    528             group.name, group.attrs["encoding-version"]

/mnt/data/tool/miniconda3/envs/prost/lib/python3.7/enum.py in __getitem__(cls, name)
    356     def __getitem__(cls, name):
--> 357         return cls._member_map_[name]
    358 

KeyError: 'dict'

During handling of the above exception, another exception occurred:

AnnDataReadError                          Traceback (most recent call last)
/tmp/ipykernel_216029/910368596.py in <module>
----> 1 adata = ad.read_h5ad('20240525_Datasets/Gyllborg2020HybISS.h5ad')
      2 adata

/mnt/data/tool/miniconda3/envs/prost/lib/python3.7/site-packages/anndata/_io/h5ad.py in read_h5ad(filename, backed, as_sparse, as_sparse_fmt, chunk_size)
    419                 d[k] = read_dataframe(f[k])
    420             else:  # Base case
--> 421                 d[k] = read_attribute(f[k])
    422 
    423         d["raw"] = _read_raw(f, as_sparse, rdasp)

/mnt/data/tool/miniconda3/envs/prost/lib/python3.7/functools.py in wrapper(*args, **kw)
    838                             '1 positional argument')
    839 
--> 840         return dispatch(args[0].__class__)(*args, **kw)
    841 
    842     funcname = getattr(func, '__name__', 'singledispatch function')

/mnt/data/tool/miniconda3/envs/prost/lib/python3.7/site-packages/anndata/_io/utils.py in func_wrapper(elem, *args, **kwargs)
    182                 parent = _get_parent(elem)
    183                 raise AnnDataReadError(
--> 184                     f"Above error raised while reading key {elem.name!r} of "
    185                     f"type {type(elem)} from {parent}."
    186                 )

AnnDataReadError: Above error raised while reading key '/layers' of type <class 'h5py._hl.group.Group'> from /.
rocketeer1998 commented 1 week ago

Finally fix this by reinstalling PROST because I found there is tremendous inconsistency between my PROST and the newest PROST. Always remember to use the latest version!