22 #include <basic/MetricValue.hh>
24 #include <basic/Tracer.hh>
33 #include <utility/vector1.hh>
34 #include <utility/string_util.hh>
35 #include <utility/tag/Tag.hh>
36 #include <utility/exit.hh>
40 #include <ObjexxFCL/format.hh>
47 #include <utility/vector0.hh>
50 #include <utility/excn/Exceptions.hh>
54 static basic::Tracer
TR(
"protocols.toolbox.PoseMetricCalculators.FragQualCalculator");
58 namespace pose_metric_calculators {
63 rmsd_cutoff_goodfrag_( 1.0 ),
64 ratio_cutoff_goodfrag_( 0.3 ),
65 total_goodfrags_( 0 ),
80 rmsd_cutoff_goodfrag_( rmsd ),
81 ratio_cutoff_goodfrag_( ratio ),
82 total_goodfrags_( 0 ),
95 rmsd_cutoff_goodfrag_( rval.rmsd_cutoff_goodfrag_ ),
96 ratio_cutoff_goodfrag_( rval.ratio_cutoff_goodfrag_ ),
97 total_goodfrags_( rval.total_goodfrags_ ),
98 coverage_( rval.coverage_ ),
99 goodfrags_( rval.goodfrags_ ),
101 begin_( rval.begin_ ),
103 verbose_( rval.verbose_ )
146 using namespace core;
147 if ( key ==
"num_goodfrag" ) {
148 basic::check_cast( valptr, &
total_goodfrags_,
"number of fragments within rmsd cutoff " );
150 }
else if (key ==
"coverage" ) {
151 basic::check_cast( valptr, &
coverage_,
"ratio of the region where good fragments are included more than XXX% " );
152 (
static_cast<basic::MetricValue<Real> *
>(valptr))->set(
coverage_ );
154 TR <<
"FragQualCalculator cannot compute the requested metric " << key << std::endl;
166 if ( key ==
"num_goodfrag" ) {
168 }
else if ( key ==
"coverage" ) {
169 result = utility::to_string(
coverage_ );
171 basic::Error() <<
"FragQualCalculator cannot compute metric " << key << std::endl;
181 using ObjexxFCL::fmt::RJ;
182 using ObjexxFCL::fmt::F;
199 Pose input_pose( pose ), test_pose( pose );
203 for ( FrameIterator frame =
frag_->begin(); frame !=
frag_->end(); ++frame ) {
209 frag_region[
start ] =
true;
211 for (
Size i=1; i<=frame->nr_frags(); i++ ) {
213 frame->apply( i, test_pose );
220 TR <<
"FRAG_SCORE " << RJ( 6, frame->length() ) << RJ( 6, frame->start() ) << RJ( 6, i ) << F( 10, 4, rmsd ) << std::endl;
225 is_covered[
start ] =
true;
233 if( frag_region[ i ] ) {
235 if( is_covered[ i ] ) {
262 String const fset_string ( tag->getOption<
String>(
"frag",
"" ) );
263 runtime_assert( ! fset_string.empty() );
264 if ( data.
has(
"fragsets", fset_string ) ) {
267 throw utility::excn::EXCN_RosettaScriptsOption(
"fragsets " + fset_string +
" not found in DataMap.");
270 verbose_ = tag->getOption<
bool>(
"verbose", 0 );