Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ABEGO_SS_Pool.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/ABEGO_SS_Pool.hh
11 /// @brief provides a quota selector based on difefrent secondary structure predicitons
12 /// @author Dominik Gront (dgront@chem.uw.edu.pl)
13 
15 
16 // package headers
21 
22 // utility headers
23 #include <utility/vector1.hh>
24 #include <core/types.hh>
25 #include <basic/Tracer.hh>
26 
27 //C++
28 #include <sstream>
29 
30 namespace protocols {
31 namespace frag_picker {
32 namespace quota {
33 
34 static basic::Tracer trABEGO_SS_Pool(
35  "protocols.frag_picker.quota.ABEGO_SS_Pool");
36 
37 /// @brief Creates a pool of a given size and name
38 /// @param total_size - how many fragments will be selected (in total in all pools)
39 /// @param name - name assigned to this pool. This in general may be any string that
40 /// later allows one control pool's behavior from a flag file
41 /// @param ss_type - what is the type of secondary structur this pool is accepting
42 /// @param fraction - fraction of the total number of fragments that goes into this pool
44  utility::vector1< std::pair<Size,Size> > ss_abego_types,
45  utility::vector1<Size> which_components,utility::vector1<Real> weights,Real fraction,Size n_scores,Size buffer_factor = 5) :
46  QuotaPool(pool_name,fraction) {
47 
48  ss_abego_types_ = new ABEGO_SS_Map(ss_abego_types);
49 
50  buffer_factor_ = buffer_factor;
51  assert ( which_components.size() == weights.size() );
52  for(Size i=1;i<=which_components.size();i++) {
53  components_.push_back( which_components[i] );
54  weights_.push_back( weights[i] );
55  }
57  this_size_ = (Size)(fraction * total_size);
58  if(this_size_<20)
59  this_size_ = 20;
60 
62  storage_ = new BoundedQuotaContainer(ordering,this_size_,this_size_*buffer_factor);
63  FragmentCandidateOP worst_f = new FragmentCandidate(1,1,0,1);
65  storage_->set_worst(std::pair<FragmentCandidateOP, scores::FragmentScoreMapOP>(worst_f,worst_s));
66  for(Size i=1;i<=n_scores;i++)
67  worst_s->set_score_component(99999.9999,i);
68 
69  if(trABEGO_SS_Pool.Debug.visible()) {
70  trABEGO_SS_Pool.Debug<< "Creating a pool >"<<pool_name<<"< for: \n";
71 // for(Size i=1;i<=ss_abego_types_.size();i++) {
72 // trABEGO_SS_Pool.Debug<<ss_abego_types_[i].first<<":"<<ss_abego_types_[i].second<<"\n";
73 // }
74  trABEGO_SS_Pool.Debug<< ss_abego_types_->show_valid();
75  trABEGO_SS_Pool.Debug<<"\nholding "<<this_size_<<" candidates, quota fraction is: "<<fraction<<std::endl;
76  }
77 }
78 
79 
81 
83 
84  VallResidueOP r = candidate.first->get_middle_residue();
85  Size abego_bin = torsion2big_bin_id(r->phi(),r->psi(),r->omega());
86 
87  return ss_abego_types_->check_status(candidate.first->get_middle_ss(),abego_bin);
88 }
89 
90 
92 
93  if( could_be_accepted(candidate) ) {
94  return storage_->push( candidate );
95  }
96  return false;
97 }
98 
100  std::ostream & out,
102 ) const
103 {
104  out << get_pool_name() << " collected "<<current_size()<<std::endl;
105 }
106 
107 } // quota
108 } // frag_picker
109 } // protocols
110