GlfRecord.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __GLF_RECORD_H__
00019 #define __GLF_RECORD_H__
00020
00021 #include <map>
00022 #include <stdint.h>
00023
00024 #include "InputFile.h"
00025 #include "CharBuffer.h"
00026
00027 class GlfRecord
00028 {
00029 public:
00030 GlfRecord();
00031 ~GlfRecord();
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 void reset();
00043
00044
00045
00046 bool read(IFILE filePtr);
00047
00048
00049 bool write(IFILE filePtr) const;
00050
00051 void print() const;
00052
00053
00054 bool setRtypeRef(uint8_t rtypeRef);
00055 bool setRecordType(uint8_t recType);
00056 bool setRefBaseInt(uint8_t refBase);
00057
00058 bool setOffset(uint32_t offset);
00059 bool setMinDepth(uint32_t minDepth);
00060 bool setMinLk(uint8_t minLk);
00061 bool setReadDepth(uint32_t readDepth);
00062 bool setRmsMapQ(uint8_t rmsMapQ);
00063
00064
00065
00066 bool setLk(int index, uint8_t value);
00067
00068
00069
00070 bool setLkHom1(uint8_t lk);
00071 bool setLkHom2(uint8_t lk);
00072 bool setLkHet(uint8_t lk);
00073 bool setInsertionIndel1(const std::string& indelSeq);
00074 bool setDeletionIndel1(const std::string& indelSeq);
00075 bool setInsertionIndel2(const std::string& indelSeq);
00076 bool setDeletionIndel2(const std::string& indelSeq);
00077
00078
00079 inline int getRecordType() const
00080 {
00081 return(myRecTypeRefBase >> REC_TYPE_SHIFT);
00082 }
00083 inline int getRefBase() const
00084 {
00085 return(myRecTypeRefBase & REF_BASE_MASK);
00086 }
00087
00088 char getRefBaseChar() const;
00089 uint32_t getOffset();
00090 uint8_t getMinDepth();
00091 uint8_t getMinLk();
00092 uint32_t getReadDepth();
00093 uint8_t getRmsMapQ();
00094
00095
00096
00097 uint8_t getLk(int index);
00098
00099
00100
00101 uint8_t getLkHom1();
00102 uint8_t getLkHom2();
00103 uint8_t getLkHet();
00104 int16_t getIndel1(std::string& indelSeq);
00105 int16_t getIndel2(std::string& indelSeq);
00106
00107
00108 private:
00109
00110 void readType1(IFILE filePtr);
00111
00112
00113 void readType2(IFILE filePtr);
00114
00115
00116
00117 void writeRtypeRef(IFILE filePtr) const;
00118
00119
00120
00121 void writeType1(IFILE filePtr) const;
00122
00123
00124 void writeType2(IFILE filePtr) const;
00125
00126
00127 uint8_t myRecTypeRefBase;
00128
00129 static const uint8_t REC_TYPE_SHIFT = 4;
00130 static const uint8_t REF_BASE_MASK = 0xF;
00131 static const uint8_t REC_TYPE_MASK = 0xF0;
00132
00133 static const uint32_t MIN_LK_SHIFT = 24;
00134 static const uint32_t READ_DEPTH_MASK = 0xFFFFFF;
00135 static const uint32_t MIN_LK_MASK = 0xFF000000;
00136
00137 static const char REF_BASE_MAX = 15;
00138 static std::string REF_BASE_CHAR;
00139
00140 static const int NUM_REC1_LIKELIHOOD = 10;
00141
00142 struct
00143 {
00144 uint32_t offset;
00145 uint32_t min_depth;
00146 uint8_t rmsMapQ;
00147 uint8_t lk[NUM_REC1_LIKELIHOOD];
00148 } myRec1Base;
00149
00150 static const int REC1_BASE_SIZE = 19;
00151
00152 struct
00153 {
00154 uint32_t offset;
00155 uint32_t min_depth;
00156 uint8_t rmsMapQ;
00157 uint8_t lkHom1;
00158 uint8_t lkHom2;
00159 uint8_t lkHet;
00160 int16_t indelLen1;
00161 int16_t indelLen2;
00162 } myRec2Base;
00163
00164
00165 CharBuffer myIndelSeq1;
00166 CharBuffer myIndelSeq2;
00167
00168 static const int REC2_BASE_SIZE = 16;
00169
00170 };
00171
00172 #endif