00001
00006 #ifndef FASTA_SEQ_H
00007 #define FASTA_SEQ_H
00008
00009 #include <string>
00010 #include <iostream>
00011 #include <memory>
00012
00026 namespace bioinfo
00027 {
00048 template <typename seqtype = std::string>
00049 class fasta_seq
00050 {
00051 public:
00052
00053
00058 fasta_seq();
00059
00064 fasta_seq(const std::string&);
00065
00069 ~fasta_seq();
00070
00074 void
00075 write(const std::string&) const;
00076
00080 const
00081 std::string& get_header() const {
00082 return *(_fasta_seq.first);
00083 }
00084
00089 void
00090 set_header(std::string* str) {
00091 _fasta_seq.first.reset(str);
00092 }
00093
00100 const seqtype&
00101 get_seq() const {
00102 return *(_fasta_seq.second);
00103 }
00104
00109 seqtype&
00110 get_seq() {
00111 return *(_fasta_seq.second);
00112 }
00113
00117 void read(const std::string&);
00118
00119 private:
00120 std::pair<std::auto_ptr<std::string>,std::auto_ptr<seqtype> > _fasta_seq;
00121 };
00122
00123 }
00124
00125 namespace std
00126 {
00128 template<typename seqtype>
00129 ostream& operator<<(ostream&, const bioinfo::fasta_seq<seqtype>& );
00130
00131 template<typename seqtype>
00132 istream& operator>>(istream&, const bioinfo::fasta_seq<seqtype>& );
00134 }
00135
00136
00137 #include "fasta_seq.hpp"
00138
00139 #endif // FASTA_SEQ_H