Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SymmetryInfo.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 // This file is part of the Rosetta software suite and is made available under license.
5 // The Rosetta software is developed by the contributing members of the Rosetta Commons consortium.
6 // (C) 199x-2009 Rosetta Commons participating institutions and developers.
7 // For more information, see http://www.rosettacommons.org/.
8 
9 /// @file
10 /// @brief
11 /// @author Ingemar Andre, Phil Bradley
12 
13 #ifndef INCLUDED_core_conformation_symmetry_SymmetryInfo_hh
14 #define INCLUDED_core_conformation_symmetry_SymmetryInfo_hh
15 
17 
18 // Unit Headers
22 
23 //core
24 #include <core/types.hh>
25 #include <core/id/DOF_ID.fwd.hh>
26 #include <core/id/TorsionID.fwd.hh>
27 #include <core/id/AtomID.fwd.hh>
29 
30 // Utility Headers
31 // AUTO-REMOVED #include <utility/vector1.hh>
32 #include <utility/pointer/owning_ptr.hh>
33 #include <utility/pointer/ReferenceCount.hh>
34 
35 // C++ headers
36 #include <map>
37 #include <string>
38 
39 #include <utility/vector1_bool.hh>
40 
41 
42 namespace core {
43 namespace conformation {
44 namespace symmetry {
45 
46 
47 //Symm_info
48 
50 public:
51 
52  typedef utility::vector1< Size > Clones; // NOTE vector1 *not* std::vector
53  typedef utility::vector1< std::pair<Size,Real> > WtedClones; // NOTE vector1 *not* std::vector
54 
55  typedef id::DOF_ID DOF_ID;
57  typedef id::AtomID AtomID;
58 
59  /// convenience: these could go somewhere else
63 
64 public:
65  SymmetryInfo();
66  virtual ~SymmetryInfo();
67  //SymmetryInfo(SymmetryInfo const &);
68  SymmetryInfo( SymmData const & symmdata, Size const nres_subunit, Size const njump_subunit );
69 
71  Size const nres_monomer,
72  Size const njump_monomer,
73  Size const N,
74  std::map< Size, SymDof > dofs,
75  Size const score_subunit,
77  SymSlideInfo slide_info,
78  Size const num_interfaces = 1,
79  std::string const & type = "simple"
80  );
81 
82  SymmetryInfoOP clone() const;
83 
84  void
85  initialize(
86  Size const nres_monomer,
87  Size const njump_monomer,
88  Size const N,
89  Size const num_virtual,
90  std::map< Size, SymDof > dofs,
91  Size const score_subunit,
93  SymSlideInfo slide_info,
94  Size const num_interfaces = 1,
95  std::string const & type = "simple"
96  );
97 
98  void
99  initialize(
100  Size const nres_monomer,
101  Size const njump_monomer,
102  Size const N,
103  Size const num_virtual,
104  std::map< Size, WtedClones > jump_clones,
105  std::map< Size, SymDof > dofs,
106  Size const score_subunit,
108  SymSlideInfo slide_info,
109  Size const num_interfaces = 1,
110  std::string const & type = "simple"
111  );
112 
113  bool operator== ( SymmetryInfo const & s );
114 
115  bool operator!= ( SymmetryInfo const & s );
116 
117  //fpd bb_* and chi_* stuff should get merged at some point since they are always equivalent
118  Size bb_follows( Size const seqpos ) const;
119  Size chi_follows( Size const seqpos ) const;
120  Size jump_follows( Size const seqpos ) const;
121 
122  std::vector < std::pair < Size, Size > > map_symmetric_res_pairs( Size res1, Size res2 );
123 
124  bool bb_is_independent( Size const seqpos ) const;
125  bool chi_is_independent( Size const seqpos ) const;
126  bool fa_is_independent( Size const seqpos ) const;
127  bool jump_is_independent( Size const seqpos ) const;
128 
129  bool is_virtual( Size const seqpos ) const;
130 
131  //fpd resize the asymm unit to contain nres_new residues
132  void resize_asu( Size nres_new );
133 
134  //fpd resize the asymm unit to contain nmonomer_new internal jumps
135  void update_nmonomer_jumps( Size nmonomer_new );
136 
137  Size subunits() const;
138 
139  Size subunit_index( Size const seqpos ) const;
140 
141  Size score_multiply_factor() const;
142 
144  independent_residues() const;
145 
146  Size num_bb_clones() const;
147  Size num_chi_clones() const;
148  Size num_jump_clones() const;
149 
151  Size num_total_residues() const;
154  Size num_interfaces() const;
155  Size num_virtuals() const;
156 
157  Size get_nres_subunit() const; //fpd same as num_independent_residues?
158  Size get_njumps_subunit() const;
159 
160  // accessors for Torsion/DOF IDs
161  bool dof_is_independent( DOF_ID const & id, Conformation const & conf ) const;
162 
163  // get a weight for derivative calculations
164  // weights are 1 for indep DOFs, 0 for dependent NON-JUMP DOFs
165  // and may be any real for dependent jump dofs
166  core::Real get_dof_derivative_weight( DOF_ID const & id, Conformation const & conf ) const;
167 
168  bool torsion_is_independent( TorsionID const & id ) const;
169  bool atom_is_independent( AtomID const & id ) const;
170 
171  /// @brief Returns a list of dofs that depend on id. Inefficient -- creates list anew each time.
172  DOF_IDs dependent_dofs( DOF_ID const & id, Conformation const & conf ) const;
173 
174  /// @brief Returns a list of dofs that depend on id. Inefficient -- creates list anew each time.
175  TorsionIDs dependent_torsions( TorsionID const & id ) const;
176  AtomIDs dependent_atoms( AtomID const & id ) const;
177 
178  // clone list accessors
179  Clones const & bb_clones( Size const seqpos ) const;
180  Clones const & chi_clones( Size const seqpos ) const;
181  Clones const & jump_clones( Size const base_jump ) const;
182 
183  void add_bb_clone( Size const base_pos, Size const clone_pos );
184  void add_chi_clone( Size const base_pos, Size const clone_pos );
185  void add_jump_clone( Size const base_pos, Size const clone_jump, Real const wt );
186 
187  std::map< Size, SymDof > const &get_dofs() const;
188 
189  void set_dofs( std::map< Size, SymDof > const & dofs );
190 
191  Size interface_number( Size const res1, Size const res2 ) const;
192 
193  // score multiply factors
194  Size score_multiply( Size const res1, Size const res2 ) const;
195  void set_score_multiply_from_subunit_factors( utility::vector1< Size > const & score_multiply_vector_subunit, Size const nres_subunit, Size const n_subunits );
196  void set_score_multiply( Size const res, Size const factor );
197  bool get_use_symmetry() const;
198 
199  void set_use_symmetry( bool setting ); //fpd used in silent file reading(?)
200 
202  void set_cp_weighting_during_minimization( bool setting );
203 
205 
206  //fpd these should be unnecessary given *_is_independent & get_*_clone functions
207  bool is_asymmetric_seqpos( Size const res ) const;
208  Size get_asymmetric_seqpos( Size const res ) const;
209 
211 
212  // io
213  friend std::istream& operator>> ( std::istream & s, SymmetryInfo & symminfo );
214  friend std::ostream& operator<< ( std::ostream & s, const SymmetryInfo & symminfo );
215 
216  bool read_silent_struct( std::string const & filename );
217  bool write_silent_struct( std::string const & filename );
218 
219  std::string get_jump_name(Size i) const;
220  Size get_jump_num(std::string i) const;
221  void set_jump_name(Size i, std::string);
222  Size num_slidablejumps() const;
223 
224  void
226  utility::vector1<char> const & components,
227  std::map<char,std::pair<Size,Size> > const & component_bounds,
228  std::map<std::string,char> const & name2component,
229  std::map<std::string,utility::vector1<char> > const & jname2component,
230  std::map<std::string,utility::vector1<Size> > const & jname2subunits
231  );
232 
233  utility::vector1<char> const & get_components() const;
234  std::map<char,std::pair<Size,Size> > const & get_component_bounds() const;
235  std::map<std::string,char> const & get_subunit_name_to_component() const;
236  std::map<std::string,utility::vector1<char> > const & get_jump_name_to_components() const;
237  std::map<std::string,utility::vector1<Size> > const & get_jump_name_to_subunits() const;
238 
239  std::pair<Size,Size> const & get_component_bounds(char c) const;
240  Size get_component_lower_bound(char c) const;
241  Size get_component_upper_bound(char c) const;
242  char get_component_of_residue(Size ir) const;
243  char get_subunit_name_to_component(std::string const & vname) const;
245  utility::vector1<Size> const & get_jump_name_to_subunits (std::string const & jname) const;
246 
247 private:
248 
249 #ifdef USEBOOSTSERIALIZE
250  friend class boost::serialization::access;
251 
252  template<class Archive>
253  void serialize(Archive & ar, const unsigned int version){
254  ar & bb_clones_;
255  ar & chi_clones_;
256  ar & jump_clones_;
257  ar & jump_clone_wts_;
258  ar & bb_follows_;
259  ar & chi_follows_;
260  ar & jump_follows_;
261  ar & empty_list;
262  ar & nres_monomer_;
263  ar & scoring_subunit_;
264  ar & npseudo_;
265  ar & njump_monomer_;
266  ar & type_;
267  ar & interfaces_;
268  ar & score_multiply_;
270  ar & dofs_;
271  ar & use_symmetry_;
273  ar & slide_info_;
274  //ar & jnum2name_;
275  //ar & name2jnum_;
276 
277  }
278 #endif
279 
280  // mapping from each primary jump to it's clones
281  std::map< Size, Clones > bb_clones_;
282  std::map< Size, Clones > chi_clones_;
283  std::map< Size, Clones > jump_clones_;
284 
285  // a weight applied to the motion of each jump clone
286  std::map< Size, Real > jump_clone_wts_;
287 
288  // these are derived from the above lists:
289  std::map< Size, Size > bb_follows_;
290  std::map< Size, Size > chi_follows_;
291  std::map< Size, Size > jump_follows_;
292 
293  // silly! should make static class data
295 
301 
302  // store the number of interfaces
304 
305  //Store score multiplication factors
307 
308  // total number of subunits in the entire symm complex (not just those in the model)
309  // read in the 'E =' line in the symm definition file
311 
312  // store the allowed dofs
313  std::map< Size, SymDof > dofs_;
314 
315  // Toggle use of symmetry
317 
318  // Toggle use of count pair weighting in scoring during minimization
320 
321  // Slide info
323 
324  std::map<Size,std::string> jnum2dofname_;
325  std::map<std::string,Size> dofname2jnum_;
326 
328  std::map<char,std::pair<Size,Size> > component_bounds_;
329  std::map<std::string,char> name2component_;
330  std::map<std::string,utility::vector1<char> > jname2components_;
331  std::map<std::string,utility::vector1<Size> > jname2subunits_;
332 
335 
336 }; // SymmetryInfo
337 
338 
339 
340 } // symmetry
341 } // conformation
342 } // core
343 
344 #endif