Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GraftOneCDRLoop.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/antibody2/GraftOneCDRLoop.cc
11 /// @brief grafts a cdr onto the template of an antibody framework
12 /// @detailed
13 /// @author Jianqing Xu (xubest@gmail.com)
14 
19 #include <core/pose/util.hh>
22 #include <core/id/AtomID_Map.hh>
23 #include <core/pose/util.tmpl.hh>
24 #include <basic/Tracer.hh>
25 
26 
27 static basic::Tracer TRG("protocols.antibody2.GraftOneCDRLoop");
28 
29 namespace protocols {
30 namespace antibody2 {
31 using namespace core;
32 
33 
34 
36 
37 
38 
40  AntibodyInfoOP antibody_info,
41  Ab_TemplateInfoOP ab_t_info) : Mover( "GraftOneCDRLoop" ){
42 
43  set_default();
44 
45  cdr_name_ = cdr_name;
46  ab_info_ = antibody_info;
47  ab_t_info_ = ab_t_info;
48 
49 
50  init();
51 
52 }
53 
54 
56 
57 
59  ab_info_=NULL;
60  ab_t_info_=NULL;
61  stem_copy_size_ = 2;
62  flank_size_ = 4 ;
63  // JQX: the default value of flank_size_ is equle to 4, meaning there are 4 residues
64  // on the C-ter and N-ter of the actual loop
65  // However, based on the old R2 antibody code, only 3 residues on each stem
66 
67  h3_stem_not_graft_ = false;
68  benchmark_ = false;
69 
70 }
71 
72 
73 
75 
76  //idealize the loop
77  idealize::IdealizeMover idealizer;
78  idealizer.fast( false );
79 
80 }
81 
82 
83 
84 
86 
87  if(scorefxn_){
89  }
90 
92  stem_copy_size_ = 0 ;
93  }
94 
95 }
96 
97 
98 
99 
101 
102 
103  TRG<<"Start to Graft CDRs "<< ab_info_->get_CDR_Name(cdr_name_) <<" ............"<<std::endl;
104  TRG<<"flank_size: "<<flank_size_<<std::endl;
105 
106  finalize_setup();
107 
108 
109 
110  core::Size query_start = ab_info_->get_CDR_loop(cdr_name_).start();
111  core::Size query_end = ab_info_->get_CDR_loop(cdr_name_).stop();
112  Size query_size = ( query_end - query_start )+1;
113 
114 
115  // create a sub pose with 4 flanking residues on either side of CDR loop
116  // TRG<<"query_start="<<query_start<<std::endl;
117  // TRG<<"query_end="<<query_end<<std::endl;
118  // TRG<<"flank_size="<<flank_size_<<std::endl;
119  // TRG<<"query_size="<<query_size<<std::endl;
120  // TRG<<"truncated_pose will be from "<<query_start-flank_size_<<" to "<<query_end+flank_size_<<std::endl;
121  pose::Pose truncated_pose( pose_in, query_start-flank_size_, query_end+flank_size_ );
122  pose::Pose template_pose = ab_t_info_->get_one_template_pose(ab_info_->get_CDR_Name(cdr_name_)) ;
123  TRG<< "template_pose: "<<std::endl;
124  TRG<< template_pose<<std::endl;
125 
126  // Just want to make life a litter easier
127  //TRG<<"**************&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*************"<<std::endl;
128  //TRG<<pose_in.sequence()<<std::endl;
129  //TRG<<" the template sequence: "<<template_pose.sequence()<<std::endl;
130  //TRG<<"trucated_query sequence: "<<truncated_pose.sequence()<<std::endl;
131  //TRG<<"**************&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*************"<<std::endl;
132 
133 
134  // create atom map for superimposing 2 flanking resiudes
136  pose::initialize_atomid_map( atom_map, template_pose, id::BOGUS_ATOM_ID );
137 
138 
139 
140  // ****AAAAAAAAAAAAAAAAAAA**** the template pose should have 4 residues each side
141  // @@@AAAAAAAAAAAAAAAAAAA@@@ the real alignment only based on 3 residues each side
142 
143  for( Size start_stem = 2; start_stem <= flank_size_; ++start_stem ) {
144  /// starting from the 2nd residue in the l1-3.pdb, H1-3.pdb
145  Size const ref_stem ( start_stem );
146  for( Size j=1; j <= 4; j++ ) { /// four backbone heavy atoms
147 // TRG<<"j="<<j<<" start_stem_in_template_pose="<<start_stem<<" ref_stem_in_truncated_pose_="<<ref_stem<<std::endl;
148  id::AtomID const id1( j, start_stem );
149  id::AtomID const id2( j, ref_stem );
150  atom_map[ id1 ] = id2;
151  }
152  }
153 
154  // start at the end of the actual loop
155  for( Size end_stem = query_size+flank_size_+1; end_stem <= query_size+flank_size_+flank_size_-1; ++end_stem ) {
156  Size const ref_stem ( end_stem);
157  // if(template_name_ == "h3") Size const ref_stem(end_stem+1);
158  for( Size j=1; j <= 4; j++ ) { /// four backbone heavy atoms
159 // TRG<<"j="<<j<<" end_stem_in_template_pose="<<end_stem<<" ref_stem_in_truncated_pose_="<<ref_stem<<std::endl;
160  id::AtomID const id1( j, end_stem );
161  id::AtomID const id2( j, ref_stem );
162  atom_map[ id1 ] = id2;
163  }
164  }
165 
166 
167  scoring::superimpose_pose( template_pose, truncated_pose, atom_map );
168 
169 
170  // TODO:
171  // JQX:
172  // when copying the backbone heavy atom coordinates, you copy two more residues on each side
173  // pay attention to this, it is "2", not "3" here. "3" was used to superimpose like the code did above.
174  // No reason for that, just to match R2_antibody.
175  // This may be the reason why you need hfr to reasign the phi, psi, or omega angle of h3_start-1
176  // when doing H3 loop modeling. But this is still weird, because you need to take care
177  // of 2 residues on each side then, not just one more on h3_start-1 or +1 position using hfr.pdb.
178  // Maybe I should remove this number 2, just copy the loop itself !!!!!
179 
180  for ( Size i=query_start-stem_copy_size_; i <= query_end+stem_copy_size_; ++i ) {
181  Size template_num ( i - (query_start-5) ); // this "5" is the default in the L1.pdb, you have 4 residues before the 1st one
182 // TRG<<" i="<<i<<" template_num="<<template_num<<std::endl;
183  conformation::Residue const & source_rsd( pose_in.residue( i ) );
184  conformation::Residue const & target_rsd( template_pose.residue( template_num) );
185 // TRG<<source_rsd<<std::endl;
186 // TRG<<target_rsd<<std::endl;
187 
188  Size const natoms( source_rsd.natoms() );
189 
190  bool any_missing( false );
191  id::AtomID_Mask missing( false );
192  // dimension the missing-atom mask
193  pose::initialize_atomid_map( missing, pose_in );
194 
195  if( source_rsd.name() != target_rsd.name() ) pose_in.set_secstruct( i, 'X' );
196  for ( Size j=1; j<= natoms; ++j ) {
197  std::string const & atom_name( source_rsd.atom_name(j) );
198  if ( target_rsd.has( atom_name ) ) {
199  pose_in.set_xyz( id::AtomID( source_rsd.atom_index( atom_name),i ), target_rsd.xyz( atom_name ) );
200  //make sure the source_rsd in pose_in only has 4 backbone atoms
201  //my script should take care of it
202  }
203  else {
204  TRG<<"watch out !!! missing "<<atom_name << " !!!!!" <<std::endl;
205  any_missing = true;
206  missing[ id::AtomID( pose_in.residue_type(i).atom_index(source_rsd.atom_name(j)), i ) ] = true;
207  }
208  }
209 
210  if ( any_missing ) {
211  pose_in.conformation().fill_missing_atoms( missing );
212  }
213  }
214 
215 // pose_in.dump_pdb(template_name_+"_graft");
216 
217 
218 }
219 
220 
221 
222 
223 
224 
225 
226 
227 
228 std::string GraftOneCDRLoop::get_name() const { return "GraftOneCDRLoop"; }
229 
230 // copy ctor
233 }
234 
235 
236 ///@brief assignment operator
238  //abort self-assignment
239  if (this == &rhs) return *this;
240  Mover::operator=(rhs);
242  return *this;
243 }
244 
246  lhs.flank_size_ = rhs.flank_size_;
248  lhs.cdr_name_=rhs.cdr_name_;
249  lhs.ab_info_=rhs.ab_info_;
250  lhs.ab_t_info_=rhs.ab_t_info_;
251  lhs.benchmark_=rhs.benchmark_;
253 }
254 
255 
256 
257 
258 
259 } // namespace antibody2
260 } // namespace protocols