25 #include <basic/options/option.hh>
32 #include <basic/Tracer.hh>
33 #include <utility/tag/Tag.hh>
34 #include <utility/exit.hh>
35 #include <utility/vector1.hh>
37 #include <utility/string_util.hh>
38 using utility::string_split;
40 #include <ObjexxFCL/format.hh>
44 #include <basic/options/keys/dna.OptionKeys.gen.hh>
46 #include <utility/vector0.hh>
49 using namespace ObjexxFCL::fmt;
55 using namespace chemical;
56 using namespace conformation;
57 using namespace basic::options;
60 using namespace operation;
62 using namespace scoring;
63 using namespace constraints;
68 static basic::Tracer
TR(
"protocols.dna.RestrictDesignToProteinDNAInterface",t_info);
70 TaskOperationOP RestrictDesignToProteinDNAInterfaceCreator::create_task_operation()
const
75 RestrictDesignToProteinDNAInterface::RestrictDesignToProteinDNAInterface()
81 forget_chains_and_interface_( true ),
83 close_threshold_( 10. * 10. ),
84 contact_threshold_( 3.7 * 3.7 )
134 if ( tag->hasOption(
"dna_defs") ) {
137 if ( defs ==
"COMMANDLINE" ) {
138 TR(t_debug) <<
" parsing dna definitions from command line" << std::endl;
141 TR(t_debug) <<
" parsing dna definitions: " << defs << std::endl;
142 Strings
const str_defs( string_split( defs,
',' ) );
147 if ( tag->hasOption(
"base_only") )
base_only_ = tag->getOption<
bool >(
"base_only");
148 if ( tag->hasOption(
"z_cutoff") )
z_cutoff_ = tag->getOption<
Real >(
"z_cutoff");
149 if ( tag->hasOption(
"close_threshold") )
151 if ( tag->hasOption(
"contact_threshold") )
153 if ( tag->hasOption(
"forget_chains_and_interface") )
170 using namespace task;
202 for ( DnaDesignDefOPs::const_iterator def(
targeted_dna_.begin() );
204 Size index( (*def)->pdbpos );
208 index = pdb_pose_map.
find( (*def)->chain, (*def)->pdbpos );
211 std::cerr <<
"ERROR: DNA design def " << **def <<
" indicates a non-DNA position"
212 << std::endl; utility_exit();
214 std::cerr <<
"ERROR: DNA design def " << **def <<
" is DNA but is not in the 'top' strand"
215 << std::endl; utility_exit();
218 runtime_assert( index == pos.
top() );
220 toptask.add_behavior(
"TARGET");
223 if ( ! (*def)->name3.empty() ) {
230 allowed_type( toptask.allowed_residue_types_begin() ),
231 end( toptask.allowed_residue_types_end() ); allowed_type !=
end; ++allowed_type ) {
232 if ( std::find( name3map.begin(), name3map.end(), *allowed_type ) != name3map.end() ) {
233 toptask.target_type( *allowed_type );
break;
234 TR(t_info) <<
"Setting target type " << (*def)->name3
235 <<
" at position " << pos.
top() << std::endl;
238 if ( ! toptask.target_type() ) {
239 TR(t_info) <<
"Error: target type " << (*def)->name3
240 <<
" does not correspond to an allowed type at position " << pos.
top()
241 << std::endl; utility_exit();
248 allowed_type( bottask.allowed_residue_types_begin() ),
249 end( bottask.allowed_residue_types_end() ); allowed_type !=
end; ++allowed_type ) {
250 if ( std::find( name3map_comp.begin(), name3map_comp.end(), *allowed_type ) !=
251 name3map_comp.end() ) {
252 bottask.target_type( *allowed_type );
break;
253 TR(t_info) <<
"Setting target type " << comp_name3 <<
" at position " << pos.
bottom()
257 if ( ! bottask.target_type() ) {
258 TR(t_info) <<
"Error: target type " << comp_name3
259 <<
" does not correspond to an allowed type at position " << pos.
bottom()
260 << std::endl; utility_exit();
281 bool limit_by_DNA(
false);
282 for (
Size i(1); i <= nres; ++i ) {
286 if ( rtask.has_behavior(
"TARGET") || rtask.has_behavior(
"SCAN") ) {
291 if ( !limit_by_DNA ) {
293 for (
Size dpos(1); dpos <= nres; ++dpos ) {
295 dna_design_positions.push_back( dpos );
304 if ( !toptask.has_behavior(
"TARGET") && !toptask.has_behavior(
"SCAN") )
continue;
305 dna_design_positions.push_back( resid );
307 TR(t_info) <<
"\nTargeting DNA at position ";
310 << pose.
pdb_info()->number( dnapos.
top() ) <<
'\n';
312 TR << pose.
chain( dnapos.
top() ) <<
"." << dnapos.
top() <<
'\n';
314 TR(t_debug) <<
"Allowed types:\n"; toptask.print_allowed_types(
TR(t_debug) );
316 if ( !dnapos.
paired() )
continue;
317 dna_design_positions.push_back( dnapos.
bottom() );
320 TR(t_info) <<
"\nTargeting DNA at position ";
332 for (
Size p_index(1); p_index <= nres; ++p_index ) {
338 protein_positions.push_back(p_index);
345 interface_->determine_protein_interface( pose, protein_positions, dna_design_positions );
349 bool const repack_only( option[ OptionKeys::dna::design::repack_only ]() );
351 for ( DnaNeighbors::const_iterator itr(
interface_->protein_neighbors().begin() ),
353 Size const index( itr->first );
358 bool const cst( constraint_set && constraint_set->residue_pair_constraints_exists( index ) );
359 if ( neighbor.
contact() && !cst && !repack_only )
continue;
363 if ( neighbor.
close() ) aas[ current_aa ] =
true;
368 if ( current_aa != orig_aa ) aas[ orig_aa ] =
true;
371 if ( !aas.empty() ) restask.restrict_absent_canonical_aas( aas );
372 else restask.prevent_repacking();
379 if ( ! rlt.being_packed() )
continue;
380 TR(t_info) <<
"DNA types allowed at ";
385 else TR << i <<
" " << pose.
chain(i);
388 std::set< std::string > name3set;
390 allowed_type( rlt.allowed_residue_types_begin() ),
391 typesend( rlt.allowed_residue_types_end() ); allowed_type != typesend; ++allowed_type ) {
392 name3set.insert( (*allowed_type)->name3() );
394 for ( std::set< std::string >::const_iterator n3( name3set.begin() ), n3end( name3set.end() );
395 n3 != n3end; ++n3 ) {
401 if ( ! rlt.being_packed() )
continue;
405 TR(t_info) << pose.
chain(i) <<
"." << i <<
".";
408 if ( rlt.being_designed() )
TR(t_info) <<
" is DESIGNABLE";
409 else TR(t_info) <<
" is packable";
412 TR(t_info) << std::endl;
415 TR.Debug <<
"forgetting chains and interface" << std::endl;