34 #include <basic/Tracer.hh>
41 #include <numeric/constants.hh>
42 #include <numeric/xyzVector.hh>
45 #include <utility/string_util.hh>
46 #include <utility/tag/Tag.hh>
48 #include <utility/vector0.hh>
49 #include <utility/vector1.hh>
55 static basic::Tracer
tr(
"protocols.match.MatchPositionModifiers" );
65 else if( mpm_name ==
"num_neighbors" )
return new NumNeighborsMPM( input_tokens );
66 else if( mpm_name ==
"bfactor" )
return new BfactorMPM( input_tokens );
68 else if( mpm_name ==
"no_c_n_term" )
return new RemoveNorCTermMPM( input_tokens );
69 else if( mpm_name ==
"task_operation" )
return new TaskOperationMPM( geom_cst, input_tokens );
80 if( input_tokens.size() < 3 ) utility_exit_with_message(
"Not enough information given to initialize SecondaryStructureMPM");
81 for(
core::Size i = 2; i < input_tokens.size(); ++i){
82 if( input_tokens[ i ] ==
"ss_char" ){
84 tr <<
"SecondaryStructureMPM requires positions to have ss char " << input_tokens[i+1][0] <<
"." << std::endl;
87 else if( input_tokens[ i ] ==
"ss_motif" ){
89 tr <<
"SecondaryStructureMPM requires positions to have motif " << input_tokens[i+1] <<
"." << std::endl;
92 else tr <<
"Token " << input_tokens[ i ] <<
" could not be understood by SecondaryStructureMPM and will be ignored." << std::endl;
110 for(
core::Size i =1; i <= original_positions.size(); ++i ){
112 bool position_passes(
false);
117 position_passes =
true;
124 if( position_passes )
break;
133 for(
core::Size j = seqpos - 1; (j >= seqpos - 3) && (j > 0 ); --j){
135 position_passes =
true;
143 position_passes =
true;
150 tr <<
"WARNING: SecondaryStructureMPM doesn't know how to interpret motif '" <<
ss_motifs_[ motif ] <<
"'." << std::endl;
153 if( position_passes ){
154 to_return.push_back( seqpos );
156 else remove_string += utility::to_string( seqpos ) +
"+";
158 tr <<
"SecondaryStructureMPM removed the following match positions " << remove_string <<
"." << std::endl;
165 com_vector_criterion_(false), both_criteria_needed_to_pass_(false),
166 min_com_vector_ang_cos_( 1.0 ), max_com_vector_ang_cos_( -1.0 )
168 if( input_tokens.size() < 3 ) utility_exit_with_message(
"Not enough information given to initialize NumNeighborsMPM");
169 for(
core::Size i = 2; i <= input_tokens.size(); ++i){
170 if( input_tokens[ i ] ==
"min_neighbors" ){
172 tr <<
"NumNeighborsMPM will only allow positions that have at least " <<
min_neighbors_ <<
" 10A neighbors." << std::endl;
175 else if ( input_tokens[ i ] ==
"max_neighbors" ){
177 tr <<
"NumNeighborsMPM will only allow positions that have no more than " <<
max_neighbors_ <<
" 10A neighbors." << std::endl;
180 else if ( input_tokens[ i ] ==
"min_com_vector_ang" ){
185 else if ( input_tokens[ i ] ==
"max_com_vector_ang" ){
190 else if ( input_tokens[ i ] ==
"both_criteria_needed_to_pass" ){
193 else tr <<
"Token " << input_tokens[ i ] <<
" could not be understood by NumNeighborsMPM and will be ignored." << std::endl;
218 for(
core::Size i =1; i <= original_positions.size(); ++i ){
222 bool neighborpass(
true ), com_vect_pass(
true);
227 bool pass(neighborpass);
231 pass = (neighborpass && com_vect_pass);
234 else pass = (neighborpass || com_vect_pass);
236 if( pass ) to_return.push_back( original_positions[i] );
237 else remove_string += utility::to_string( original_positions[ i ] ) +
"+";
239 tr <<
"NumNeighborsMPM removed the following match positions " << remove_string <<
"." << std::endl;
254 core::Real com_cos( seqpos_to_com.dot( ca_cb ) / (seqpos_to_com.length() * ca_cb.length() ) );
266 :
MatchPositionModifier(), use_relative_bfactors_(false), all_bfactors_zero_(false), max_bfactor_(0.0)
268 if( input_tokens.size() < 3 ) utility_exit_with_message(
"Not enough information given to initialize BfactorMPM");
269 for(
core::Size i =2; i < input_tokens.size(); ++i){
270 if( input_tokens[ i ] ==
"relative" ){
273 tr <<
"BfactorMPM will only allow positions that have a relative B-factor of not more than" <<
max_bfactor_ <<
"." << std::endl;
275 if( input_tokens[ i ] ==
"absolute" ){
278 tr <<
"BfactorMPM will only allow positions that have an absolute B-factor of not more than" <<
max_bfactor_ <<
"." << std::endl;
280 else tr <<
"Token " << input_tokens[ i ] <<
" could not be understood by BfactorMPM and will be ignored." << std::endl;
298 tr <<
"Warning: all bfactors in the pose were 0, meaning they were probably wiped. BfactorMPM will not modify match positions." << std::endl;
299 to_return = original_positions;
303 for(
core::Size i =1; i <= original_positions.size(); ++i ){
304 if( bfactors[ original_positions[ i ] ] <=
max_bfactor_ ) to_return.push_back( original_positions[i] );
305 else remove_string += utility::to_string( original_positions[ i ] ) +
"+";
307 tr <<
"BfactorMPM removed the following match positions " << remove_string <<
"." << std::endl;
323 if( bfactors[ seqpos ] > max_bfactor ) max_bfactor = bfactors[ seqpos ];
326 if( max_bfactor == 0.0 ){
368 for(
core::Size i =2; i < input_tokens.size(); ++i){
369 if( input_tokens[ i ] ==
"cterm" ){
370 runtime_assert( input_tokens.size() > i );
373 else if( input_tokens[ i ] ==
"nterm" ){
374 runtime_assert( input_tokens.size() > i );
402 for(
core::Size i = 1; i <= original_positions.size(); ++i){
403 if( (original_positions[i] >=
nterm_length_) && (original_positions[i] <= cterm) ) to_return.push_back( original_positions[i] );
420 for(
core::Size i = 3; i <= input_tokens.size(); ++i ) tagstring = tagstring +
" " + input_tokens[i];
423 runtime_assert(input_tokens[2].substr(0,1) ==
"<");
424 runtime_assert(input_tokens[input_tokens.size()].substr( input_tokens[input_tokens.size()].length() - 1,1) ==
">" );
425 std::string task_op_name = utility::trim( input_tokens[2],
"<");
426 tr <<
"TaskOperationMPM getting task_op of type " << task_op_name <<
" with tag '" << tagstring <<
"'." << std::endl;
430 std::istringstream tagstream(tagstring);
431 tag->read(tagstream);
454 using namespace core::pack::task;
457 PackerTaskOP ptask(tfactory.create_task_and_apply_taskoperations( match_pose ) );
465 for(
core::Size i = 1; i <= original_positions.size(); ++i){
466 ResidueLevelTask const & restask( ptask->residue_task( original_positions[i] ));
467 if( restask.being_packed() ){
475 bool name3_found(
false );
477 if( (*restype_it)->name3() == (*upres_it)->name3() ){
479 to_return.push_back( original_positions[i] );
484 if( name3_found )
break;