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
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.
13 // ----------------------------------------
14 // ---------- sequence.hh -----------
15 // ----------------------------------------
23 // Sequence data class
25 //! Attach annotation information to a sequence track
29 std::string name, type;
32 //! sequence track for mussa.
35 friend class ConnView;
42 std::list<annot> annots;
44 void motif_scan(std::string a_motif, std::vector<int> * motif_match_starts);
45 std::string rc_motif(std::string a_motif);
46 std::string motif_validate(std::string a_motif);
48 typedef std::string::iterator iterator;
49 typedef std::string::const_iterator const_iterator;
50 typedef std::string::size_type size_type;
53 Sequence(std::string seq);
54 //! assignment to constant sequences
55 Sequence &operator=(const Sequence&);
56 Sequence &operator=(const std::string &);
58 //! set sequence to a (sub)string containing nothing but AGCTN
59 void set_filtered_sequence(const std::string& seq,
60 std::string::size_type start=0,
61 std::string::size_type count=0);
63 //! load sequence AGCT from fasta file
64 /*! \throws mussa_load_error
66 void load_fasta(const std::string file_path, int seq_num=1,
67 int start_index=0, int end_index=0);
68 //! load sequence annotations
69 /*! \throws mussa_load_error
71 void load_annot(const std::string file_path, int start_index, int end_index);
72 const std::list<annot> annotations() const;
74 // simple access functions
75 void set_seq(const std::string& a_seq);
76 const std::string& get_seq() const;
77 const char *c_seq() const;
78 std::string subseq(int start, int end) const;
79 std::string rev_comp() const;
81 // string-like functions
83 const_iterator begin() const;
85 const_iterator end() const;
87 //! alias for size, (included as this is much like a string)
88 std::string::size_type length() const;
89 //! the number of base pairs in this sequence
90 std::string::size_type size() const;
93 const std::string& get_header() const;
94 std::vector<int> find_motif(std::string a_motif);
95 void save(std::fstream &save_file);
96 void load_museq(std::string load_file_path, int seq_num);