Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SameChiBinComboGrouper.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 // :noTabs=false:tabSize=4:indentSize=4:
4 //
5 // (c) Copyright Rosetta Commons Member Institutions.
6 // (c) This file is part of the Rosetta software suite and is made available under license.
7 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
8 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
9 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
10 
11 /// @file protocols/match/output/SameChiBinComboGrouper.cc
12 /// @brief
13 /// @author Alex Zanghellini (zanghell@u.washington.edu)
14 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com), porting to mini
15 
16 // Unit headers
18 
19 // Package headers
22 #include <protocols/match/Hit.hh>
23 
24 // Project headers
26 // AUTO-REMOVED #include <core/scoring/ScoringManager.hh>
29 
30 // Utility headers
31 #include <utility/exit.hh>
32 
33 #include <utility/OrderedTuple.hh>
34 #include <utility/vector1.hh>
35 
36 
37 namespace protocols {
38 namespace match {
39 namespace output {
40 
41 SameChiBinComboGrouper::SameChiBinComboGrouper() : n_geometric_constraints_( 0 ) {}
42 SameChiBinComboGrouper::SameChiBinComboGrouper( Size ncst ) : n_geometric_constraints_( ncst ) {}
43 
45 
48  match const & m
49 )
50 {
51  return assign_group_for_match( match_dspos1( m, 1 ) );
52 }
53 
56  match_dspos1 const & m
57 )
58 {
59  using namespace core::scoring;
60  using namespace core::pack::dunbrack;
61 
62  runtime_assert( m.upstream_hits.size() == n_geometric_constraints_ );
63 
64  RotamerLibrary const & rotlib( RotamerLibrary::get_instance() );
65 
67  for ( Size ii = 1; ii <= n_geometric_constraints_; ++ii ) {
68  rot_vector[ ii ] = m.upstream_hits[ ii ].scaffold_build_id();
69  core::conformation::ResidueCOP iires = hit_cacher_->upstream_conformation_for_hit( ii, fake_hit( m.upstream_hits[ ii ] ) );
70 
71  /*
72  for ( Size jj = 1; jj <= iires->nchi(); ++jj ) {
73  core::Vector p1, p2, p3, p4;
74  p1 = iires->xyz( iires->chi_atoms( jj )[ 1 ] );
75  p2 = iires->xyz( iires->chi_atoms( jj )[ 2 ] );
76  p3 = iires->xyz( iires->chi_atoms( jj )[ 3 ] );
77  p4 = iires->xyz( iires->chi_atoms( jj )[ 4 ] );
78 
79  std::cout << "res chi reported: chi " << jj << " " << iires->chi( jj ) << " real: "
80  << numeric::constants::d::radians_to_degrees * numeric::dihedral_radians(
81  p1, p2, p3, p4 ) << std::endl;
82 
83  }*/
84 
85  rot_vector[ n_geometric_constraints_ + ii ] = iires->aa();
86 
87  SingleResidueRotamerLibraryCAP srrl( rotlib.get_rsd_library( iires->type() ) );
88  if ( ! srrl ) {
89  /// ?!?! What do we without a library?
90  rot_vector[ 2*n_geometric_constraints_ + ii ] = 1;
91  } else {
93  dynamic_cast< SingleResidueDunbrackLibrary const * > ( srrl.get() ));
94  if ( srdl ) {
95  RotVector rotvect;
96  srdl->get_rotamer_from_chi( iires->chi(), rotvect );
97  rot_vector[ 2*n_geometric_constraints_ + ii ] = srdl->rotwell_2_rotno( rotvect );
98  } else {
99  /// ?!?! What do we do with a non-dunbrack library?
100  rot_vector[ 2*n_geometric_constraints_ + ii ] = 1;
101  }
102  }
103  }
104 
105  ChiBinComboCountMap::const_iterator iter = chibin_combo_indexer_.find( rot_vector );
106  if ( iter == chibin_combo_indexer_.end() ) {
107  Size next_index = chibin_combo_indexer_.size() + 1;
108  chibin_combo_indexer_[ rot_vector ] = next_index;
109  return next_index;
110  } else {
111  return iter->second;
112  }
113 }
114 
115 void
117 {
118  chibin_combo_indexer_.clear();
119 }
120 
121 void
123 {
124  n_geometric_constraints_ = n_csts;
125 }
126 
127 void
129 {
130  hit_cacher_ = cacher;
131 }
132 
133 
134 }
135 }
136 }