Here's my python code (sample):
scorefxn = create_score_function_ws_patch("standard", "score12")
residue_energies = [pose.energies().residue_total_energy(i) for i in range(1, pose.total_residue() + 1)]
score_prot = 0
score_lig = 0
for i in range(1, len(residue_energies) + 1):
if pose.residue(i).is_protein():
score_prot += residue_energies[i - 1]
else:
score_lig += residue_energies[i - 1]
The most likely reason for the difference is in hydrogen bonding; hydrogen bonds are stored on a per-Pose basis instead of a per-Residue basis like most score terms for performance reasons. There is a way to override this if necessary.
Scoring in this way is incorrect if you meant to calculate the empty form of the protein. The scores are still aware of the presence of the ligand when you do this, so (for example) the protein-ligand van der Waals scores are still there. If you want the score of the empty protein, and/or of the ligand alone, you should separate them into separate Pose objects. (Copy the pose, delete the ligand from one and the protein from the other).
The first thing to try is the pose utility function remove_nonprotein_residues(pose). It's in the core::pose utility functions, I'm not sure of the python syntax.
It's good. I found a way to do that !
Here's my python code (sample):
scorefxn = create_score_function_ws_patch("standard", "score12")
residue_energies = [pose.energies().residue_total_energy(i) for i in range(1, pose.total_residue() + 1)]
score_prot = 0
score_lig = 0
for i in range(1, len(residue_energies) + 1):
if pose.residue(i).is_protein():
score_prot += residue_energies[i - 1]
else:
score_lig += residue_energies[i - 1]
print "prot: " +str(score_prot)+ " lig: " +str(score_lig)+ " total: " +str(score_prot + score_lig)
print "scorefxn: " +str(scorefxn(pose))
Output:
prot: 1402.95812191 lig: 62597.7988939 total: 64000.7570158
scorefxn: 63887.7082482
Now, I don't understand why I obtain different results ?!
The most likely reason for the difference is in hydrogen bonding; hydrogen bonds are stored on a per-Pose basis instead of a per-Residue basis like most score terms for performance reasons. There is a way to override this if necessary.
Scoring in this way is incorrect if you meant to calculate the empty form of the protein. The scores are still aware of the presence of the ligand when you do this, so (for example) the protein-ligand van der Waals scores are still there. If you want the score of the empty protein, and/or of the ligand alone, you should separate them into separate Pose objects. (Copy the pose, delete the ligand from one and the protein from the other).
Thank you for reply me !
Last question, how do you remove residue from pose ?
The first thing to try is the pose utility function remove_nonprotein_residues(pose). It's in the core::pose utility functions, I'm not sure of the python syntax.
Failing that, try pose.conformation().delete_residue_slow(ligand_position).
Apparently, the right syntax is core.pose.remove_nonprotein_residues(pose).
Just remove_nonprotein_residues(pose) doesn't work for me.
(But I think this function "speaks" a little too much for me.)
Thank you.