fix more warnings
[mussa.git] / alg / nway_paths.hpp
1 #ifndef _MUSSA_NWAY_H_
2 #define _MUSSA_NWAY_H_
3 //  This file is part of the Mussa source distribution.
4 //  http://mussa.caltech.edu/
5 //  Contact author: Tristan  De Buysscher, tristan@caltech.edu
6
7 // This program and all associated source code files are Copyright (C) 2005
8 // the California Institute of Technology, Pasadena, CA, 91125 USA.  It is
9 // under the GNU Public License; please see the included LICENSE.txt
10 // file for more information, or contact Tristan directly.
11
12
13 //                        ----------------------------------------
14 //                         ----------  mussa_nway.hh  -----------
15 //                        ----------------------------------------
16
17 #include <list>
18 #include <string>
19 #include <vector>
20
21 #include "alg/flp.hpp"
22 #include "alg/conserved_path.hpp"
23
24 class NwayPaths
25 {
26   friend class ConnView;
27   friend class SeqView;
28   protected:
29     int threshold;
30     int win_size;
31     int soft_thres;
32
33     double ent_thres;
34     std::vector<char *> c_sequences; //used by entropy_path_search
35
36   public:
37     NwayPaths();
38     //! setup an nway comparison, initialize # of species, window size, 
39     //! threshold
40     void setup(int w, int t);
41     void setup_ent(double new_entropy_thres, std::vector<std::string> some_Seqs);
42     void set_soft_thres(int soft_thres);
43     //! return minimum threshold for this analysis
44     int get_threshold() const;
45     //! return window size used for this analysis
46     int get_window() const;
47
48     void radiate_path_search(std::vector<std::vector<FLPs> > all_comparisons);
49     void trans_path_search(std::vector<std::vector<FLPs> > all_comparisons);
50     void entropy_path_search(std::vector<std::vector<FLPs> > all_comparisons);
51     double path_entropy(std::vector<int> path);
52
53   // old recursive transitive nway ... has issues checking all links?
54     void find_paths_r(std::vector<std::vector<FLPs> > all_comparisons);
55     void path_search(std::vector<std::vector<FLPs> > all_comparisons, ConservedPath path, size_t depth);
56
57     void simple_refine();
58     void save(std::string save_file_path);
59     //! load a muway file, \throws mussa_load_error
60     void load(std::string load_file_path);
61     void add_path(int threshold, std::vector<int>& loaded_path);
62     void add_path(ConservedPath loaded_path);
63     //! how many sequences are in our comparison
64     size_t sequence_count();
65
66     void find_paths(std::vector<std::vector<FLPs> > all_comparisons);
67     void refine();
68
69     void save_old(std::string save_file_path);
70     void print(std::list<std::vector<int> >&);
71
72     std::list<ConservedPath>::iterator pbegin() { return pathz.begin() ; }
73     std::list<ConservedPath>::iterator pend() { return pathz.end() ; }
74     std::list<ConservedPath>::const_iterator pbegin() const { return pathz.begin() ; }
75     std::list<ConservedPath>::const_iterator pend() const { return pathz.end() ; }
76     std::list<ExtendedConservedPath>::iterator rpbegin() { return refined_pathz.begin() ; }
77     std::list<ExtendedConservedPath>::const_iterator rpend() const { return refined_pathz.end() ; }
78     std::list<ExtendedConservedPath>::const_iterator rpbegin() const { return refined_pathz.begin() ; }
79     std::list<ExtendedConservedPath>::iterator rpend() { return refined_pathz.end() ; }
80     // these probably shouldn't be public, but lets start 
81     // simple
82     std::list<ConservedPath> pathz;
83     std::list<ExtendedConservedPath > refined_pathz;
84 };
85 #endif