Created
August 16, 2017 17:59
-
-
Save dacarlin/3e660fe5c8de2578901c39ba8747fbe6 to your computer and use it in GitHub Desktop.
Get a Pose energy table as a DataFrame
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
def get_energies_dataframe(pose, score_function, residues=[]): | |
values = [] | |
labels = [] | |
data = [] | |
if len(residues) > 0: | |
residue_set = residues | |
else: | |
residue_set = range(1, pose.total_residue()+1) | |
score_types = score_function.get_nonzero_weighted_scoretypes() | |
begin_score = score_function(pose) # must score anyway | |
for residue in residue_set: | |
for st in score_types: | |
label = str(st).replace('ScoreType.', '') | |
value = pose.energies().residue_total_energies(residue)[st] | |
data.append((residue, label, value)) | |
return pandas.DataFrame(data, columns=['residue', 'score_type', 'value']) | |
get_energies_dataframe(p, s, residues=[1, 2, 3]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is this a complete function?
Where is the code for 'get_nonzero_weighted_scoretypes()'?
Also, what about the code for setting 's'/'score_function' as its own function to apply to 'pose' as a part of generating 'begin_score'?
Are these generic functions for PyRosetta?