30 #include <basic/basic.hh>
31 #include <basic/Tracer.hh>
32 #include <basic/MetricValue.hh>
42 #include <utility/file/FileName.hh>
43 #include <utility/assert.hh>
46 #include <ObjexxFCL/FArray1D.hh>
50 #include <utility/vector1.hh>
58 static basic::Tracer
TR(
"FlexPepDockingPoseMetrics");
61 namespace flexpep_docking {
82 TR <<
"WARNING: calc_frac_native_contacts() should have not been invoked when -pep_fold_only flag (= no receptor) is active";
86 for (
int i=
flags_->peptide_first_res(); i<=
flags_->peptide_last_res(); ++i)
89 for (
int j=
flags_->receptor_first_res(); j<=
flags_->receptor_last_res(); ++j)
93 numOfNativeContacts++;
94 if (
isInContact(
final.residue(i),
final.residue(j),threashold))
96 subsetOfPredictedContacts++;
101 TR <<
"nat " << numOfNativeContacts << std::endl;
102 TR <<
"rec " << subsetOfPredictedContacts << std::endl;
115 for (
core::Size i = 1; i <= natoms_res1; ++i ) {
116 for (
core::Size j = 1; j <= natoms_res2; ++j ) {
118 if( dist <= threashold ) {
132 ObjexxFCL::FArray1D_bool
const & res_subset,
133 t_predicate_func predicate,
138 using namespace core::scoring;
142 assert( nres1 == nres2 );
161 for (
core::Size j = 1; j <= natoms_res; ++j )
163 if ( predicate( pose1, pose2, i, j ) )
172 return (ngood * 1.0) / natoms_total;
184 using namespace core;
190 Size res1_first =
flags_->peptide_first_res() ;
191 Size res1_last = nres - k + 1;
192 Real best_rms = std::numeric_limits<Real>::infinity();
193 for(
Size res1 = res1_first ; res1 <= res1_last ; ++res1)
195 ObjexxFCL::FArray1D_bool res_subset( nres,
false );
196 for(
Size resi = res1; resi < res1 + k; ++resi){
197 res_subset(resi) =
true;
200 if(cur_rms < best_rms)
226 ObjexxFCL::FArray1D_bool
const & res_subset)
const
228 using namespace core;
229 using namespace basic;
234 for(
Size i = 1 ; i <= nres ; ++i)
238 Real phidiff = subtract_degree_angles(pose1.
phi(i), pose2.
phi(i));
239 Real psidiff = subtract_degree_angles(pose1.
psi(i), pose2.
psi(i));
241 sumSqr += pow(phidiff,2);
245 sumSqr += pow(psidiff,2);
249 return sqrt( sumSqr / n);
259 std::map < std::string, core::Real >
261 using namespace core;
262 using namespace core::pose::metrics;
263 using namespace core::scoring;
265 std::map < std::string, core::Real > if_metrics;
274 (*scorefxn_no_cst)(pose);
278 float trans_magnitude = 1000;
280 translate_away->step_size( trans_magnitude );
282 float bound_energy = (*scorefxn_no_cst)( unbound_pose );
283 translate_away->apply( unbound_pose );
284 float unbound_energy = (*scorefxn_no_cst)( unbound_pose );
286 float Isc = (bound_energy - unbound_energy);
287 TR <<
"Isc: " << Isc << std::endl;
299 if( !CalculatorFactory::Instance().check_calculator_exists( sasa_calc_name ) ){
302 CalculatorFactory::Instance().register_calculator
303 ( sasa_calc_name, sasa_calculator );
306 if( !CalculatorFactory::Instance().check_calculator_exists( hbond_calc_name ) ){
310 ( hbond_calc_name, hb_calc );
313 if( !CalculatorFactory::Instance().check_calculator_exists( packstat_calc_name ) ){
317 ( packstat_calc_name, packstat_calc );
320 if( !CalculatorFactory::Instance().check_calculator_exists( burunsat_calc_name ) ){
323 (sasa_calc_name, hbond_calc_name);
325 ( burunsat_calc_name, burunsat_calc );
329 basic::MetricValue<Real> tot_sasa_mval;
330 basic::MetricValue<Size> tot_hb_mval;
331 basic::MetricValue<Real> tot_packstat_mval;
332 basic::MetricValue<Size> tot_unsat_mval;
335 basic::MetricValue< utility::vector1< core::Real > >bound_sasa_per_res_mval;
336 basic::MetricValue< utility::vector1< core::Size > >bound_hb_per_res_mval;
337 basic::MetricValue< utility::vector1< core::Real > >bound_packstat_per_res_mval;
338 basic::MetricValue< utility::vector1< core::Size > >bound_unsat_per_res_mval;
340 basic::MetricValue< utility::vector1< core::Real > >unbound_sasa_per_res_mval;
341 basic::MetricValue< utility::vector1< core::Size > >unbound_hb_per_res_mval;
342 basic::MetricValue< utility::vector1< core::Real > >unbound_packstat_per_res_mval;
343 basic::MetricValue< utility::vector1< core::Size > >unbound_unsat_per_res_mval;
346 float bound_sasa = 0.0, unbound_sasa = 0.0;
347 Size bound_hb = 0, unbound_hb = 0;
348 float bound_packstat = 0.0, unbound_packstat = 0.0;
349 Size bound_unsat = 0, unbound_unsat = 0;
352 pose.
metric(sasa_calc_name,
"total_sasa",tot_sasa_mval);
353 bound_sasa = tot_sasa_mval.value();
354 unbound_pose.metric(sasa_calc_name,
"total_sasa",tot_sasa_mval);
355 unbound_sasa = tot_sasa_mval.value();
356 TR <<
"Total BSA is: " << unbound_sasa - bound_sasa << std::endl;
359 pose.
metric(hbond_calc_name,
"all_Hbonds", tot_hb_mval);
360 bound_hb = tot_hb_mval.value();
361 unbound_pose.metric(hbond_calc_name,
"all_Hbonds", tot_hb_mval);
362 unbound_hb = tot_hb_mval.value();
363 TR <<
"Interface HB #: " << bound_hb - unbound_hb << std::endl;
365 if (!
flags_->is_ligand_present(pose)) {
367 pose.
metric(packstat_calc_name,
"total_packstat", tot_packstat_mval);
368 bound_packstat = tot_packstat_mval.value();
369 unbound_pose.metric(packstat_calc_name,
"total_packstat", tot_packstat_mval);
370 unbound_packstat = tot_packstat_mval.value();
371 TR <<
"Total packstats: " << bound_packstat - unbound_packstat << std::endl;
375 pose.
metric(burunsat_calc_name,
"all_bur_unsat_polars", tot_unsat_mval);
376 bound_unsat = tot_unsat_mval.value();
377 unbound_pose.metric(burunsat_calc_name,
"all_bur_unsat_polars", tot_unsat_mval);
378 unbound_unsat = tot_unsat_mval.value();
379 TR <<
"Interface Unsat polar groups: " << bound_unsat - unbound_unsat << std::endl;
382 if_metrics[
"I_sc"] = Isc;
383 if_metrics[
"I_bsa"] = unbound_sasa - bound_sasa;
384 if_metrics[
"I_hb"] = bound_hb - unbound_hb;
385 if_metrics[
"I_pack"] = bound_packstat - unbound_packstat;
386 if_metrics[
"I_unsat"] = bound_unsat - unbound_unsat;
389 pose.
metric(sasa_calc_name,
"residue_sasa" ,bound_sasa_per_res_mval);
390 pose.
metric(hbond_calc_name,
"residue_Hbonds",bound_hb_per_res_mval);
391 if (!
flags_->is_ligand_present(pose)) {
392 pose.
metric(packstat_calc_name,
"residue_packstat",bound_packstat_per_res_mval);
394 pose.
metric(burunsat_calc_name,
"residue_bur_unsat_polars",bound_unsat_per_res_mval);
396 unbound_pose.metric(sasa_calc_name,
"residue_sasa" ,unbound_sasa_per_res_mval);
397 unbound_pose.metric(hbond_calc_name,
"residue_Hbonds",unbound_hb_per_res_mval);
398 unbound_pose.metric(burunsat_calc_name,
"residue_bur_unsat_polars",unbound_unsat_per_res_mval);
400 for (
int i=
flags_->peptide_first_res();
401 i <
flags_->peptide_first_res() +
flags_->peptide_nres(); i++){
403 <<
" bsa: " << unbound_sasa_per_res_mval.value()[i] - bound_sasa_per_res_mval.value()[i]
404 <<
" HB: " << bound_hb_per_res_mval.value()[i] - unbound_hb_per_res_mval.value()[i];
405 if (!
flags_->is_ligand_present(pose)) {
406 TR <<
" pack: " << bound_packstat_per_res_mval.value()[i];
408 TR <<
" unsat: " << bound_unsat_per_res_mval.value()[i] - unbound_unsat_per_res_mval.value()[i]
421 for (
int i=
flags_->peptide_first_res(); i <=
flags_->peptide_last_res(); ++i) {
422 using namespace core::scoring;
426 pepScore_noref += ienergy - ifa_ref;