Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SurfaceSearchPattern.cc
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
11 /// @brief
12 /// @author
13 
14 #include <utility/vector1.hh>
15 #include <utility/pointer/ReferenceCount.hh>
16 #include <utility/pointer/owning_ptr.hh>
17 
18 #include <numeric/xyzVector.hh>
19 #include <numeric/xyzMatrix.hh>
20 #include <numeric/xyz.functions.hh>
21 
22 #include <core/types.hh>
23 
24 #include <core/pose/Pose.hh>
25 
27 
32 
34 
37 
38 namespace protocols {
39 namespace hotspot_hashing {
40 
41 static basic::Tracer TR( "protocols.hotspot_hashing.SurfaceSearchPattern" );
42 
44  core::pose::Pose const & source_pose,
45  core::pack::task::TaskFactoryOP surface_selection,
46  core::Real surface_density) :
47  surface_vectors_(),
48  surface_density_(surface_density)
49 {
50  using namespace core::scoring::sc;
51 
52  core::pose::Pose pose(source_pose);
53 
54  // Create list of target residues using taskoperation
56  if ( surface_selection != 0 )
57  {
58  task = surface_selection->create_task_and_apply_taskoperations( pose );
59  TR.Debug << "Initializing from packer task." << std::endl;
60  }
61  else
62  {
64  TR.Debug << "No packer task specified, using default task." << std::endl;
65  }
66 
67  TR.Debug << "Initializing SurfaceSearchPattern. Density: " << surface_density << std::endl;
68 
69  // Perform SC calculation, surface dots will be extracted for partner 1
70  MolecularSurfaceCalculator calculator;
71  calculator.settings.density = surface_density_;
72  calculator.Init();
73  calculator.Calc(pose);
74 
75  std::vector<DOT> surface_dots = calculator.GetDots(0);
76 
77  TR.Debug << "Generated surface dots: " << surface_dots.size() << std::endl;
78 
79  core::Size zeronormal_dots = 0;
80  core::Size skipped_dots = 0;
81  core::Size selected_dots = 0;
82 
83  for (core::Size i = 0; i < surface_dots.size(); i++)
84  {
85  if (surface_dots[i].outnml.length() == 0)
86  {
87  zeronormal_dots++;
88  continue;
89  }
90  else if (task->pack_residue(surface_dots[i].atom->nresidue))
91  {
92  selected_dots++;
93  surface_vectors_.push_back(VectorPair(surface_dots[i].coor, -surface_dots[i].outnml));
94  }
95  else
96  {
97  skipped_dots++;
98  }
99  }
100 
101  TR.Debug << "Zero-length normal dots: " << zeronormal_dots << std::endl;
102  TR.Debug << "Skipped dots: " << skipped_dots << std::endl;
103  TR.Debug << "Accepted dots: " << selected_dots << std::endl;
104 
105  TR.Debug << "Generated surface vectors: " << surface_vectors_.size() << std::endl;
106 
107  if ( TR.Trace.visible() )
108  {
109  TR.Trace << "Raw surface dots:" << "\n";
110  TR.Trace << "id atomid residueid residue atom area x y z nx ny nz " << "\n";
111 
112  for (core::Size i = 0; i < surface_dots.size(); i++)
113  {
114  if (task->pack_residue(surface_dots[i].atom->nresidue))
115  {
116  TR.Trace << i << " " <<
117  surface_dots[i].atom->nresidue << " " <<
118  surface_dots[i].atom->natom << " " <<
119  surface_dots[i].atom->residue << " " <<
120  surface_dots[i].atom->atom << " " <<
121  surface_dots[i].area << " " <<
122  surface_dots[i].coor.x() << " " <<
123  surface_dots[i].coor.y() << " " <<
124  surface_dots[i].coor.z() << " " <<
125  surface_dots[i].outnml.x() << " " <<
126  surface_dots[i].outnml.y() << " " <<
127  surface_dots[i].outnml.z() << " " <<
128  "\n";
129  }
130  }
131 
132  TR.Trace << std::endl;
133  }
134 }
135 
137 {
139 
140  for (core::Size i = 1; i <= surface_vectors_.size(); i++)
141  {
142  VectorPair search_vector = surface_vectors_[i];
143 
145  search_vector.position,
146  search_vector.position + search_vector.direction,
147  search_vector.position + search_vector.direction + (search_vector.position != 0 ? search_vector.position.cross(search_vector.direction) : (search_vector.position + 1).cross(search_vector.direction)));
148 
149  searchpoints.push_back(tp);
150  }
151 
152  return searchpoints;
153 }
154 
155 }
156 }