41 #include <utility/string_util.hh>
43 #include <basic/Tracer.hh>
57 #include <utility/tag/Tag.hh>
58 #include <utility/tag/Tag.fwd.hh>
69 #include <utility/vector1.hh>
71 #include <boost/foreach.hpp>
73 #define foreach BOOST_FOREACH
76 using namespace protocols::seeded_abinitio;
77 static basic::Tracer
TR(
"protocols.seeded_abinitio.GrowPeptides" );
81 namespace seeded_abinitio {
83 using namespace protocols::moves;
87 GrowPeptidesCreator::keyname()
const{
88 return GrowPeptidesCreator::mover_name();
92 GrowPeptidesCreator::create_mover()
const {
97 GrowPeptidesCreator::mover_name(){
98 return "GrowPeptides";
102 GrowPeptides::GrowPeptides()
105 GrowPeptides::~GrowPeptides() {}
114 GrowPeptides::fresh_instance()
const {
125 TR<<
" ---- growing N-terminal stretch from residues: "<<res_pos <<
" to " <<stop <<
"----------" << std::endl;
130 for (
Size k= res_pos; k <
stop ; ++k ) {
131 Size resi = stop - k + res_pos - 1 ;
132 const char aa = nat_seq[ stop - k - 1 + seq_register - 1];
133 TR.Debug <<
"RES AA N-terminal extension: " << resi << aa <<std::endl;
137 target_seeds.
set_omega( res_pos, 180.0 );
144 TR<<
" ----- growing C-terminal extension from residues: "<<res_pos <<
" to " <<stop <<
"--------" <<std::endl;
149 for (
Size j = res_pos ; j <
stop ; ++j ){
150 const char aa = nat_seq[ j - res_pos + seq_register ];
152 TR.Debug <<
"RES AA C-terminal extension " << resi << aa <<std::endl;
192 GrowPeptides::grow_from_verteces(
196 std::set< core::Size > vertex_set
199 using namespace core;
200 using namespace kinematics;
203 saved_pose = curr_pose;
207 TR<<
"foldtree before growing: " << grow_foldtree << std::endl;
210 foreach(
const Size vertex, vertex_set )
211 verteces.push_back( vertex );
213 TR<<
"start new protein: " << verteces[1] <<
" end: " << verteces[verteces.size()] <<
" size sequence: " << sequence.size()<< std::endl;
214 TR.Debug <<
"number verteces: "<< verteces.size()<< std::endl;
216 if ( verteces[verteces.size()] - (verteces[1] - 1) != sequence.size() )
217 utility_exit_with_message(
"chunk pieces do not agree with the length of the submitted template pdb" );
219 for (
Size vertex_it = 4 ; vertex_it <= verteces.size(); vertex_it = vertex_it + 4){
221 if( vertex_it < verteces.size() ){
224 TR.Debug <<
"for temp jump --- from: " <<verteces[vertex_it - 3 ]<<
", to: "<< verteces[vertex_it - 3] + (seeds[vertex_it/4].stop() - seeds[vertex_it/4].start()) + 1 <<
", cutpoint: "<< verteces[vertex_it - 3] + (seeds[vertex_it/4].
stop() - seeds[vertex_it/4].start()) <<std::endl;
226 Size temp_cutpoint = verteces[vertex_it - 3] + (seeds[vertex_it/4].stop() - seeds[vertex_it/4].start());
231 grow_foldtree.new_jump( verteces[vertex_it - 3 ], verteces[vertex_it - 3] + (seeds[vertex_it/4].
stop() - seeds[vertex_it/4].
start()) + 1 , temp_cutpoint );
233 TR<<
"foldtree before adding new seeds, current seed: "<<vertex_it/4 <<
" with foldtree " << grow_foldtree << std::endl;
238 TR<<
"appending N-terminally from: " << verteces[vertex_it - 3 ] <<
" to " << verteces[vertex_it - 2] <<std::endl;
239 TR<<
"appending C-terminally from: " << verteces[vertex_it - 1 ] <<
" to " << verteces[vertex_it ] << std::endl;
242 Size nseq_start = seeds[vertex_it/4 ].start() - ( verteces[vertex_it - 2] - verteces[vertex_it - 3] );
243 TR.Debug <<
" grow nterm: start sequence " <<nseq_start <<
" position in pose "<< verteces[vertex_it - 3] <<
" stop " << verteces[vertex_it - 2] <<
" sequence " << sequence << std::endl ;
246 append_residues_nterminally( seeds[vertex_it /4].
start() - ( verteces[vertex_it - 2] - verteces[vertex_it - 3] ) , verteces[vertex_it - 3] , verteces[vertex_it - 2], sequence , curr_pose ) ;
248 TR <<
"growing foldtree: " << grow_foldtree << std::endl;
249 TR.Debug <<
" grow cterm: start sequence " << seeds<<
" position in pose "<< verteces[vertex_it - 1 ] <<
" stop " << verteces[vertex_it] <<
" sequence " << sequence << std::endl ;
250 append_residues_cterminally( seeds[vertex_it/4].
stop(), verteces[vertex_it - 1 ] , verteces[vertex_it], sequence , curr_pose ) ;
255 grow_foldtree.clear();
258 TR.Debug <<
"done growing, temporary foldtree: " << grow_foldtree << std::endl;
262 TR <<
"growing completed, temporary foldtree: " << grow_foldtree << std::endl;
268 setup_cached_observers( pose );
271 if( all_seeds_.size() > 0 && template_presence ){
275 if( !fetch_foldtree )
276 TR<<
"taking foldtree from pose" <<std::endl;
279 if( fetch_foldtree ){
280 TR<<
"generate a foldtree through SeedFoldTree, and get cutpoints" << std::endl;
283 seed_ft_generator->ddg_based( ddg() );
284 seed_ft_generator->scorefxn( scorefxn_ );
285 seed_ft_generator->anchor_specified(anchor_specified_);
286 if( anchor_specified_ )
287 seed_ft_generator->set_anchor_res( anchors_ );
290 std::string secstr_template = template_pdb_->secstruct();
291 TR.Debug <<
"sec str for template: " << secstr_template << std::endl;
292 seed_foldtree_ = seed_ft_generator->set_foldtree( tmp_seed_target_poseOP, secstr_template, all_seeds_,
true );
293 verteces_ = seed_ft_generator->get_folding_verteces();
294 TR.Debug<<
"verteces for folding: " <<std::endl;
295 cutpoints = seed_foldtree_->cutpoints();
306 seq = template_pdb_->sequence();
307 if( seq ==
"" ) utility_exit_with_message(
"no sequence specified" );
309 grow_from_verteces( pose, seq, all_seeds_ , verteces_ );
313 TR<<
"set new foldtree: "<< pose.
fold_tree() <<std::endl;
378 if( !output_centroid ){
379 TR<<
"switching back to full_atom mode" <<std::endl;
382 ( *scorefxn_ )( pose );
397 GrowPeptides::get_name()
const {
398 return GrowPeptidesCreator::mover_name();
402 GrowPeptides::parse_my_tag(
409 TR<<
"GrowPeptides mover has been initiated" <<std::endl;
411 template_presence =
false;
415 TR<<
"scoring with following scorefunction: " << *scorefxn_ <<std::endl;
417 fetch_foldtree = tag->getOption<
bool >(
"SeedFoldTree", 0 );
419 ddg_ = tag->getOption<
bool >(
"ddg_based", 0 );
423 if( tag->hasOption(
"extend_nterm" ) ) {
424 extend_nterm = tag->getOption<
Size >(
"extend_nterm" , 0 );
425 TR<<
"extending peptide n-terminally by "<< extend_nterm << std::endl;
427 if( tag->hasOption(
"extend_cterm" ) ){
428 extend_cterm = tag->getOption<
Size >(
"extend_cterm" , 0 );
429 TR<<
"extending peptide c-terminally by " << extend_cterm << std::endl;
432 all_ala_N = tag->getOption<
bool >(
"all_ala_N" , 0 );
434 TR<<
"N-terminally added amino acids are all ALA" <<std::endl;
436 all_ala_C = tag->getOption<
bool >(
"all_ala_C", 0 );
438 TR<<
"C-terminally added amino acids are all ALA" <<std::endl;
440 if( tag->hasOption(
"nseq" ) )
441 csequence_ = ( tag->getOption<
std::string >(
"nseq" ) );
443 if( tag->hasOption(
"cseq" ) )
444 nsequence_ = ( tag->getOption<
std::string >(
"cseq" ) );
446 output_centroid = tag->getOption<
bool >(
"output_centroid", 0 );
448 if( tag->hasOption(
"template_pdb" ) ){
452 TR<<
"read in a template pdb with " <<template_pdb_->total_residue() <<
"residues"<<std::endl;
453 template_presence =
true;
456 if( tag->hasOption(
"sequence" )){
460 if( !template_presence && seq_ ==
"" )
461 utility_exit_with_message(
"neither template pdb nor sequence for growing is specified!!" );
465 foreach(
TagPtr const btag, branch_tags ){
468 if( template_presence )
469 curr_pose_ = template_pdb_;
473 anchor_specified_ =
false;
475 if( btag->getName() ==
"Seeds" ) {
481 all_seeds_.add_loop( begin , end , 0, 0,
false );
482 TR <<
"parsing seeds: \n"<< begin <<
" and " << end <<std::endl;
484 if( btag->hasOption(
"anchor" )){
486 TR<<
"anchor residue: " << anchor_res << std::endl;
487 anchors_.push_back( anchor_res );
488 anchor_specified_ =
true;
493 if( btag->getName() ==
"Steal_seq_span" ) {
494 if( !template_presence )
495 utility_exit_with_message(
"need to specify a template pdb to steal sequenc spans");
500 runtime_assert( end > begin );
501 runtime_assert( begin>=1);
502 runtime_assert( end<=template_pdb_->total_residue() );
504 sequence_chunks_.push_back( seq_chunk );