Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RestrictIdentitiesAtAlignedPositions.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file protocols/toolbox/task_operations/RestrictIdentitiesAtAlignedPositionsOperation.cc
11 /// @brief
12 /// @author Sarelf Fleishman sarelf@uw.edu
13 
14 // Unit Headers
18 #include <core/pose/selection.hh>
20 #include <core/pose/Pose.hh>
24 // Project Headers
25 #include <core/pose/Pose.hh>
26 #include <utility/string_util.hh>
27 
28 // AUTO-REMOVED #include <core/pack/task/PackerTask.hh>
29 // AUTO-REMOVED #include <core/pack/task/operation/TaskOperations.hh>
30 
31 // Utility Headers
32 #include <core/types.hh>
33 #include <basic/Tracer.hh>
34 #include <utility/exit.hh>
35 #include <utility/vector1.hh>
36 #include <utility/tag/Tag.hh>
39 
40 #include <boost/foreach.hpp>
41 #define foreach BOOST_FOREACH
42 
43 // C++ Headers
44 
45 using basic::Error;
46 using basic::Warning;
47 static basic::Tracer TR( "protocols.toolbox.TaskOperations.RestrictIdentitiesAtAlignedPositionsOperation" );
48 
49 namespace protocols {
50 namespace toolbox {
51 namespace task_operations {
52 
53 using namespace core::pack::task::operation;
54 using namespace std;
55 
58  chain_( 1 ),
59  design_only_target_residues_( false ),
60  prevent_repacking_( false ),
61  keep_aas_( "ACDEFGHIKLMNPQRSTVWY" ),
62  restrict_identities_( false )
63 {
65  res_ids_.clear();
66 }
67 
69 
72 {
74 }
75 
77 {
79 }
80 
81 void
83 {
84  using namespace protocols::rosetta_scripts;
85  using namespace core::pack::task::operation;
86 
88  dao.design_shell( 0.01 );
89  dao.repack_shell( 6.0 );
90  foreach( core::Size const resid, res_ids_ ){
91  core::Size const nearest_to_res = find_nearest_res( pose, *source_pose_, resid, chain() );
92  if( nearest_to_res == 0 ){
93  TR<<"WARNING: could not find a residue near to "<<resid<<std::endl;
94  continue;
95  }//fi
96  RestrictAbsentCanonicalAASRLTOP racaas1 = new RestrictAbsentCanonicalAASRLT; /// used to determine the single residue identity taken from the source pose
97  RestrictAbsentCanonicalAASRLTOP racaas2 = new RestrictAbsentCanonicalAASRLT; /// used to limit identities to those specified by the user
99  char const residue_id( source_pose_->residue( resid ).name1() );
100  std::string residues_to_keep("");
101  residues_to_keep += residue_id;
102  racaas1->aas_to_keep( residues_to_keep );
103  racaas2->aas_to_keep( keep_aas_ );
105  if( prevent_repacking() && source_pose_->residue( resid ).name1() == pose.residue( nearest_to_res ).name1() ) /// if the source and designed pose have the same residue identity we can additionally prevent repacking at this position
106  oocr.op( pr );
107  else if( restrict_identities() )
108  oocr.op( racaas2 );
109  else
110  oocr.op( racaas1 );
112  temp_vec.clear();
113  temp_vec.push_back( nearest_to_res );
114  oocr.residue_indices( temp_vec );
115  oocr.apply( pose, task );
116  dao.include_residue( nearest_to_res );
117  }//foreach resid
119  dao.apply( pose, task );
120 }
121 
122 void
125 }
126 
127 void
129 {
130  using namespace protocols::rosetta_scripts;
131  utility::vector1< std::string > pdb_names, start_res, stop_res;
132  source_pose( tag->getOption< std::string >( "source_pdb" ) );
133  std::string const res_list( tag->getOption< std::string >( "resnums" ) );
134  utility::vector1< std::string > const split_reslist( utility::string_split( res_list,',' ) );
135  chain( tag->getOption< core::Size >( "chain", 1 ) );
136  TR<<"source_pdb: "<<tag->getOption< std::string >( "source_pdb" )<<" restricting residues: ";
137  foreach( std::string const res_str, split_reslist ){
138  res_ids_.push_back( core::pose::parse_resnum( res_str, *source_pose_ ) );
139  TR<<res_str<<",";
140  }
141  design_only_target_residues( tag->getOption< bool >( "design_only_target_residues", false ) );
142  prevent_repacking( tag->getOption< bool >( "prevent_repacking", false ) );
143  keep_aas_ = tag->getOption< std::string >( "keep_aas", "ACDEFGHIKLMNPQRSTVWY" );
144  restrict_identities( tag->hasOption( "keep_aas" ) );
145  TR<<std::endl;
146 }
147 
148 } //namespace protocols
149 } //namespace toolbox
150 } //namespace task_operations