GuangyuWangLab2021 / cellDancer

Predict RNA velocity through deep learning
https://guangyuwanglab2021.github.io/cellDancer_website/
BSD 3-Clause "New" or "Revised" License
60 stars 11 forks source link

Violation for pd.DataFrame update #1

Closed yuntianf closed 1 year ago

yuntianf commented 1 year ago

Hi, I tried running the cd.velocity function according to your demo, but it casted out error as below.

AttributeError                            Traceback (most recent call last)
Cell In[9], line 1
----> 1 loss_df, cellDancer_df=cd.velocity(CD8,\
      2                                    gene_list=["GZMK"],\
      3                                    permutation_ratio=0.125,\
      4                                    n_jobs=8)

File ~/softwares/anaconda3/envs/py3.8/lib/python3.8/site-packages/celldancer/velocity_estimation.py:763, in velocity(cell_type_u_s, gene_list, max_epoches, check_val_every_n_epoch, patience, learning_rate, dt, n_neighbors, permutation_ratio, speed_up, norm_u_s, norm_cell_distribution, loss_func, n_jobs, save_path)
    760 gene_list_buring=[list(cell_type_u_s.gene_name.drop_duplicates())[0]]
    761 datamodule=build_datamodule(cell_type_u_s,speed_up,norm_u_s,permutation_ratio,norm_cell_distribution,gene_list=gene_list_buring)
--> 763 result = Parallel(n_jobs=n_jobs, backend="loky")(
    764     delayed(_train_thread)(
    765         datamodule = datamodule,
    766         data_indices=[data_index], 
    767         max_epoches=max_epoches,
    768         check_val_every_n_epoch=check_val_every_n_epoch,
    769         patience=patience,
    770         learning_rate=learning_rate,
    771         n_neighbors=n_neighbors,
    772         dt=dt,
    773         loss_func=loss_func,
    774         save_path=save_path,
    775         norm_u_s=norm_u_s)
    776     for data_index in range(0,len(gene_list_buring)))
    778 # clean directory
    779 shutil.rmtree(os.path.join(save_path,'TEMP'))

File ~/softwares/anaconda3/envs/py3.8/lib/python3.8/site-packages/joblib/parallel.py:1056, in Parallel.__call__(self, iterable)
   1053     self._iterating = False
   1055 with self._backend.retrieval_context():
-> 1056     self.retrieve()
   1057 # Make sure that we get a last message telling us we are done
   1058 elapsed_time = time.time() - self._start_time

File ~/softwares/anaconda3/envs/py3.8/lib/python3.8/site-packages/joblib/parallel.py:935, in Parallel.retrieve(self)
    933 try:
    934     if getattr(self._backend, 'supports_timeout', False):
--> 935         self._output.extend(job.get(timeout=self.timeout))
    936     else:
    937         self._output.extend(job.get())

File ~/softwares/anaconda3/envs/py3.8/lib/python3.8/site-packages/joblib/_parallel_backends.py:542, in LokyBackend.wrap_future_result(future, timeout)
    539 """Wrapper for Future.result to implement the same behaviour as
    540 AsyncResults.get from multiprocessing."""
    541 try:
--> 542     return future.result(timeout=timeout)
    543 except CfTimeoutError as e:
    544     raise TimeoutError from e

File ~/softwares/anaconda3/envs/py3.8/lib/python3.8/concurrent/futures/_base.py:444, in Future.result(self, timeout)
    442     raise CancelledError()
    443 elif self._state == FINISHED:
--> 444     return self.__get_result()
    445 else:
    446     raise TimeoutError()

File ~/softwares/anaconda3/envs/py3.8/lib/python3.8/concurrent/futures/_base.py:389, in Future.__get_result(self)
    387 if self._exception:
    388     try:
--> 389         raise self._exception
    390     finally:
    391         # Break a reference cycle with the exception in self._exception
    392         self = None

AttributeError: 'DataFrame' object has no attribute 'append'

It seems that pandas has removed support for df.append, could you please fix this?

Abclisy commented 1 year ago

Hello, thank you for the feedback! Could you tell us the version of your pandas? Since pandas version 1.4.0, the append method has been deprecated. We are working to let it be compatible with both versions and will update it in a later version.

For your current concern, could you try pip install pandas==1.3.4 as described in requirements.txt and restart the kernel to see if it works or not? If it still doesn't work, could you send us your device information, the Python version, and the packages information (conda list)?

yuntianf commented 1 year ago

Sure, my current pandas version is 2.0.0, I will try 1.3.4 and let you know.

Abclisy commented 1 year ago

Hello, it's been a while since we heard back from you regarding this issue. We will be closing this issue. However, please don't hesitate to reopen it or create a new issue if you have further questions or concerns. Thank you for your understanding.