Slice Tools libSlice |
SliceData.hhGo to the documentation of this file.00001 #ifndef SLICEDATA_HH 00002 #define SLICEDATA_HH 1 00003 00008 #include <string> 00009 #include "Exceptions.hh" 00010 #include "Slice.h" 00011 #include "ReadData.hh" 00012 #include "ConsensusData.hh" 00013 00026 namespace libSlice 00027 { 00028 class ConsensusData; 00029 00038 class SliceData 00039 { 00040 public: 00041 SliceData(const ReadManager & readManager, 00042 const char * index, 00043 const char * gindex, 00044 const char * existing, 00045 long sliceRangeIndex=0, 00046 long sliceRangeGindex=0); 00047 00048 virtual ~SliceData(); 00049 00050 void addNuc (const char * nucData); 00051 void addQualVal (const char * qualVal); 00052 void addReadId (const char * readId); 00053 00054 00055 void print(ostream & out, const string & prefix = ""); 00056 void printError(ostream & out) const; 00057 void printXML(ostream & out, const string & prefix = " "); 00058 00059 int getErrorCode() const; 00060 int getErrorOperation() const; 00061 00062 void setDistributionTable(double freqA, double freqC, 00063 double freqG, double freqT, 00064 double freqGap); 00065 00066 void setHighQualityThreshold(int highQualityThreshold); 00067 void setDoAmbiguity(int doAmbiguity); 00068 void setScoringModel(int scoringModel); 00069 00070 ConsensusData doCalculations(bool recallEmpty = false); 00071 00073 enum SliceErrorCode 00074 { 00075 SLICE_NOERROR = 0, 00076 SLICE_ERR_GETCONSENSUS, 00077 SLICE_ERR_QV_NONNUMERIC, 00078 SLICE_ERR_UNDERFLOW, 00079 SLICE_ERR_OVERFLOW, 00080 SLICE_ERR_NO_READID, 00081 SLICE_ERR_CALCULATION_NOT_DONE 00082 }; 00083 00085 enum StringOperation 00086 { 00087 STROP_NONE = 0, 00088 STROP_GET_QUAL_VAL, 00089 STROP_IS_REVERSE_COMPLIMENT 00090 }; 00091 00092 unsigned short getDepth() const; 00093 ReadData * getRead(unsigned short index) const; 00094 long getIndex() const; 00095 long getGindex() const; 00096 00097 char getBase(unsigned short index); 00098 char getQualVal(unsigned short index); 00099 char getConsensus(); 00100 00101 static char getBaseCompliment(char base); 00102 00103 const string & getNucData() const; 00104 const string & getQualValData() const; 00105 const string & getReadIdData() const; 00106 00107 void resetIndex(long index, long gindex); 00108 void resetReadId(); 00109 void resetQualVal(); 00110 void resetNuc(); 00111 void setConsensus(char consensus); 00112 00113 00114 private: 00115 const ReadManager & m_readManager; 00116 00117 void flattenSlice(); 00118 00119 char * getBases(int len) const; 00120 00121 char getExisting() const; 00122 char * getQualVals(int len); 00123 char * getReverseCompliments(int len); 00124 char * foreach(const string & data, int numresults, 00125 StringOperation operation, 00126 const char * underflowError, 00127 const char * overflowError); 00128 00129 libSlice_Slice * m_slice; 00130 00131 long m_index; 00132 long m_gindex; 00133 string m_existing; 00134 string m_indexstr; 00135 00136 string m_nucData; 00137 string m_qualValData; 00138 string m_readIdData; 00139 00140 int m_highQualityThreshold; 00141 int m_doAmbiguity; 00142 int m_scoringModel; 00143 00144 libSlice_BaseDistribution m_distribution; 00145 00146 SliceErrorCode m_errorCode; 00147 StringOperation m_errorOperation; 00148 string m_errorData; 00149 }; 00150 } 00151 00152 ostream & operator<< (ostream & os, libSlice::SliceData & slice); 00153 ostream & operator<< (ostream & os, libSlice::SliceData * slice); 00154 00155 00156 #endif 00157 00158 |