Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Hit.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/Hit.cc
12 /// @brief Constructors for match_dspos1
13 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com), porting to mini
14 
15 // Unit headers
16 #include <protocols/match/Hit.hh>
17 
18 namespace protocols {
19 namespace match {
20 
21 bool
23 {
24  if( first_[1] < rhs.first_[1] ) return true;
25  else if( first_[1] > rhs.first_[1] ) return false;
26 
27  if( first_[2] < rhs.first_[2] ) return true;
28  else if( first_[2] > rhs.first_[2] ) return false;
29 
30  if( first_[3] < rhs.first_[3] ) return true;
31  else if( first_[3] > rhs.first_[3] ) return false;
32 
33  return false;
34 }
35 
36 bool
38 {
39  if( ( first_[1] == rhs.first_[1] )
40  &&( first_[2] == rhs.first_[2] )
41  &&( first_[3] == rhs.first_[3] ) ) return true;
42 
43  return false;
44 }
45 
46 bool
48 {
49  if( downstream_conf_id_ < rhs.downstream_conf_id_ ) return true;
50  else if( downstream_conf_id_ > rhs.downstream_conf_id_) return false;
51 
52  for( core::Size i =1; i <= 6; ++i ){
53  if( second_[i] < rhs.second_[i] ) return true;
54  else if ( second_[i] > rhs.second_[i] ) return false;
55  }
56  return false;
57 }
58 
59 bool
61 {
63  &&( second_[1] == rhs.second_[1] )
64  &&( second_[2] == rhs.second_[2] )
65  &&( second_[3] == rhs.second_[3] )
66  &&( second_[4] == rhs.second_[4] )
67  &&( second_[5] == rhs.second_[5] )
68  &&( second_[6] == rhs.second_[6] ) ) return true;
69 
70  return false;
71 }
72 
74  originating_geom_cst_for_dspos( 0 ),
75  downstream_conf_id( 0 ),
76  dspos( 0 )
77 {}
78 
79 match_dspos1::match_dspos1( core::Size n_geometric_constraints ) : upstream_hits( n_geometric_constraints ) {}
80 
82  match const & m,
83  core::Size geomcst_specifying_dspos
84 ) :
85  upstream_hits( m.size() ),
86  originating_geom_cst_for_dspos( geomcst_specifying_dspos ),
87  downstream_conf_id( m[ geomcst_specifying_dspos ].first()[ 4 ] ),
88  dspos( m[ geomcst_specifying_dspos ].second() )
89 {
90  for ( core::Size ii = 1; ii <= m.size(); ++ii ) {
91  upstream_hits[ ii ] = upstream_hit( m[ ii ] );
92  }
93 }
94 
95 Hit
96 fake_hit( upstream_hit const & uhit ) {
97  Hit hit;
98  hit.first()[ 1 ] = uhit.scaffold_build_id();
99  hit.first()[ 2 ] = uhit.upstream_conf_id();
100  hit.first()[ 3 ] = uhit.external_geom_id();
101  hit.first()[ 4 ] = 0;
102  std::fill( hit.second().begin(), hit.second().end(), 0.0 );
103  return hit;
104 }
105 
106 Hit
107 fake_hit( downstream_hit const & dhit ) {
108  Hit hit;
109  hit.first()[ 1 ] = 0;
110  hit.first()[ 2 ] = 0;
111  hit.first()[ 3 ] = 0;
112  hit.first()[ 4 ] = dhit.downstream_conf_id();
113  hit.second() = dhit.second();
114  return hit;
115 }
116 
117 
118 /// @brief Create a hit with the full data from a given match_dspos1 representing
119 /// the upstream conformation from the originating_geom_cst and its
120 /// description of the downstream position.
122 {
123  core::Size const geomcst_w_dspos = m.originating_geom_cst_for_dspos;
124  Hit fullhit;
125  fullhit.first()[ 1 ] = m.upstream_hits[ geomcst_w_dspos ].scaffold_build_id();
126  fullhit.first()[ 2 ] = m.upstream_hits[ geomcst_w_dspos ].upstream_conf_id();
127  fullhit.first()[ 3 ] = m.upstream_hits[ geomcst_w_dspos ].external_geom_id();
128  fullhit.first()[ 4 ] = m.downstream_conf_id;
129  fullhit.second() = m.dspos;
130  return fullhit;
131 }
132 
133 }
134 }
135