You are here - problem with runing the script

3 posts / 0 new
Last post - problem with runing the script

I have folder in workspace(domain_name) with subfiles (file_pdb) . I want to run script , where argument is a domain_name, and then the script makes some operations on subfiles. But I get error
Traceback (most recent call last):
File "", line 1, in
File "C:\Program Files (x86)\Python27x32\energy_model", line 58, in results_all_models
results = energy_model(ff)
File "C:\Program Files (x86)\Python27x32\energy_model", line 8, in energy_model
File "C:\Program Files (x86)\PyRosetta\rosetta\", line 1131, in exit_callback
raise PyRosettaException()
PyRosettaException: PyRosettaException

I ve checked if file pdb is a full path and it is. I ve chcecke if def energy_model works alone and it is. Whats wrong is here?

from rosetta import *
import os

def energy_model(file_pdb):
return res

#result = []
def scorefunction_show(scorefxn, pose):
pose_score = scorefxn(pose) #make sure scores are set
#print "------------------------------------------------------------"
#print " Scores Weight Raw Score Wghtd.Score"
#print "------------------------------------------------------------"
result = []

for scoretype in scorefxn.get_nonzero_weighted_scoretypes():
#scoretype = core.scoring.ScoreType(i)
if scorefxn.has_nonzero_weight( scoretype ):
weight = scorefxn[ scoretype ];
raw = pose.energies().total_energies()[ scoretype ]
weighted = weight*raw

#print " %-24s %9.3f" % ( scoretype, weight*raw)
sum_weighted += weight * raw
name_score = name_from_score_type(scoretype)

return result

def results_all_models(domain_name):

print os.getcwd()
path = "./"+domain_name
input_files = [f for f in os.listdir(path) if f.endswith('.pdb')]

print os.getcwd()
print os.getcwd()

for i in range(len(input_files)):
filenamein = "'"+os.getcwd()+"/"+input_files[i]+"'"
#f = os.path.expanduser(filenamein)
ff = os.path.normpath(filenamein)

print ff
results = energy_model(ff)
outfile.write("Results for model "+filenamein+":\n")
outfile.write(" %-24s %9.3f"+results[0])
outfile.write(" Total weighted score: %9.3"+results[i+2])

Post Situation: 
Thu, 2013-10-31 00:35


It looks like your missing rosetta.init() statement after your import. Your init() is half way through the script. Put it at the beginning after the import statement, and see if it works then.

Also, 'standard' is not the right scorefunction. If you are using the newest binaries, the scorefunction should be 'talaris2013'; if you have an older version, like the windows version, you will want to use 'standard' plus the 'score12' patch:

score = create_score_function_ws_patch('standard', 'score12')

You can also use standard/score12 with the newest binaries, but you must pass the option -restore_pre_talaris_2013_behavior.
See for setting options in PyRosetta.


Thu, 2013-10-31 08:15

Are you getting any additional diagnostic error messages? Often there will be some error or warning from the C++ portion of Rosetta printed prior to the Traceback. (BTW, the forum eats whitespace, so it's better to post Python scripts as attachments to preserve indentation.)

I suspect that there's something wrong with one or more of the PDB files you're trying to load. I'd add a line in energy_model() to print the name of the PDB you're loading prior to the pose_from_pdb(s) line. Then take a look at the PDB name it prints right before it gives you the traceback. Is it just that one PDB that's giving you a problem, or is it any PDB you try? Where did you get the PDBs you're loading from? What do they look like? (If you can post an example here as an attachment, we can take a look at it.)

Thu, 2013-10-31 08:06