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 _HDF5SEQUENCE_H 00008 #define _HDF5SEQUENCE_H 00009 00010 #include <H5Cpp.h> 00011 #include "halSequence.h" 00012 #include "hdf5ExternalArray.h" 00013 #include "hdf5Genome.h" 00014 00015 namespace hal { 00016 00017 class HDF5SequenceIterator; 00018 00019 class HDF5Sequence : public Sequence 00020 { 00021 friend class HDF5SequenceIterator; 00022 00023 public: 00024 00029 HDF5Sequence(HDF5Genome* genome, 00030 HDF5ExternalArray* array, 00031 hal_index_t index); 00032 00034 ~HDF5Sequence(); 00035 00036 // SEQUENCE INTERFACE 00037 std::string getName() const; 00038 00039 const Genome* getGenome() const; 00040 00041 Genome* getGenome(); 00042 00043 hal_size_t getStartPosition() const; 00044 00045 hal_index_t getArrayIndex() const; 00046 00047 // SEGMENTED SEQUENCE INTERFACE 00048 00049 hal_size_t getSequenceLength() const; 00050 00051 hal_size_t getNumTopSegments() const; 00052 00053 hal_size_t getNumBottomSegments() const; 00054 00055 TopSegmentIteratorPtr getTopSegmentIterator( 00056 hal_index_t position); 00057 00058 TopSegmentIteratorConstPtr getTopSegmentIterator( 00059 hal_index_t position) const; 00060 00061 BottomSegmentIteratorPtr getBottomSegmentIterator( 00062 hal_index_t position); 00063 00064 BottomSegmentIteratorConstPtr getBottomSegmentIterator( 00065 hal_index_t position) const; 00066 00067 void getString(std::string& outString) const; 00068 00069 void setString(const std::string& inString); 00070 00071 void getSubString(std::string& outString, hal_size_t start, 00072 hal_size_t length) const; 00073 00074 void setSubString(const std::string& intString, 00075 hal_size_t start, 00076 hal_size_t length); 00077 00078 // LOCAL NON-INTERFACE METHODS 00079 00080 static H5::CompType dataType(hal_size_t maxNameLength); 00081 00082 void set(hal_size_t startPosition, const Sequence::Info& sequenceInfo); 00083 00084 protected: 00085 00086 static const size_t startOffset; 00087 static const size_t lengthOffset; 00088 static const size_t numTopSegmentsOffset; 00089 static const size_t numBottomSegmentsOffset; 00090 static const size_t nameOffset; 00091 00092 mutable HDF5ExternalArray* _array; 00093 mutable hal_index_t _index; 00094 mutable HDF5Genome* _genome; 00095 }; 00096 00097 } 00098 00099 #endif