32 #include <basic/Tracer.hh>
33 #include <utility/exit.hh>
34 #include <utility/vector1.hh>
35 #include <utility/tag/Tag.hh>
39 #include <boost/foreach.hpp>
40 #define foreach BOOST_FOREACH
45 #include <utility/vector0.hh>
50 static basic::Tracer
TR(
"protocols.toolbox.TaskOperations.RestrictToAlignedSegmentsOperation" );
54 namespace task_operations {
56 using namespace core::pack::task::operation;
84 using namespace protocols::rosetta_scripts;
86 std::set< core::Size > designable;
88 for(
core::Size count = 1; count <= source_pose_.size(); ++count ){
90 core::Size const nearest_to_to =
find_nearest_res( pose, *source_pose_[ count ], std::min( stop_res_[ count ], source_pose_[ count ]->total_residue() ), chain() );
92 TR<<
"Finding nearest residue to residue pair "<<start_res_[ count ]<<
','<<stop_res_[ count ]<<
" in source pose"<<std::endl;
93 if( nearest_to_from == 0 || nearest_to_to == 0 ){
94 TR<<
"nearest_to_from: "<<nearest_to_from<<
" nearest_to_to: "<<nearest_to_to<<
". Failing"<<std::endl;
97 for(
core::Size position = nearest_to_from; position <= nearest_to_to; ++position )
98 designable.insert( position );
103 dao->repack_shell( repack_shell() );
105 dao->include_residue( d );
114 repackable.clear(); immutable.clear();
116 if( std::find( designed_residues.begin(), designed_residues.end(), i ) != designed_residues.end() )
118 if( std::find( surrounding_shell.begin(), surrounding_shell.end(), i ) == surrounding_shell.end() )
119 immutable.push_back( i );
121 repackable.push_back( i );
127 if( repackable.size() ){
128 oocr_repackable.residue_indices( repackable );
129 oocr_repackable.apply( pose, task );
130 TR<<
"allowing repacking in: ";
135 if( immutable.size() ){
136 oocr_immutable.residue_indices( immutable );
137 oocr_immutable.apply( pose, task );
138 TR<<
"no repack in: ";
148 using namespace protocols::rosetta_scripts;
150 pdb_names.clear(); start_res.clear(); stop_res.clear();
151 if( tag->hasOption(
"source_pdb" ) )
152 pdb_names.push_back( tag->getOption<
std::string >(
"source_pdb" ) );
153 if( tag->hasOption(
"start_res" ) )
154 start_res.push_back( tag->getOption<
std::string >(
"start_res" ) );
155 if( tag->hasOption(
"stop_res" ) )
156 stop_res.push_back( tag->getOption<
std::string >(
"stop_res" ) );
158 chain( tag->getOption<
core::Size >(
"chain", 1 ) );
159 if( tag->hasOption(
"source_pdb" ) || tag->hasOption(
"start_res" ) || tag->hasOption(
"stop_res" ) ){
160 runtime_assert( tag->hasOption(
"source_pdb" ) && tag->hasOption(
"start_res" ) && tag->hasOption(
"stop_res" ) );
164 foreach(
TagPtr const btag, btags ){
165 pdb_names.push_back( btag->getOption<
std::string >(
"source_pdb" ) );
166 start_res.push_back( btag->getOption<
std::string >(
"start_res" ) );
167 stop_res.push_back( btag->getOption<
std::string >(
"stop_res" ) );
170 for(
core::Size i = 1; i <= pdb_names.size(); ++i ){
171 if( i == 1 || pdb_names[ i ] != pdb_names[ i - 1 ]){
176 source_pose_.push_back( source_pose_[ i - 1 ] );
179 start_res_.push_back( parsed_start );
180 stop_res_. push_back( parsed_stop );
182 repack_shell( tag->getOption<
core::Real >(
"repack_shell", 6.0 ));