19 #include <utility/string_util.hh>
20 #include <utility/exit.hh>
28 #include <boost/foreach.hpp>
31 #define foreach BOOST_FOREACH
39 #include <basic/Tracer.hh>
41 #include <utility/tag/Tag.hh>
42 #include <utility/vector1.hh>
49 #include <utility/io/izstream.hh>
50 #include <utility/io/ozstream.hh>
62 #include <numeric/xyzVector.hh>
67 #include <numeric/random/random.hh>
68 #include <numeric/random/random_permutation.hh>
77 namespace protein_interface_design {
80 static basic::Tracer
TR(
"protocols.protein_interface_design.movers.Splice" );
81 static basic::Tracer
TR_ccd(
"protocols.protein_interface_design.movers.Splice_ccd" );
82 static numeric::random::RandomGenerator
RG( 78289 );
104 saved_from_res_( 0 ),
108 rms_cutoff_( 999999 ),
110 randomize_cut_( false ),
111 cut_secondarystruc_( false ),
112 task_factory_( NULL ),
113 design_task_factory_( NULL ),
114 torsion_database_fname_(
"" ),
115 database_entry_( 0 ),
116 database_pdb_entry_(
"" ),
117 template_file_(
"" ),
119 equal_length_( false ),
120 template_pose_( NULL ),
122 saved_fold_tree_( NULL ),
124 dbase_iterate_( false ),
127 locked_res_id_(
' ' ),
128 checkpointing_file_ (
"" ),
129 loop_dbase_file_name_(
"" ),
130 loop_pdb_source_(
"" ),
132 splice_filter_( NULL ),
133 use_sequence_profiles_( false ),
135 profile_weight_away_from_interface_( 1.0 )
152 using namespace core::pose;
153 using namespace protocols::rosetta_scripts;
154 using namespace core::chemical;
159 TR<<
"target: "<<from_res<<
" "<<to_res<<
" source: "<<from_nearest_on_source<<
" "<<to_nearest_on_source<<std::endl;
160 runtime_assert( from_nearest_on_source && to_nearest_on_source );
162 core::Size const residue_diff( to_nearest_on_source - from_nearest_on_source - (to_res - from_res ));
168 TR<<
"DEBUG: copy_stretch foldtree: "<<saved_ft<<std::endl;
171 llc.loop_end( to_res );
172 llc.delta( residue_diff );
177 target.
copy_segment( to_nearest_on_source - from_nearest_on_source + 1, source, from_res, from_nearest_on_source );
188 if( checkpointing_file_ ==
"" )
return;
189 utility::io::izstream data( checkpointing_file_ );
191 TR<<
"Loading from checkpoint"<<std::endl;
195 getline( data, line );
196 if( line.length() == 0 ){
197 TR<<
"Checkpointing file empty or corrupted. Not loading."<<std::endl;
200 istringstream line_stream( line );
201 dbase_subset_.clear();
202 while( !line_stream.eof() ){
204 line_stream >> entry;
205 dbase_subset_.push_back( entry );
208 TR<<
"dbase subset order loaded from checkpoint is: ";
215 getline( data, line );
216 istringstream line_stream( line );
218 line_stream >> entry;
219 current_dbase_entry_ = std::find( dbase_subset_.begin(), dbase_subset_.end(), entry );
221 TR <<
"current dbase entry loaded from checkpoint is: " << *current_dbase_entry_ << std::endl;
226 if( checkpointing_file_ ==
"" )
228 TR<<
"Splice checkpointing to file: "<<checkpointing_file_<<std::endl;
230 data.open( checkpointing_file_.c_str(), std::ios::out );
232 utility_exit_with_message(
"Unable to open splice checkpointing file for writing: " + checkpointing_file_ +
"\n" );
233 foreach(
core::Size const dbase_entry, dbase_subset_ ){
234 TR<<
' '<<dbase_entry;
235 data <<
' ' << dbase_entry;
237 if( current_dbase_entry_ == dbase_subset_.end() )
238 data<<
'\n'<<99999<<std::endl;
240 data<<
'\n'<<*current_dbase_entry_<<std::endl;
250 for(
core::Size i = 1; i <= torsion_database_.size(); ++i ){
251 using namespace protocols::rosetta_scripts;
256 core::Size const pose_residues = nearest_to_entry_stop_on_pose - nearest_to_entry_start_on_pose + 1;
257 int const delta( dofs.
size() - pose_residues );
258 if( locked_res() >= nearest_to_entry_start_on_pose && locked_res() <= nearest_to_entry_stop_on_pose ){
263 bool const fit = std::find( delta_lengths_.begin(), delta_lengths_.end(), delta ) != delta_lengths_.end();
264 if( fit || database_pdb_entry_ !=
"" || dbase_entry != 0 )
265 dbase_subset_.push_back( i );
267 if( dbase_subset_.empty() ){
268 TR<<
"Loop of appropriate length not found in database. Returning"<<std::endl;
272 TR<<
"Found "<<dbase_subset_.size()<<
" entries in the torsion dbase that match the length criteria"<<std::endl;
273 numeric::random::random_permutation( dbase_subset_.begin(), dbase_subset_.end(),
RG );
274 current_dbase_entry_ = dbase_subset_.begin();
275 load_from_checkpoint();
277 if( dbase_iterate() ){
278 load_from_checkpoint();
279 if( current_dbase_entry_ == dbase_end() ){
280 TR<<
"Request to read past end of dbase. Splice returns without doing anything."<<std::endl;
283 dbase_entry = *current_dbase_entry_;
285 current_dbase_entry_++;
286 if( current_dbase_entry_ == dbase_end() ){
287 TR<<
"Reached last dbase entry"<<std::endl;
288 end_dbase_subset_->obj =
true;
291 else if( dbase_entry == 0 ){
292 if( database_pdb_entry_ ==
"" )
293 dbase_entry = (
core::Size )( RG.uniform() * dbase_subset_.size() + 1 );
295 for(
core::Size count = 1; count <= dbase_subset_.size(); ++count ){
296 if( torsion_database_[ dbase_subset_[ count ] ].source_pdb() == database_pdb_entry_ ){
297 TR<<
"Found entry for "<<database_pdb_entry_<<
" at number "<<dbase_subset_[ count ]<<std::endl;
298 dbase_entry = dbase_subset_[ count ];
302 runtime_assert( dbase_entry <= dbase_subset_.size() );
312 using namespace protocols::rosetta_scripts;
316 TR<<
"Starting splice apply"<<std::endl;
320 TR<<
"locked residue/locked_residue_id set to: "<<locked_res()<<
','<<locked_res_id()<<std::endl;
325 if( template_file_ !=
"" ){
326 core::Size template_from_res( 0 ), template_to_res( 0 );
328 if( from_res() && to_res() ){
329 template_from_res =
find_nearest_res( pose, *template_pose_, from_res(), 1);
331 runtime_assert( template_from_res );
332 runtime_assert( template_to_res );
335 from_res( template_from_res );
336 to_res( template_to_res );
343 if( torsion_database_fname_ ==
"" && from_res() == 0 && to_res() == 0 ){
345 std::sort( designable.begin(), designable.end() );
346 from_res( designable[ 1 ] );
347 to_res( designable[ designable.size() ] );
350 core::Size nearest_to_from( 0 ), nearest_to_to( 0 ), residue_diff( 0 );
354 if( torsion_database_fname_ ==
"" ){
358 residue_diff = nearest_to_to - nearest_to_from - ( to_res() - from_res() );
359 if( nearest_to_from == 0 || nearest_to_to == 0 ){
360 TR<<
"nearest_to_from: "<<nearest_to_from<<
" nearest_to_to: "<<nearest_to_to<<
". Failing"<<std::endl;
365 for(
core::Size i = nearest_to_from; i <= nearest_to_to; ++i ){
366 if( source_pose.residue( i ).has_variant_type(
DISULFIDE ) ){
367 TR<<
"Residue "<<i<<
" is a disulfide. Failing"<<std::endl;
374 residue_dofs.
resid( i );
375 residue_dofs.
phi( source_pose.phi( i ) );
376 residue_dofs.
psi( source_pose.psi( i ) );
377 residue_dofs.
omega( source_pose.omega( i ) );
383 ss << source_pose.residue( i ).name1();
385 residue_dofs.
resn( s );
387 dofs.push_back( residue_dofs );
389 cut_site = dofs.cut_site() ? dofs.cut_site() + from_res() - 1: to_res();
392 core::Size const dbase_entry( find_dbase_entry( pose ) );
393 if( dbase_entry == 0 )
395 dofs = torsion_database_[ dbase_entry ];
396 std::string const source_pdb_name( dofs.source_pdb() );
397 if( use_sequence_profiles_ ){
398 load_pdb_segments_from_pose_comments( pose );
399 modify_pdb_segments_with_current_segment( source_pdb_name );
401 TR<<
"Taking loop from source pdb "<<source_pdb_name<<std::endl;
402 if( mover_tag_() != NULL )
403 mover_tag_->obj =
"segment_" + source_pdb_name;
404 foreach(
BBDofs & resdofs, dofs ){
405 using namespace core::chemical;
406 if( resdofs.
resn() ==
"CYD" ){
407 TR<<
"Residue "<<resdofs.
resid()<<
" is a disulfide. Failing"<<std::endl;
417 nearest_to_to = dofs.size();
420 if( template_file_ !=
"" ){
421 from_res(
find_nearest_res( pose, *template_pose_, dofs.start_loop(), 1 ) );
424 runtime_assert( from_res() );
425 runtime_assert( to_res() );
426 cut_site = dofs.cut_site() - dofs.start_loop() + from_res();
429 from_res( dofs.start_loop() );
430 to_res( dofs.stop_loop() );
431 cut_site = dofs.cut_site();
432 runtime_assert( from_res() && to_res() && cut_site );
434 residue_diff = dofs.size() - ( dofs.stop_loop() - dofs.start_loop() + 1 );
436 TR<<
"From res: "<<from_res()<<
" to_res: "<<to_res()<<std::endl;
437 runtime_assert( to_res() > from_res() );
444 copy_stretch( pose, *template_pose_, from_res(), to_res() );
447 using namespace utility;
450 if( randomize_cut() ){
454 std::vector< core::Size > loop_positions_in_source;
455 loop_positions_in_source.clear();
456 TR<<
"DSSP of source segment: ";
457 for(
core::Size i = nearest_to_from; i <= std::min( nearest_to_to, to_res() - from_res() + nearest_to_from ); ++i ){
459 loop_positions_in_source.push_back( i );
463 cut_site = loop_positions_in_source[ (
core::Size) ( RG.uniform() * loop_positions_in_source.size()) ] - nearest_to_from + from_res();
464 TR<<
"Cut placed at: "<<cut_site<<std::endl;
467 fold_tree( pose, from_res(), pose.
total_residue(), cut_site );
470 TR<<
"Foldtree before loop length change: "<<pose.
fold_tree()<<std::endl;
473 llc.loop_end( cut_site + residue_diff < from_res() ? to_res() : cut_site );
474 llc.delta( residue_diff );
476 TR<<
"Foldtree after loop length change: "<<pose.
fold_tree()<<std::endl;
480 core::Size const total_residue_new( dofs.size() );
481 TR<<
"Changing dofs\n";
482 for(
core::Size i = 0; i < total_residue_new; ++i ){
485 pose.
set_phi( pose_resi, dofs[ i + 1 ].
phi() );
486 pose.
set_psi( pose_resi, dofs[ i + 1 ].
psi() );
489 TR<<
"resi, phi/psi/omega: "<< pose_resi<<
' '<<pose.
phi( pose_resi )<<
'/'<<pose.
psi( pose_resi )<<
'/'<<pose.
omega( pose_resi )<<std::endl;
498 for(
core::Size i = 0; i < total_residue_new; ++i ){
500 std::string const dofs_resn( dofs[ i + 1 ].resn() );
501 runtime_assert( dofs_resn.length() == 1 );
502 if( pose_resi == locked_res() ){
503 threaded_seq += locked_res_id();
507 if( dofs_resn ==
"G" || dofs_resn ==
"P" ){
508 threaded_seq += dofs_resn;
509 pro_gly_res.push_back( pose_resi );
510 TR<<
"Pro/Gly will be allowed at: "<<pose_resi<<std::endl;
518 if( ( nearest_in_copy > 0 && dofs_resn[ 0 ] == in_pose_copy.
residue( nearest_in_copy ).
name1() ) || dofs_resn ==
"G" || dofs_resn ==
"P" )
519 threaded_seq += dofs_resn;
524 char orig_residue( 0 );
525 if( nearest_in_copy )
526 orig_residue = in_pose_copy.
residue( nearest_in_copy ).
name1();
527 if( orig_residue == 0 || orig_residue ==
'G' || orig_residue ==
'P' )
535 using namespace protocols::toolbox::task_operations;
536 using namespace core::pack::task;
539 tso->start_res( from_res() );
540 tso->allow_design_around(
true );
541 TR<<
"Threading sequence: "<<threaded_seq<<
" starting from "<<from_res()<<std::endl;
543 if( design_task_factory()() == NULL )
549 TR<<
"Restricting chain "<<i<<
" to repacking only"<<std::endl;
555 tf->push_back( tso );
557 dao->
design_shell( (design_task_factory()() == NULL ? 0.0 : 4.0 ) );
558 dao->repack_shell( 6.0 );
559 for(
core::Size i = from_res() - 1; i <= from_res() + total_residue_new + 1; ++i ){
561 dao->include_residue( i );
563 tf->push_back( dao );
564 TR<<
"allowing pro/gly only at positions: ";
566 if( std::find( pro_gly_res.begin(), pro_gly_res.end(), res_num ) == pro_gly_res.end() ){
568 racaas->keep_aas(
"ADEFIKLMNQRSTVWY" );
569 racaas->include_residue( res_num );
570 tf->push_back( racaas);
585 acb.
resnum( utility::to_string( cut_site + residue_diff ) );
586 acb.find_automatically(
false );
587 acb.change_foldtree(
false );
589 TR<<
"Adding chainbreak at: "<<cut_site + residue_diff <<std::endl;
593 if( use_sequence_profiles_ )
594 add_sequence_constraints( pose );
596 using namespace protocols::loops;
599 loops->push_back( loop );
610 mm->
set_chi(
false ); mm->set_bb(
false ); mm->set_jump(
false );
613 for(
core::Size i = from_res() - 3; i <= from_res(); ++i ){
618 for(
core::Size i = from_res() + total_residue_new - 1; i <= from_res() + total_residue_new + 2; ++i ){
624 core::Size const startn( disulfn > 0 ? disulfn + 1 : from_res() - 3 );
625 core::Size const startc( disulfc > 0 ? disulfc - 6 : from_res() + total_residue_new - ( res_move() - 3 ) );
626 for(
core::Size i = startn; i <= startn + res_move() - 1; ++i ){
627 mm->set_chi( i,
true );
628 mm->set_bb( i,
true );
630 for(
core::Size i = startc; i <= startc + res_move() - 1; ++i ){
631 mm->set_chi( i,
true );
632 mm->set_bb( i,
true );
636 ccd_mover.
apply( pose );
639 if( torsion_database_fname_ ==
"" ){
641 for(
core::Size i = 0; i <= total_residue_new - 1; ++i ){
642 core::Real const dist( pose.
residue( from_res() + i ).
xyz(
"CA" ).distance( source_pose.residue( nearest_to_from+ i ).xyz(
"CA" ) ) );
645 core::Real const average_rms( rms / total_residue_new );
646 TR<<
"Average distance of spliced segment to original: "<< average_rms<<std::endl;
647 if( average_rms >= rms_cutoff() ){
648 TR<<
"Failing because rmsd = "<<average_rms<<std::endl;
653 if( !splice_filter()->apply( pose ) ){
654 TR<<
"Failing because filter fails"<<std::endl;
664 for(
core::Size i = startn; i <= startc + res_move() - 1; ++i )
666 dao_dofs->design_shell( 0 );
667 tf_dofs->push_back( dao_dofs );
670 torsion.task_factory_set(
true );
671 torsion.apply( pose );
672 core::Size const stop_on_template( startc + res_move() - 1 - residue_diff );
673 TR_ccd <<
"start, stop, cut: "<<startn<<
" "<<stop_on_template<<
" "<<cut_site<<std::endl;
676 if( loop_dbase_file_name_ !=
"" ){
677 std::ofstream dbase_file;
678 dbase_file.open( loop_dbase_file_name_.c_str(), std::ios::app );
679 for(
core::Size i = startn; i <= startc + res_move() - 1; ++i )
681 dbase_file << startn<<
' '<<stop_on_template<<
' '<<cut_site<<
' ';
682 if( loop_pdb_source_ !=
"" )
683 dbase_file << loop_pdb_source_<<std::endl;
685 dbase_file <<
"cut" << std::endl;
690 PackerTaskOP ptask = tf()->create_task_and_apply_taskoperations( pose );
705 saved_from_res_ = from_res();
706 saved_to_res_ = to_res();
711 from_res( saved_from_res_ );
712 to_res( saved_to_res_ );
714 save_to_checkpoint();
726 runtime_assert( tag->hasOption(
"task_operations" ) != (tag->hasOption(
"from_res" ) || tag->hasOption(
"to_res" ) ) || tag->hasOption(
"torsion_database" ) );
727 runtime_assert( tag->hasOption(
"torsion_database" ) != tag->hasOption(
"source_pdb" ) );
729 if( !tag->hasOption(
"task_operations" ) ){
733 if( tag->hasOption(
"design_task_operations" ) ){
734 TR<<
"Defined design_task_factory, which will be used during splice design"<<std::endl;
737 if( tag->hasOption(
"residue_numbers_setter" ) ){
738 runtime_assert( !tag->hasOption(
"locked_res" ) );
739 locked_res_ = protocols::moves::get_set_from_datamap< protocols::moves::DataMapObj< utility::vector1< core::Size > > >(
"residue_numbers", tag->getOption<
std::string >(
"residue_numbers_setter" ), data );
741 if( tag->hasOption(
"torsion_database" ) ){
742 torsion_database_fname( tag->getOption<
std::string >(
"torsion_database" ) );
743 database_entry( tag->getOption<
core::Size >(
"database_entry", 0 ) );
744 database_pdb_entry( tag->getOption<
std::string >(
"database_pdb_entry",
"" ) );
745 runtime_assert( !( tag->hasOption(
"database_entry" ) && tag->hasOption(
"database_pdb_entry" ) ) );
746 runtime_assert( !( tag->hasOption(
"delta_lengths" ) && (tag->hasOption(
"database_pdb_entry" ) || tag->hasOption(
"database_entry" ) ) ) );
747 read_torsion_database();
748 TR<<
"torsion_database: "<<torsion_database_fname()<<
" ";
749 if( database_entry() == 0 ){
750 if( database_pdb_entry_ ==
"" )
751 TR<<
" database entry will be randomly picked at run time. ";
753 TR<<
" picking database entry "<<database_pdb_entry()<<std::endl;
756 TR<<
" database_entry: "<<database_entry()<<
" ";
757 runtime_assert( database_entry() <= torsion_database_.size() );
761 source_pdb( tag->getOption<
std::string >(
"source_pdb" ) );
763 ccd( tag->getOption<
bool >(
"ccd", 1 ) );
764 rms_cutoff( tag->getOption<
core::Real >(
"rms_cutoff", 999999 ) );
765 runtime_assert( !(tag->hasOption(
"torsion_database" ) && tag->hasOption(
"rms_cutoff" )) );
766 res_move( tag->getOption<
core::Size >(
"res_move", 4 ) );
767 randomize_cut( tag->getOption<
bool >(
"randomize_cut",
false ) );
768 runtime_assert( ( tag->hasOption(
"randomize_cut" ) && tag->hasOption(
"source_pose" ) ) || !tag->hasOption(
"source_pose" ) );
769 cut_secondarystruc( tag->getOption<
bool >(
"cut_secondarystruc",
false ) );
771 template_file( tag->getOption<
std::string >(
"template_file",
"" ) );
772 equal_length( tag->getOption<
bool >(
"equal_length",
false ) );
773 poly_ala( tag->getOption<
bool >(
"thread_ala",
true ) );
777 if( tag->hasOption(
"delta_lengths" ) ){
778 delta = tag->getOption<
std::string >(
"delta_lengths" );
779 StringVec
const lengths_keys( utility::string_split( delta,
',' ) );
781 if( delta ==
"" )
continue;
782 int const delta_i( 1 * atoi( delta.c_str() ) );
783 delta_lengths_.push_back( delta_i );
787 delta_lengths_.push_back( 0 );
788 std::sort( delta_lengths_.begin(), delta_lengths_.end() );
789 std::unique( delta_lengths_.begin(), delta_lengths_.end() );
791 if( template_file_ !=
"" ){
792 if( data.
has(
"poses", template_file_ ) ){
794 TR<<
"using template pdb from datamap"<<std::endl;
796 else if( tag->hasOption(
"template_file" ) ){
799 data.
add(
"poses", template_file_, template_pose_ );
800 TR<<
"loading template_pose from "<<template_file_<<std::endl;
806 design( tag->getOption<
bool >(
"design",
false ) );
807 dbase_iterate( tag->getOption<
bool >(
"dbase_iterate",
false ) );
808 if( dbase_iterate() ){
810 data.
add(
"stopping_condition", curr_mover_name, end_dbase_subset_ );
811 TR<<
"Placed stopping_condition "<<curr_mover_name<<
" on the DataMap"<<std::endl;
813 if( tag->hasOption(
"locked_residue" ) ){
816 TR<<
"locking residue "<<locked_res()<<
" of identity "<<locked_res_id()<<std::endl;
818 checkpointing_file( tag->getOption<
std::string > (
"checkpointing_file",
"" ) );
819 loop_dbase_file_name( tag->getOption<
std::string > (
"loop_dbase_file_name",
"" ) );
820 if( tag->hasOption(
"splice_filter" ))
822 if( tag->hasOption(
"mover_tag" ) )
824 loop_pdb_source( tag->getOption<
std::string >(
"loop_pdb_source",
"" ) );
827 foreach(
TagPtr const sub_tag, sub_tags ){
828 if( sub_tag->getName() ==
"Segments" ){
829 use_sequence_profiles_ =
true;
830 profile_weight_away_from_interface( tag->getOption<
core::Real >(
"profile_weight_away_from_interface", 1.0 ) );
831 segment_type_ = sub_tag->getOption<
std::string >(
"current_segment" );
832 TR<<
"reading segments in splice "<<tag->getName()<<std::endl;
842 foreach(
TagPtr const segment_tag, segment_tags ){
843 std::string const segment_name( segment_tag->getName() );
846 StringVec
const profile_name_pairs( utility::string_split( profiles_str,
',' ) );
848 foreach(
std::string const s, profile_name_pairs ){
849 StringVec
const profile_name_file_name( utility::string_split( s,
':' ) );
850 splice_segment->read_profile( profile_name_file_name[ 2 ], profile_name_file_name[ 1 ] );
852 splice_segment->read_pdb_profile( pdb_profile_match );
853 splice_segments_.insert( std::pair< std::string, SpliceSegmentOP >( segment_name, splice_segment ) );
858 TR<<
"from_res: "<<from_res()<<
" to_res: "<<to_res()<<
" dbase_iterate: "<<dbase_iterate()<<
" randomize_cut: "<<randomize_cut()<<
" cut_secondarystruc: "<<cut_secondarystruc()<<
" source_pdb: "<<source_pdb()<<
" ccd: "<<ccd()<<
" rms_cutoff: "<<rms_cutoff()<<
" res_move: "<<res_move()<<
" template_file: "<<template_file()<<
" checkpointing_file: "<<checkpointing_file_<<
" loop_dbase_file_name: "<<loop_dbase_file_name_<<
" loop_pdb_source: "<<loop_pdb_source()<<
" mover_tag: "<<mover_tag_<<
" torsion_database: "<<torsion_database_fname_<<std::endl;
895 TR<<
"Reading torsion database"<<std::endl;
896 utility::io::izstream data( torsion_database_fname_ );
898 TR <<
"cannot open torsion database " << torsion_database_fname_ << std::endl;
902 while( getline( data, line ) ) {
904 if( elements_in_line.size() % 4 != 0 )
905 utility_exit_with_message(
"While reading torsion database "+torsion_database_fname_+
" found a line where the number of elements is not divisible by 4. This likely stems from an error in the database:\n" + line );
906 std::istringstream line_stream( line );
909 while( !line_stream.eof() ){
912 line_stream >> phi >> psi >> omega >> resn;
913 if( line_stream.eof() ){
922 torsion_database_.push_back( bbdof_entry );
924 TR<<
"Finished reading torsion database with "<<torsion_database_.size()<<
" entries"<<std::endl;
931 using namespace protocols::loops;
934 core::Size const s2 = std::min( conf.chain_end( 1 ), stop + 6 );
937 if( conf.num_chains() == 1 ){
938 ft.add_edge( 1, s1, -1 );
939 ft.add_edge( s1, s2, 1 );
940 ft.add_edge( s1, cut, -1 );
941 ft.add_edge( s2, cut + 1, -1 );
943 ft.delete_self_edges();
944 TR<<
"single chain ft: "<<ft<<std::endl;
949 for(
core::Size resi = conf.chain_begin( 1 ); resi <= conf.chain_end( 1 ); ++resi ){
956 ft.add_edge( s1, s2, 1 );
957 ft.add_edge( s2, conf.chain_end( 1 ), -1 );
958 if( locked_res() > 0 && (locked_res() <= s2 && locked_res() >= s1 )){
959 TR<<
"s1,s2,locked_res: "<<s1<<
','<<s2<<
','<<locked_res()<<std::endl;
960 if( locked_res() < cut ){
961 ft.add_edge( s1, locked_res(), -1 );
962 ft.add_edge( locked_res(), cut, -1 );
963 ft.add_edge( s2, cut+1, -1 );
965 if( locked_res() > cut ){
966 ft.add_edge( s1, cut, -1 );
967 ft.add_edge( s2, locked_res(), -1 );
968 ft.add_edge( locked_res(), cut + 1, -1 );
970 if( locked_res() == cut ){
971 ft.add_edge( s1, cut, -1 );
972 ft.add_edge( s2, cut+1, -1 );
974 using namespace protocols::protein_interface_design;
979 for(
core::Size resi = conf.chain_begin( 2 ); resi <= conf.chain_end( 2 ); ++resi ){
981 if( residue.is_ligand() )
continue;
982 for(
core::Size atomi = 1; atomi <= residue.natoms(); ++atomi ){
983 core::Real const dist( conf.residue( locked_res() ).xyz( from_atom ).distance( residue.xyz( atomi ) ) );
984 if( dist <= min_dist ){
986 nearest_atom = atomi;
991 runtime_assert( nearest_res );
992 ft.add_edge( locked_res(), nearest_res, 2 );
993 ft.add_edge( nearest_res, conf.chain_begin( 2 ), -1 );
994 ft.add_edge( nearest_res, conf.chain_end( 2 ), -1 );
995 ft.set_jump_atoms( 2, from_atom, conf.residue( nearest_res ).atom_name( nearest_atom ) );
998 if(locked_res() > 0 && ! ( locked_res() > s1 && locked_res() < s2 ) ){
999 TR<<
"locked_res "<<locked_res()<<
" is outside loop scope so ignoring"<<std::endl;
1001 ft.add_edge( s1, cut, -1 );
1002 ft.add_edge( s2, cut + 1, -1 );
1003 ft.add_edge( 1, conf.chain_begin( 2 ), 2 );
1005 if( (!locked_res() || ( locked_res() <= s1 || locked_res() >= s2 ) ) && !pose.
residue( conf.chain_begin( 2 ) ).is_ligand() )
1006 ft.add_edge( conf.chain_begin( 2 ), conf.chain_end( 2 ), -1 );
1008 TR<<
"Previous ft: "<<pose.
fold_tree()<<std::endl;
1012 TR<<
"Current ft: "<<pose.
fold_tree()<<std::endl;
1028 return locked_res_->obj[ 1 ];
1050 loop_dbase_file_name_ = s;
1055 return loop_dbase_file_name_;
1060 loop_pdb_source_ = s;
1065 return loop_pdb_source_;
1070 return splice_filter_;
1080 splice_segments_[ segment_type ]->read_profile( file_name, segment_name );
1081 TR<<
"In segment_type "<<segment_type_<<
": reading profile for segment "<<segment_name<<
" from file "<<file_name<<std::endl;
1086 using namespace core::sequence;
1087 using namespace std;
1090 profile_vector.clear();
1091 runtime_assert( pdb_segments_.size() );
1092 for( map< string, string >::const_iterator i = pdb_segments_.begin(); i != pdb_segments_.end(); ++i ){
1095 profile_vector.push_back( splice_segments_[ segment_type ]->pdb_profile( pdb_name ) );
1102 using namespace std;
1104 for( std::map< string, string >::const_iterator i = comments.begin(); i != comments.end(); ++i ){
1107 if( key.substr( 0, 7 ) !=
"segment" )
1109 std::string const short_key( key.substr(8, 1000 ) );
1110 pdb_segments_[ short_key ] = val;
1111 TR<<
"recording segment/pdb pair: "<<short_key<<
'/'<<val<<std::endl;
1117 pdb_segments_[ segment_type_ ] = pdb_name;
1123 using namespace protocols::toolbox::task_operations;
1125 pido->repack_chain1(
true );
1126 pido->design_chain1(
true );
1127 pido->repack_chain2(
false );
1128 pido->design_chain2(
false );
1129 pido->interface_distance_cutoff( 8.0 );
1131 tf_outside_interface->push_back( pido );
1135 return chain1_outside_interface;
1140 using namespace core::scoring::constraints;
1143 TR<<
"Removing existing sequence profile constraints from pose"<<std::endl;
1145 TR<<
"Total number of constraints at start: "<<constraints.size()<<std::endl;
1148 if( c->type() ==
"SequenceProfile" ){
1153 TR<<
"Removed a total of "<<cst_num<<
" sequence constraints."<<std::endl;
1154 TR<<
"After removal the total number of constraints is: "<<pose.
constraint_set()->get_all_constraints().size()<<std::endl;
1161 TR<<
"Upweighting sequence constraint for residues: ";
1164 using namespace core::scoring::constraints;
1166 if( std::find( upweighted_residues.begin(), upweighted_residues.end(), seqpos ) != upweighted_residues.end() ){
1167 spc->weight( profile_weight_away_from_interface() );
1174 TR<<
"Added a total of "<<cst_num<<
" sequence constraints."<<std::endl;
1175 TR<<
"Now the pose has a total of "<<pose.
constraint_set()->get_all_constraints().size()<<
" constraints"<<std::endl;
1179 TR<<
"res_type_constraint weight is set to "<<score_weight<<std::endl;
1180 if( score_weight <= 0.001 )
1181 TR<<
"Warning! res_type_constraint weight is low, even though I've just added sequence constraints to the pose! These sequence constraints will have no effect. This could be an ERROR"<<std::endl;
1186 return profile_weight_away_from_interface_;
1191 profile_weight_away_from_interface_ = p;