Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Align_RmsdEvaluator.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 Align_RmsdEvaluator
11 /// @author James Thompson
12 
13 // Unit Headers
15 
16 // Package Headers
18 
19 // Project Headers
22 #include <core/pose/Pose.hh>
23 #include <core/scoring/rms_util.hh>
26 
27 // Utility headers
28 #include <basic/Tracer.hh>
29 #include <numeric/xyzVector.hh>
30 #include <numeric/model_quality/maxsub.hh>
31 #include <numeric/model_quality/rms.hh>
32 #include <ObjexxFCL/FArray2D.hh>
33 #include <utility/vector1.hh>
34 
35 // C++ headers
36 #include <map>
37 #include <string>
38 
39 static basic::Tracer tr("protocols.comparative_modeling.Align_RmsdEvaluator");
40 
41 namespace protocols {
42 namespace comparative_modeling {
43 
45 
47  core::pose::PoseCOP native_pose,
48  std::string tag,
49  bool calc_gdt,
51 ) :
52  AlignEvaluator( native_pose, tag, true, aln ),
53  calc_gdt_ (calc_gdt),
54  report_gdt_components_(false)
55 {}
56 
57 void
59  core::pose::Pose & pose,
60  std::string /*tag*/,
62 ) const {
63  using core::Real;
64  using ObjexxFCL::FArray2D;
66 
67  int n_atoms;
68  FArray2D< Real > p1a, p2a;
69  tr.Debug << "gathering xyz coordinates ... ";
71  pose, *native_pose(),
72  *get_alignment(pose),
73  n_atoms, p1a, p2a
74  );
75  tr.Debug << "gathered " << n_atoms << "coordinates" << std::endl;
76  tr.flush_all_channels();
77 
78  Real rmsd( numeric::model_quality::rms_wrapper( n_atoms, p1a, p2a ) );
79  ss.add_energy( "rms_" + tag(), rmsd );
80 
81  Real const coverage(
82  (Real) (n_atoms) / (Real) (native_pose()->total_residue())
83  );
84 
85  if ( report_aln_components() ) {
86  ss.add_energy( "nres_ali_" + tag(), n_atoms );
87  ss.add_energy( "coverage_" + tag(), coverage );
88  }
89 
90  if ( calc_gdt() ) {
91  tr.Debug << "computing gdtmm for " << tag() << std::endl;
92  Real m_1_1, m_2_2, m_3_3, m_4_3, m_7_4;
93  Real gdtmm = xyz_gdtmm( p1a, p2a, m_1_1, m_2_2, m_3_3, m_4_3, m_7_4 );
94  ss.add_energy ( "gdtmm_" + tag(), coverage * gdtmm );
95  if ( report_gdt_components() ) {
96  ss.add_energy( "m11", m_1_1 );
97  ss.add_energy( "m22", m_2_2 );
98  ss.add_energy( "m33", m_3_3 );
99  ss.add_energy( "m43", m_4_3 );
100  ss.add_energy( "m74", m_7_4 );
101  }
102 
103  // high-accuracy statistics
104  core::id::SequenceMapping mapping = get_alignment(pose)->sequence_mapping(1, 2);
105  std::map<Size, Size> residues;
106  for (Size idx_mod = 1; idx_mod <= mapping.size1(); ++idx_mod) {
107  Size idx_ref = mapping[idx_mod];
108  if (idx_ref > 0) {
109  residues[idx_ref] = idx_mod;
110  }
111  }
112 
113  tr.Debug << "computing high-accuracy statistics for " << tag() << std::endl;
114  ss.add_energy("gdtha_" + tag(), core::scoring::gdtha(*native_pose(), pose, residues));
115  ss.add_energy("gdtsc_" + tag(), core::scoring::gdtsc(*native_pose(), pose, residues));
116 
117  tr.Debug << "computing maxsub for " << tag() << std::endl;
118  ss.add_energy( "maxsub_" + tag(), core::scoring::xyz_maxsub( p1a, p2a, n_atoms ) );
119  }
120 }
121 
122 } // comparative_modeling
123 } // protocols