[project @ 13]
[mussa.git] / sequence.hh
1 //  This file is part of the Mussa source distribution.
2 //  http://mussa.caltech.edu/
3 //  Contact author: Tristan  De Buysscher, tristan@caltech.edu
4
5 // This program and all associated source code files are Copyright (C) 2005
6 // the California Institute of Technology, Pasadena, CA, 91125 USA.  It is
7 // under the GNU Public License; please see the included LICENSE.txt
8 // file for more information, or contact Tristan directly.
9
10
11 //                        ----------------------------------------
12 //                           ---------- sequence.hh -----------
13 //                        ----------------------------------------
14
15
16 #include <iostream>
17 #include <iomanip>
18 #include <list>
19 #include <vector>
20 #include <string>
21 #include <fstream>
22 #include <stdlib.h>
23 #include <algorithm>
24
25 // Sequence data class
26
27 using namespace std;
28
29 struct annot
30 {
31   int start, end;
32   string name, type;
33 };
34
35 class Sequence
36 {
37   friend class ConnView;
38   friend class SeqView;
39   private:
40     string sequence;
41     int length;
42     string header;
43     string species;
44     int species_num; 
45
46
47     list<annot> annots;
48
49     void motif_scan(string a_motif, vector<int> * motif_match_starts);
50     string rc_motif(string a_motif);
51     string motif_validate(string a_motif);
52
53   public:
54     Sequence();
55     string load_fasta(string file_path, int seq_num, 
56                     int start_index, int end_index);
57     string load_annot(string file_path, int start_index, int end_index);
58     string seq();
59     string subseq(int start, int end);
60     const char * c_seq();
61     string rev_comp();
62     int len();
63     string hdr();
64     void set_seq(string a_seq);
65     vector<int> find_motif(string a_motif);
66     string sp_name();
67     void clear();
68     void save(fstream &save_file);
69     void load_museq(string load_file_path, int seq_num); 
70 };