Member Site › Forums › PyRosetta › PyRosetta – Scripts › __init__.py – problem with runing the script
- This topic has 2 replies, 3 voices, and was last updated 11 years, 1 month ago by Anonymous.
-
AuthorPosts
-
-
October 31, 2013 at 7:35 am #1742Anonymous
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
results_all_models(‘d1bgfa’)
File “C:Program Files (x86)Python27x32energy_model”, line 58, in results_all_models
results = energy_model(ff)
File “C:Program Files (x86)Python27x32energy_model”, line 8, in energy_model
p=pose_from_pdb(s)
File “C:Program Files (x86)PyRosettarosetta__init__.py”, line 1131, in exit_callback
raise PyRosettaException()
PyRosettaException: PyRosettaExceptionI 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 osdef energy_model(file_pdb):
s=file_pdb
p=pose_from_pdb(s)
scorefxn=create_score_function(‘standard’)
res=scorefunction_show(scorefxn,p)
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 ”
“
sum_weighted=0.0
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)
result.append(name_score)
result.append(weighted)result.append(sum_weighted)
return resultinit()
def results_all_models(domain_name):filenameout=domain_name+”_results.txt”
outfile=open(filenameout,”w”)
print os.getcwd()
path = “./”+domain_name
input_files = [f for f in os.listdir(path) if f.endswith(‘.pdb’)]print os.getcwd()
os.chdir(path)
print os.getcwd()for i in range(len(input_files)):
filenamein = “‘”+os.getcwd()+”/”+input_files+”‘”
#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])
outfile.close() -
October 31, 2013 at 3:06 pm #9459Anonymous
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.)
-
October 31, 2013 at 3:15 pm #9457Anonymous
Hi.
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 http://www.pyrosetta.org/faq#TOC-1.-How-do-I-interact-with-the-Rosetta-Options-system-using-PyRosetta- for setting options in PyRosetta.-J
-
-
AuthorPosts
- You must be logged in to reply to this topic.