dpeerlab / Palantir

Single cell trajectory detection
https://palantir.readthedocs.io
GNU General Public License v2.0
213 stars 50 forks source link

palantir.presults.PResults.load error #53

Closed YubinXie closed 3 years ago

YubinXie commented 3 years ago

I tried to load the saved results from palantir, and got many errors. I am able to load with pkl but it is not a palantir result class.

---------------------------------------------------------------------------
RecursionError                            Traceback (most recent call last)
<ipython-input-4-62407a65f141> in <module>
----> 1 pr_res=palantir.presults.PResults.load('../data/palantir.pkl')

~/miniconda3/envs/scrna/lib/python3.7/site-packages/palantir/presults.py in load(cls, pkl_file)
     62             data["_entropy"],
     63             data["_branch_probs"],
---> 64             data["_waypoints"],
     65         )
     66         return presults

~/miniconda3/envs/scrna/lib/python3.7/site-packages/palantir/presults.py in __init__(self, pseudotime, entropy, branch_probs, waypoints)
     19 
     20         # Initialize
---> 21         self._pseudotime = (pseudotime - pseudotime.min()) / (
     22             pseudotime.max() - pseudotime.min()
     23         )

~/miniconda3/envs/scrna/lib/python3.7/site-packages/pandas/core/generic.py in stat_func(self, axis, skipna, level, numeric_only, **kwargs)
  11213             return self._agg_by_level(name, axis=axis, level=level, skipna=skipna)
  11214         return self._reduce(
> 11215             f, name, axis=axis, skipna=skipna, numeric_only=numeric_only
  11216         )
  11217 

~/miniconda3/envs/scrna/lib/python3.7/site-packages/pandas/core/series.py in _reduce(self, op, name, axis, skipna, numeric_only, filter_type, **kwds)
   3864         otherwise delegate to the object.
   3865         """
-> 3866         delegate = self._values
   3867 
   3868         if axis is not None:

~/miniconda3/envs/scrna/lib/python3.7/site-packages/pandas/core/generic.py in __getattr__(self, name)
   5270             return object.__getattribute__(self, name)
   5271         else:
-> 5272             if self._info_axis._can_hold_identifiers_and_holds_name(name):
   5273                 return self[name]
   5274             return object.__getattribute__(self, name)

... last 1 frames repeated, from the frame below ...

~/miniconda3/envs/scrna/lib/python3.7/site-packages/pandas/core/generic.py in __getattr__(self, name)
   5270             return object.__getattribute__(self, name)
   5271         else:
-> 5272             if self._info_axis._can_hold_identifiers_and_holds_name(name):
   5273                 return self[name]
   5274             return object.__getattribute__(self, name)

RecursionError: maximum recursion depth exceeded
ManuSetty commented 3 years ago

Solution that worked: Save and load output directly using pickle rather than the palantir save and load functions. We will deprecate the save and load interfaces

YubinXie commented 3 years ago

save with pickle and load with pandas works (pd version==1.1)