17 #include <basic/database/open.hh>
18 #include <basic/Tracer.hh>
54 #include <utility/io/izstream.hh>
60 #include <utility/vector1.hh>
71 namespace interaction_graph {
75 static basic::Tracer
TR(
"core.pack.interaction_graph.SurfacePotential");
111 utility::io::izstream residue_hASA_ifstream;
112 basic::database::open( residue_hASA_ifstream,
"scoring/score_functions/SurfacePotential/average_hASA_by_res_and_neighbor.txt" );
115 Real lte10_asa = 0.0;
116 Real lte13_asa = 0.0;
117 Real lte16_asa = 0.0;
118 Real lte20_asa = 0.0;
119 Real lte24_asa = 0.0;
123 while ( !residue_hASA_ifstream.eof() ) {
124 residue_hASA_ifstream >> str_restype >> lte10_asa >> lte13_asa >> lte16_asa >> lte20_asa >> lte24_asa;
133 for (
Size ii=1; ii <= 10; ++ii ) {
136 for (
Size ii=11; ii <= 13; ++ii ) {
139 for (
Size ii=14; ii <= 16; ++ii ) {
142 for (
Size ii=17; ii <= 20; ++ii ) {
145 for (
Size ii=21; ii <= 24; ++ii ) {
158 TR <<
"]" << std::endl;
174 utility::io::izstream hASA_score_ifstream;
175 basic::database::open( hASA_score_ifstream,
"scoring/score_functions/SurfacePotential/surface_score.txt" );
177 Real amount_hASA = 0.0;
179 Size num_fields = 20;
181 while ( !hASA_score_ifstream.eof() ) {
182 hASA_score_ifstream >> amount_hASA;
185 for (
Size ii=1; ii <= num_fields; ++ii ) {
186 hASA_score_ifstream >> score;
193 TR <<
"patch energies: [ " << std::endl;
195 TR <<
"patch size: " << ii * 25 <<
" [ ";
199 TR <<
"]" << std::endl;
201 TR <<
"]" << std::endl;
215 utility::io::izstream hpatch_score_ifstream;
216 basic::database::open( hpatch_score_ifstream,
"scoring/score_functions/SurfacePotential/hpatch_score.txt" );
218 Real patch_area = 0.0;
221 while ( !hpatch_score_ifstream.eof() ) {
222 hpatch_score_ifstream >> patch_area >> score;
227 TR <<
"patch area scores: [ " << std::endl;
231 TR <<
"]" << std::endl;
248 std::cout <<
"Number of neighbors (" << num_nbs <<
") outside bounds in SurfacePotential::average_residue_hASA." << std::endl;
251 std::cout <<
"aatype (" << aa_type <<
") outside of canonical 20 in SurfacePotential::average_residue_hASA." << std::endl;
270 std::cout <<
"patch_area (" << patch_area <<
") greater than MAX_PATCH_SURFACE_AREA in SurfacePotential::hASA_patch_energy." << std::endl;
288 std::cout <<
"patch_area (" << patch_area <<
") greater than MAX_HPATCH_AREA in SurfacePotential::hpatch_score." << std::endl;
314 Real total_hASA = 0.0;
317 TR << rsd.
aa() << resid <<
" (hASA: " <<
average_residue_hASA( rsd.
aa(), num_neighbors_[ resid ] ) <<
", nbs: " << num_neighbors_[ resid ] <<
") neighbors... ";
323 Real distanceBetweenAtoms = 0.0;
324 for (
Size res2_position = 1; res2_position < pose.
total_residue(); ++res2_position ) {
326 if ( resid == res2_position ) {
continue; }
357 TR <<
"compute_residue_surface_energy: calculated total_hASA: " << total_hASA <<
", surface energy: " << emap[
scoring::surface ] << std::endl;
386 total_surface_energy_ = 0.0;
387 residue_surface_energy_.clear();
392 residue_surface_energy_.clear();
393 residue_surface_energy_.resize( pose.
n_residue(), 0.0 );
417 if( symm_info && !symm_info->bb_is_independent(res1_position) )
continue;
420 Real total_hASA = 0.0;
433 TR << pose.
residue( res1_position ).
aa() << res1_position
435 <<
", nbs: " << num_neighbors_[ res1_position ] <<
") neighbors... ";
451 Real distanceBetweenAtoms = 0.0;
453 for (
Size res2_position = 1; res2_position < pose.
total_residue(); ++res2_position ) {
455 if( symm_info && !symm_info->bb_is_independent(res2_position) )
continue;
457 if ( res2_position == res1_position ) {
continue; }
484 residue_surface_energy_[ res1_position ] =
hASA_patch_energy( total_hASA, num_neighbors_[ res1_position ] );
488 TR <<
"compute_pose_surface_energy: calculated residue total_hASA: " << total_hASA <<
", surface energy: "
489 << residue_surface_energy_[ res1_position ] << std::endl;
495 total_surface_energy_ = 0.0;
496 for (
Size ii=1; ii < residue_surface_energy_.size(); ++ii ) {
497 total_surface_energy_ += residue_surface_energy_[ii];
501 TR <<
"compute_pose_surface_energy: calculated surface energy: " << total_surface_energy_ <<
", residue_surfaceE: [ ";
502 for (
Size ii=1; ii <= residue_surface_energy_.size(); ++ii ) {
503 TR << residue_surface_energy_[ ii ] <<
", ";
505 TR <<
"]" << std::endl;
517 std::map< core::Size, std::pair< core::Real, core::Real > > patch_scores;
518 std::map< Size,utility::vector1< id::AtomID > > atoms_in_patches;
521 return total_hpatch_score;
543 std::map<
core::Size, std::pair< core::Real, core::Real > > & patch_scores_,
548 using namespace core;
549 using namespace core::id;
550 using namespace core::pack::interaction_graph;
572 core::conformation::find_neighbors<core::conformation::PointGraphVertexData,core::conformation::PointGraphEdgeData>( pg, max_pair_radius + max_pair_radius + max_ep_radius );
576 rdots[ ii ]->increment_self_overlap();
578 edge_end_iter = pg->get_vertex(ii ).upper_edge_list_end(); edge_iter != edge_end_iter; ++edge_iter ) {
579 Size jj = edge_iter->upper_vertex();
580 rdots[ ii ]->increment_both( *rdots[ jj ] );
585 Size heavyatom_count = 0;
602 atom_2_ds_index.resize( ii, rsd.
nheavyatoms(), 0 );
605 atom_2_ds_index[ atomid ] = ds_index;
606 ds_index_2_atomid[ ds_index ] = atomid;
613 invdots[ ii ]->setup_from_rotamer_dots( *rdots[ ii ] );
617 TR <<
"compute_pose_hpatch_score(): finding intra- and inter-residue overlaps" << std::endl;
630 if ( rdots[ ii ]->get_atom_sasa( iia ) == 0 )
635 if ( iia_elem != carbon_atom && iia_elem != sulfur_atom )
639 Vector const & iia_xyz = rdots[ ii ]->rotamer()->xyz( iia );
642 for (
Size iib = iia+1; iib <= iia_end; ++iib ) {
645 if ( rdots[ ii ]->get_atom_sasa( iib ) == 0 )
650 if ( iib_elem != carbon_atom && iib_elem != sulfur_atom )
654 Vector const & iib_xyz = rdots[ ii ]->rotamer()->xyz( iib );
656 if ( iia_xyz.distance_squared( iib_xyz ) < (iia_rad + iib_rad) * (iia_rad + iib_rad) ) {
664 if ( invdots[ ii ]->atom_overlap_is_exposed( iia, iib ) ) {
665 Size iia_dsid = atom_2_ds_index(
AtomID( iia, ii ) );
666 Size iib_dsid = atom_2_ds_index(
AtomID( iib, ii ) );
680 edge_end_iter = pg->get_vertex( ii ).upper_edge_list_end(); edge_iter != edge_end_iter; ++edge_iter ) {
682 Size jj = edge_iter->upper_vertex();
688 if ( rdots[ ii ]->get_atom_sasa( iia ) == 0 )
692 if ( iia_elem != carbon_atom && iia_elem != sulfur_atom )
696 Vector const & iia_xyz = rdots[ ii ]->rotamer()->xyz( iia );
700 if ( rdots[ jj ]->get_atom_sasa( jja ) == 0 )
704 if ( jja_elem != carbon_atom && jja_elem != sulfur_atom )
708 Vector const & jja_xyz = rdots[ jj ]->rotamer()->xyz( jja );
710 if ( iia_xyz.distance_squared( jja_xyz ) < (iia_rad+jja_rad) * (iia_rad+jja_rad) ) {
718 if ( invdots[ ii ]->atom_overlap_is_exposed( iia, *invdots[ jj ], jja ) ) {
720 Size iia_dsid = atom_2_ds_index(
AtomID( iia, ii ) );
721 Size jja_dsid = atom_2_ds_index(
AtomID( jja, jj ) );
746 patch_scores_.clear();
747 total_hpatch_score_ = 0.0;
750 std::map< Size, utility::vector1< Size > > sets = ds.
sets();
751 std::map< Size, utility::vector1< Size > >::iterator it;
754 for ( it = sets.begin() ; it != sets.end(); it++ ) {
755 std::ostringstream strstream;
761 if ( (*it).second.size() < 4 ) {
766 TR <<
"representative: " << (*it).first <<
" => atoms in CC: [ ";
769 for (
Size ii=1; ii <= (*it).second.size(); ++ii ) {
770 id::AtomID const & atomid = ds_index_2_atomid[ (*it).second[ii] ];
771 atoms[ ii ] = atomid;
775 if ( pose.
pdb_info()->chain( atomid.
rsd() ) !=
' ' ) {
783 patch_area += rdots[ atomid.
rsd() ]->get_atom_sasa( atomid.
atomno() );
785 atoms_in_patches_[ (*it).first ] = atoms;
789 TR <<
"], patch_area: " << patch_area;
800 TR <<
", hpatch_score: " << score << std::endl;
802 total_hpatch_score_ += score;
804 patch_scores_[ (*it).first ] = std::make_pair( score, patch_area );
809 TR <<
"calculated total hpatch score: " << total_hpatch_score_ <<
", individual patch scores: [ ";
810 std::map< Size, std::pair< Real, Real > >::iterator scores_iter;
811 for ( scores_iter = patch_scores_.begin(); scores_iter != patch_scores_.end(); scores_iter++ ) {
812 TR << (*scores_iter).second.first <<
", ";
814 TR <<
"]" << std::endl;
819 for ( it = sets.begin() ; it != sets.end(); it++ ) {
820 std::ostringstream strstream;
822 std::map< core::Size, std::pair< core::Real, core::Real > >::iterator ps_it = patch_scores_.find( (*it).first );
823 if ( ps_it == patch_scores_.end() ) {
continue; }
824 Real score = (*ps_it).second.first;
825 if ( score < 4.00 ) {
continue; }
827 TR <<
"large patch, hpatch_score: " << score <<
", PyMOL expression: select p" << (*it).first <<
", ";
828 for (
Size ii=1; ii <= (*it).second.size(); ++ii ) {
829 id::AtomID const & atomid = ds_index_2_atomid[ (*it).second[ii] ];
834 if ( pose.
pdb_info()->chain( atomid.
rsd() ) !=
' ' ) {