24 #include <basic/Tracer.hh>
32 #include <utility/string_util.hh>
37 #include <basic/options/option.hh>
38 #include <basic/options/keys/motifs.OptionKeys.gen.hh>
39 #include <basic/options/keys/out.OptionKeys.gen.hh>
46 #include <utility/vector1.hh>
52 static basic::Tracer
irt(
"protocols.motifs.IRCollection", basic::t_info );
61 for(
core::Size target_index = 1, end_index = build_sites.size() ; target_index <= end_index ; ++target_index ) {
62 core::Size target_pos( build_sites[ target_index ] );
65 for( MotifCOPs::const_iterator motif_itr_itr = motifs.
begin(), end_itr = motifs.
end() ; motif_itr_itr != end_itr ; ++motif_itr_itr ) {
66 MotifCOP motif_itr( *motif_itr_itr );
69 if( !motif_itr->apply_check( pose, target_pos ) )
continue;
74 bool is_it_forward(
false );
94 return accumulated_nirs;
110 for(
core::Size rindex = 1, end_rindex = rotset->num_rotamers() ; rindex <= end_rindex ; ++rindex ) {
118 if( !flexible_regions->is_loop_residue( test_pos ) ) {
123 if( test_rmsd < closest_rmsd[ this_nir ] ) {
124 closest_pos[ this_nir ] = test_pos;
125 closest_rmsd[ this_nir ] = test_rmsd;
141 std::map< core::Size, MotifCOP > setpos;
142 std::map< core::Size, core::conformation::ResidueCOP > setpos_ir;
143 std::map< core::Size, bool > setpos_forward_info;
153 hb_options->exclude_DNA_DNA(
false );
154 hb_options->use_hb_env_dep(
false );
155 options.hbond_options( *hb_options );
156 score_fxn->set_energy_method_options( options );
158 pre_loop_refine.
apply( pose );
162 try_for_more( pose, flexible_regions, setpos, setpos_ir, setpos_forward_info, start_depth );
174 std::map< core::Size, MotifCOP > setpos,
175 std::map< core::Size, core::conformation::ResidueCOP > setpos_ir,
176 std::map< core::Size, bool > setpos_forward_info,
189 core::Real motif_rmsd_cutoff( basic::options::option[ basic::options::OptionKeys::motifs::close_enough ]() );
190 core::Size max_depth( basic::options::option[ basic::options::OptionKeys::motifs::max_depth ]() );
194 irt <<
"Entering search at recursion depth " << depth << std::endl;
196 if( depth <= max_depth ) {
199 for( std::map< core::Size, MotifCOP >::const_iterator itr = setpos.begin(), e_itr = setpos.end() ; itr != e_itr ; ++itr ) {
200 irt <<
"Position " << itr->first <<
" is set." << std::endl;
212 for(
core::Size rindex = 1, end_rindex = rotset->num_rotamers() ; rindex <= end_rindex ; ++rindex ) {
217 core::Size const this_pos( closest_pos[ this_nir ] );
220 if( setpos.find( this_pos ) != setpos.end() ||
221 !flexible_regions->is_loop_residue( this_pos ) ) {
226 if( closest_rmsd[ this_nir ] > motif_rmsd_cutoff ) {
234 irt <<
"Attempting to incorporate a motif at position " << this_pos <<
" with initial rmsd of " <<
235 closest_rmsd[ this_nir ] << std::endl;
244 new_start_pose = pose;
246 std::map< core::Size, MotifCOP > new_setpos( setpos );
248 std::map< core::Size, core::conformation::ResidueCOP > new_setpos_ir( setpos_ir );
249 new_setpos_ir[ this_pos ] = this_rotamer;
250 std::map< core::Size, bool > new_setpos_forward_info( setpos_forward_info );
253 try_for_more( new_start_pose, flexible_regions, new_setpos, new_setpos_ir, new_setpos_forward_info, depth+1 );
268 std::string my_output_path( basic::options::option[ basic::options::OptionKeys::out::path::pdb ]() );
270 std::string try_filename( my_output_path +
"/" + unique_name +
"_" + motif_filename +
"_" + utility::to_string(
unique_id() ) +
".pdb" );
277 hb_options->exclude_DNA_DNA(
false );
278 hb_options->use_hb_env_dep(
false );
279 options.hbond_options( *hb_options );
280 score_fxn->set_energy_method_options( options );
284 irt <<
"Finished search at recursion depth " << depth << std::endl;
294 std::map< core::Size, MotifCOP > & setpos,
295 std::map< core::Size, core::conformation::ResidueCOP > & setpos_ir,
296 std::map< core::Size, bool > & setpos_forward_info,
300 bool const this_forward_info
303 using namespace core::scoring;
306 core::Real num_inverse_rotamers( 1.0 + setpos.size() );
313 hb_options->exclude_DNA_DNA(
false );
314 hb_options->use_hb_env_dep(
false );
315 options.hbond_options( *hb_options );
316 score_fxn->set_energy_method_options( options );
325 for( std::map< core::Size, MotifCOP >::const_iterator itr = setpos.begin(), e_itr = setpos.end() ; itr != e_itr ; ++itr ) {
327 add_motif_sc_constraints( bb_cst_set, pose, prev_pos, *(setpos_ir[ prev_pos ]), itr->second, setpos_forward_info[ prev_pos ] );
338 loop_refine.
apply( pose );
343 irt <<
"After backbone refinement constraints score is " << bb_constraint_check << std::endl;
347 if( bb_constraint_check > 1.0 ) {
360 for( std::map< core::Size, MotifCOP >::const_iterator itr = setpos.begin(), e_itr = setpos.end() ; itr != e_itr ; ++itr ) {
362 add_motif_sc_constraints( sc_cst_set, pose, prev_pos, *(setpos_ir[ prev_pos ]), itr->second, setpos_forward_info[ prev_pos ] );
372 sc_loop_refine.
apply( pose );
377 irt <<
"After sidechain refinement constraints score is " << sc_constraint_check << std::endl;
381 if( sc_constraint_check > 1.0 ) {
390 std::map< core::Size, MotifCOP > & setpos,
391 std::map< core::Size, bool > & setpos_forward_info,
396 for( std::map< core::Size, MotifCOP >::const_iterator itr = setpos.begin(), e_itr = setpos.end() ; itr != e_itr ; ++itr ) {
398 if( setpos_forward_info[ this_pos ] ) {
399 accum_string += itr->second->restype_name2() + utility::to_string( pose.
pdb_info()->number( this_pos ) );
401 accum_string += itr->second->restype_name1() + utility::to_string( pose.
pdb_info()->number( this_pos ) );