halapi
hierarchichalalignmentformatapi
|
00001 /* 00002 * Copyright (C) 2012 by Glenn Hickey (hickey@soe.ucsc.edu) 00003 * 00004 * Released under the MIT license, see LICENSE.txt 00005 */ 00006 00007 #ifndef _HDF5TOPSEGMENT_H 00008 #define _HDF5TOPSEGMENT_H 00009 00010 #include <H5Cpp.h> 00011 #include "halTopSegment.h" 00012 #include "hdf5ExternalArray.h" 00013 #include "hdf5Genome.h" 00014 00015 namespace hal { 00016 00017 class HDF5TopSegmentIterator; 00018 class HDF5BottomSegmentIterator; 00019 00020 class HDF5TopSegment : public TopSegment 00021 { 00022 friend class HDF5TopSegmentIterator; 00023 friend class HDF5BottomSegmentIterator; 00024 00025 public: 00026 00031 HDF5TopSegment(HDF5Genome* genome, 00032 HDF5ExternalArray* array, 00033 hal_index_t index); 00034 00036 ~HDF5TopSegment(); 00037 00039 hal_size_t getLength() const; 00040 00043 void setLength(hal_size_t length); 00044 00046 const Genome* getGenome() const; 00047 00049 Genome* getGenome(); 00050 00052 hal_index_t getStartPosition() const; 00053 00056 void setStartPosition(hal_index_t startPos); 00057 00059 hal_index_t getNextParalogyIndex() const; 00060 00064 void setNextParalogyIndex(hal_index_t parIdx); 00065 00067 hal_index_t getParentIndex() const; 00068 00071 void setParentIndex(hal_index_t parIdx); 00072 00074 hal_bool_t getParentReversed() const; 00075 00078 void setParentReversed(hal_bool_t isReversed); 00079 00082 hal_index_t getBottomParseIndex() const; 00083 00087 void setBottomParseIndex(hal_index_t botParseIdx); 00088 00091 hal_offset_t getBottomParseOffset() const; 00092 00096 void setBottomParseOffset(hal_offset_t botParseOffset); 00097 00098 static H5::CompType dataType(); 00099 00101 hal_index_t getArrayIndex() const; 00102 00103 protected: 00104 00105 static const size_t genomeIndexOffset; 00106 static const size_t lengthOffset; 00107 static const size_t bottomIndexOffset; 00108 static const size_t bottomOffsetOffset; 00109 static const size_t parIndexOffset; 00110 static const size_t parentIndexOffset; 00111 static const size_t parentReversedOffset; 00112 static const size_t totalSize; 00113 00114 mutable HDF5ExternalArray* _array; 00115 mutable hal_index_t _index; 00116 mutable HDF5Genome* _genome; 00117 }; 00118 00119 //INLINE members 00120 inline hal_index_t HDF5TopSegment::getStartPosition() const 00121 { 00122 return _array->getValue<hal_index_t>(_index, genomeIndexOffset); 00123 } 00124 00125 inline void 00126 HDF5TopSegment::setStartPosition(hal_index_t startPos) 00127 { 00128 _array->setValue(_index, genomeIndexOffset, startPos); 00129 } 00130 00131 inline hal_size_t HDF5TopSegment::getLength() const 00132 { 00133 return _array->getValue<hal_size_t>(_index, lengthOffset); 00134 } 00135 00136 inline void 00137 HDF5TopSegment::setLength(hal_size_t length) 00138 { 00139 _array->setValue(_index, lengthOffset, length); 00140 } 00141 00142 inline const Genome* HDF5TopSegment::getGenome() const 00143 { 00144 return _genome; 00145 } 00146 00147 inline Genome* HDF5TopSegment::getGenome() 00148 { 00149 return _genome; 00150 } 00151 00152 inline hal_index_t HDF5TopSegment::getNextParalogyIndex() const 00153 { 00154 return _array->getValue<hal_index_t>(_index, parIndexOffset); 00155 } 00156 00157 inline void HDF5TopSegment::setNextParalogyIndex(hal_index_t parIdx) 00158 { 00159 _array->setValue(_index, parIndexOffset, parIdx); 00160 } 00161 00162 inline hal_index_t HDF5TopSegment::getParentIndex() const 00163 { 00164 return _array->getValue<hal_index_t>(_index, parentIndexOffset); 00165 } 00166 00167 inline void HDF5TopSegment::setParentIndex(hal_index_t parentIndex) 00168 { 00169 _array->setValue(_index, parentIndexOffset, parentIndex); 00170 } 00171 00172 inline hal_bool_t HDF5TopSegment::getParentReversed() const 00173 { 00174 return _array->getValue<hal_bool_t>(_index, parentReversedOffset); 00175 } 00176 00177 inline void HDF5TopSegment::setParentReversed(hal_bool_t isReversed) 00178 { 00179 _array->setValue(_index, parentReversedOffset, isReversed); 00180 } 00181 00182 inline hal_index_t HDF5TopSegment::getBottomParseIndex() const 00183 { 00184 return _array->getValue<hal_index_t>(_index, bottomIndexOffset); 00185 } 00186 00187 inline void HDF5TopSegment::setBottomParseIndex(hal_index_t parseIndex) 00188 { 00189 _array->setValue(_index, bottomIndexOffset, parseIndex); 00190 } 00191 00192 inline hal_offset_t HDF5TopSegment::getBottomParseOffset() const 00193 { 00194 return _array->getValue<hal_offset_t>(_index, bottomOffsetOffset); 00195 } 00196 00197 inline void HDF5TopSegment::setBottomParseOffset(hal_offset_t parseOffset) 00198 { 00199 _array->setValue(_index, bottomOffsetOffset, parseOffset); 00200 } 00201 00202 inline hal_index_t HDF5TopSegment::getArrayIndex() const 00203 { 00204 return _index; 00205 } 00206 00207 00208 } 00209 00210 #endif