Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RNA_ChunkLibrary.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 // CVS information:
4 // $Revision: 1.1.2.1 $
5 // $Date: 2005/11/07 21:05:35 $
6 // $Author: rhiju $
7 // (c) Copyright Rosetta Commons Member Institutions.
8 // (c) This file is part of the Rosetta software suite and is made available under license.
9 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
10 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
11 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
12 /// @author Rhiju Das
13 
14 #ifndef INCLUDED_protocols_rna_RNA_ChunkLibrary_HH
15 #define INCLUDED_protocols_rna_RNA_ChunkLibrary_HH
16 
18 
19 #include <core/pose/Pose.fwd.hh>
21 #ifdef WIN32
22 #include <core/pose/MiniPose.hh>
23 #endif
24 #include <core/types.hh>
25 #include <utility/pointer/ReferenceCount.hh>
26 #include <utility/pointer/owning_ptr.hh>
27 #include <utility/vector1.fwd.hh>
28 // AUTO-REMOVED #include <numeric/xyzVector.hh>
30 //#include <protocols/toolbox/AllowInsert.fwd.hh>
31 //#include <core/kinematics/tree/Atom.fwd.hh>
32 // AUTO-REMOVED #include <core/kinematics/tree/Atom.hh>
33 // AUTO-REMOVED #include <core/kinematics/FoldTree.hh>
34 // AUTO-REMOVED #include <core/id/AtomID.hh>
35 
36 
37 // ObjexxFCL Headers
38 #include <ObjexxFCL/FArray1D.hh>
39 
40 // C++ Headers
41 #include <string>
42 #include <map>
43 
44 #include <utility/vector1.hh>
45 
46 
47 
48 /////////////////////////////////////////////////////////////////////////////////////
49 /////////////////////////////////////////////////////////////////////////////////////
50 //
51 // This is a kind of generalized fragment library, where mini poses that
52 // have putative solutions for junctions, loops, internal loops etc. can be switched into a
53 // larger pose. Does not require ideal geometry
54 // Note that the class is actually not that RNA specific, so perhaps may be useful for others,
55 // although I'm currently only developing it for pieces connected to RNA stems.
56 // Maybe has overlap with CartesianFragment class used by DNA people, but I find this somewhat
57 // less confusing.
58 // The only thing to be wary of ... the fold tree must be set up with chainbreaks in the "right places"...
59 // basically one at eery junction.
60 //
61 //
62 
63 namespace protocols{
64 namespace rna{
65 
67  public:
68 
69  //constructor!
71  core::pose::ResMap const & res_map );
72 
74  core::pose::ResMap const & res_map );
75 
76  // Need a clone();
77 
78  //destructor -- necessary?
79  virtual ~ChunkSet();
80 
81  void
82  insert_chunk_into_pose( core::pose::Pose & pose, Size const & chunk_pose_index, protocols::toolbox::AllowInsertOP const & allow_insert ) const;
83 
84  Size
85  num_chunks() const{ return mini_pose_list_.size(); };
86 
87  std::map< core::id::AtomID, core::id::AtomID >
88  get_atom_id_map( core::pose::Pose & pose, protocols::toolbox::AllowInsertOP const & allow_insert ) const;
89 
90  core::pose::MiniPoseOP const mini_pose( Size const idx ) const;
91 
92  bool
93  check_fold_tree_OK( core::pose::Pose const & pose );
94 
95  private:
96 
97  void filter_atom_id_map_with_mask( std::map< core::id::AtomID, core::id::AtomID > & atom_id_map ) const;
98 
101  std::map< core::id::AtomID, bool > atom_id_mask_;
102 
103  };
104 
105 
106  /////////////////////////////////////////////////////////////////////////////////////////////////
107  /////////////////////////////////////////////////////////////////////////////////////////////////
109  public:
110 
112 
113  // constructor -- needs a list of silent files. Each silent file
114  // has solutions for a particular piece of the desired pose.
115  // this will be deprecated soon...
117  core::pose::Pose const & pose,
118  std::map< Size, Size > const & connections_in_big_pose /* to figure out mapping to big pose*/
119  );
120 
121  // default constructor.
123  utility::vector1 < std::string > const & pdb_files,
124  utility::vector1 < std::string > const & silent_files,
125  core::pose::Pose const & pose,
126  utility::vector1< core::Size > const & input_res );
127 
128  // should not be in use in the future...
130  utility::vector1 < std::string > const & silent_files,
131  core::pose::Pose const & pose,
132  utility::vector1< core::Size > const & input_res );
133 
134  //destructor
136 
137  // default constructor.
138  void
140  utility::vector1 < std::string > const & pdb_files,
141  utility::vector1 < std::string > const & silent_files,
142  core::pose::Pose const & pose,
143  utility::vector1< core::Size > const & input_res );
144 
145  Size num_chunk_sets() const { return chunk_sets_.size(); };
146 
147  Size num_chunks( Size const n ) const { return chunk_sets_[ n ]->num_chunks(); };
148 
149  ChunkSetOP chunk_set( Size const n ) const { return chunk_sets_[ n ]; };
150 
151  void add_chunk_set( std::string const & silent_file,
152  core::pose::ResMap const & res_map,
153  core::pose::Pose const & big_pose );
154 
156  Size const & chunk_list_index,
157  Size const & chunk_pose_index ) const;
158 
159  bool
161 
162  void
163  initialize_random_chunks( core::pose::Pose & pose, bool const dump_pdb = false ) const;
164 
166 
168 
169  core::Real const & chunk_coverage() const{ return chunk_coverage_; };
170 
171  void
173 
174  bool
175  check_fold_tree_OK( core::pose::Pose const & pose );
176 
177  private:
178 
179  void
180  zero_out_allow_insert( core::pose::ResMap const & res_map,
181  core::pose::Pose const & pose,
182  core::pose::Pose const & scratch_pose,
183  Size const domain_num );
184 
185  bool
186  check_fold_tree_OK( core::pose::ResMap const & res_map,
187  core::pose::Pose const & pose,
188  core::pose::Pose const & scratch_pose );
189  void
191 
192  void
194  core::pose::Pose const & pose,
197  utility::vector1< core::Size > & sequence_start ) const;
198 
199  void
200  process_input_file( std::string const & silent_file,
202  bool is_pdb = false ) const;
203 
204  void
207  core::pose::Pose const & scratch_pose,
208  std::string const & sequence_of_big_pose,
209  std::map< Size, Size > const & connections_in_big_pose ) const;
210 
211  void
213  utility::vector1< Size > const & chain_id,
214  utility::vector1< Size > const & scratch_sequence_start,
215  utility::vector1< std::string > const & scratch_sequences,
216  utility::vector1< utility::vector1< Size > > const & matches_to_each_scratch_sequence,
217  core::pose::Pose const & scratch_pose,
218  std::map< Size, Size > const & connections_in_big_pose,
219  utility::vector1< core::pose::ResMap > & res_maps ) const;
220 
221  void
222  get_sequence_matches( utility::vector1< utility::vector1< Size > > & matches_to_each_scratch_sequence,
223  utility::vector1< std::string > const & scratch_sequences,
224  std::string const & sequence_of_big_pose ) const;
225 
226  void
227  check_connections( Size const & num_chain, core::pose::ResMap & res_map,
228  utility::vector1< Size > const & chain_id,
229  utility::vector1< Size > const & scratch_sequence_start,
230  utility::vector1< std::string > const & scratch_sequences,
231  utility::vector1< utility::vector1< Size > > const & matches_to_each_scratch_sequence,
232  core::pose::Pose const & scratch_pose,
233  std::map< Size, Size > const & connections_in_big_pose,
234  utility::vector1< core::pose::ResMap > & res_maps ) const;
235 
236  bool
237  fill_res_map( core::pose::ResMap & res_map, Size const & match_pos, Size const & scratch_start_pos, Size const & scratch_sequence_length ) const;
238 
239  void
240  test_matches( Size const & res1, Size const & res2, core::pose::ResMap & res_map,
241  utility::vector1< Size > const & chain_id,
242  utility::vector1< Size > const & scratch_sequence_start,
243  utility::vector1< std::string > const & scratch_sequences,
244  utility::vector1< utility::vector1< Size > > const & matches_to_each_scratch_sequence,
245  core::pose::Pose const & scratch_pose,
246  std::map< Size, Size > const & connections_in_big_pose,
247  utility::vector1< core::pose::ResMap > & res_maps ) const;
248 
249  bool
250  check_res_map( core::pose::ResMap const & res_map, core::pose::Pose const & scratch_pose, std::string const & sequence ) const;
251 
252  void
253  check_res_map_recursively( core::pose::ResMap const & res_map_old,
254  utility::vector1< std::string > const & scratch_sequences,
255  utility::vector1< utility::vector1< Size > > const & matches_to_each_scratch_sequence,
256  core::pose::Pose const & scratch_pose,
257  std::map< Size, Size > const & connections_in_big_pose,
258  utility::vector1< core::Size > const & chain_id,
259  core::Size const & num_sequence,
260  core::Size const & num_match,
261  utility::vector1< core::pose::ResMap > & res_maps ) const;
262  bool
264  core::pose::Pose const & scratch_pose,
265  std::map< core::Size, core::Size > const & connections_in_big_pose,
266  core::pose::ResMap const & res_map,
267  utility::vector1< Size > const & chain_id ) const;
268 
269  void
270  align_to_chunk( core::pose::Pose & pose, ChunkSet const & chunk_set, core::Size const chunk_index ) const;
271 
272  private:
273 
276  ObjexxFCL::FArray1D <bool> covered_by_chunk_;
279 
280  };
281 
282 
283 
284 }
285 }
286 
287 #endif