Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
qsarMover.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/ligand_docking/qsar/qsarMover.cc
11 /// @author Sam DeLuca
12 
20 #include <protocols/jd2/Job.hh>
21 
24 #include <core/pose/util.hh>
25 #include <core/pose/Pose.hh>
26 
27 #include <basic/Tracer.hh>
28 
29 #include <utility/tag/Tag.hh>
30 #include <utility/string_util.hh>
31 #include <utility/vector0.hh>
32 #include <utility/excn/Exceptions.hh>
33 #include <utility/vector1.hh>
34 
35 namespace protocols {
36 namespace qsar {
37 static basic::Tracer TR("protocols.ligand_docking.qsar.qsarMover");
38 
39 
42 {
43  return qsarCreator::mover_name();
44 }
45 
48  return new qsarMover;
49 }
50 
53 {
54  return "qsar";
55 }
56 
58  qsar_map_(0),
59  chain_(),
60  initialize_(false)
61 {}
62 
63 //@brief parse XML (specifically in the context of the parser/scripting scheme)
64 void
66  utility::tag::TagPtr const tag,
67  protocols::moves::DataMap & /*datamap*/,
68  protocols::filters::Filters_map const & /*filters*/,
69  protocols::moves::Movers_map const & /*movers*/,
70  core::pose::Pose const & /*pose*/
71 )
72 {
73  if ( tag->getName() != "qsarMover" ) throw utility::excn::EXCN_RosettaScriptsOption("This should be impossible");
74 
75  if ( ! tag->hasOption("chain") ) throw utility::excn::EXCN_RosettaScriptsOption("'qsar' mover requires chain tag");
76  chain_= tag->getOption<std::string>("chain");
77 
78  if ( ! tag->hasOption("grids") ) throw utility::excn::EXCN_RosettaScriptsOption("'qsarMover' requires grids tag");
79 
80  std::string grids_string= tag->getOption<std::string>("grids");
81  utility::vector1<std::string> grid_strings(utility::string_split(grids_string, ','));
82  grids_to_use_ = grid_strings;
83 }
84 
86 {
88 
90  core::Size const begin(pose.conformation().chain_begin(chain_id));
91  /// TODO The next line assumes the chain is one residue. fix this.
93 
94  if(grids_to_use_.size()==0)
95  {
96  TR << "WARNING: no grids specified, QSAR scoring function will be empty!!" <<std::endl;
97  return;
98  }else if(!initialize_)
99  {
101  for(; grid_iterator != grids_to_use_.end();++grid_iterator)
102  {
103  //grid_manager->make_new_grid(*grid_iterator);
104  grid_manager->get_grid(*grid_iterator);
105  TR.Debug << "getting grid: " << *grid_iterator << std::endl;
106  }
107  if(qsar_map_ == 0)
108  {
109 
110  qsar_map_ = new qsarMap("default",residue);
111 
112  qsar_map_->fill_with_value(1,grids_to_use_);
113  }
114 
115  grid_manager->set_qsar_map(qsar_map_);
116 
117  }
118 
119  if(!initialize_ || pose.conformation().structure_moved())
120  {
121  core::Size const jump_id(core::pose::get_jump_id_from_chain_id(chain_id,pose));
122  core::Vector const center(geometry::downstream_centroid_by_jump(pose,jump_id));
123 
124  if(!initialize_)
125  {
126  TR.Debug <<"initializing grids" << std::endl;
127  grid_manager->initialize_all_grids(center);
128  TR.Debug <<"grids initialized" <<std::endl;
129  }
130  grid_manager->update_grids(pose,center);
131  TR.Debug <<"grids updated, scoring.."<<std::endl;
132  core::Real score(grid_manager->total_score(*residue));
133  TR.Debug << "total score is " << score <<std::endl;
134  std::map<std::string,core::Real> scores(grid_manager->get_cached_scores());
135 
136 
138  grid_manager->append_cached_scores(job);
139  //grid_manager->write_grids("test_");
140  }
141  if(!initialize_)
142  initialize_=true;
143 }
144 
146 {
147  return "qsarMover";
148 }
149 
150 }
151 }