Created
July 30, 2021 10:27
-
-
Save aozalevsky/45f80d0bb8ad6efdbdc2166baaf8dc4e to your computer and use it in GitHub Desktop.
Add pLDDT scores to structures predicted by the AlphaFold2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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