Slice Tools libSlice |
ReadData.hhGo to the documentation of this file.00001 #ifndef READDATA_HH 00002 #define READDATA_HH 1 00003 00008 #include <string> 00009 #include <map> 00010 #include <map> 00011 #include <vector> 00012 00013 using namespace std; 00014 00015 /* 00016 template<> struct hash< std::string > 00017 { 00018 size_t operator()( const std::string& x ) const 00019 { 00020 return hash< const char* >()( x.c_str() ); 00021 } 00022 }; 00023 */ 00024 00025 namespace libSlice 00026 { 00027 using std::string; 00028 using std::map; 00029 using std::vector; 00030 00034 class ReadData 00035 { 00036 public: 00037 ReadData(const char * id, 00038 const char * seqname, 00039 const char * dir, 00040 const char * chem); 00041 00042 void addClrData (const char * left, 00043 const char * right); 00044 00045 void setClrData(long int clrleft, long int clrright); 00046 void setSeqData(long int seqleft, long int seqright); 00047 00048 void addNucData (const char * buffer, bool isLeft); 00049 void addQualData(const char * buffer, bool isLeft); 00050 00051 void flushTrimmedSeq(); 00052 void flushTrimmedSeqSide(bool flushLeft); 00053 00054 void reverseCompliment(); 00055 00056 void resetId(const string & id); 00057 00058 char isReverseCompliment() const; 00059 00060 void printXML(ostream & out, 00061 const string & prefix=" ") const; 00062 00063 long getSeqleft() const; 00064 long getSeqright() const; 00065 long getClrleft() const; 00066 long getClrright() const; 00067 00068 const string & getId() const; 00069 const string & getSeqname() const; 00070 const string & getChem() const; 00071 const string & getRawNucData(bool getLeft) const; 00072 const string & getRawQualData(bool getLeft) const; 00073 00074 const string getNucData(bool getLeft) const; 00075 const string getQualData(bool getLeft) const; 00076 00077 private: 00078 void validateSeqdata() const; 00079 void parseDirection(); 00080 00081 string m_id; 00082 string m_seqname; 00083 string m_dir; 00084 string m_chem; 00085 00086 string m_leftnuc; 00087 string m_leftqual; 00088 string m_rightnuc; 00089 string m_rightqual; 00090 00091 long m_seqleft; 00092 long m_seqright; 00093 long m_clrleft; 00094 long m_clrright; 00095 00096 char m_rc; 00097 }; 00098 00100 typedef map<string, ReadData *> ReadMap; 00101 00106 class ReadManager 00107 { 00108 public: 00109 ReadManager(); 00110 ~ReadManager(); 00111 00112 int size() const; 00113 00114 ReadData * addReadData(const char * id, 00115 const char * seqname, 00116 const char * dir, 00117 const char * chem); 00118 00119 void insertRead(ReadData * rd); 00120 00121 void resetReadId(ReadData * rd, const string & id); 00122 void removeRead(const string & id); 00123 00124 ReadData * getNextRead(); 00125 void resetReadIterator(); 00126 00127 void printXML(ostream & out, const string & prefix=" ") const; 00128 00129 ReadData * find(const string & readId) const; 00130 00131 private: 00132 00133 ReadMap m_readMap; 00134 ReadMap::const_iterator m_readIterator; 00135 }; 00136 } 00137 00138 #endif |