kmayerb / tcrdist3

flexible CDR based distance metrics
MIT License
53 stars 17 forks source link

Error in "Hello tcrdist3" #55

Closed aoki0623mriid2 closed 2 years ago

aoki0623mriid2 commented 3 years ago

Dear kmayerb,

I have just installed tcrdist3 and tried to run "Hello tcrdist3". (https://tcrdist3.readthedocs.io/en/latest/welcome.html)

However, when I ran "tr = TCRrep(cell_df = df, …", I faced the error message as "TypeError: expected dtype object, got 'numpy.dtype[int16]'"

I cannot solve this problem, so please help me.

The version of my numpy is 1.21.2 I paste the Traceback I recieved below.

Best, Hiroyasu

Traceback (most recent call last): File "", line 4, in File "C:\Users\puchi\AppData\Roaming\Python\Python37\site-packages\tcrdist\repertoire.py", line 202, in init self.compute_distances() File "C:\Users\puchi\AppData\Roaming\Python\Python37\site-packages\tcrdist\repertoire.py", line 310, in compute_distances store = self.store_all_cdr) File "C:\Users\puchi\AppData\Roaming\Python\Python37\site-packages\tcrdist\rep_funcs.py", line 115, in _pws pw_mat = _pw(seqs1 = df[k].values, metric = metrics[k], ncpus = cpu, uniqify= uniquify, kargs[k]) File "C:\Users\puchi\AppData\Roaming\Python\Python37\site-packages\tcrdist\rep_funcs.py", line 140, in _pw kwargs) File "C:\Users\puchi\AppData\Roaming\Python\Python37\site-packages\pwseqdist\pairwise.py", line 167, in apply_pairwise_rect urect = metric(pw_indices, seqs_mat, seqs_L, *args, **kwargs) File "C:\Users\puchi\AppData\Roaming\Python\Python37\site-packages\pwseqdist\nb_metrics.py", line 239, in nb_vector_tcrdist return _nb_vector_tcrdist(indices, seqs_mat, seqs_L, distance_matrix, dist_weight, gap_penalty, ntrim, ctrim, fixed_gappos) TypeError: expected dtype object, got 'numpy.dtype[int16]'

kmayerb commented 3 years ago

Hiroyasu,

Hi. I am not sure the cause of the issue you are experiencing. Most common issues are from incorrectly formatted inputs so I am surprised to see this here on basic example. How did you install and on what type of machine (If Windows?, I am not certain as we've only tested on Linux and OSX)

Can you confirm success of the commands below

import numba
import numpy
import pandas as pd
from tcrdist.repertoire import TCRrep

Also can you confirm that you downloaded dash.csv and loaded it correctly as a DataFrame?

aoki0623mriid2 commented 3 years ago

Kmayerb,

Thank you for your quick response.

I confirmed "import numba" and "import numpy" succeeded on my python. However, I faced the same problem again.

I installed tcrdist3 on Windows 10 by using pip install git+https://github.com/kmayerb/tcrdist3.git@0.2.0 I also checked the input csv file and confirmed it was successfully imported.

`>>> df.head(3)
             subject epitope  count     v_a_gene   j_a_gene  ...     v_b_gene    j_b_gene          cdr3_b_aa                                      cdr3_b_nucseq             clone_id
0  mouse_subject0050      PA      2   TRAV7-3*01  TRAJ33*01  ...  TRBV13-1*01  TRBJ2-3*01  CASSDFDWGGDAETLYF  tgtgccagcagtgatttcgactggggaggggatgcagaaacgctgt...  mouse_tcr0072.clone
1  mouse_subject0050      PA      6  TRAV6D-6*01  TRAJ56*01  ...    TRBV29*01  TRBJ1-1*01       CASSPDRGEVFF               tgtgctagcagtccggacaggggtgaagtcttcttt  mouse_tcr0096.clone
2  mouse_subject0050      PA      1  TRAV6D-6*01  TRAJ49*01  ...    TRBV29*01  TRBJ1-5*01        CASTGGGAPLF                  tgtgctagcacagggggaggggctccgcttttt  mouse_tcr0276.clone

[3 rows x 12 columns]`

Is there dependency on the version of numba or numpy? If there is no cue, I next try to install tcrdist3 on Mac PC in my lab.

Thank you.

kmayerb commented 3 years ago

Dependencies should be required on pip install based on the requirements.txt and setup.py file. I would definitely try on Mac or Linux machine, as we really don't have a testing in place to make sure this will work on Windows. You can of course use Docker desktop to run linux type environment on your Windows Laptop.