Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AtomBasedConstraintsScore.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 protocols/frag_picker/scores/AtomBasedConstraintsScore.cc
11 /// @brief
12 /// @author Dominik Gront (dgront@chem.uw.edu.pl)
13 
14 // package headers
16 
17 #include <basic/Tracer.hh>
19 #include <numeric/xyzVector.hh>
20 
21 #include <core/id/NamedAtomID.hh>
22 #include <core/pose/Pose.hh>
24 #include <utility/vector1.hh>
25 
26 
27 namespace protocols {
28 namespace frag_picker {
29 namespace scores {
30 
31 static basic::Tracer trAtomBasedConstraintsScore(
32  "fragment.picking.scores.AtomBasedConstraintsScore");
33 
34 /// @param priority - the priority for this scoring method. The lower the priority, the later the score will be evaluated
35 /// Because a fragment may be discarded when a score is too low, the most accurate and meaningful scores should have the highest priority
36 /// @param lowest_acceptable_value - a fragment for which this score is below a certain threshold will be discarded
37 /// @param query_size - the number of residues in the query sequence
38 /// @param constrainable_atoms - a vector of strings providing names of constrained atoms.
39 /// On every do_cahing() event these and only these atoms will be cached from a chunk's pose
40 /// @param score_name - name assigned to this scoring term; this string must show up in scores config file if the score is to be evaluated during picking
42  Real lowest_acceptable_value, bool use_lowest, Size query_size, utility::vector1<
43  std::string> constrainable_atoms, std::string score_name) :
44  CachingScoringMethod(priority, lowest_acceptable_value, use_lowest, score_name) {
45 
46  query_size_ = query_size;
47  for (Size i = 1; i < constrainable_atoms.size(); ++i)
48  constrainable_atoms_.insert(std::pair<std::string, Size>(
49  constrainable_atoms[i], i));
50 }
51 
52 /// @param priority - the priority for this scoring method. The lower the priority, the later the score will be evaluated
53 /// Because a fragment may be discarded when a score is too low, the most accurate and meaningful scores should have the highest priority
54 /// @param lowest_acceptable_value - a fragment for which this score is below a certain threshold will be discarded
55 /// @param query_size - the number of residues in the query sequence
56 /// @param score_name - name assigned to this scoring term; this string must show up in scores config file if the score is to be evaluated during picking
58  Real lowest_acceptable_value, bool use_lowest, Size query_size, std::string score_name) :
59  CachingScoringMethod(priority, lowest_acceptable_value, use_lowest, score_name) {
60 
61  query_size_ = query_size;
62  constrainable_atoms_.insert(std::pair<std::string, Size>("N", 1));
63  constrainable_atoms_.insert(std::pair<std::string, Size>("CA", 2));
64  constrainable_atoms_.insert(std::pair<std::string, Size>("C", 3));
65  constrainable_atoms_.insert(std::pair<std::string, Size>("O", 4));
66  constrainable_atoms_.insert(std::pair<std::string, Size>("CB", 5));
67  constrainable_atoms_.insert(std::pair<std::string, Size>("H", 6));
68  constrainable_atoms_.insert(std::pair<std::string, Size>("HA", 7));
69  constrainable_atoms_.insert(std::pair<std::string, Size>("HB", 8));
70  constrainable_atoms_.insert(std::pair<std::string, Size>("1HB", 9));
71  constrainable_atoms_.insert(std::pair<std::string, Size>("2HB", 10));
72 }
73 
75 
76  std::map<std::string, Size>::iterator it;
77  for ( it=constrainable_atoms_.begin() ; it != constrainable_atoms_.end(); it++ )
78  if( (it)->second == atom_id )
79  return (it)->first;
80 
81  return 0;
82 }
83 
85 
86  trAtomBasedConstraintsScore.Debug << "caching backbone atoms for "
87  << chunk->get_pdb_id() << " of size " << chunk->size() << std::endl;
88  core::pose::PoseOP pose = chunk->get_pose();
89 
90 // pose->dump_pdb("dump-"+chunk->get_pdb_id()+".pdb");
91 
92  numeric::xyzVector<Real> empty_one;
93  for (Size i = 1; i <= chunk->size(); ++i) {
96  constrainable_atoms_.size());
97  for (Size j = 1; j < constrainable_atoms_.size(); ++j) {
98  flag_row[j] = false;
99  row[j] = empty_one;
100  }
101  chunk_atoms_xyz_.push_back(row);
102  atom_flags_.push_back(flag_row);
103 
104  std::map<std::string, Size>::iterator it;
105  chemical::ResidueType const & ith_res_type = pose->residue_type(i);
106  for (it = constrainable_atoms_.begin(); it
107  != constrainable_atoms_.end(); ++it) {
108  if(! ith_res_type.has_atom_name( it->first ))
109  continue;
110  id::NamedAtomID idAtom(it->first, i);
111  numeric::xyzVector<Real> xyz = pose->xyz(idAtom);
112  chunk_atoms_xyz_[i][it->second] = xyz;
113  atom_flags_[i][it->second] = true;
114  }
115  }
116 }
117 
119  chunk_atoms_xyz_.erase(chunk_atoms_xyz_.begin(), chunk_atoms_xyz_.end());
120  atom_flags_.erase(atom_flags_.begin(), atom_flags_.end());
121 }
122 
123 }
124 } // frag_picker
125 } // protocols