Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GridManager.hh
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/GridManager.hh
11 /// @author Sam DeLuca
12 
13 #ifndef INCLUDED_protocols_qsar_scoring_grid_GridManager_hh
14 #define INCLUDED_protocols_qsar_scoring_grid_GridManager_hh
15 
16 
17 
19 #include <protocols/jd2/Job.fwd.hh>
22 
23 #include <core/types.hh>
25 #include <core/pose/Pose.fwd.hh>
26 
27 #include <utility/vector1.hh>
28 #include <utility/tag/Tag.fwd.hh>
29 #include <utility/json_spirit/json_spirit_writer.h>
30 #include <utility/json_spirit/json_spirit_reader.h>
31 
32 #include <string>
33 #include <map>
34 
35 
36 
37 namespace protocols {
38 namespace qsar {
39 namespace scoring_grid {
40 
41 typedef std::map<std::string,GridBaseOP> GridMap;
42 typedef std::map<std::string,core::Real> ScoreMap;
43 
45 {
46 public:
47  static GridManager* get_instance();
48  ///@brief reset GridManager to the default settings
49  void reset();
50  ///@brief should grid scores be normalized?
51  void set_normalized(bool normalized);
52  ///@brief set width (must be done before initialization)
53  void set_width(core::Real width);
54  ///@brief set resolution (must be done before initialization)
55  void set_resolution(core::Real resolution);
56  ///@brief set ligand chain (must be done before initialization)
57  void set_chain(char chain);
58  ///@brief make a new grid from grid tag, and insert it into the grid manager
59  void make_new_grid(utility::tag::TagPtr const tag);
60  ///@brief insert a grid pointer into the grid manager
61  void insert_grid(std::string const name,GridBaseOP const grid);
62  ///@brief set the qsar_map
63  void set_qsar_map(qsarMapOP qsar_map);
64  ///@brief is a qsar map attached to the grid manager?
65  bool is_qsar_map_attached();
66  ///@brief given a grid type, return a pointer to the grid
67  GridBaseOP get_grid(std::string const & grid_name);
68  ///@brief get a list of grid names
70  ///@brief return the total score of a residue on the grid
72  ///@brief return the total score of a chain on the grid
73  core::Real total_score(core::pose::Pose const & pose, core::Size const chain_id);
74  ///@brief get a map of scoring terms and scores for each term given a residue and atom number
75  std::map<std::string,core::Real> atom_score(core::pose::Pose const & pose, core::conformation::Residue const & residue, core::Size atomindex );
76  ///@brief recalculate all grids for a pose. This must be called if the backbone or sidechain conformations change!
77  void update_grids(core::pose::Pose const & pose, core::Vector const & center, core::Size const & ligand_chain_id_to_exclude);
78  ///@brief recalculate all grids for a pose. This must be called if the backbone or sidechain conformations change!
79  void update_grids(core::pose::Pose const & pose, core::Vector const & center,utility::vector1<core::Size> ligand_chain_ids_to_exclude);
80  ///@brief recalculate all grids for a pose. This must be called if the backbone or sidechain conformations change!
81  void update_grids(core::pose::Pose const & pose, core::Vector const & center);
82  ///@brief initialize all grids and fill with 0s given a center point
83  void initialize_all_grids(core::Vector const & center);
84  ///@brief return the number of grids in the manager
85  core::Size size();
86  ///@brief get a map of cached scores
88  ///@brief append all cached scores to a current job
90  ///@brief write all grids out using the BRIX format
91  void write_grids(std::string prefix);
92  ///@brief check to see if all atoms in the ligand are in the grid
93  bool is_in_grid(core::conformation::Residue const & residue);
94 
95 private:
96  GridManager();
97  GridManager(GridManager const &);
98  GridManager const & operator = (GridManager const & );
99  //GridManager(core::Real width,core::Real resolution);
100 
101  /// @brief serialize the current map to a JSON object. There is no public interface for this because the grid manager takes care of it on its own
102  utility::json_spirit::Value serialize();
103  /// @brief deserialize the JSON object to a map. There is no public interface for this because the grid manager takes care of it on its own
104  void deserialize(utility::json_spirit::mArray data);
105 
106 private:
108 
109  std::map<std::string,GridMap> grid_map_cache_;
110 
111  std::map<std::string,core::Real> grid_weights_;
112 
120  char chain_;
122 };
123 
124 }
125 }
126 }
127 
128 #endif /* GRIDMANAGER_HH_ */