massive code move
[mussa.git] / mussa_class.hh
1 #ifndef _MUSSA_CLASS_H_
2 #define _MUSSA_CLASS_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_class.hh -----------
15 //                        ----------------------------------------
16
17 #include <list>
18 #include <string>
19 #include <vector>
20
21 #include "mussa_nway.hh"
22 #include "sequence.hh"
23
24 std::string int_to_str(int an_int);
25
26 class Mussa
27 {
28   friend class MussaOverlord;
29   friend class ConnWindow;
30
31   private:
32     // Private variables
33     // parameters needed for a mussa analysis
34     std::string ana_name, file_path_base;
35     int seq_num, window, threshold, soft_thres;
36     char ana_mode;
37     double ent_thres;
38     std::list<std::string> seq_files, annot_files;
39     std::list<int> fasta_indices, sub_seq_starts, sub_seq_ends;
40     bool win_override, thres_override;
41     bool win_append, thres_append;
42
43     //! sequence data
44     std::vector<Sequence> the_Seqs;
45     //! the seqcomp data
46     std::vector<std::vector<FLPs> > all_comps;
47     //! N-way data, ie the mussa results  
48     Nway_Paths the_paths;
49
50
51     // Private methods
52     std::string get_Seqs();
53     void seqcomp();
54     void nway();
55
56
57   public:
58     Mussa();  
59
60     // parameters need to be set before calling this
61     // w & t are for command line override functionality, set to 0 to ignore
62     std::string analyze(int w, int t, char ana_mode, double ent_thres);
63     void save();
64     void save_muway(std::string save_path);
65     std::string load(std::string ana_file);
66
67     // clear parameters and initialize data lists
68     void clear();
69
70     // set parameters from a file - 'mupa' ~ mussa parameters
71     std::string load_mupa_file(std::string para_file_path);
72
73     // set parameters individually (eg from user input into gui classes)
74     void set_name(std::string a_name);
75     void set_seq_num(int a_num);
76     void set_window(int a_window);
77     void set_threshold(int a_threshold);
78     void set_soft_thres(int sft_thres);
79     void set_ana_mode(char new_ana_mode);
80    // sets an individual sequence to a string (no ATCGN checking atm) 
81     void add_a_seq(std::string a_seq);
82     // sets info to load a seq and annotations from a fasta file 
83     void set_seq_info(std::string seq_file, std::string annot_file, 
84                       int fa_i, int a_start, int the_end);
85
86     // deprecated - support bridge for python version of mussa
87     // these save & load from the old file format
88     void save_old();
89     void load_old(char * load_file_path, int s_num);
90 };
91 #endif