poseidonchan / TAPE

Deep learning-based tissue compositions and cell-type-specific gene expression analysis with tissue-adaptive autoencoder (TAPE)
https://sctape.readthedocs.io/
GNU General Public License v3.0
47 stars 9 forks source link

ValueError: Bin edges must be unique: array #7

Closed renruichen closed 1 year ago

renruichen commented 1 year ago

Hello, I'm glad to learn this excellent paper. There is a problem with the running of this paper, which takes up your time. I hope to get your reply. I try to run it with the following command: Sigm, Pred = Deconvolution('./Liver_counts_ref.txt','./time_point/GSE190939.txt',sep='\t', datatype='counts',genelenfile='./GeneLength_mouse.txt', mode='overall', adaptive=True, save_model_name = None) Works fine when my GSE190939.txt contains multiple samples; However, only a single sample is included. The error information is as follows:

ValueError Traceback (most recent call last) /tmp/ipykernel_191090/2707054586.py in 2 datatype='counts', genelenfile='./GeneLength_mouse.txt', 3 mode='overall', adaptive=True, ----> 4 save_model_name = None) 5 ### Write data 6 Sigm.to_csv(name+'Sigm.txt',sep='\t')

~/miniconda3/lib/python3.7/site-packages/TAPE/deconvolution.py in Deconvolution(necessary_data, real_bulk, sep, variance_threshold, datatype, genelenfile, d_prior, mode, adaptive, save_model_name, sparse, batch_size, epochs) 68 train_x, train_y, test_x, genename, celltypes, samplename = \ 69 ProcessInputData(simudata, real_bulk, sep=sep, datatype=datatype, genelenfile=genelenfile, ---> 70 variance_threshold=variance_threshold) 71 print('training data shape is ', train_x.shape, '\ntest data shape is ', test_x.shape) 72 if save_model_name is not None:

~/miniconda3/lib/python3.7/site-packages/TAPE/utils.py in ProcessInputData(train_data, test_data, sep, datatype, variance_threshold, genelenfile) 106 mean_trainx = np.mean(train_x, axis=0) 107 top_iv = pd.cut(mean_trainx, --> 108 np.linspace(np.min(mean_trainx), np.max(mean_trainx), 100)).value_counts().sort_values()[-5:].index 109 train_mid = [i.mid for i in top_iv] 110 mean_testx = np.mean(test_x, axis=0)

~/miniconda3/lib/python3.7/site-packages/pandas/core/reshape/tile.py in cut(x, bins, right, labels, retbins, precision, include_lowest, duplicates, ordered) 294 dtype=dtype, 295 duplicates=duplicates, --> 296 ordered=ordered, 297 ) 298

~/miniconda3/lib/python3.7/site-packages/pandas/core/reshape/tile.py in _bins_to_cuts(x, bins, right, labels, precision, include_lowest, dtype, duplicates, ordered) 412 if duplicates == "raise": 413 raise ValueError( --> 414 f"Bin edges must be unique: {repr(bins)}.\n" 415 f"You can drop duplicate edges by setting the 'duplicates' kwarg 416 )

ValueError: Bin edges must be unique: array([nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan]). You can drop duplicate edges by setting the 'duplicates' kwarg'''

We look forward to your reply. Thank you very much. My email is : chenrenrui2019@sibs.ac.cn I would appreciate it if I could contact you

poseidonchan commented 1 year ago

Thanks for your feedback! Actually, this code is a kind of redundancy. So I modify the code to avoid this problem. You can re-download scTAPE from pypi using command like

pip install sctape==1.1.1

to try the new code.

renruichen commented 1 year ago

Thank you for your prompt reply. When I tried using: pip install scTAPE==1.1.1 --trusted-host pypi.mirrors.ustc.edu.cn An error has occurred:

ERROR: Ignored the following versions that require a different python version: 1.0.1 Requires-Python ==3.7; Error: Ignored the following versions that require a different Python version: 1.0.1 requires - python ==3.7; 1.0.2 Requires-Python ==3.7; 1.0.3 Requires-Python ==3.7; Requires-Python ==3.7; 1.1.0 Requires-Python ==3.7; 1.1.1 Requires-Python ==3.7
ERROR: Could not find a version that satisfies the requirement scTAPE==1.1.1 (from versions: 0.1, while 0.1.2 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 1.0.0)
ERROR: No matching distribution found for scTAPE==1.1.1. Error: No matching distribution found for sctape ==1.1.1

So I use: pip install sctape-1.1-py3-none-any. whl --trusted-host pypi.mirrors.ustc.edu.cn. An error has occurred: ERROR: Package 'sctape' requires a different Python: 3.7.12 not in '==3.7' Error: Package 'sctape' requires a different Python: 3.7.12 Not in '==3.7'

renruichen commented 1 year ago

Finally, install with source code, compare the pgg-info of scTAPE1.0.0 and change it to Requires-Python: > =3.7 The installation is normal.

I hope this can be a reference for others