18 #include <basic/database/open.hh>
19 #include <basic/options/option.hh>
20 #include <basic/options/keys/out.OptionKeys.gen.hh>
22 #include <basic/options/keys/packstat.OptionKeys.gen.hh>
31 #include <basic/Tracer.hh>
35 #include <numeric/numeric.functions.hh>
36 #include <numeric/NumericTraits.hh>
39 #include <ObjexxFCL/FArray1D.hh>
40 #include <ObjexxFCL/FArray2D.hh>
41 #include <ObjexxFCL/FArray3D.hh>
42 #include <ObjexxFCL/ubyte.hh>
47 #include <utility/exit.hh>
48 #include <utility/io/izstream.hh>
49 #include <utility/io/ozstream.hh>
52 #include <utility/vector1.hh>
53 #include <numeric/xyz.functions.hh>
54 #include <numeric/xyzVector.io.hh>
55 #include <numeric/random/random.fwd.hh>
56 #include <ObjexxFCL/format.hh>
61 namespace ObjexxFCL { }
using namespace ObjexxFCL;
65 namespace ObjexxFCL {
namespace fmt { } }
using namespace ObjexxFCL::fmt;
74 basic::Tracer
TRcs(
"protocols.packstat");
88 0,1,1,2,1,2,2,3, 1,2,2,3,2,3,3,4, 1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5,
89 1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5, 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,
90 1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5, 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,
91 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7,
92 1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5, 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,
93 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7,
94 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7,
95 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7, 4,5,5,6,5,6,6,7, 5,6,6,7,6,7,7,8,
112 static bool done_init =
false;
113 if( done_init )
return;
115 FArray1D_short tmp(
nbytes );
116 static bool init = {
false };
123 utility::io::izstream masks_stream( basic::database::full_name(
"sampling/SASA-masks.dat" ) );
125 for (
int i = 1; i <=
nolp*
nori; ++i ) {
126 for (
int j = 1; j <=
nbytes; ++j ) {
127 masks_stream >> tmp(j);
128 } masks_stream >> skip;
130 for (
int j = 1; j <=
nbytes; ++j ) {
131 masks(j,i) =
static_cast< ubyte
>(tmp(j));
134 masks_stream.close();
137 utility::io::izstream angles_stream( basic::database::full_name(
"sampling/SASA-angles.dat" ) );
140 for (
int i = 1; i <=
nphi; ++i ) {
141 for (
int j = 1; j <=
ntheta; ++j ) {
142 angles_stream >>
angles(i,j);
143 } angles_stream >> skip;
148 angles_stream.close();
157 SasaResult::SasaResult(
size_t Nprobes,
size_t Nspheres) :
158 sphere_sasa( Nspheres, Nprobes, 0.0 )
166 prune_cavity_burial_probe_radii(),
167 min_hole_radius(0.5),
168 num_cav_ball_layers(0),
169 frac_cav_ball_required_exposed(0.0f),
170 area_cav_ball_required_exposed(0.0f),
171 min_cav_ball_radius(0.5f),
172 num_surrounding_sasa_bins(7),
173 surrounding_sasa_smoothing_window(1),
174 dont_compute_cav_balls( false ),
175 min_cluster_overlap( 0.1 ),
176 cluster_min_volume(10)
181 using namespace numeric;
185 PackstatReal mag = uniform() * 2 * numeric::NumericTraits<Real>::pi();
186 return RotPair( rotation_matrix<PackstatReal>( axis, mag ), rotation_matrix<PackstatReal>( axis, -mag ) );
191 return a.
xyz.x() < b.
xyz.x();
201 return a.
xyz().x() < b.
xyz().x();
224 using namespace core::io::pdb;
226 bool tmp = basic::options::option[basic::options::OptionKeys::out::file::output_virtual]();
227 basic::options::option[basic::options::OptionKeys::out::file::output_virtual].value(
true);
229 basic::options::option[basic::options::OptionKeys::out::file::output_virtual].value(tmp);
230 istringstream iss( oss.str() );
235 p.
spheres = pdb.get_spheres(arm);
236 p.centers = pdb.get_res_centers();
237 p.labels = pdb.res_labels();
249 using namespace utility;
250 using namespace numeric;
262 for(
Size i = 1; i <= spheres.size(); ++i ) spheres[i].
id = i;
267 size_t Nspheres = spheres.size();
270 int olp, aphi,theta, point,masknum;
274 ObjexxFCL::FArray3D_ubyte atom_sasa_masks(
old::nbytes, Nspheres, Nprobes, NULL );
278 for (
size_t pr_bin = 1; pr_bin <= Nprobes; ++pr_bin ) {
283 rotations.push_back( rots );
286 for(
SphereCIter i = spheres.begin(); i != spheres.end(); ++i ) {
287 rspheres.push_back(
Sphere( rot * i->xyz, i->radius ) );
290 for(
size_t i = 1; i <= Nspheres; ++i ) {
292 XYZ const xyz1( rspheres[i].
xyz );
295 for(
size_t j = 1; j < i; ++j ) {
296 XYZ const xyz2( rspheres[j].xyz );
299 PackstatReal const dist_sq = xyz1.distance_squared(xyz2);
302 if ( dist_sq > dth*dth )
continue;
303 if ( dist_sq <= 0.0 )
continue;
307 if ( dist > dth2 )
continue;
317 point =
angles(aphi,theta);
318 masknum = point*100+olp;
319 for (
int bb = 1, l = atom_sasa_masks.index(bb,i,pr_bin); bb <=
nbytes; ++bb, ++l ) {
320 atom_sasa_masks[ l ] = bit::bit_or( atom_sasa_masks[ l ],
masks(bb,masknum) );
326 point =
angles(aphi,theta);
327 masknum = point*100+olp;
328 for (
int bb = 1, l = atom_sasa_masks.index(bb,j,pr_bin); bb <=
nbytes; ++bb, ++l ) {
329 atom_sasa_masks[ l ] = bit::bit_or( atom_sasa_masks[ l ],
masks(bb,masknum) );
339 for(
size_t pr_bin = 1; pr_bin <= Nprobes; ++pr_bin ) {
340 for(
size_t is = 1; is <= Nspheres; ++is ) {
343 for (
size_t bb = 1, l = atom_sasa_masks.index(bb,is,pr_bin); (
int)bb <=
nbytes; ++bb, ++l ) {
347 total_sa = 12.56637 * ( irad * irad );
348 expose = ( 1.0f - fraction ) * total_sa;
349 result.
sphere_sasa(spheres[is].
id,pr_bin) = expose;
363 size_t ball_count = 0;
365 for (
size_t is = 1; is <= Nspheres; ++is ) {
369 for ( ii = opts.
probe_radii.size(); ii >= 1; ii--) {
374 if( ii < 1 || ii == opts.
probe_radii.size() )
continue;
376 size_t const largest_pr_bin = ii+1;
383 for (
size_t pr_bin = largest_pr_bin;
387 Rot rev_rot = rotations[pr_bin].second;
391 for (
int bb = 1, l = atom_sasa_masks.index(bb,is,pr_bin); bb <=
nbytes; ++bb, ++l ) {
392 ubyte
const mask = atom_sasa_masks[ l ];
393 int NSHORT = 8;
if ( bb == 21 ) NSHORT = 2;
394 for (
short k = 0; k < NSHORT; ++k ) {
395 if ( !( bit::bit_test( static_cast<short>(mask), k ) ) ) {
396 const size_t dot = 8*(bb-1)+k+1;
398 median = (rev_rot * sasa_dots[dot]) * (spheres[is].radius+tmp_probe_radius) + spheres[is].xyz;
399 CavityBall h( ++ball_count, is, median, tmp_probe_radius );
420 using namespace ObjexxFCL;
423 FArray2D_ubyte prune_sasa_masks(
old::nbytes, cavballs.size(), NULL );
428 for(
CavBallIter i = cavballs.begin(); i != cavballs.end(); ++i ) {
429 if( maxrad < i->radius() ) {
430 maxrad = i->radius();
436 for(
PackstatReal dpr = 0.0f; dpr <= maxrad; dpr += 0.1 ) {
440 for(
size_t ib = 1; ib <= cavballs.size(); ib++ ) {
442 if( cb1.
radius() - dpr < 0.1 )
continue;
444 for(
size_t jb = ib+1; jb <= cavballs.size(); jb++ ) {
446 if( cb2.
radius() - dpr < 0.1 )
continue;
447 if( cb2.
xyz().x() - cb1.
xyz().x() > dth )
break;
449 int olp,aphi,theta,point,masknum;
452 if( dis2 > dis_thresh*dis_thresh || dis2 == 0 )
continue;
457 point =
angles(aphi,theta);
458 masknum = point*100+olp;
459 for (
int bb = 1, l = prune_sasa_masks.index(bb,ib); bb <=
nbytes; ++bb, ++l ) {
460 prune_sasa_masks[ l ] = bit::bit_or( prune_sasa_masks[ l ],
masks(bb,masknum) );
464 point =
angles(aphi,theta);
465 masknum = point*100+olp;
466 for (
int bb = 1, l = prune_sasa_masks.index(bb,jb); bb <=
nbytes; ++bb, ++l ) {
467 prune_sasa_masks[ l ] = bit::bit_or( prune_sasa_masks[ l ],
masks(bb,masknum) );
473 for(
size_t ib = 1; ib <= cavballs.size(); ib++ ) {
474 if( cavballs[ib].radius() - dpr < 0.1 )
continue;
476 for (
int bb = 1, l = prune_sasa_masks.index(bb,ib); bb <=
nbytes; ++bb, ++l ) {
480 expose *= 12.56637 * ( cavballs[ib].radius() - dpr ) * ( cavballs[ib].radius() - dpr );
481 cavballs[ib].vol += 0.1 * expose;
483 cavballs[ib].area = expose;
496 using namespace ObjexxFCL;
499 FArray2D_ubyte prune_sasa_masks(
old::nbytes, cavballs.size(), NULL );
505 for(
size_t ib = 1; ib <= cavballs.size(); ib++ ) {
508 for(
size_t jb = ib+1; jb <= cavballs.size(); jb++ ) {
511 if( cb2.
xyz().x() - cb1.
xyz().x() > maxrad )
break;
513 int olp,aphi,theta,point,masknum;
516 if( dis2 > dis_thresh*dis_thresh || dis2 == 0 )
continue;
521 point =
angles(aphi,theta);
522 masknum = point*100+olp;
523 for (
int bb = 1, l = prune_sasa_masks.index(bb,ib); bb <=
nbytes; ++bb, ++l ) {
524 prune_sasa_masks[ l ] = bit::bit_or( prune_sasa_masks[ l ],
masks(bb,masknum) );
529 point =
angles(aphi,theta);
530 masknum = point*100+olp;
531 for (
int bb = 1, l = prune_sasa_masks.index(bb,jb); bb <=
nbytes; ++bb, ++l ) {
532 prune_sasa_masks[ l ] = bit::bit_or( prune_sasa_masks[ l ],
masks(bb,masknum) );
541 for(
size_t ii = 1; ii <= cavballs.size(); ii++ ) {
543 for (
int bb = 1, l = prune_sasa_masks.index(bb,ii); bb <=
nbytes; ++bb, ++l ) {
547 expose *= 12.56637 * cavballs[ii].radius() * cavballs[ii].radius();
550 not_hidden_cav_balls.push_back( cavballs[ii] );
554 return not_hidden_cav_balls;
563 using namespace ObjexxFCL;
566 FArray2D_ubyte prune_sasa_masks(
old::nbytes, cavballs.size(), 0 );
572 for(
size_t ib = 1; ib <= cavballs.size(); ib++ ) {
576 size_t begin =
search_x( spheres, cb.
xyz().x()-max_dis_sphere );
577 for(
size_t js = begin; js <= spheres.size(); ++js ) {
578 Sphere const & s( spheres[js] );
579 if( s.
xyz.x() - cb.
xyz().x() > max_dis_sphere )
break;
581 int olp,aphi,theta,point,masknum;
584 if( dis2 > dis_thresh*dis_thresh )
continue;
589 point =
angles(aphi,theta);
590 masknum = point*100+olp;
591 for (
int bb = 1, l = prune_sasa_masks.index(bb,ib); bb <=
nbytes; ++bb, ++l ) {
592 prune_sasa_masks[ l ] = bit::bit_or( prune_sasa_masks[ l ],
masks(bb,masknum) );
596 for(
size_t jb = ib+1; jb < cavballs.size(); jb++ ) {
598 if( cb2.
xyz().x() - cb.
xyz().x() > max_dis_cavball )
break;
601 int olp,aphi,theta,point,masknum;
604 if( dis2 > dis_thresh*dis_thresh || dis2 == 0 )
continue;
609 point =
angles(aphi,theta);
610 masknum = point*100+olp;
611 for (
int bb = 1, l = prune_sasa_masks.index(bb,ib); bb <=
nbytes; ++bb, ++l ) {
612 prune_sasa_masks[ l ] = bit::bit_or( prune_sasa_masks[ l ],
masks(bb,masknum) );
620 size_t num_exposed = 0;
622 for(
size_t ii = 1; ii <= cavballs.size(); ii++ ) {
623 if( cavballs[ii].exposed_radius >= pr ) {
628 for (
int bb = 1, l = prune_sasa_masks.index(bb,ii); bb <=
nbytes; ++bb, ++l ) {
632 cavballs[ii].exposed_radius = pr;
654 TRcs <<
"prune raduis " << largest_probe_radius <<
" ";
655 int num_prune_steps(0);
659 num_exposed =
prune_1pass( spheres, cavballs, largest_probe_radius );
661 TRcs << cavballs.size() - num_exposed <<
" ";
662 if ( num_prune_steps >= iter_th || (num_exposed-last_num) <= delta_th )
break;
663 last_num = num_exposed;
671 for(
CavBallIter i = cavballs.begin(); i != cavballs.end(); ++i ) {
672 if( i->exposed_radius < largest_probe_radius ) {
673 buried_cav_balls.push_back( *i );
674 buried_cav_balls[ buried_cav_balls.size() ].id_ = ++id;
681 TRcs <<
"prune raduis " << pr <<
" ";
682 int num_prune_steps(0);
686 num_exposed =
prune_1pass( spheres, buried_cav_balls, pr );
688 TRcs << buried_cav_balls.size() - num_exposed <<
" ";
689 if ( num_prune_steps >= iter_th || (num_exposed-last_num) <= delta_th )
break;
690 last_num = num_exposed;
695 return buried_cav_balls;
705 for(
CavBallIter c = cavballs.begin();
c != cavballs.end(); ++
c ) {
707 for(
SphereIter s = spheres.begin(); s != spheres.end(); ++s ) {
708 if( s->xyz.distance_squared(
c->xyz() ) <= dis2 ) {
722 for(
CavBallIter i = cavballs.begin(); i != cavballs.end(); ++i ) {
723 bool ok_to_add =
true;
724 for(
CavBallIter j = selected_cavballs.begin(); j != selected_cavballs.end(); ++j ) {
725 if( i->xyz().distance_squared(j->xyz()) < dist_th ) ok_to_add =
false;
727 if( ok_to_add ) selected_cavballs.push_back( *i );
729 return selected_cavballs;
735 if( d2 > 36.0 )
return 0.0;
740 if( d > r1+r2 )
return 0.0;
741 core::Real alpha = r2*sin( acos( (d*d + r2*r2 - r1*r1) / ( 2*d*r2 ) ) );
743 return alpha*alpha*numeric::NumericTraits<Real>::pi();
748 using namespace numeric;
750 for(
Size i = 1; i <= cavballs.size(); i++ ) {
751 cavballs[i].cluster_ = i;
754 for(
Size i = 1; i <= cavballs.size(); i++ ) {
757 for(
Size j = i+1; j <= cavballs.size(); j++ ) {
759 if( abs( cb1.
xyz().x() - cb2.
xyz().x() ) > 6.0 )
continue;
771 for(
Size i = 1; i <= cavballs.size(); i++ ) {
773 for(
Size j = i+1; j <= cavballs.size(); j++ ) {
775 if( abs( cb1.
xyz().x() - cb2.
xyz().x() ) > 6.0 )
continue;
781 for(
Size k = 1; k <= cavballs.size(); k++ ) {
782 if(cavballs[k].cluster_==from) cavballs[k].cluster_ = to;
793 std::map<Size,Size> perm;
795 for(
Size i = 1; i <= cavballs.size(); i++ ) {
796 if( perm.find(cavballs[i].cluster_) == perm.end() ) {
797 perm[cavballs[i].cluster_] = count;
801 for(
Size i = 1; i <= cavballs.size(); i++ ) {
802 cavballs[i].cluster_ = perm[cavballs[i].cluster_];
810 for(
Size i = 1; i <= cavballs.size(); i++ ) {
813 cluster_centers.resize(cb.
cluster_);
814 cluster_volume .resize(cb.
cluster_);
816 cluster_counts .resize(cb.
cluster_);
817 cluster_surface_accessibility.resize(cb.
cluster_);
821 for(
Size i = 1; i <= cluster_centers.size(); i++ ) {
823 cluster_volume[i] = 0.0;
824 cluster_counts[i] = 0.0;
825 cluster_surf [i] = 0.0;
826 cluster_surface_accessibility[i] = 0.0;
829 for(
Size i = 1; i <= cavballs.size(); i++ ) {
832 cluster_centers.resize(cb.
cluster_);
833 cluster_volume .resize(cb.
cluster_);
835 cluster_counts .resize(cb.
cluster_);
840 cluster_counts [cb.
cluster_] += 1.0;
844 for(
Size i = 1; i <= cluster_counts.size(); i++ ) {
845 cluster_centers[i] /= cluster_counts[i];
850 for(
Size i = 1; i <= cluster_counts.size(); i++ ) {
861 cbc.
volume = cluster_volume[i];
863 cbc.
center = cluster_centers[i];
865 for(
Size j = 1; j <= cavballs.size(); j++ ) {
872 result.push_back( cbc );
876 std::sort( result.begin(), result.end(),
OrderCBC() );
878 for(
Size i = 1; i <= result.size(); i++ ) {
879 for(
Size j = 1; j <= result[i].cavballs.size(); j++ ) {
880 result[i].cavballs[j].cluster_ = i;
894 using namespace utility;
895 using namespace numeric;
903 for(
size_t is = begin; is <= spheres.size(); ++is ) {
904 Sphere const & sphere( spheres[is] );
909 for(
size_t pr = 1; pr <= Nprobes; ++pr ) {
914 tot_sasa(pr,
id) += result->sphere_sasa(is,sspr);
923 for(
size_t pr = 1; pr <= Nprobes; ++pr ) {
930 for(
size_t pr = 2; pr <= Nprobes; ++pr ) {
931 psrdOP->msa(
id,pr-1) = tot_sasa(pr,
id) - tot_sasa(1,
id);
946 assert( pd.
spheres.size() > 0 );
947 assert( pd.
centers.size() > 0 );
951 opts.prune_max_delta = 0;
952 opts.num_cav_ball_layers = 0;
953 opts.frac_cav_ball_required_exposed = 0.00;
954 opts.area_cav_ball_required_exposed = 0.00;
955 opts.surrounding_sasa_smoothing_window = 1+2*oversample;
956 opts.num_surrounding_sasa_bins = 7;
960 for(
core::Size i = 1; i <= oversample; ++i ) opts.probe_radii.push_back( pr + i*ostep );
961 opts.probe_radii.push_back( pr );
962 for(
core::Size i = 1; i <= oversample; ++i ) opts.probe_radii.push_back( pr - i*ostep );
982 return ps_discrim.
score( psrds );
1002 assert( pd.
spheres.size() > 0 );
1003 assert( pd.
centers.size() > 0 );
1007 opts.prune_max_delta = 0;
1008 opts.num_cav_ball_layers = 0;
1009 opts.frac_cav_ball_required_exposed = 0.00;
1010 opts.area_cav_ball_required_exposed = 0.00;
1011 opts.surrounding_sasa_smoothing_window = 1+2*oversample;
1012 opts.num_surrounding_sasa_bins = 7;
1013 for(
core::Size ipr = 1; ipr <= 31; ++ipr ) {
1016 for(
core::Size i = 1; i <= oversample; ++i ) opts.probe_radii.push_back( pr + i*ostep );
1017 opts.probe_radii.push_back( pr );
1018 for(
core::Size i = 1; i <= oversample; ++i ) opts.probe_radii.push_back( pr - i*ostep );
1027 res_scores.push_back( ps_discrim.
score( ss ) );
1069 assert( pd.
spheres.size() > 0 );
1070 assert( pd.
centers.size() > 0 );
1074 opts.prune_max_delta = 0;
1075 opts.num_cav_ball_layers = 0;
1076 opts.frac_cav_ball_required_exposed = 0.00;
1077 opts.area_cav_ball_required_exposed = 0.00;
1078 opts.surrounding_sasa_smoothing_window = 1+2*oversample;
1079 opts.num_surrounding_sasa_bins = 7;
1080 for(
core::Size ipr = 1; ipr <= 31; ++ipr ) {
1083 for(
core::Size i = 1; i <= oversample; ++i ) opts.probe_radii.push_back( pr + i*ostep );
1084 opts.probe_radii.push_back( pr );
1085 for(
core::Size i = 1; i <= oversample; ++i ) opts.probe_radii.push_back( pr - i*ostep );
1095 for(
int i = 1; i <= (
int)ss->nrad(); ++i ) {
1096 for(
int j = 1; j <= (
int)ss->npr() ; ++j ) {
1097 std::cout << ss->msa(i,j) <<
" ";
1101 return ps_discrim.
score( ss );
1127 Real w = exp( -pow(d-d0,2.0)/10.0 ) + exp(-d/10.0) - 1.5/(d+1.0);
1128 if( w < 0 ) w = 0.0;
1140 using namespace numeric;
1144 Spheres & spheres(pd.spheres);
1149 opts.prune_max_delta = 0;
1150 opts.num_cav_ball_layers = 10;
1151 opts.frac_cav_ball_required_exposed = 0.00;
1152 opts.area_cav_ball_required_exposed = 0.00;
1153 opts.surrounding_sasa_smoothing_window = 3;
1154 opts.min_cav_ball_radius = 0.7;
1155 opts.min_cluster_overlap = 0.1;
1156 opts.cluster_min_volume = 10.0;
1157 for(
PackstatReal pr = 3.0; pr >= 0.4; pr -= 0.1 ) opts.probe_radii.push_back(pr);
1158 opts.prune_cavity_burial_probe_radii.push_back( 1.6 );
1182 assert(clusters.size() > 0);
1186 for(
Size roi_i = 1; roi_i <= rois.size(); ++roi_i ) {
1187 Size roi = rois[roi_i];
1190 utility_exit_with_message(
"residue of interest must have a CB!");
1197 if( roi_ca.distance(pose.
residue(roi).
xyz(ia)) > dist_max ) {
1199 if( native ) native_roi_max = native->residue(roi).xyz(ia);
1200 dist_max = roi_max.distance(roi_ca);
1203 Real const d0 = roi_max.distance(roi_ca);
1204 TRcs <<
"PACKSTAT_ROI " << roi <<
" d0 is " << d0 << std::endl;
1205 Real best_clust_score = 0.0;
1208 for(
Size i = 1; i <= clusters.size(); ++i ) {
1209 Real clust_score = 0.0, clust_wtot = 0.0;
1211 for(
Size j = 1; j <= clusters[i].cavballs.size(); ++j ) {
1213 Real const d = roi_ca.distance(xyz);
1215 clust_score+= w*clusters[i].cavballs[j].vol*(clusters[i].cavballs[j].anb-50);
1216 clust_wtot += w*clusters[i].cavballs[j].vol*(clusters[i].cavballs[j].anb-50);
1217 clust_wcen += w*clusters[i].cavballs[j].vol*(clusters[i].cavballs[j].anb-50)*clusters[i].cavballs[j].
xyz();
1219 if( clust_score <= 0 )
continue;
1220 clust_wcen /= clust_wtot;
1222 TRcs <<
"PACKSTAT_ROI_CLUSTER " << roi <<
" clust " << i <<
" vol " << clusters[i].volume <<
" score " << clust_score;
1224 Real dnat = clust_wcen.distance(native_roi_max);
1225 TRcs <<
" dnat " << dnat;
1229 if( clust_score > best_clust_score ) {
1230 best_clust_score = clust_score;
1231 best_clust_wcen = clust_wcen;
1236 std::set<id::AtomID> nbrs;
1240 if( best_clust_wcen.distance_squared(pose.
xyz(aid)) > 49.0 )
continue;
1246 TRcs <<
"PACKSTAT_ROI " << roi <<
" cluster weighted center " << best_clust_wcen << std::endl;
1248 std::map<id::AtomID,Real> constraints;
1250 for( std::set<id::AtomID>::iterator i = nbrs.begin(); i != nbrs.end(); ++i ) {
1252 constraints[aid] = best_clust_wcen.distance(pose.
xyz(aid));
1253 TRcs <<
"PACKSTAT_ROI " << roi <<
" constraint: " << aid <<
" " <<
" " << std::endl;
1256 constraints_list.push_back(constraints);
1259 utility::io::ozstream out( (
"PACKSTAT_ROI_"+string_of(roi)+
".pdb").c_str() );
1263 for(
Size i = 1; i <= clusters.size(); i++ ) {
1264 if( clusters[i].volume < 10 )
continue;
1265 for(
Size j = 1; j <= clusters[i].cavballs.size(); j++ ) {
1266 out << clusters[i].cavballs[j].hetero_atom_line(i,i) << std::endl;
1270 out <<
"HETATM" + I( 5, 0 ) +
" C CEN X"
1272 + F( 8, 3, best_clust_wcen.x() ) + F( 8, 3, best_clust_wcen.y() ) + F( 8, 3, best_clust_wcen.z() )
1273 + F( 6, 2, 0.0 ) +
' ' + F( 5, 2,2.0);
1280 return constraints_list;
1286 using namespace core::scoring::packstat;
1287 using namespace std;
1288 using namespace core;
1289 using namespace basic::options;
1290 using namespace ObjexxFCL::fmt;
1291 using namespace numeric;
1292 using namespace utility;
1294 bool surface_accessibility = option[ OptionKeys::packstat::surface_accessibility ]();
1295 core::Real burial_radius = option[ OptionKeys::packstat::cavity_burial_probe_radius ]();
1299 TRcs <<
"spheres len: " << pd.spheres.size() << std::endl;
1300 TRcs <<
"centers len: " << pd.centers.size() << std::endl;
1304 opts.prune_max_delta = 0;
1305 opts.num_cav_ball_layers = 10;
1306 opts.frac_cav_ball_required_exposed = 0.00;
1307 opts.area_cav_ball_required_exposed = 0.00;
1308 opts.surrounding_sasa_smoothing_window = 3;
1309 opts.min_cav_ball_radius = option[ OptionKeys::packstat::min_cav_ball_radius ]();
1310 opts.min_cluster_overlap = option[ OptionKeys::packstat::min_cluster_overlap ]();
1311 opts.cluster_min_volume = option[ OptionKeys::packstat::cluster_min_volume ]();
1312 for(
PackstatReal pr = 3.0; pr > 2.0; pr -= 0.2 ) opts.probe_radii.push_back(pr);
1313 for(
PackstatReal pr = 2.0; pr >= 0.7; pr -= 0.1 ) opts.probe_radii.push_back(pr);
1314 opts.prune_cavity_burial_probe_radii.push_back( burial_radius );
1315 if( surface_accessibility ) {
1316 for(
PackstatReal pr = burial_radius-0.1; pr >= 0.1; pr -= 0.1 ) {
1317 opts.prune_cavity_burial_probe_radii.push_back(pr);
1337 for(
Size i = 1; i <= clusters.size(); i++ ) {
1338 for(
Size j = 1; j <= clusters[i].cavballs.size(); j++ ) {
1339 if( clusters[i].cavballs[j].radius() > 0.7 )
1340 out << clusters[i].cavballs[j].hetero_atom_line( pose.
total_residue()+i, i, 0.6 ) << std::endl;