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