atarashansky / SAMap

SAMap: Mapping single-cell RNA sequencing datasets from evolutionarily distant organisms.
MIT License
63 stars 19 forks source link

AttributeError: type object 'object' has no attribute 'dtype' #110

Closed yangqi1999 closed 1 year ago

yangqi1999 commented 1 year ago

Hi, atarashansky. I performed the code gpf = GenePairFinder(sm,keys=keys) to find the gene pairs that are enriched in pairs of cell types. While I got an ERROR that type object 'object' has no attribute 'dtype'. The error information are as follows :

gpf = GenePairFinder(sm,keys=keys)
Finding cluster-specific markers in Cse:leiden_clusters.
... storing 'leiden_clusters' as categorical
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/yangqi3/01_Software/conda/envs/SAMap/lib/python3.7/site-packages/samap/analysis.py", line 628, in __init__
    self.find_markers()
  File "/yangqi3/01_Software/conda/envs/SAMap/lib/python3.7/site-packages/samap/analysis.py", line 639, in find_markers
    find_cluster_markers(self.sams[sid], self.keys[sid])
  File "/yangqi3/01_Software/conda/envs/SAMap/lib/python3.7/site-packages/samap/analysis.py", line 851, in find_cluster_markers
    layer=None,
  File "/yangqi3/01_Software/conda/envs/SAMap/lib/python3.7/site-packages/scanpy/tools/_rank_genes_groups.py", line 609, in rank_genes_groups
    method, corr_method, n_genes_user, rankby_abs, tie_correct, **kwds
  File "/yangqi3/01_Software/conda/envs/SAMap/lib/python3.7/site-packages/scanpy/tools/_rank_genes_groups.py", line 391, in compute_statistics
    self.stats = pd.DataFrame(columns=idx)
  File "/yangqi3/01_Software/conda/envs/SAMap/lib/python3.7/site-packages/pandas/core/frame.py", line 435, in __init__
    mgr = init_dict(data, index, columns, dtype=dtype)
  File "/yangqi3/01_Software/conda/envs/SAMap/lib/python3.7/site-packages/pandas/core/internals/construction.py", line 239, in init_dict
    val = construct_1d_arraylike_from_scalar(np.nan, len(index), nan_dtype)
  File "/yangqi3/01_Software/conda/envs/SAMap/lib/python3.7/site-packages/pandas/core/dtypes/cast.py", line 1449, in construct_1d_arraylike_from_scalar
    dtype = dtype.dtype
AttributeError: type object 'object' has no attribute 'dtype'

How can I solve this problem ?

Many thanks,

Yang

atarashansky commented 1 year ago

It seems like a recent pandas update broke everything. Can you post the output of pip list here?

yangqi1999 commented 1 year ago

I'm very sorry forgot this issue. This is the pip list in my env. pip.txt

atarashansky commented 1 year ago

Can you try reinstalling samap from the latest github source in a fresh environment? Let me know if that doesn't fix the problem.

yangqi1999 commented 1 year ago

OK, I'll show the latest result here.

yangqi1999 commented 1 year ago

Thanks, I have solved this problem after updating the pandas from 1.0.0 to 1.3.5.