11a50cc69052ba86db2c5aabb6743e35362dc018
[mussa.git] / sequence.hh
1 #ifndef _MUSSA_SEQUENCE_H_
2 #define _MUSSA_SEQUENCE_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 //                           ---------- sequence.hh -----------
15 //                        ----------------------------------------
16
17
18 #include <fstream>
19 #include <list>
20 #include <string>
21 #include <vector>
22
23 // Sequence data class
24
25 using namespace std;
26
27 struct annot
28 {
29   int start, end;
30   std::string name, type;
31 };
32
33 class Sequence
34 {
35   friend class ConnView;
36   friend class SeqView;
37   private:
38     std::string sequence;
39     std::string header;
40     std::string species;
41     int species_num; 
42
43     std::list<annot> annots;
44
45     void motif_scan(std::string a_motif, std::vector<int> * motif_match_starts);
46     std::string rc_motif(std::string a_motif);
47     std::string motif_validate(std::string a_motif);
48
49   public:
50     Sequence();
51     std::string load_fasta(std::string file_path, int seq_num, 
52                     int start_index, int end_index);
53     std::string load_annot(std::string file_path, int start_index, int end_index);
54     std::string seq();
55     std::string subseq(int start, int end);
56     const char * c_seq();
57     std::string rev_comp();
58     int len();
59     std::string hdr();
60     void set_seq(std::string a_seq);
61     std::vector<int> find_motif(std::string a_motif);
62     std::string sp_name();
63     void clear();
64     void save(std::fstream &save_file);
65     void load_museq(std::string load_file_path, int seq_num); 
66 };
67 #endif