Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FragSet.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 // :noTabs=false:tabSize=4:indentSize=4:
4 //
5 // (c) Copyright Rosetta Commons Member Institutions.
6 // (c) This file is part of the Rosetta software suite and is made available under license.
7 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
8 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
9 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
10 
11 /// @file core/fragments/FragSet.hh
12 /// @brief set of fragments
13 /// @author Oliver Lange ( olange@u.washington.edu)
14 /// @date Wed Aug 22 12:08:31 2007
15 ///
16 
17 #ifndef INCLUDED_core_fragment_FragSet_HH
18 #define INCLUDED_core_fragment_FragSet_HH
19 
20 // Unit Headers
22 
23 // Package Headers
24 #include <core/types.hh>
27 // AUTO-REMOVED #include <core/fragment/FrameIterator.hh>
28 // AUTO-REMOVED #include <core/fragment/FrameList.hh>
29 
30 // Project headers
32 
33 // Utility headers
34 // AUTO-REMOVED #include <utility/vector1.hh>
35 #include <utility/pointer/ReferenceCount.hh>
36 
39 #include <utility/vector1.hh>
40 
41 #ifdef WIN32
42  #include <core/fragment/FragID.hh>
43 #endif
44 
45 
46 // Package Headers
47 
48 namespace core {
49 namespace fragment {
50 
51 ///@detail The FragSet: (Interface Definition -- Virtual BaseClass )
52 /*
53  The FragSet is the basic interface to communicate with mover classes. Its main purpose is a fast access
54  to fragments by seqpos. More functionality might be coming.
55 
56  To access fragments:
57 
58  by region: --> region( .. )
59  all frames: FrameIterator it = fragset.begin() ... fragset.end()
60  all fragments: FragID_Iterator it = fragset.begin() ... fragset.end()
61 
62  Two simple extensions are already provided:
63  ConstantLengthFragSet: fragments are stored by their start-sequence position, only one frame per position
64  OrderFragSet: fragments are stored by their start-sequence position, multiple frames per position
65  what might be useful: a map from position to all fragments that overlap with that position
66 
67 */
68 
69 
71 
72  //how to iterate over fragments that fit certain search criteria ?
73 public:
74  FragSet() : min_pos_ ( 100000 ), max_pos_( 0 ), max_frag_length_( 0 )
75  {}
76 
77  virtual ~FragSet() {}
78 
79  ///@brief clone and copy the pointer of all Frames (Frames will not be copied)
80  virtual FragSetOP clone() const = 0;
81 
82  ///@brief create an empty clone
83  virtual FragSetOP empty_clone() const = 0;
84 
85 
86  ///@brief iterate over contents
87  virtual FrameIterator begin() const = 0;
88  virtual FrameIterator end() const = 0;
89 
90  ///@brief appends frames at sequence position pos to frames, returns nr of frames added
91  virtual Size frames( core::Size pos, FrameList &frames ) const {
92  return region_simple( pos, pos, frames);
93  }
94 
95  ///@brief returns fragments that exactly span seq_pos start...end
97  // return region( start, end, end-start+1, end-start+1, frames );
98  return region_all( start, end, end-start+1, end-start+1, frames );
99  }
100 
101  ///@brief return a list of frames that all sample the specified region, assume all motions are allowed
102  virtual Size region_all(
104  core::Size end,
105  core::Size min_overlap,
106  core::Size min_length,
108  ) const;
109 
110  ///@brief the region thing has to be thought-over. How do we really want to sample fragments?
111  /// for now, we ignore everything in this call and just return frags that have "start" as there specified start() entry.
112  virtual Size region(
113  kinematics::MoveMap const& move_map,
115  core::Size end,
116  core::Size min_overlap,
117  core::Size min_length,
119  ) const = 0;
120 
121  ///@brief InsertMap and InsertSize gives quick overview which residues can be affected by fragments.
122  /// insert_map --- list of start-positions, insert_size corresponding list of longest fragment at position x
123  virtual void generate_insert_map( kinematics::MoveMap const& mm, InsertMap &insert_map, InsertSize &insert_size) const;
124 
125  ///@brief returns the maximal sequence position that can be affected by fragments in this set
126  Size max_pos() const
127  { return max_pos_; }
128 
129  ///@brief returns the first sequence position that can be affected by fragments in this set
130  Size min_pos() const
131  { return min_pos_; }
132 
133  ///@brief returns the longest fragment stored in this FragSet.
135  { return max_frag_length_; }
136 
137  ///@brief add a single frame. if compatible frame is already in set the frames will be merged
138  void add( FrameOP aFrame );
139 
140  ///@brief add all Frames in list
141  void add( FrameList const& frames );
142 
143  ///@brief add all Frames in FragSet
144  void add( FragSet const& frames );
145 
146  ///@brief add single fragment
147  void add( FragID const& );
148 
149  // put all fragments in FragID_list into this FragSet.
150  // this function has the following effect:
151  // fragments that belong to the same frame are copied into a new frame
152  // the frame gets added. If all fragments of a frame are in the list, the frame is just added as is
153  //
154  void add( FragID_List & list ) { //need to work on const-correctness to make this a const-add
155  insert_fragID_list( list );
156  }
157 
158  ///@brief add all fragments in FragID_List
159  void insert_fragID_list( FragID_List & list );
160 
161  ///@brief returns total size--> counts together all frags in each frame
162  Size size() const;
163 
164  ///@brief counts number of frames ( slow! - it really counts )
165  Size nr_frames() const;
166 
167  virtual bool empty() const = 0;
168 
169  friend std::ostream & operator<<(std::ostream & out, FragSet const & frags );
170 
171 protected:
172  ///@brief setter for max_frag_length_
173  void set_max_frag_length( Size setting ) {
174  max_frag_length_ = setting;
175  }
176 
177  void set_max_pos( Size pos ) { max_pos_=pos; }
178  void set_min_pos( Size pos ) { min_pos_=pos; }
179 
180  /// @brief storage classes have to overload this one to add frames to their container
181  virtual void add_( FrameOP aFrame ) = 0;
182 
183 private:
187 
188 }; // class FragSet
189 
190 
191 
192 } /* core */
193 } /* fragment */
194 
195 #endif