67 #include <basic/options/option.hh>
68 #include <basic/options/keys/dna.OptionKeys.gen.hh>
69 #include <basic/options/keys/motifs.OptionKeys.gen.hh>
70 #include <basic/options/keys/packing.OptionKeys.gen.hh>
75 #include <basic/Tracer.hh>
77 #include <utility/vector0.hh>
78 #include <utility/vector1.hh>
79 #include <utility/string_util.hh>
86 #include <ObjexxFCL/string.functions.hh>
95 namespace ObjexxFCL {
namespace fmt { } }
using namespace ObjexxFCL::fmt;
105 using utility::string_split;
106 using namespace core;
107 using namespace chemical;
108 using namespace conformation;
109 using namespace optimization;
110 using namespace basic::options;
111 using namespace pack;
112 using namespace task;
113 using namespace operation;
114 using namespace pose;
115 using namespace scoring;
116 using namespace protocols::dna;
118 using namespace ObjexxFCL;
119 using namespace ObjexxFCL::fmt;
121 using basic::t_warning;
123 using basic::t_debug;
124 static basic::Tracer
TR(
"devel.motifs.MotifDnaPacker");
127 MotifDnaPackerCreator::keyname()
const
129 return MotifDnaPackerCreator::mover_name();
133 MotifDnaPackerCreator::create_mover()
const
139 MotifDnaPackerCreator::mover_name()
141 return "MotifDnaPacker";
146 MotifDnaPacker::MotifDnaPacker()
147 : protocols::moves::
Mover(
"MotifDnaPacker"),
154 expand_motifs_(false),
155 aromatic_motifs_(false),
156 minimize_dna_(false),
157 special_rotweight_(-40.0),
159 flex_dna_sugar_(false),
170 ) : protocols::moves::
Mover(
"MotifDnaPacker"),
171 scorefxn_( scorefxn_in ),
173 expand_motifs_(false),
174 aromatic_motifs_(false),
175 minimize_dna_(false),
176 special_rotweight_(-40.0),
178 flex_dna_sugar_(false),
222 if( option[ OptionKeys::packing::resfile ].user() ) {
229 for (
Size p_index(1); p_index<=nres; ++p_index ) {
231 dna_positions.push_back( p_index );
234 protein_positions.push_back( p_index );
236 preventrepack.push_back( p_index );
240 bool target_dna_empty(
false );
245 for(
Size i(1); i<=dna_design_positions.size(); ++i ) {
246 complete_ddps.push_back(dna_design_positions[i]);
247 complete_ddps.push_back(partner[dna_design_positions[i]]);
249 base_partners.push_back( complete_ddps );
251 target_dna_empty =
true;
254 for(
Size i(1); i<=( dna_positions.size() / 2 ); ++i ) {
256 if( partner[dna_positions[i]] != 0 ) {
257 pair.push_back( dna_positions[i] );
258 pair.push_back( partner[dna_positions[i]] );
260 if( ! pair.empty() ) {
261 base_partners.push_back( pair );
267 complete_interface_->determine_protein_interface( pose, protein_positions, dna_positions );
269 rdtpdi->copy_interface( complete_interface_ );
270 rdtpdi->set_forget_chains_and_interface(
false );
272 taskfactory0->push_back( rdtpdi );
273 PackerTaskOP ptask_ = taskfactory0->create_task_and_apply_taskoperations( pose );
277 if ( rtask.being_designed() ) {
278 complete_design_positions.push_back(j);
286 for(
Size bp(1); bp<=base_partners.size(); ++bp ) {
289 std::map< core::Size, pack::rotamer_set::Rotamers > rotamer_map;
290 std::map< core::Size, std::set< std::string > > types_map;
291 std::set< core::Size > src_pos;
292 std::list< std::string > info_lines;
293 std::stringstream info_lines_str;
296 interface_->determine_protein_interface( pose, protein_positions, base_partners[bp] );
300 rdtpdi2->copy_interface( interface_ );
305 for(
Size i(1); i<=(base_partners[bp].size()); ++i ) {
306 if( dna_chains->is_top(base_partners[bp][i]) ) {
307 std::stringstream def;
308 def << pose.
pdb_info()->chain( base_partners[bp][i]) <<
"." << pose.
pdb_info()->number(base_partners[bp][i]) <<
"." << pose.
residue(base_partners[bp][i]).
name3();
310 targetdefs.push_back( target );
313 rdtpdi2->set_forget_chains_and_interface(
false );
319 rdtpdi2->copy_targeted_dna( targetdefs );
322 for(
Size d(1) ; d <= dna_positions.size(); ++d ) {
324 for(
Size i(1); i<=(base_partners[bp].size()); ++i ) {
325 if ( dna_positions[d] == base_partners[bp][i] ) {
330 restricted_DNA.push_back( dna_positions[d] );
334 fixedDNA->residue_indices( restricted_DNA );
337 taskfactory1->push_back( fixedDNA );
338 taskfactory1->push_back( wrc );
339 taskfactory2->push_back( fixedDNA );
340 taskfactory2->push_back( wrc );
343 taskfactory1->push_back( rdtpdi2 );
344 taskfactory2->push_back( rdtpdi2 );
345 PackerTaskOP ptask_ = taskfactory2->create_task_and_apply_taskoperations( pose );
349 if ( rtask.being_designed() ) {
350 design_positions.push_back(j);
351 std::stringstream numberandchain;
352 numberandchain << pose.
pdb_info()->number( j ) << pose.
pdb_info()->chain( j );
353 info_lines_str << numberandchain.str() <<
",";
356 info_lines.push_back( info_lines_str.str() );
358 if ( design_positions.empty() )
continue;
371 bool const overwrite_old_info(
true);
374 (*pdboutput_)(pose,
dna_packer_->pdbname() +
".pdb");
380 if( option[ OptionKeys::motifs::quick_and_dirty ].user() )
break;
381 run_motifs( pose, design_positions, src_pos, rotamer_map, types_map, info_lines, taskfactory1 );
383 if( option[ OptionKeys::motifs::quick_and_dirty ].user() )
break;
384 run_motifs( pose, design_positions, src_pos, rotamer_map, types_map, info_lines, taskfactory1 );
387 if( option[ OptionKeys::motifs::quick_and_dirty ].user() )
break;
388 expand_motifs( pose, design_positions, src_pos, rotamer_map, types_map, info_lines, taskfactory1 );
391 if( option[ OptionKeys::motifs::quick_and_dirty ].user() )
break;
392 aromatic_motifs( pose, design_positions, src_pos, rotamer_map, types_map, info_lines, taskfactory1 );
403 if ( option[ OptionKeys::dna::design::dna_defs ].user() ) {
405 }
else if ( option[ OptionKeys::motifs::target_dna_defs ].user() ) {
472 protocols::loops::Loop const dna_loop( devel::blab::motif::setup_dna_loop_with_random_cutpoint( pose ) );
473 protocols::loops::Loop const protein_loop;*/
503 if( option[ OptionKeys::motifs::run_motifs ].user() )
run_motifs_ =
true;
504 if( option[ OptionKeys::motifs::expand_motifs ].user() )
expand_motifs_ =
true;
505 if( option[ OptionKeys::motifs::aromatic_motifs ].user() )
aromatic_motifs_ =
true;
506 if( option[ OptionKeys::motifs::special_rotweight ].user() )
special_rotweight_ = option[ OptionKeys::motifs::special_rotweight ]();
507 if( option[ OptionKeys::motifs::num_repacks ].user() )
num_repacks_ = option[ OptionKeys::motifs::num_repacks ]();
508 if( option[ OptionKeys::motifs::minimize_dna ].user() )
minimize_dna_ =
true;
509 if( option[ OptionKeys::motifs::flex_sugar ].user() )
flex_dna_sugar_ =
true;
511 if( option[ OptionKeys::motifs::target_dna_defs ].user() )
dna_design_ =
true;
518 std::set< core::Size > & src_pos,
519 std::map< core::Size, pack::rotamer_set::Rotamers > & rotamer_map,
520 std::map<
core::Size, std::set< std::string > > & types_map,
521 std::list< std::string > & info_lines,
525 for(
core::Size i(1); i <= design_positions.size(); ++i ) {
526 std::set< std::string > name3set;
528 src_pos.insert( design_positions[i] );
530 if ( ! motif_rotamers.empty() ) {
533 variant_rotamers.push_back( variant_rot );
534 name3set.insert( (motif_rotamers[rot])->name3() );
536 rotamer_map[design_positions[i]] = variant_rotamers;
539 ms_rsoop->set_new_rots( variant_rotamers );
543 types_map[design_positions[i]] = name3set;
547 std::stringstream mot_name;
548 bool special_rotweight_zero(
true );
549 if( special_rotweight_zero ) {
550 core::Real zero_special_rotweight( -0.0000000001 );
563 bool const overwrite_old_info(
true);
566 (*pdboutput_)(pose,
dna_packer_->pdbname() + tag +
".pdb");
573 core::Real special_rotweight2 = ( special_rotweight / 2 );
575 special_rotweight = special_rotweight2;
577 filename <<
filename_root_ <<
"_" << lead_zero_string_of( trial, 4 );
584 bool const overwrite_old_info(
true);
587 (*pdboutput_)(pose,
dna_packer_->pdbname() + tag +
".pdb");
599 std::set< core::Size > & src_pos,
600 std::map< core::Size, pack::rotamer_set::Rotamers > & rotamer_map,
601 std::map<
core::Size, std::set< std::string > > & types_map,
602 std::list< std::string > & info_lines,
606 for( std::map< core::Size, pack::rotamer_set::Rotamers >::const_iterator it( rotamer_map.begin() ),
607 end( rotamer_map.end() ); it !=
end; ++it ) {
609 std::set< std::string > name3s( types_map[it->first] );
610 std::set< core::Size > current_pos( src_pos );
611 current_pos.erase( it->first );
612 for( std::set< std::string >::const_iterator it2( name3s.begin() ),
613 end2( name3s.end() ); it2 != end2; ++it2 ) {
620 if( src_rotamers[
rot2]->name3() != *it2 )
continue;
621 restricted_rotamers.push_back( src_rotamers[
rot2] );
627 ms_rsoop->set_new_rots( restricted_rotamers );
630 for( std::set< core::Size >::const_iterator it3( current_pos.begin() ),
631 end3( current_pos.end() ); it3 != end3; ++it3 ) {
632 if( rotamer_map[*it3].empty() )
continue;
634 for(
core::Size it4(1); it4<=(rotamer_map[*it3]).
size(); ++it4 ) {
635 other_rotamers.push_back( rotamer_map[*it3][it4] );
638 ms_rsoop2->set_new_rots( other_rotamers );
642 std::stringstream mot_name;
643 mot_name << *it2 <<
"_" << pose.
pdb_info()->chain(it->first) << pose.
pdb_info()->number(it->first);
646 bool special_rotweight_zero(
true );
647 if( special_rotweight_zero ) {
648 core::Real zero_special_rotweight( -0.0000000001 );
661 bool const overwrite_old_info(
true);
664 (*pdboutput_)(pose,
dna_packer_->pdbname() + tag +
".pdb");
671 core::Real special_rotweight2 = ( special_rotweight / 2 );
673 special_rotweight = special_rotweight2;
675 filename <<
filename_root_ <<
"_" << mot_name2 <<
"_" << lead_zero_string_of( trial, 4 );
683 bool const overwrite_old_info(
true);
686 (*pdboutput_)(pose,
dna_packer_->pdbname() + tag +
".pdb");
699 std::set< core::Size > & src_pos,
700 std::map< core::Size, pack::rotamer_set::Rotamers > & rotamer_map,
701 std::map<
core::Size, std::set< std::string > > & types_map,
702 std::list< std::string > & info_lines,
706 for( std::map< core::Size, pack::rotamer_set::Rotamers >::const_iterator it( rotamer_map.begin() ),
707 end( rotamer_map.end() ); it !=
end; ++it ) {
709 std::set< std::string > name3s( types_map[it->first] );
710 std::set< core::Size > current_pos( src_pos );
711 current_pos.erase( it->first );
712 bool aromatics(
false );
713 std::set< std::string > name3_arom;
714 for( std::set< std::string >::const_iterator zt( name3s.begin() ),
715 end2( name3s.end() ); zt != end2; ++zt ) {
716 if( *zt ==
"TYR" || *zt ==
"PHE" || *zt ==
"TRP" ) {
718 name3_arom.insert( *zt );
724 for( std::set< std::string >::const_iterator it2( name3_arom.begin() ),
725 end2( name3_arom.end() ); it2 != end2; ++it2 ) {
732 if( src_rotamers[
rot2]->name3() != *it2 )
continue;
733 restricted_rotamers.push_back( src_rotamers[
rot2] );
739 ms_rsoop->set_new_rots( restricted_rotamers );
742 for( std::set< core::Size >::const_iterator it3( current_pos.begin() ),
743 end3( current_pos.end() ); it3 != end3; ++it3 ) {
744 if( rotamer_map[*it3].empty() )
continue;
746 for(
core::Size it4(1); it4<=(rotamer_map[*it3]).
size(); ++it4 ) {
747 other_rotamers.push_back( rotamer_map[*it3][it4] );
750 ms_rsoop2->set_new_rots( other_rotamers );
754 std::stringstream mot_name;
755 mot_name << *it2 <<
"_" << pose.
pdb_info()->chain(it->first) << pose.
pdb_info()->number(it->first);
758 bool special_rotweight_zero(
true );
759 if( special_rotweight_zero ) {
760 core::Real zero_special_rotweight( -0.0000000001 );
773 bool const overwrite_old_info(
true);
776 (*pdboutput_)(pose,
dna_packer_->pdbname() + tag +
".pdb");
783 core::Real special_rotweight2 = ( special_rotweight / 2 );
785 special_rotweight = special_rotweight2;
787 filename <<
filename_root_ <<
"_" << mot_name2 <<
"_" << lead_zero_string_of( trial, 4 );
795 bool const overwrite_old_info(
true);
798 (*pdboutput_)(pose,
dna_packer_->pdbname() + tag +
".pdb");
806 run_motifs( pose, design_positions, src_pos, rotamer_map, types_map, info_lines, taskfactory );