Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AtrGrid.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 src/protocols/qsar/scoring_grid/AtrGrid.cc
11 /// @author Sam DeLuca
12 
13 
16 
18 #include <core/pose/Pose.hh>
19 
20 #include <utility/tag/Tag.hh>
21 #include <utility/vector0.hh>
22 #include <utility/vector1.hh>
23 #include <utility/tools/make_vector.hh>
24 #include <utility/excn/Exceptions.hh>
25 #include <utility/json_spirit/json_spirit_value.h>
26 
27 namespace protocols {
28 namespace qsar {
29 namespace scoring_grid {
30 
32 {
34 }
35 
37 {
38  GridBaseOP atr_grid= new AtrGrid();
39 
40  atr_grid->parse_my_tag(tag);
41 
42  return atr_grid;
43 }
44 
46 {
47 
48  return new AtrGrid();
49 }
50 
51 
53 {
54  return "AtrGrid";
55 }
56 
57 
59  SingleGrid("AtrGrid"),
60  inner_radius_(2.25),
61  outer_radius_(4.75),
62  bb_(-1),
63  sc_(-1),
64  ligand_(-1)
65 {
66  //
67 }
68 
69 void
71 
72  if (tag->hasOption("bb") || tag->hasOption("sc") || tag->hasOption("ligand") ){
73  // the user MUST provide all 3 if he/she is providing any of these 3 options
74  if (!(tag->hasOption("bb") && tag->hasOption("sc") && tag->hasOption("ligand") ) ){
75  throw utility::excn::EXCN_RosettaScriptsOption("'AtrGrid' requires bb, sc, and ligand if any one of these are used");
76  }
77  bb_= tag->getOption<core::Real>("bb");
78  sc_= tag->getOption<core::Real>("sc");
79  ligand_= tag->getOption<core::Real>("ligand");
80  }
81 
82  if(tag->hasOption("inner_radius") || tag->hasOption("outer_radius")){
83  // the user MUST provide both if he/she is providing either of these options
84  if(!(tag->hasOption("inner_radius") && tag->hasOption("outer_radius"))){
85  throw utility::excn::EXCN_RosettaScriptsOption("'AtrGrid' requires outer_radius and inner_radius if either of these options are used");
86  }
87  inner_radius_= tag->getOption<core::Real>("inner_radius");
88  outer_radius_= tag->getOption<core::Real>("outer_radius");
89  }
90 }
91 
92 utility::json_spirit::Value AtrGrid::serialize()
93 {
94  using utility::json_spirit::Value;
95  using utility::json_spirit::Pair;
96 
97  // [inner_radius, outer_radius]
98  Pair radius("radius",utility::tools::make_vector(Value(inner_radius_),Value(outer_radius_)));
99  Pair bb("bb",Value(bb_));
100  Pair sc("sc",Value(sc_));
101  Pair ligand("ligand",Value(ligand_));
102  Pair base_data("base_data",SingleGrid::serialize());
103 
104  return Value(utility::tools::make_vector(radius,bb,sc,ligand,base_data));
105 
106 }
107 
108 void AtrGrid::deserialize(utility::json_spirit::mObject data)
109 {
110  utility::json_spirit::mArray radius(data["radius"].get_array());
111  inner_radius_ = radius[0].get_real();
112  outer_radius_ = radius[1].get_real();
113  bb_ = data["bb"].get_real();
114  sc_ = data["sc"].get_real();
115  ligand_ = data["ligand"].get_real();
116  SingleGrid::deserialize(data["base_data"].get_obj());
117 }
118 
119 void AtrGrid::refresh(core::pose::Pose const & pose, core::Vector const & center)
120 {
121  utility::vector1<core::Size> ligand_chain_ids_to_exclude;
122  this->refresh(pose, center, ligand_chain_ids_to_exclude);
123 }
124 
125 void AtrGrid::refresh(core::pose::Pose const & pose, core::Vector const & center, core::Size const & ligand_chain_id_to_exclude)
126 {
127  utility::vector1<core::Size> ligand_chain_ids_to_exclude;
128  ligand_chain_ids_to_exclude.push_back(ligand_chain_id_to_exclude);
129  this->refresh(pose, center, ligand_chain_ids_to_exclude);
130 }
131 
133 {
134  for(core::Size a=1, a_end = rsd.last_backbone_atom(); a <= a_end; ++a)
135  {
137  }
138  for(core::Size a = rsd.first_sidechain_atom(), a_end = rsd.nheavyatoms(); a <= a_end; ++a)
139  {
141  }
142 
143 }
144 
146  core::conformation::Residue const & rsd,
147  utility::vector1<core::Size> ligand_chain_ids_to_exclude
148 
149 ){
150  if( find(
151  ligand_chain_ids_to_exclude.begin(),
152  ligand_chain_ids_to_exclude.end(),
153  rsd.chain()
154  ) == ligand_chain_ids_to_exclude.end()
155  ) {
156  return;
157  }
158  for(core::Size a = 1, a_end = rsd.nheavyatoms(); a <= a_end; ++a)
159  {
161  }
162 }
163 
165  core::pose::Pose const & pose,
166  core::Vector const &,
167  utility::vector1<core::Size> ligand_chain_ids_to_exclude
168 ){
169  // Set neutral core around each sidechain heavy atom, as MOST of these stay put.
170  for(Size r = 1, r_end = pose.total_residue(); r <= r_end; ++r) {
171  core::conformation::Residue const & rsd = pose.residue(r);
172  if( rsd.is_protein() ) set_protein_rings(rsd);
173  else{
174  set_ligand_rings(rsd, ligand_chain_ids_to_exclude);
175 
176  }
177  // else don't add this ligand to the grid
178  }
179 
180 }
181 
182 
183 }
184 }
185 }