I am trying to read a silent file with the function poses_from_silent(), but I get an error about an unrecognized residue:
for pose in poses_from_silent(silentFile): pose
core.io.silent.SilentFileData: Reading all structures from silent.out core.io.silent.SilentFileData: Finished reading X structures from silent.out
$HOME/miniconda2/lib/python2.7/site-packages/pyrosetta-2018.31+release.231d1f3-py2.7-linux-x86_64.egg/pyrosetta/io/__init__.pyc in poses_from_silent(silent_filename) 66 ss = sfd.get_structure(tag) 67 pose = Pose() ---> 68 ss.fill_pose(pose) 69 yield pose
File: /home/benchmark/T/rosetta.Glass/_commits_/main/source/src/core/pose/annotated_sequence.cc:191 [ ERROR ] UtilityExitException ERROR: can't find residue type for XX at pos XXX in sequence M[MET:NtermProteinFull]...
However, when I am working with a single pdb file there is no problem to do this; I am currently loading the params file, for a single pdb, with the function pose_from_file() as follows:
pose = Pose() generate_nonstandard_residue_set(pose,paramsFile) pose_from_file(pose, pdbFile)
which loads correctly the params file into a new pose object and then it is passed to the pose_from_file() function.
Is there an analog way for loading the params file as to be read by the poses_from_silent() function?
You can take a look at the implementation of poses_from_silent() to see how it works:
The ss.fill_pose() will obey a set non-standard residue set just like pose_from_file() will. You would just need to implement your own version oof poses_from_silent which loads your params files for each pose you're creating.
The other alternative is to add the params files to the global residue type set. This can be done by passing them in during PyRosetta initialization with the -extra_res_fa option. (http://www.pyrosetta.org/faq#TOC-1.-How-do-I-interact-with-the-Rosetta-Options-system-using-PyRosetta-) -- The drawback of this way is that you'd add the ligand for the entire run, and not just the loaded structures.
Thank you very much Rocco for your answer, very helpfull as always!