halapi hierarchichalalignmentformatapi

- Main Page
- Namespaces
- Classes
- Files

- File List

hdf5_impl/hdf5Alignment.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 _HDF5ALIGNMENT_H
    00008 #define _HDF5ALIGNMENT_H
    00009
    00010 #include <map>
    00011 #include <H5Cpp.h>
    00012 #include "hdf5Alignment.h"
    00013 #include "halAlignmentInstance.h"
    00014 #include "hdf5Genome.h"
    00015 #include "hdf5MetaData.h"
    00016
    00017 typedef struct _stTree stTree;
    00018
    00019 namespace hal {
    00020
    00021 class HDF5Genome;
    00025 class HDF5Alignment : public Alignment
    00026 {
    00027 public:
    00028
    00029    ~HDF5Alignment();
    00030
    00031    void createNew(const std::string& alignmentPath);
    00032    void open(const std::string& alignmentPath,
    00033              bool readOnly);
    00034    void close();
    00035
    00036    Genome* addLeafGenome(const std::string& name,
    00037                            const std::string& parentName,
    00038                            double branchLength);
    00039
    00040    Genome* addRootGenome(const std::string& name,
    00041                            double branchLength);
    00042
    00043    void removeGenome(const std::string& name);
    00044
    00045    const Genome* openConstGenome(const std::string& name) const;
    00046
    00047    Genome* openGenome(const std::string& name);
    00048
    00049    std::string getRootName() const;
    00050
    00051    std::string getParentName(const std::string& name) const;
    00052
    00053    double getBranchLength(const std::string& parentName,
    00054                           const std::string& childName) const;
    00055
    00056    std::vector<std::string>
    00057    getChildNames(const std::string& name) const;
    00058
    00059    std::vector<std::string>
    00060    getLeafNamesBelow(const std::string& name) const;
    00061
    00062    hal_size_t getNumGenomes() const;
    00063
    00064    MetaData* getMetaData();
    00065
    00066    const MetaData* getMetaData() const;
    00067
    00068    std::string getNewickTree() const;
    00069
    00070 protected:
    00071    // Nobody creates this class except through the interface.
    00072    friend AlignmentPtr hdf5AlignmentInstance();
    00073    friend AlignmentConstPtr hdf5AlignmentInstanceReadOnly();
    00074    friend AlignmentPtr
    00075    hdf5AlignmentInstance(const H5::FileCreatPropList& fileCreateProps,
    00076                          const H5::FileAccPropList& fileAccessProps,
    00077                          const H5::DSetCreatPropList& datasetCreateProps);
    00078    friend AlignmentConstPtr
    00079    hdf5AlignmentInstanceReadOnly(const H5::FileCreatPropList& fileCreateProps,
    00080                                  const H5::FileAccPropList& fileAccessProps,
    00081                                  const H5::DSetCreatPropList& datasetCreateProps);
    00082
    00083    HDF5Alignment();
    00084    HDF5Alignment(const H5::FileCreatPropList& fileCreateProps,
    00085                  const H5::FileAccPropList& fileAccessProps,
    00086                  const H5::DSetCreatPropList& datasetCreateProps);
    00087
    00088    void loadTree();
    00089    void writeTree();
    00090    void addGenomeToTree(const std::string& name,
    00091                         const std::pair<std::string, double>& parentName,
    00092                         const std::vector<std::pair<std::string, double> >&
    00093                         childNames);
    00094
    00095 protected:
    00096
    00097    H5::H5File* _file;
    00098    H5::FileCreatPropList _cprops;
    00099    H5::FileAccPropList _aprops;
    00100    H5::DSetCreatPropList _dcprops;
    00101    int _flags;
    00102    HDF5MetaData* _metaData;
    00103    static const H5std_string MetaGroupName;
    00104    static const H5std_string TreeGroupName;
    00105    static const H5std_string GenomesGroupName;
    00106    stTree* _tree;
    00107    mutable std::map<std::string, stTree*> _nodeMap;
    00108    bool _dirty;
    00109    mutable std::map<std::string, HDF5Genome*> _openGenomes;
    00110 };
    00111
    00112 }
    00113 #endif
    00114

All Classes Namespaces Functions Variables Friends