Skip to content

Instantly share code, notes, and snippets.

@aozalevsky
Created July 30, 2021 10:27
Show Gist options
  • Save aozalevsky/45f80d0bb8ad6efdbdc2166baaf8dc4e to your computer and use it in GitHub Desktop.
Save aozalevsky/45f80d0bb8ad6efdbdc2166baaf8dc4e to your computer and use it in GitHub Desktop.
Add pLDDT scores to structures predicted by the AlphaFold2
import prody
import dill # or pickle
# Read AF2 output
with open('result_model_1.pkl', 'rb') as f:
af = dill.load(f)
# Parse PDB structure
pdb = prody.parsePDB('relaxed_model_1.pdb')
# Assign per-residue pLDDT scores as B-factors
for r in pdb.iterResidues():
r.setBetas(af['plddt'][r.getResnum() - 1])
# Save output PDB file
prody.writePDB('relaxed_model_1_plddt.pdb', pdb)
# To color structure in PyMOL in the AF colorscheme use command
# spectrum b, rainbow_rev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment