Update mussa to build on ubuntu 10.04 with qt 4.6.2 +boost 1.40.0.1
[mussa.git] / alg / conserved_path.hpp
1 #ifndef _CONSERVED_PATH_H
2 #define _CONSERVED_PATH_H
3 #include <vector>
4 #include <ostream>
5
6 struct ConservedPath
7 {
8   typedef int path_element;
9   typedef std::vector<path_element> path_type;
10   typedef path_type::iterator iterator;
11   typedef path_type::const_iterator const_iterator;
12   typedef path_type::size_type size_type;
13
14   ConservedPath();
15   ConservedPath(const ConservedPath& );
16   ConservedPath(size_t window_size, double score, path_type path);
17
18   //! reset our path to be empty (including setting threshold to 0)
19   void clear();
20   path_element& operator[](size_type index);
21   void push_back(const path_element& );
22   void pop_back();
23
24   size_type size() const;
25   iterator begin();
26   const_iterator begin() const;
27   iterator end();
28   const_iterator end() const;
29
30   friend bool operator==(const ConservedPath& a, const ConservedPath &b);
31   friend bool operator!=(const ConservedPath& a, const ConservedPath &b);
32   friend bool operator<(const ConservedPath& a, const ConservedPath &b);
33   friend std::ostream& operator<<(std::ostream&, const ConservedPath&);
34
35   //! return true if all elements of the path are "next to" our current path.
36   /*! Next to is defined as being window index + 1
37    *  that definition may not properly track reverse compliment
38    *  \throws conserved_path_size_mismatch
39    */
40   bool nextTo(const ConservedPath& next) const;
41   //! indicate which elements of the path are reversed
42   std::vector<bool> reverseComplimented() const;
43   //! return the list of indexes normalized (to the left)
44   path_type normalizedIndexes() const;
45   //! extend our current path
46   //! (aka increment our window size  by growth)
47   ConservedPath& extend(int growth=1);
48
49   //! window size (really should always be positive
50   size_t window_size;
51   //! either number of conserved bases or average entropy
52   double score;
53   //! offsets into each of our sequences representing the start of our window
54   path_type track_indexes;
55 };
56 #endif