Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AntibodyUtil.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
6 // (c) under license. The Rosetta software is developed by the contributing
7 // (c) members of the Rosetta Commons. For more information, see
8 // (c) http://www.rosettacommons.org. Questions about this can be addressed to
9 // (c) University of Washington UW TechTransfer,email:license@u.washington.edu.
10 
11 /// @file protocols/antibody2/AntibodyUtil.cc
12 /// @brief
13 /// @author Jianqing Xu (xubest@gmail.com)
14 
16 
17 // Rosetta Headers
19 #include <core/pose/PDBInfo.hh>
20 #include <core/pose/Pose.hh>
21 #include <core/scoring/rms_util.hh>
22 #include <core/types.hh>
23 #include <basic/Tracer.hh>
24 #include <core/id/AtomID_Map.hh>
25 
26 #include <protocols/loops/Loop.hh>
27 #include <protocols/loops/Loops.hh>
28 
29 //Auto Headers
30 #include <core/pose/util.hh>
31 #include <core/pose/util.tmpl.hh>
33 
34 #include <iostream>
35 #include <fstream>
36 #include <numeric/xyz.functions.hh>
37 #include <numeric/numeric.functions.hh>
38 #include <numeric/random/random.hh>
39 #include <numeric/PCA.hh>
52 
53 
54 
55 
56 
57 
58 
59 
60 static basic::Tracer TR("antibody2.AntibodyUtil");
61 
62 
63 using namespace core;
64 namespace protocols{
65 namespace antibody2{
66 
67 
68  //JQX:
69  // Description (Jason contributed)
70  // assuming a loop 10,11,12,13,14,15, cut_point is 13/14
71  // or loop = Loop (10, 15, 13)
72  // 1. (Rosetta Default)
73  // set_single_loop_fold_tree()
74  // jump from 8->17 (-2 amd +2)
75  // 2. (Aroop's)
76  // simple_one_loop_fold_tree()
77  // jump from 9->16 (-1 and +1)
78  // 3. (Aroop's)
79  // simple_fold_tree()
80  // jump from 10->15, but you need manuly input
81  // 4. (Aroop's)
82  // setup_simple_fold_tree()
83  // jump from 10->15, but you need manuly input
84 
86  pose::Pose & pose_in,
87  loops::Loop const & loop ) {
88  using namespace kinematics;
89 
90  TR << "Utility: Setting up simple one loop fold tree" << std::endl;
91 
92  //setup fold tree for this loop
93  FoldTree f;
94  f.clear();
95  Size nres = pose_in.total_residue();
96  Size jumppoint1 = loop.start() - 1;
97  Size jumppoint2 = loop.stop() + 1;
98 
99  if( jumppoint1 < 1 ) jumppoint1 = 1;
100  if( jumppoint2 > nres) jumppoint2 = nres;
101 
102  f.add_edge( 1, jumppoint1, Edge::PEPTIDE );
103  f.add_edge( jumppoint1, loop.cut(), Edge::PEPTIDE );
104  f.add_edge( loop.cut() + 1, jumppoint2, Edge::PEPTIDE );
105  f.add_edge( jumppoint2, nres, Edge::PEPTIDE );
106  f.add_edge( jumppoint1, jumppoint2, 1 );
107  f.reorder( 1 );
108 
109  pose_in.fold_tree( f );
110 
111  TR << "Utility: Finished setting up simple one loop fold tree" << std::endl;
112 
113  return;
114  } // simple_one_loop_fold_tree
115 
116 
117 
118 
119 
121  pose::Pose & pose_in,
122  Size jumppoint1,
123  Size cutpoint,
124  Size jumppoint2 ) {
125  using namespace kinematics;
126 
127  TR << "Utility: Setting up simple fold tree" << std::endl;
128 
129  //setup fold tree for this loop
130  FoldTree f;
131  f.clear();
132  Size nres = pose_in.total_residue();
133 
134  if( jumppoint1 < 1 ) jumppoint1 = 1;
135  if( jumppoint2 > nres) jumppoint2 = nres;
136 
137  f.add_edge( 1, jumppoint1, Edge::PEPTIDE );
138  f.add_edge( jumppoint1, cutpoint, Edge::PEPTIDE );
139  f.add_edge( cutpoint + 1, jumppoint2, Edge::PEPTIDE );
140  f.add_edge( jumppoint2, nres, Edge::PEPTIDE );
141  f.add_edge( jumppoint1, jumppoint2, 1 );
142  f.reorder( 1 );
143 
144  pose_in.fold_tree( f );
145 
146  TR << "Utility: Finished setting up simple fold tree" << std::endl;
147 
148  return;
149  } // simple_fold_tree
150 
151 
152 
153 
154 
155 
156 
157 
158 
159 
160 
161 
162 
163 
164 
165 
166  ///////////////////////////////////////////////////////////////////////////
167  /// @begin CDR_H3_filter
168  ///
169  /// @brief tests if a loop has H3 like base charachteristics
170  ///
171  /// @detailed Uses the Shirai rules to find out if the dihedral angle
172  /// formed by CA atoms of residues n-2,n-1,n and n+1 conform to a
173  /// kinked/extended structure in accordance with the sequence. If
174  /// there is a match, a true value is returned
175  ///
176  /// @param[in] pose: full actual protein
177  /// loop_begin: seq numbered loop begin corresponding to pose
178  /// size: size of loop to compute loop_end
179  ///
180  /// @global_read reads -command line flag -base stored in dle_ns
181  /// to determine to do the complete H3 filter check or just do
182  /// a prediction of the H3 base type based on the
183  /// aforementioned dihedral angle
184  ///
185  /// @references Structural classification of CDR-H3 in antibodies
186  /// Hiroki Shirai, Akinori Kidera, Haruki Nakamura
187  /// FEBS Letters 399 (1996) 1-8
188  ///
189  /// @authors Aroop 02/04/2010
190  ///
191  /// @last_modified 02/04/2010
192  ///////////////////////////////////////////////////////////////////////////
193 
194  //TODO:
195  //JQX:
196  //work with Daisuke to put the L89 creteria into the code
197 
198  bool CDR_H3_filter_legacy_code_with_old_rule(const pose::Pose & pose_in, loops::Loop & input_loop, bool is_camelid)
199  {
200 
201 
202  TR << "Utility: Checking Kink/Extended CDR H3 Base Angle" << std::endl;
203 
204 
205  char const light_chain = 'L';
206 
207  if(is_camelid )
208  return( true );
209 
210  // Values read from plot in reference paper. Fig 1 on Page 3
211  // Values adjusted to match data from antibody training set
212  Real const kink_lower_bound = -10.00; // Shirai: 0
213  Real const kink_upper_bound = 70.00; // Shirai: 70
214  Real const extended_lower_bound = 125.00; // Shirai: ~180
215  Real const extended_upper_bound = 185.00; // Shirai: ~180
216 
217  // Hydrogen Bond maximum value is 3.9 Angstroms - not used
218  // Real const h_bond(3.9);
219  // Salt Bridge maximum value is 2.0 Angstroms - not used
220  // Real const s_bridge(4.0);
221 
222  // chop out the loop:
223  //JQX: 2 residues before h3, one residue after h3. Matched Rosetta2!
224  Size start(input_loop.start()-2);
225  Size stop(input_loop.stop()+1);
226 
227 
228  bool is_kinked( false );
229  bool is_extended( false );
230  bool is_H3( false );
231 
232  // extract 3 letter residue codes for the chopped loop
233  std::vector <std::string> aa_name; // loop residue 3 letter codes
234  //JQX: pay attention here!! It is vector, not vector1! too painful to compare to R2 code
235  // just make vector, so it can match R2 code easily
236  for(Size ii=start; ii<=stop;ii++){
237  aa_name.push_back(pose_in.residue(ii).name3() );
238 // TR<<pose_in.residue(ii).name1()<<std::endl;
239  }
240 
241  Size const CA(2); // CA atom position in full_coord array
242  // base dihedral angle to determine kinked/extended conformation
243 
244  Real base_dihedral( numeric::dihedral_degrees(
245  pose_in.residue( stop ).xyz( CA ),
246  pose_in.residue( stop - 1).xyz( CA ),
247  pose_in.residue( stop - 2).xyz( CA ),
248  pose_in.residue( stop - 3).xyz( CA ) ) );
249 
250  //pose_in.dump_pdb("check_cter_dihedral.pdb");
251 
252 
253  TR << "Base Dihedral: " << base_dihedral << std::endl;
254 
255 
256 
257  // JQX: the code in the below if statement was in Rosetta 2, but Aroop did not port it into R3
258  // Maybe he has already tested that, the performance was better if using extra
259  // sequence creteria. But for now, I still port the code in here. Maybe for some reason
260  // one still decides not to use the sequence rules.
261 
262  bool H3_base_only=false;
263 
264  if( H3_base_only) {
265  std::string base;
266  if((base_dihedral > kink_lower_bound) && (base_dihedral < kink_upper_bound)){
267  base = "KINK";
268  TR << " " << base << std::endl;
269  }
270  else if((base_dihedral > extended_lower_bound) && (base_dihedral < extended_upper_bound)){
271  base = "EXTENDED";
272  TR << " " << base << std::endl;
273  }
274  else{
275  base = "NEUTRAL";
276  TR << " " << base << std::endl;
277  }
278 
279  return( true );
280  }
281 
282 
283  // setting up pseudo-periodic range used in extended base computation
284  if( base_dihedral < kink_lower_bound ){
285  base_dihedral = base_dihedral + 360.00;
286  }
287 
288  // Rule 1a for standard kink
289  if ((aa_name[aa_name.size()-3] != "ASP") && (aa_name[aa_name.size()-1] == "TRP")) //aa_name.size()-3 = n-1
290  { //aa_name.size()-1 = n+1
291  if( (base_dihedral > kink_lower_bound) && (base_dihedral < kink_upper_bound))
292  {
293  // std::cout << "KINK Found" << std::endl; // aroop_temp remove
294  is_kinked = true;
295  is_H3 = true;
296  }
297  }
298 
299  // Rule 1b for standard extended form
300  if ( ( aa_name[ aa_name.size() - 3 ] == "ASP" ) &&
301  ( ( aa_name[1] != "LYS" ) && ( aa_name[1] != "ARG" ) ) &&
302  ( is_H3 != true ) ) //aa_name[1] = 0 position
303  {
304 
305  if( ( base_dihedral>extended_lower_bound) && (base_dihedral<extended_upper_bound) ) {
306  // std::cout << "EXTENDED Found" << std::endl; // aroop_temp remove
307  is_extended = true;
308  is_H3 = true;
309  }
310 
311  if(!is_H3) {
312  // Rule 1b extension for special kinked form
313  bool is_basic(false); // Special basic residue exception flag
314  for(Size ii = 2; ii <= Size(aa_name.size() - 5); ii++) { //aa_name.size() - 5 = n-3
315  if( aa_name[ii] == "ARG" || aa_name[ii] == "LYS" ) { //aa_name[2] = 0 position
316  is_basic = true;
317  break;
318  }
319  }
320 
321  if(!is_basic) {
322  Size rosetta_number_of_L49 = pose_in.pdb_info()->pdb2pose(light_chain, 49 );
323  std::string let3_code_L49 = pose_in.residue( rosetta_number_of_L49 ).name3();
324  if( let3_code_L49 == "ARG" || let3_code_L49 == "LYS"){
325  is_basic = true;
326  }
327  }
328  if( is_basic && ( base_dihedral > kink_lower_bound ) &&
329  ( base_dihedral < kink_upper_bound ) ) {
330  // aroop_temp remove
331  // std::cout << "KINK (special 1b) Found" << std::endl;
332  is_kinked = true;
333  is_H3 = true;
334  }
335  }
336  }
337 
338  // Rule 1c for kinked form with salt bridge
339  if ( ( aa_name[ aa_name.size() - 3 ] == "ASP") &&
340  ( ( aa_name[1] == "LYS") || ( aa_name[1] == "ARG" ) ) &&
341  ( (aa_name[0] != "LYS" ) && ( aa_name[0] != "ARG" ) ) &&
342  ( is_H3 != true) ) {
343  if( (base_dihedral > kink_lower_bound ) &&
344  (base_dihedral < kink_upper_bound ) ) {
345  // aroop_temp remove
346  // std::cout << "KINK (w sb) Found" << std::endl;
347  is_kinked = true;
348  is_H3 = true;
349  }
350  if(!is_H3) {
351  bool is_basic(false); // Special basic residue exception flag
352  Size rosetta_number_of_L46 = pose_in.pdb_info()->pdb2pose( light_chain, 46 );
353  std::string let3_code_L46 = pose_in.residue( rosetta_number_of_L46 ).name3();
354  if( let3_code_L46 == "ARG" || let3_code_L46 == "LYS") is_basic = true;
355  if( is_basic && (base_dihedral > extended_lower_bound ) &&
356  ( base_dihedral < extended_upper_bound ) ) {
357  // aroop_temp remove
358  // std::cout << "EXTENDED (special 1c) Found" << std::endl;
359  is_extended = true;
360  is_H3 = true;
361  }
362  }
363  }
364 
365  // Rule 1d for extened form with salt bridge
366  if ( ( aa_name[ aa_name.size() - 3 ] == "ASP") &&
367  ( ( aa_name[1] == "LYS") || ( aa_name[1] == "ARG" ) ) &&
368  ( ( aa_name[0] == "LYS") || ( aa_name[0] == "ARG") ) &&
369  ( is_H3 != true ) )
370  {
371  if( ( base_dihedral > extended_lower_bound ) &&
372  ( base_dihedral < extended_upper_bound ) ) {
373  // aroop_temp remove
374  // std::cout << "EXTENDED (w sb) Found" << std::endl;
375  is_extended = true;
376  is_H3 = true;
377  }
378  }
379 
380  TR << "Utility: Finished Checking Kink/Extended CDR H3 Base Angle: " << is_H3 << std::endl;
381 
382  return is_H3;
383  } // CDR_H3_filter
384 
385 
386 bool CDR_H3_cter_filter(const pose::Pose & pose_in, AntibodyInfoOP ab_info)
387 {
388 
389  TR << "Utility: Checking Kink/Extended CDR H3 Base Angle" << std::endl;
390 
391  if(ab_info->is_Camelid() ){ return( true ); }
392 
393  // Values read from plot in reference paper. Fig 1 on Page 3
394  // Values adjusted to match data from antibody training set
395  Real const kink_lower_bound = -10.00; // Shirai: 0
396  Real const kink_upper_bound = 70.00; // Shirai: 70
397  Real const extended_lower_bound = 125.00; // Shirai: ~180
398  Real const extended_upper_bound = 185.00; // Shirai: ~180
399 
400  // Hydrogen Bond maximum value is 3.9 Angstroms - not used
401  // Real const h_bond(3.9);
402  // Salt Bridge maximum value is 2.0 Angstroms - not used
403  // Real const s_bridge(4.0);
404 
405  // chop out the loop:
406  //JQX: 2 residues before h3, one residue after h3. Matched Rosetta2!
407  Size start( ab_info->get_CDR_loop(h3).start() - 2 );
408  Size stop( ab_info->get_CDR_loop(h3).stop() + 1 );
409 
410 
411  bool matched_kinked( false );
412  bool matched_extended( false );
413 
414 
415  // extract 3 letter residue codes for the chopped loop
416  std::vector <std::string> aa_name; // loop residue 3 letter codes
417  //JQX: pay attention here!! It is vector, not vector1! too painful to compare to R2 code
418  // just make vector, so it can match R2 code easily
419  for(Size ii=start; ii<=stop;ii++){
420  aa_name.push_back(pose_in.residue(ii).name3() );
421  // TR<<pose_in.residue(ii).name1()<<std::endl;
422  }
423 
424  Size const CA(2); // CA atom position in full_coord array
425  // base dihedral angle to determine kinked/extended conformation
426 
427  Real base_dihedral( numeric::dihedral_degrees(
428  pose_in.residue( stop ).xyz( CA ),
429  pose_in.residue( stop - 1).xyz( CA ),
430  pose_in.residue( stop - 2).xyz( CA ),
431  pose_in.residue( stop - 3).xyz( CA ) ) );
432 
433  //pose_in.dump_pdb("check_cter_dihedral.pdb");
434 
435  TR << "Base Dihedral: " << base_dihedral << std::endl;
436 
437  // setting up pseudo-periodic range used in extended base computation
438  if( base_dihedral < kink_lower_bound ){
439  base_dihedral = base_dihedral + 360.00;
440  }
441 
442 
443  if( (base_dihedral > kink_lower_bound ) && (base_dihedral < kink_upper_bound ) ) {
444  if(ab_info->get_Predicted_H3BaseType()==Kinked) {matched_kinked = true;}
445  }
446  if( (base_dihedral > extended_lower_bound ) && (base_dihedral < extended_upper_bound ) ) {
447  if(ab_info->get_Predicted_H3BaseType()==Extended) {matched_extended = true;}
448  }
449 
450 
451  bool passed;
452  if (matched_kinked || matched_extended){
453  passed=true;
454  }
455  else{
456  passed=false;
457  }
458 
459  TR << "Utility: Finished Checking Kink/Extended CDR H3 Base Angle: " << passed << std::endl;
460 
461  return passed;
462 }
463 
464 
465 
467 {
468  using namespace pack::task;
469  using namespace pack::task::operation;
470 
471  TR << "Utility: Setting Up Packer Task" << std::endl;
472 
473  core::pack::task::TaskFactoryOP tf = new TaskFactory;
474  tf->clear();
475 
476  tf->push_back(new OperateOnCertainResidues(new PreventRepackingRLT, new ResidueLacksProperty("PROTEIN") ));
477  tf->push_back(new InitializeFromCommandline );
478  tf->push_back(new IncludeCurrent );
479  tf->push_back(new RestrictToRepacking );
480  tf->push_back(new NoRepackDisulfides );
481 
482  // incorporating Ian's UnboundRotamer operation.
483  // note that nothing happens if unboundrot option is inactive!
486  unboundrot->initialize_from_command_line();
487 
488  operation::AppendRotamerSetOP unboundrot_operation = new operation::AppendRotamerSet( unboundrot );
489  tf->push_back( unboundrot_operation );
490 
491  // adds scoring bonuses for the "unbound" rotamers, if any
492  core::pack::dunbrack::load_unboundrot( pose_in ); ///FIXME: this is dangerous here..... JQX
493  //TODO:
494  //JQX: need to understand this pose_in!!!!
495 
496  TR << "Utility: Done: Setting Up Packer Task" << std::endl;
497 
498  return tf;
499 
500 } // setup_packer_task
501 
502 
503 
504 /* void
505  dle_extreme_repack(
506  pose::Pose & pose_in,
507  int repack_cycles,
508  ObjexxFCL::FArray1D_bool & allow_repack,
509  bool rt_min,
510  bool rotamer_trials,
511  bool force_one_repack,
512  bool use_unbounds
513  )
514  {
515  using namespace pose;
516 
517  // Exit if not fullatom
518  if( !pose_in.fullatom() ) {
519  std::cout << "Repack called in centroid mode" << std::endl;
520  std::cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" << std::endl;
521  std::cout << "------NOT REPACKING-----------" << std::endl;
522  return;
523  }
524  // Saving parameters
525  bool initial_rot_trial = score_get_try_rotamers();
526  bool initial_min_rot = get_minimize_rot_flag();
527  score_set_minimize_rot( rt_min );
528  score_set_try_rotamers( rotamer_trials );
529  // initial allowed chi movement
530  FArray1D_bool old_chi_move( pose_in.total_residue(), false );
531  for( int i = 1; i <= pose_in.total_residue(); i++ ) {
532  // storing old
533  old_chi_move(i) = pose_in.get_allow_chi_move(i);
534  // setting new
535  pose_in.set_allow_chi_move( i, allow_repack(i) || old_chi_move(i) );
536  }
537  Score_weight_map weight_map( score12 );
538  Monte_carlo mc( pose_in, weight_map, 2.0 );
539  // repack idealized native
540  Pose start_native_pose;
541  start_native_pose = pose_in;
542  for(int i=1; i <= repack_cycles; i++) {
543  pose_in = start_native_pose;
544  if( use_unbounds )
545  dle_pack_with_unbound( pose_in, allow_repack, true ); // include_current = true
546  else
547  pose_in.repack( allow_repack, true ); //include_current = true
548  pose_in.score( weight_map );
549  score_set_minimize_rot( false );
550  score_set_try_rotamers( false );
551  if( force_one_repack && (i == 1) ) mc.reset( pose_in );
552  mc.boltzmann( pose_in );
553  score_set_minimize_rot( rt_min );
554  score_set_try_rotamers( rotamer_trials );
555  }
556  pose_in = mc.low_pose();
557  pose_in.score( weight_map );
558 
559  // Restoring Globals
560  score_set_minimize_rot( initial_rot_trial );
561  score_set_try_rotamers( initial_min_rot );
562  pose_in.set_allow_chi_move( old_chi_move );
563 
564  return;
565  }
566 */
567 
568 
569 
570  //TODO:
571  //JQX:
572  // should input a variable here to let the user to adjust 1.9
573 
574  bool cutpoints_separation( core::pose::Pose & pose, AntibodyInfoOP & antibody_info )
575  {
576 
577  bool closed_cutpoints = true;
578 
579  for( loops::Loops::const_iterator it=antibody_info->get_AllCDRs_in_loopsop()->begin(),
580  it_end=antibody_info->get_AllCDRs_in_loopsop()->end(),
581  it_next; it != it_end; ++it ) {
582  Size cutpoint = it->cut();
583  Real separation = 10.00; // an unlikely high number
584  separation = cutpoint_separation( pose, cutpoint );
585 
586  if( separation > 1.9 ) {
587  closed_cutpoints = false;
588  break;
589  }
590  }
591  return( closed_cutpoints );
592  } // cutpoints_separation
593 
594  Real cutpoint_separation(pose::Pose & pose_in, Size cutpoint) {
595 
596  Size const N ( 1 ); // N atom
597  Size const C ( 3 ); // C atom
598 
599  // Coordinates of the C atom of cutpoint res and N atom of res cutpoint+1
600  numeric::xyzVector_float peptide_C(pose_in.residue( cutpoint ).xyz( C )),
601  peptide_N( pose_in.residue( cutpoint + 1 ).xyz( N ) );
602  // Real cutpoint_separation=distance(peptide_C, peptide_N);
603  Real cutpoint_separation=peptide_C.distance(peptide_N);
604 
605  return( cutpoint_separation );
606  } // cutpoint_separation
607 
608 
609 
610 
611 
612 
613 
614  Real global_loop_rmsd (const pose::Pose & pose_in, const pose::Pose & native_pose,loops::LoopsOP current_loop )
615  {
616  using namespace scoring;
617 
618  Size loop_start = (*current_loop)[1].start();
619  Size loop_end = (*current_loop)[1].stop();
620 
621  using ObjexxFCL::FArray1D_bool;
622  FArray1D_bool superpos_partner ( pose_in.total_residue(), false );
623 
624  for ( Size i = loop_start; i <= loop_end; ++i ) superpos_partner(i) = true;
625 
626  using namespace core::scoring;
627  Real rmsG = rmsd_no_super_subset( native_pose, pose_in, superpos_partner, is_protein_backbone_including_O );
628  return ( rmsG );
629  }
630 
631 
632  Real vl_vh_packing_angle ( const pose::Pose & pose_in, AntibodyInfoOP ab_info ) {
633 
634  vector1< Size > vl_vh_residues = ab_info->get_PackingAngleResidues();
635 
637  for (Size i=1; i<=8; ++i){
638  vl_coord_set.push_back( pose_in.residue( vl_vh_residues[i] ).xyz( "CA" ) );
639  }
640 
642  for (Size i=9; i<=16; ++i){
643  vh_coord_set.push_back( pose_in.residue( vl_vh_residues[i] ).xyz( "CA" ) );
644  }
645 
646  Size vl_n_res = vl_coord_set.size();
647  numeric::xyzVector< Real > vl_centroid(0.0);
648  for (Size i = 1; i <= vl_n_res; ++i) {
649  vl_centroid += vl_coord_set[i];
650  }
651  vl_centroid /= vl_n_res;
652 
653  Size vh_n_res = vh_coord_set.size();
654  numeric::xyzVector< Real > vh_centroid(0.0);
655  for (Size i = 1; i <= vh_n_res; ++i) {
656  vh_centroid += vh_coord_set[i];
657  }
658  vh_centroid /= vh_n_res;
659 
660  numeric::xyzVector< Real > vl_first_principal_component = numeric::first_principal_component( vl_coord_set );
661  numeric::xyzVector< Real > vh_first_principal_component = numeric::first_principal_component( vh_coord_set );
662 
663  vl_first_principal_component += vl_centroid;
664  vh_first_principal_component += vh_centroid;
665 
666  Real packing_angle = numeric::dihedral_degrees( vl_first_principal_component, vl_centroid, vh_centroid, vh_first_principal_component );
667 
668  if ( packing_angle > 0 ) {
669  packing_angle -= 180;
670  }
671 
672  return packing_angle;
673  }
674 
675 
676 
677 
678 
679 
680 
681 
683  core::pose::Pose & native_pose,
684  AntibodyInfoOP ab_info,
685  AntibodyInfoOP native_ab_info ) {
686 
689 
690  for (Size i_chain=1; i_chain<=ab_info->get_AntibodyFrameworkInfo().size(); i_chain++){
691  vector1<FrameWork> chain_frmwk = ab_info->get_AntibodyFrameworkInfo()[i_chain];
692  vector1<FrameWork> native_chain_frmwk = native_ab_info->get_AntibodyFrameworkInfo()[i_chain];
693 
694 
695 
696  for (Size j_seg=1; j_seg<=chain_frmwk.size(); j_seg++) { // for loop of the framework segments
697  Size count=0;
698 
699  for (Size k_res=chain_frmwk[j_seg].start; k_res<= chain_frmwk[j_seg].stop; k_res++){
700  count++;
701  Size res_counter = k_res;
702  Size nat_counter = native_chain_frmwk[j_seg].start+count-1;
703  //TR<< res_counter<<" "<<nat_counter<<std::endl;
704 
705  for( core::Size latm=1; latm <= 4; latm++ ) {
706  core::id::AtomID const id1( latm, res_counter );
707  core::id::AtomID const id2( latm, nat_counter );
708  atom_map[ id1 ] = id2;
709  }
710  }
711  }
712 
713 
714 
715  }
716 
717 
718 
719  /*
720  for (core::Size j=1; j<= ab_info->get_ab_framework().size();j++){
721  core::Size count=0;
722  for (core::Size k=ab_info->get_ab_framework()[j].start(); k<= ab_info->get_ab_framework()[j].stop();k++){
723  count++;
724  core::Size res_counter = k;
725  core::Size nat_counter = native_ab_info->get_ab_framework()[j].start()+count-1;
726  //TR<< res_counter<<" "<<nat_counter<<std::endl;
727 
728  for( core::Size atm_counter=1; atm_counter <= 4; atm_counter++ ) {
729  core::id::AtomID const id1( atm_counter, res_counter );
730  core::id::AtomID const id2( atm_counter, nat_counter );
731  atom_map[ id1 ] = id2;
732  }
733  }
734  }
735  */
736  core::scoring::superimpose_pose( pose, native_pose, atom_map );
737 
738  } // align_to_native()
739 
740 
741 
742 
743 
744 } // namespace antibody2
745 } // namespace protocols
746 
747 
748 
749 
750 
751