Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TorsionBinPool.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/frag_picker/quota/TorsionBinPool.hh
11 /// @brief provides a quota selector based on torsion bin prediciton
12 /// @author Dominik Gront (dgront@chem.uw.edu.pl)
13 
14 #include <protocols/frag_picker/TorsionBinPool.hh>
15 
16 // package headers
20 
21 // utility headers
22 #include <utility/vector1.hh>
23 #include <core/types.hh>
24 #include <basic/Tracer.hh>
25 
26 namespace protocols {
27 namespace frag_picker {
28 namespace quota {
29 
30 
31 static basic::Tracer trTorsionBinPool(
32  "protocols.frag_picker.quota.TorsionBinPool");
33 
34 SecondaryStructurePool::~TorsionBinPool() {}
35 
36 /// @brief prints information on which fragments can be accepted by this pool and how many of them
37 void TorsionBinPool::show_availability(std::ostream & where) const {
38  where << std::setw(10) << get_pool_name()<<" : nH = "<< max_h_ - nh_<<" nE = "<<max_e_ - ne_<<" nL = "<<max_l_ - nl_<<"\n";
39 }
40 
42 
43  char ss = candidate.first->get_middle_ss();
44  switch(ss) {
45  case 'H' :
46  if (nh_ < max_h_) {
47  nh_++;
48  ++inserted_;
49  return true;
50  }
51  return false;
52  case 'E' :
53  if (ne_ < max_e_) {
54  ne_++;
55  ++inserted_;
56  return true;
57  }
58  return false;
59  default:
60  if (nl_ < max_l_) {
61  nl_++;
62  ++inserted_;
63  return true;
64  }
65  return false;
66  }
67 }
68 
69 void TorsionBinPool::restart(Size query_seq_pos,Size fragment_size) {
70 
71  frag_size_ = fragment_size;
72  Size query_center_frag_pos = query_seq_pos + fragment_size / 2;
73  max_h_ = round( total_size_ * prediction_->helix_fraction( query_center_frag_pos ) );
74  max_e_ = round( total_size_ * prediction_->strand_fraction( query_center_frag_pos ) );
75  max_l_ = round( total_size_ * prediction_->loop_fraction( query_center_frag_pos ) );
76  nh_ = ne_ = nl_ = 0;
77 }
78 
79 } // quota
80 } // frag_picker
81 } // protocols
82