Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'pmhc_a_aa' #76

Open
Tianran1 opened this issue Oct 11, 2022 · 7 comments
Open

KeyError: 'pmhc_a_aa' #76

Tianran1 opened this issue Oct 11, 2022 · 7 comments

Comments

@Tianran1
Copy link

Hi, I am new to tcrdist. When I want to compute the distance between two sets using "compute_rect_distances", it always gives me the KeyError: 'pmhc_a_aa'. Does anyone know how to fix it? Thanks

@kmayerb
Copy link
Owner

kmayerb commented Oct 11, 2022 via email

@Tianran1
Copy link
Author

Hi, I just used the example code from your pipeline.

"""
import pandas as pd
from tcrdist.repertoire import TCRrep

df = pd.read_csv("dash.csv")
df2 = pd.read_csv("dash2.csv")
df = df.head(10) #(1)
tr = TCRrep(cell_df = df, #(2)
df2 = df2,
organism = 'mouse',
chains = ['alpha','beta'],
db_file = 'alphabeta_gammadelta_db.tsv')

assert tr.pw_alpha.shape == (10,10)
assert tr.pw_beta.shape == (10,10)

tr.compute_rect_distances() # (3)
assert tr.rw_alpha.shape == (10,1924)
assert tr.rw_beta.shape == (10,1924)

df3 = df2.head(100)

tr.compute_rect_distances(df = tr.clone_df, df2 = df3) # (4)
assert tr.rw_alpha.shape == (10,100)
assert tr.rw_beta.shape == (10,100)

tr.compute_rect_distances( df = tr.clone_df.iloc[0:2,], # (5)
df2 = df3)
assert tr.rw_alpha.shape == (2,100)
assert tr.rw_beta.shape == (2,100)
"""

I only changed the df2 to be df as well because I cannot find the dash2.csv.
Could you have a look?
Many thanks.

@kmayerb
Copy link
Owner

kmayerb commented Oct 11, 2022 via email

@Tianran1
Copy link
Author

Hi, thanks very much. Now it works. Then maybe you need to change the pipeline example since it's not correct.

@kmayerb
Copy link
Owner

kmayerb commented Oct 12, 2022 via email

@kmayerb
Copy link
Owner

kmayerb commented Oct 12, 2022 via email

@kmayerb
Copy link
Owner

kmayerb commented Oct 12, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants