37 #include <basic/Tracer.hh>
42 #include <utility/string_util.hh>
43 #include <utility/tools/make_vector1.hh>
44 #include <utility/tools/make_map.hh>
46 #include <numeric/xyz.functions.hh>
51 #include <utility/vector1.hh>
57 static basic::Tracer
mt(
"protocols.motifs.Motif", basic::t_info );
70 res1_atom1_name_( res1_atom1 ),
71 res1_atom2_name_( res1_atom2 ),
72 res1_atom3_name_( res1_atom3 ),
74 res2_atom1_name_( res2_atom1 ),
75 res2_atom2_name_( res2_atom2 ),
76 res2_atom3_name_( res2_atom3 ),
77 forward_jump_( orientation ),
78 backward_jump_( ( orientation.reversed() ) ),
95 Size const residue_position_1,
100 Size const residue_position_2,
105 ) : restype_name1_( protocols::dna::
dna_full_name3( pose.residue( pose.pdb_info()->pdb2pose( chain1, residue_position_1 ) ).name3() ) ),
106 res1_atom1_name_( res1_atom1_name ),
107 res1_atom2_name_( res1_atom2_name ),
108 res1_atom3_name_( res1_atom3_name ),
109 restype_name2_( protocols::dna::
dna_full_name3( pose.residue( pose.pdb_info()->pdb2pose( chain2, residue_position_2 ) ).name3() ) ),
110 res2_atom1_name_( res2_atom1_name ),
111 res2_atom2_name_( res2_atom2_name ),
112 res2_atom3_name_( res2_atom3_name ),
113 forward_jump_( core::kinematics::Jump(
114 core::kinematics::
Stub( pose.residue( pose.pdb_info()->pdb2pose( chain1, residue_position_1 ) ).atom( res1_atom2_name ).
xyz(),
115 pose.residue( pose.pdb_info()->pdb2pose( chain1, residue_position_1 ) ).atom( res1_atom1_name ).
xyz(),
116 pose.residue( pose.pdb_info()->pdb2pose( chain1, residue_position_1 ) ).atom( res1_atom2_name ).
xyz(),
117 pose.residue( pose.pdb_info()->pdb2pose( chain1, residue_position_1 ) ).atom( res1_atom3_name ).
xyz() ),
118 core::kinematics::
Stub( pose.residue( pose.pdb_info()->pdb2pose( chain2, residue_position_2 ) ).atom( res2_atom2_name ).
xyz(),
119 pose.residue( pose.pdb_info()->pdb2pose( chain2, residue_position_2 ) ).atom( res2_atom1_name ).
xyz(),
120 pose.residue( pose.pdb_info()->pdb2pose( chain2, residue_position_2 ) ).atom( res2_atom2_name ).
xyz(),
121 pose.residue( pose.pdb_info()->pdb2pose( chain2, residue_position_2 ) ).atom( res2_atom3_name ).
xyz() ) ) ),
122 backward_jump_( forward_jump_.reversed() )
137 Size const residue_position_1,
141 Size const residue_position_2,
145 ) : restype_name1_( protocols::dna::
dna_full_name3( pose.residue( residue_position_1 ).name3() ) ),
146 res1_atom1_name_( res1_atom1_name ),
147 res1_atom2_name_( res1_atom2_name ),
148 res1_atom3_name_( res1_atom3_name ),
149 restype_name2_( protocols::dna::
dna_full_name3( pose.residue( residue_position_2 ).name3() ) ),
150 res2_atom1_name_( res2_atom1_name ),
151 res2_atom2_name_( res2_atom2_name ),
152 res2_atom3_name_( res2_atom3_name ),
153 forward_jump_( core::kinematics::Jump(
154 core::kinematics::
Stub( pose.residue( residue_position_1 ).atom( res1_atom2_name ).
xyz(),
155 pose.residue( residue_position_1 ).atom( res1_atom1_name ).
xyz(),
156 pose.residue( residue_position_1 ).atom( res1_atom2_name ).
xyz(),
157 pose.residue( residue_position_1 ).atom( res1_atom3_name ).
xyz() ),
158 core::kinematics::
Stub( pose.residue( residue_position_2 ).atom( res2_atom2_name ).
xyz(),
159 pose.residue( residue_position_2 ).atom( res2_atom1_name ).
xyz(),
160 pose.residue( residue_position_2 ).atom( res2_atom2_name ).
xyz(),
161 pose.residue( residue_position_2 ).atom( res2_atom3_name ).
xyz() ) ) ),
162 backward_jump_( forward_jump_.reversed() )
207 res2.
atom( res2_atoms[1] ).
xyz(),
208 res2.
atom( res2_atoms[2] ).
xyz(),
209 res2.
atom( res2_atoms[3] ).
xyz() ) );
213 mt <<
"Input motif residues do not match the expected combinations for this constructor; please use constructor that allows you to explicitly specify atoms involved." << std::endl;
283 res1.
atom( res1_atom1_name_ ).
xyz(),
287 res2.
atom( res2_atom1_name_ ).
xyz(),
302 res1.
atom( res1_atom1_name_ ).
xyz(),
306 res2.
atom( res2_atom1_name_ ).
xyz(),
311 mt <<
"Input motif residues do not match the expected combinations for this constructor; please use constructor that allows you to explicitly specify atoms involved." << std::endl;
326 ) : utility::pointer::ReferenceCount(),
327 restype_name1_( src.restype_name1_ ),
328 res1_atom1_name_( src.res1_atom1_name_ ),
329 res1_atom2_name_( src.res1_atom2_name_ ),
330 res1_atom3_name_( src.res1_atom3_name_ ),
331 res1_atom1_int_( src.res1_atom1_int_ ),
332 res1_atom2_int_( src.res1_atom2_int_ ),
333 res1_atom3_int_( src.res1_atom3_int_ ),
334 res1_atom1_index_( src.res1_atom1_index_ ),
335 res1_atom2_index_( src.res1_atom2_index_ ),
336 res1_atom3_index_( src.res1_atom3_index_ ),
337 restype_name2_( src.restype_name2_ ),
338 res2_atom1_name_( src.res2_atom1_name_ ),
339 res2_atom2_name_( src.res2_atom2_name_ ),
340 res2_atom3_name_( src.res2_atom3_name_ ),
341 res2_atom1_int_( src.res2_atom1_int_ ),
342 res2_atom2_int_( src.res2_atom2_int_ ),
343 res2_atom3_int_( src.res2_atom3_int_ ),
344 res2_atom1_index_( src.res2_atom1_index_ ),
345 res2_atom2_index_( src.res2_atom2_index_ ),
346 res2_atom3_index_( src.res2_atom3_index_ ),
347 forward_jump_( src.forward_jump_ ),
348 backward_jump_( src.backward_jump_ ),
349 remark_( src.remark_ ),
351 has_remark_( src.has_remark_ ),
352 has_path_( src.has_path_ )
358 return new Motif( *
this );
469 Size const rotamer_build_position,
475 using namespace core::pack::rotamer_set;
476 using namespace core::chemical;
477 using namespace core::scoring;
478 using namespace core::pack;
479 using namespace core::pack::task;
483 rotset->set_resid( rotamer_build_position );
488 scorefxn.set_weight(
fa_rep, 1.00 );
491 task->set_bump_check(
false );
492 task->temporarily_fix_everything();
493 task->temporarily_set_pack_residue( rotamer_build_position,
true );
507 task->nonconst_residue_task( rotamer_build_position ).restrict_absent_canonical_aas( aa_info );
512 if( ex_ > 0 ) task->nonconst_residue_task( rotamer_build_position ).or_ex1(
true );
513 if( ex_ > 1 ) task->nonconst_residue_task( rotamer_build_position ).or_ex2(
true );
514 if( ex_ > 2 ) task->nonconst_residue_task( rotamer_build_position ).or_ex3(
true );
515 if( ex_ > 3 ) task->nonconst_residue_task( rotamer_build_position ).or_ex4(
true );
525 rotset->build_rotamers( pose, scorefxn, *task, packer_neighbor_graph,
false );
533 Size const motif_anchor_position,
535 Size rotamer_build_position
538 using namespace core::pack::rotamer_set;
539 using namespace core::chemical;
540 using namespace core::scoring;
541 using namespace core::pack;
542 using namespace core::pack::task;
547 if( rotamer_build_position ==
Size( 0 ) ) {
550 mt <<
"Using nonsense build residue in build_motif_rotamer - default argument not yet supported\n";
551 rotamer_build_position = 2;
557 if( !
apply_check( pose, motif_anchor_position ) ) {
558 mt <<
"Bailing from build_motif_rotamer - given anchor residue not in motif\n";
565 for(
Size ir = 1 , end_ir = rotset->num_rotamers() ; ir <= end_ir ; ++ir ) {
578 Size const & res2_atom1_index_in,
579 Size const & res2_atom2_index_in,
580 Size const & res2_atom3_index_in,
595 return place_atoms_( fixed, mobile,
true, atoms, res2_atom1_index_in, res2_atom2_index_in, res2_atom3_index_in, one_three );
597 mt <<
"Bad Mojo a! call to Motif::place_atom() with wrong residue(s)!\n";
599 mt <<
"arguments are: " << fixed.
name3() <<
" and " << mobile.
name3() <<
"\n";
600 mt <<
"Neither order matches!\n";
612 Size const & res2_atom1_index_in,
613 Size const & res2_atom2_index_in,
614 Size const & res2_atom3_index_in,
616 Size const & atomtype,
620 return place_atom_( fixed, mobile,
true, atm, res2_atom1_index_in, res2_atom2_index_in, res2_atom3_index_in, atomtype, one_three );
628 Size const & res2_atom1_index_in,
629 Size const & res2_atom2_index_in,
630 Size const & res2_atom3_index_in,
640 return Motif::place_residue_( fixed, mobile,
true,res2_atom1_index_in, res2_atom2_index_in, res2_atom3_index_in, one_three );
643 return Motif::place_residue_( fixed, mobile,
false, res2_atom1_index_in, res2_atom2_index_in, res2_atom3_index_in, one_three );
645 mt <<
"Bad Mojo b! call to Motif::place_residue() with wrong residue(s)!\n";
647 mt <<
"arguments are: " << fixed.
name3() <<
" and " << mobile.
name3() <<
"\n";
648 mt <<
"Neither order matches!\n";
661 Size const & res2_atom1_index_in,
662 Size const & res2_atom2_index_in,
663 Size const & res2_atom3_index_in,
665 Size const & atomtype,
682 start_stub1 = start_stub;
690 start_stub1 = start_stub;
694 mobile.
atom( res2_atom2_index_in ).
xyz(),
695 mobile.
atom( res2_atom1_index_in ).
xyz(),
696 mobile.
atom( res2_atom2_index_in ).
xyz(),
697 mobile.
atom( res2_atom3_index_in ).
xyz()
705 fixed.
atom( res2_atom2_index_in ).
xyz(),
706 fixed.
atom( res2_atom1_index_in ).
xyz(),
707 fixed.
atom( res2_atom2_index_in ).
xyz(),
708 fixed.
atom( res2_atom3_index_in ).
xyz()
747 return place_atoms_( fixed, mobile,
true, atoms, one_three );
751 return place_atoms_( fixed, mobile,
false, atoms, one_three );
754 mt <<
"Bad Mojo! call to Motif::place_atom() with wrong residue(s)!\n";
756 mt <<
"arguments are: " << fixed.
name3() <<
" and " << mobile.
name3() <<
"\n";
757 mt <<
"Neither order matches!\n";
774 return place_atom_( fixed, mobile,
true, atm, one_three, atomtype );
809 mt <<
"Bad Mojo! call to Motif::place_residue() with wrong residue(s)!\n";
811 mt <<
"arguments are: " << fixed.
name3() <<
" and " << mobile.
name3() <<
"\n";
812 mt <<
"Neither order matches!\n";
839 start_stub1 = start_stub;
847 start_stub1 = start_stub;
892 for(
Size i(1), end_i = mobile.
natoms() ; i <= end_i ; ++i ) {
905 Size const & res2_atom1_index_in,
906 Size const & res2_atom2_index_in,
907 Size const & res2_atom3_index_in,
924 start_stub1 = start_stub;
932 start_stub1 = start_stub;
936 mobile.
atom( res2_atom2_index_in ).
xyz(),
937 mobile.
atom( res2_atom1_index_in ).
xyz(),
938 mobile.
atom( res2_atom2_index_in ).
xyz(),
939 mobile.
atom( res2_atom3_index_in ).
xyz()
946 fixed.
atom( res2_atom2_index_in ).
xyz(),
947 fixed.
atom( res2_atom1_index_in ).
xyz(),
948 fixed.
atom( res2_atom2_index_in ).
xyz(),
949 fixed.
atom( res2_atom3_index_in ).
xyz()
973 for(
Size i(1), end_i = mobile.
natoms() ; i <= end_i ; ++i ) {
1002 start_stub1 = start_stub;
1010 start_stub1 = start_stub;
1079 start_stub1 = start_stub;
1087 start_stub1 = start_stub;
1130 for(
Size i(1), end_i = atoms.size() ; i <= end_i ; ++i ) {
1144 Size const & res2_atom1_index_in,
1145 Size const & res2_atom2_index_in,
1146 Size const & res2_atom3_index_in,
1163 start_stub1 = start_stub;
1171 start_stub1 = start_stub;
1175 mobile.
atom( res2_atom2_index_in ).
xyz(),
1176 mobile.
atom( res2_atom1_index_in ).
xyz(),
1177 mobile.
atom( res2_atom2_index_in ).
xyz(),
1178 mobile.
atom( res2_atom3_index_in ).
xyz()
1187 fixed.
atom( res2_atom2_index_in ).
xyz(),
1188 fixed.
atom( res2_atom1_index_in ).
xyz(),
1189 fixed.
atom( res2_atom2_index_in ).
xyz(),
1190 fixed.
atom( res2_atom3_index_in ).
xyz()
1214 for(
Size i(1), end_i = atoms.size() ; i <= end_i ; ++i ) {
1233 out <<
" ### REMARK " <<
remark();
1244 std::ostringstream os;
1254 os << motif.
print();
1260 utility::tools::make_map(
1290 utility::tools::make_map(