You are here

PyRosetta FastDesign

10 posts / 0 new
Last post
PyRosetta FastDesign

Dear Community,


I have been trying to implement FastDesign in PyRosetta. This is my code so far, I could not find documentation or examples to help me get the code running:


x = FastDesign()


I get the folloing error:

Segmentation fault (core dumped)


I tried several settings, using MoveMap, set_enable_design(), set_to_default(), dry_run(), get_scorefxn(), get_input_pose(), I ended up doing things by trial and error, but still i get the same error output.

How do I overcome this error? What does my code need to correctly work?



I have been talking to some Python developers and they tell me a Segmentation fault (core dumped) error indicates a problem with the actual C++ code rather than python itself. So is this is a bug within PyRosetta, or am I using the mover incorrectly?



Post Situation: 
Tue, 2017-07-04 10:23

First, I would ask why do you want to use FastDesign?  What paper are you referring to in order to use it?  Much of the ability to design during fast relax was incorporated into FastRelax itself.  Is this what you want to do, or do you need something specific from FastDesign?

What version of PyRosetta are you using to start?

Wed, 2017-07-05 11:50



Thanks for your replay. as i  understand FastDesign runs the following protcol: where the protein is designed, then fast relaxed with low fa_rep, then repeat increasing the fa_rep until its default value. That is what i am trying to do, and i thought that is what FastDesign does. correct me if i am wrong.


I am using latest PyRosetta (PyRosetta4.Release.python35.ubuntu/)



I am trying to run Fixed BackBone design (that is what i meant by protein design)

Wed, 2017-07-05 12:05

So, you can do exactly that in FastRelax.  You would basically set a MoveMap that holds the BB fixed, but allows chi angles to move and pass in either your resfile or a TaskFactory. 

mm = MoveMap()

rel = FastRelax()
rel.set_movemap( mm)
rel.set_taskfactory( my_taskfactory )

rel.apply( my_pose )


Wed, 2017-07-05 13:01
task = TaskFactory.create_packer_task(pose) #<--- TaskFactory is created just fine

mm = MoveMap()

rel = FastRelax(scorefxn)
rel.set_task_factory(task)  #<--- Problem Here

TypeError: get_task_factory(): incompatible function arguments. The following argument types are supported:
    1. (self: rosetta.protocols.relax.RelaxProtocolBase) -> rosetta.core.pack.task.TaskFactory


its doesn't seem to like the TaskFactory



Everything else works fine, you need to pass in a score funtion while calling the FastRelax() ---> rel = FastRelax(scorefxn) other wise it gives Segmentation fault (core dumped)


I do need the TaskFactory in order to control which residues to mutate, so how can i fix this?

Wed, 2017-07-05 13:21

So, a PackerTask is different than a TaskFactory.  The job of the TaskFactory is to create a  PackerTask from its list of TaskOperations (hence the 'Factory' name).

You would create a TaskFactory, and then add TaskOperations to it.  If you need help with how to do this, let me know.  There is a 'ReadResFile' operation that may be of use to you. 

You would then pass the TaskFactory directly.  The packertask will be generated by the internal FastRelax machinery every time packing occurs.  The benefit to this is that you can have TaskOperations that respond to the changing environment - such as packing neighbors (which may change as things are designed or the backbone is moved) 

FastRelax does have a default constructor, so it's strange that it should require a scorefunction on construction in PyRosetta...


The alternative way to do all of this is to pass the options '-resfile my_resfile.txt' and '-respect_resfile' as command line options.  This will generate a TF in FastRelax that just reads the resfile and packs/designs accordingly (then no need to pass a TF).


from pyrosetta import *
from rosetta import *
init('-respect_resfile -resfile full_or_relative_path_to_my_resfile.txt')


Wed, 2017-07-05 14:30

Yes, I want to know how to do that please: (Create a TaskFactory, and then add TaskOperations to it, then pass the TaskFactory directly.) it would be prefereable to avoid making a resfile if possible.




wait i think i did it, is it this way?

task = TaskFactory()



Wed, 2017-07-05 14:58

  There should really be a PyRosetta tutorial for all of this, but alas... Ok, here goes.


First, you don't need to call create_packer_task.  The relax object will this itself.  

Second, a vanilla TaskFactory won't do anything.  You'll need to load it with TaskOperations. Many common task ops are in: 





#(Import Rosetta and initialize)

#Load TaskOps
from rosetta.core.pack.task.operations import *
from rosetta.protocols.toolbox.task_operations import *

#Generate the TF
TF = TaskFactory()

#Create a few TaskOps
read = ReadResfile(my_file_name)

restrict = RestrictToRepacking()

#->This would limit packing to only those that are specified in the resfile.

#You could also control residue-level design, packing, and what to design into through TaskOps. 
Checkout the RestrictAbsentCanonicalAAS, InitializeFromCommandline (which will enable -ex1 and -ex2 options for extra rotamers that is typically passed ) and RestrictToRepacking operations.

Some of my favorites:
 #OperateOnResidueSubset (which allows you to work with ResidueSelectors)


Sergey has fixed the API docs and added a sweet new search bar as I was having problems finding anything before.  

It is here:


Wed, 2017-07-05 16:10



Thank you very much, i think i got it working now :-)

Wed, 2017-07-05 16:59

FastDesign derives from FastRelax, and much of the base functionality was ported to FastRelax in order to do this.

Wed, 2017-07-05 13:09