Rosetta 3.5
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
protocols
frag_picker
scores
FragmentScoreManager.hh
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/scores/FragmentScoreManager.hh
11
/// @brief Score manager
12
/// @author Dominik Gront (dgront@chem.uw.edu.pl)
13
14
#ifndef INCLUDED_protocols_frag_picker_scores_FragmentScoreManager_hh
15
#define INCLUDED_protocols_frag_picker_scores_FragmentScoreManager_hh
16
17
// package headers
18
#include <
protocols/frag_picker/scores/FragmentScoreManager.fwd.hh
>
19
#include <
protocols/frag_picker/scores/FragmentScoringMethod.hh
>
20
// AUTO-REMOVED #include <protocols/frag_picker/scores/FragmentScoreMap.hh>
21
#include <
protocols/frag_picker/FragmentCandidate.fwd.hh
>
22
#include <
protocols/frag_picker/FragmentPicker.fwd.hh
>
23
#include <
protocols/frag_picker/VallChunk.fwd.hh
>
24
25
// utility headers
26
#include <utility/pointer/ReferenceCount.hh>
27
28
// C++
29
#include <map>
30
// AUTO-REMOVED #include <set>
31
32
#include <utility/vector1_bool.hh>
33
34
35
namespace
protocols {
36
namespace
frag_picker {
37
namespace
scores {
38
39
/// @brief holds particular score components, weights and calculates the total score for a fragment candidate
40
/// @detailed a fragment picker object needs exactly one fragment manager to pick fragments. Adding new scoring methods
41
/// is supposed to be done FragmentPicker, which calls proper method from this class.
42
class
FragmentScoreManager
:
public
utility::pointer::ReferenceCount
{
43
public
:
44
///@brief Automatically generated virtual destructor for class deriving directly from ReferenceCount
45
virtual
~FragmentScoreManager
();
46
47
/// @brief precision used to display the total score for each fragment
48
static
const
Size
TOTAL_PRECISION
= 3;
49
/// @brief default width used to print a score value, equal to 6
50
Size
default_width_
;
51
/// @brief default precision used to print a score value, equal to 1
52
Size
default_precision_
;
53
54
/// @brief creates an empty manager
55
FragmentScoreManager
();
56
57
/// @brief creates an empty score map
58
FragmentScoreMapOP
create_empty_map
();
59
60
/// @brief registers a new scoring method in this manager
61
void
add_scoring_method
(
62
FragmentScoringMethodOP
,
Real
);
63
64
/// @brief says how many scoring methods have already been registered
65
inline
Size
count_components
() {
66
return
scores_
.size();
67
}
68
69
/// @brief Returns a desired scoring method
70
/// @detailed Allowed index values are [1,count_components()]
71
inline
FragmentScoringMethodOP
get_component
(
72
Size
index) {
73
return
scores_
[index];
74
}
75
76
/// @brief returns a vector of weights that are used to compute the total score
77
utility::vector1<Real>
get_weights
() {
78
return
score_weights_
;
79
}
80
81
/// @brief prints a nice table showing the registered scores
82
/// @detailed the table shows also the order in which the scores are evaluated
83
void
show_scoring_methods
(std::ostream& out);
84
85
/// @brief calculates the total score
86
Real
total_score
(
FragmentScoreMapOP
);
87
88
/// @brief calculates all the small scores for a given fragment
89
/// @brief results are properly stored inside a FragmentScoreMap object
90
virtual
bool
score_fragment_from_cache
(
FragmentCandidateOP
,
FragmentScoreMapOP
);
91
92
/// @brief calculates all the small scores for a given fragment
93
/// @brief results are properly stored inside a FragmentScoreMap object
94
virtual
bool
score_fragment
(
FragmentCandidateOP
,
FragmentScoreMapOP
);
95
96
/// @brief those score metohods that have weight = 0.0 will be computed after the fragments are picked
97
/// @detailed if weight for a score is 0.0 than it does not affect the total score and thus has no
98
/// effect on fragments sorting, quota, etc. Such scores may be computed after fragment picking is finished
99
// By default it is set to false.
100
void
use_late_scoring_for_zeros
(
const
bool
if_true) {
101
zeros_score_later_
= if_true;
102
}
103
104
/// @brief says if late scoring is used or not
105
/// @details late scoring means that some scores (those with weight=0, such as crmsd) are evaluated
106
/// only for the selected fragments rather than for all the candidates
107
inline
bool
if_late_scoring_for_zeros
() {
108
return
zeros_score_later_
;
109
}
110
111
/// @brief calculates all these small scores for a given fragment whose weight is 0.0
112
/// @detailed When use_late_scoring_for_zeros() was used to set the flag to true,
113
/// all fragment scoring methods neglects zero-weighted scores.
114
/// These will be evaluated by this function, that may be called after fragments are picked.
115
/// This way some time consuming computations (e.g. crmsd for fragments) may be computed
116
/// only for the selected fragments rather than for all of them
117
bool
score_zero_scores
(
FragmentCandidateOP
,
FragmentScoreMapOP
);
118
119
/// @brief registers a maker object that will be used to create a scoring method object
120
void
register_score_maker
(
MakeFragmentScoringMethodOP
);
121
122
/// @brief creates a new scoring method object
123
void
create_scoring_method
(
std::string
const
&,
Size
,
Real
,
Real
,
bool
,
124
FragmentPickerOP
,
std::string
);
125
126
/// @brief reads a config file and creates scoring methods
127
void
create_scores
(
std::string
const
&,
FragmentPickerOP
);
128
129
/// @brief calls do_caching() for each FragmentScoringMethod object, if it is possible
130
/// @detailed FragmentPicker calls this method when a new chunk is to be processed
131
void
do_caching
(
VallChunkOP
chunk);
132
133
/// @brief calls clean_up() for each FragmentScoringMethod object, if it is possible
134
/// @detailed FragmentPicker calls this method when a given chunk has been processed
135
void
clean_up
();
136
137
/// @brief sets up a new number of characters spend to print fragment score value
138
void
set_width
(
FragmentScoringMethodOP
which_score,
Size
width) {
139
width_
[which_score] = width;
140
}
141
142
/// @brief sets up a new precision used to print fragment score value
143
void
set_precision
(
FragmentScoringMethodOP
which_score,
Size
precision
) {
144
precision_
[which_score] =
precision
;
145
}
146
147
/// @brief prints a flat table with all scores for all the fragments in a given vector
148
virtual
void
describe_fragments
(
utility::vector1
<
std::pair
<
FragmentCandidateOP
,
149
scores::FragmentScoreMapOP
> >
const
&, std::ostream&);
150
151
protected
:
152
utility::vector1<FragmentScoringMethodOP>
scores_
;
153
std::map<FragmentScoringMethodOP, Size>
width_
;
154
std::map<FragmentScoringMethodOP, Size>
precision_
;
155
private
:
156
utility::vector1<Real>
score_weights_
;
157
std::map<std::string, MakeFragmentScoringMethodOP>
registered_makers_
;
158
bool
zeros_score_later_
;
159
};
160
161
}
// scores
162
}
// frag_picker
163
}
// protocols
164
165
#endif
/* INCLUDED_protocols_frag_picker_scores_FragmentScoreManager_HH */
166
Generated on Sat Jun 1 2013 11:52:46 for Rosetta 3.5 by
1.8.4