Update mussa to build on ubuntu 10.04 with qt 4.6.2 +boost 1.40.0.1
[mussa.git] / alg / flp.hpp
index 0f5f892234ae4fac78093db0885bf8cad115191a..2aed0ba4845dc5ba576b01b5746bde288bd67e11 100644 (file)
@@ -13,7 +13,6 @@
 //                        ----------------------------------------
 //                            ---------- flp.hh  -----------
 //                        ----------------------------------------
-
 #include <boost/filesystem/path.hpp>
 
 #include <list>
 #include <vector>
 #include <iostream>
 
+class Sequence;
 //! FLP = Fixed Length Pairs (Data)
 /*!
  * vector of linked lists of the match type struct
  */
 class FLPs
 {
-  public:
+public:
+    typedef size_t size_type;
+    
     FLPs();
+    FLPs(const FLPs& );
     //! Setup a FLP and reserve space for the match lists
     /*!
      * Initialize the all_matches structure with a list of matches
@@ -46,10 +49,10 @@ class FLPs
 
     void setup(int win_size, int hard_thres);
     //! compare two sequences and store the list of results in all_matches
-    void seqcomp(std::string seq1, std::string seq2, bool is_RC);
+    void seqcomp(const Sequence& seq1, const Sequence& seq2, bool is_RC);
     //bool FLPs::match_less(match *match1, match *match2);
     //void FLPs::sort();
-    //! Return all the matches for a particular window?
+    //! Return all the matches for a particular window? (index and score pairs)
     std::list<match> matches(int index) const;
     //! Return all the match indexes for a particular window?
     std::list<int> match_locations(int index) const;
@@ -63,6 +66,11 @@ class FLPs
     void save(boost::filesystem::path save_file_path);
     //! Load a vector of a lists of FLPs
     void load(boost::filesystem::path file_path);
+
+    //! how far we are through current seqcomp
+    float progress() const;
+
+    const static int seqcomp_not_running = -1;
   private:
     //! the number of base pairs in the sliding window
     int window_size;
@@ -84,7 +92,14 @@ class FLPs
     /*! this is mostly so seqcomp can use operator[]
      */
     void alloc_matches(std::string::size_type len1=0);
-
-
+    
+    //! make sure that a sequence is acceptable to seqcomp
+    void validate_sequence(const Sequence&) const;
+    
+    //! current loop index
+    int seqcomp_i;
+    //! end seqcomp index (when terminating, seqcomp_i == seqcomp_end.
+    //! when not running seqcomp_i == seqcomp_end == seqcomp_not_running
+    int seqcomp_end;
 };
 #endif