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

Calculating perplexity for a list of sequences given a single structure #11

Closed
rtmag opened this issue Jul 23, 2024 · 2 comments
Closed

Comments

@rtmag
Copy link

rtmag commented Jul 23, 2024

Hello, really great project! I have a question:

Given an antibody pdb structure, would it be possible to calculate the perplexity for a list of paired heavy and light sequences?

In other words, I'd like to compare a list of antibody sequences to see which has the best fit for the structure.

Thanks a lot in advance!!

  • Roberto
@mhoie
Copy link
Contributor

mhoie commented Jul 24, 2024

HI rtmag,

If I understand you correctly, you could calculate the average log likelihood of sequences fitting into the given structure.

E.g. first align your sequences, then calculate the average score for each residue in the output CSV: https://github.com/oxpig/AntiFold/blob/master/output/single_pdb/6y1l_imgt.csv

The original sequence should score highly, while random antibody sequences should score poorly (for CDRs at least).

You can convert this to a "pseudo-perplexity" like this

# https://huggingface.co/blog/AmelieSchreiber/mutation-scoring
# Compute and return the pseudo-perplexity
pppl = torch.exp(-avg_log_likelihood)

@rtmag
Copy link
Author

rtmag commented Jul 24, 2024

Awesome Magnus, thanks for your input, will test it out :)!

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

3 participants