halapi hierarchichalalignmentformatapi

- Main Page
- Namespaces
- Classes
- Files

- File List

hdf5_impl/hdf5Genome.h

    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 _HDF5GENOME_H
    00008 #define _HDF5GENOME_H
    00009
    00010 #include <H5Cpp.h>
    00011 #include "halGenome.h"
    00012 #include "hdf5ExternalArray.h"
    00013 #include "hdf5Alignment.h"
    00014 #include "halTopSegmentIterator.h"
    00015 #include "halBottomSegmentIterator.h"
    00016 #include "hdf5MetaData.h"
    00017
    00018
    00019 namespace hal {
    00020
    00021 class HDF5TopSegmentIterator;
    00022 class HDF5BottomSegmentIterator;
    00023 class HDF5DNAIterator;
    00024 class HDF5SequenceIterator;
    00025 class HDF5Alignment;
    00026 class HDF5Sequence;
    00030 class HDF5Genome : public Genome
    00031 {
    00032    friend class HDF5TopSegmentIterator;
    00033    friend class HDF5BottomSegmentIterator;
    00034    friend class HDF5DNAIterator;
    00035    friend class HDF5SequenceIterator;
    00036 public:
    00037
    00038    HDF5Genome(const std::string& name,
    00039               HDF5Alignment* alignment,
    00040               H5::CommonFG* h5Parent,
    00041               const H5::DSetCreatPropList& dcProps);
    00042
    00043    virtual ~HDF5Genome();
    00044
    00045    // GENOME INTERFACE
    00046
    00047    const std::string& getName() const;
    00048
    00049    void setDimensions(
    00050      const std::vector<hal::Sequence::Info>& sequenceDimensions);
    00051
    00052    void setTopDimensions(
    00053      const std::vector<hal::Sequence::UpdateInfo>& sequenceDimensions);
    00054
    00055    void setBottomDimensions(
    00056      const std::vector<hal::Sequence::UpdateInfo>& sequenceDimensions);
    00057
    00058    hal_size_t getNumSequences() const;
    00059
    00060    Sequence* getSequence(const std::string& name);
    00061
    00062    const Sequence* getSequence(const std::string& name) const;
    00063
    00064    Sequence* getSequenceBySite(hal_size_t position);
    00065    const Sequence* getSequenceBySite(hal_size_t position) const;
    00066
    00067    SequenceIteratorPtr getSequenceIterator(
    00068      hal_index_t position);
    00069
    00070    SequenceIteratorConstPtr getSequenceIterator(
    00071      hal_index_t position) const;
    00072
    00073    MetaData* getMetaData();
    00074
    00075    const MetaData* getMetaData() const;
    00076
    00077    Genome* getParent();
    00078
    00079    const Genome* getParent() const;
    00080
    00081    Genome* getChild(hal_size_t childIdx);
    00082
    00083    const Genome* getChild(hal_size_t childIdx) const;
    00084
    00085    hal_size_t getNumChildren() const;
    00086
    00087    // SEGMENTED SEQUENCE INTERFACE
    00088
    00089    hal_size_t getSequenceLength() const;
    00090
    00091    hal_size_t getNumTopSegments() const;
    00092
    00093    hal_size_t getNumBottomSegments() const;
    00094
    00095    TopSegmentIteratorPtr getTopSegmentIterator(
    00096      hal_index_t position);
    00097
    00098    TopSegmentIteratorConstPtr getTopSegmentIterator(
    00099      hal_index_t position) const;
    00100
    00101    BottomSegmentIteratorPtr getBottomSegmentIterator(
    00102      hal_index_t position);
    00103
    00104    BottomSegmentIteratorConstPtr getBottomSegmentIterator(
    00105      hal_index_t position) const;
    00106
    00107    void getString(std::string& outString) const;
    00108
    00109    void setString(const std::string& inString);
    00110
    00111    void getSubString(std::string& outString, hal_size_t start,
    00112                              hal_size_t length) const;
    00113
    00114    void setSubString(const std::string& intString,
    00115                              hal_size_t start,
    00116                              hal_size_t length);
    00117
    00118    // HDF5 SPECIFIC
    00119    void write();
    00120    void read();
    00121    void create();
    00122    void resetTreeCache();
    00123
    00124 protected:
    00125
    00126    void readSequences();
    00127    void writeSequences(const std::vector<hal::Sequence::Info>&
    00128                        sequenceDimensions);
    00129    void deleteSequenceCache();
    00130
    00131 protected:
    00132
    00133    HDF5Alignment* _alignment;
    00134    H5::CommonFG* _h5Parent;
    00135    AlignmentPtr _alignmentPtr;
    00136    std::string _name;
    00137    HDF5MetaData* _metaData;
    00138    HDF5ExternalArray _dnaArray;
    00139    HDF5ExternalArray _topArray;
    00140    HDF5ExternalArray _bottomArray;
    00141    HDF5ExternalArray _sequenceArray;
    00142    H5::Group _group;
    00143    H5::DSetCreatPropList _dcprops;
    00144    hal_size_t _numChildrenInBottomArray;
    00145
    00146    mutable Genome* _parentCache;
    00147    mutable std::vector<Genome*> _childCache;
    00148    mutable std::map<hal_size_t, HDF5Sequence*> _sequencePosCache;
    00149    mutable std::map<std::string, HDF5Sequence*> _sequenceNameCache;
    00150
    00151    static const std::string dnaArrayName;
    00152    static const std::string topArrayName;
    00153    static const std::string bottomArrayName;
    00154    static const std::string sequenceArrayName;
    00155    static const std::string metaGroupName;
    00156 };
    00157
    00158
    00159 }
    00160 #endif
    00161

All Classes Namespaces Functions Variables Friends