SamReferenceInfo.h

00001 /*
00002  *  Copyright (C) 2010  Regents of the University of Michigan
00003  *
00004  *   This program is free software: you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation, either version 3 of the License, or
00007  *   (at your option) any later version.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License
00015  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #ifndef __SAM_REFERENCE_INFO_H__
00019 #define __SAM_REFERENCE_INFO_H__
00020 
00021 #include "StringArray.h"
00022 #include "StringHash.h"
00023 #include "IntArray.h"
00024 
00025 class SamReferenceInfo
00026 {
00027 public:
00028     SamReferenceInfo();
00029     ~SamReferenceInfo();
00030     // Add reference sequence name and reference sequence length.
00031     void add(const char* referenceSequenceName, 
00032              int32_t referenceSequenceLength);
00033 
00034     // Get the reference ID for the specified name.
00035     // If addID is set to true, a reference id will be created for the
00036     // referenceName if one does not already exist.  If addID is set to
00037     // false (default), it will return NO_REF_ID.
00038     int getReferenceID(const String & referenceName, bool addID = false);
00039     int getReferenceID(const char* referenceName, bool addID = false);
00040     const String & getReferenceLabel(int id) const;
00041 
00042     // Get the number of entries contained here.
00043     int32_t getNumEntries() const;
00044 
00045     // Return the reference name at the specified index.
00046     // Returns "" if index is out of bounds
00047     const char* getReferenceName(int index) const;
00048     
00049     // Return the reference length at the specified index.
00050     // Returns 0 if index is out of bounds
00051     int32_t getReferenceLength(int index) const;
00052 
00053     // Reset this reference info.
00054     void clear();
00055 
00056     SamReferenceInfo & operator = (const SamReferenceInfo & rhs);
00057 
00058     static const int NO_REF_ID = -3;
00059 
00060 private:
00061     // Reference Name information
00062     StringArray    myReferenceContigs;
00063     StringIntHash  myReferenceHash;
00064     IntArray       myReferenceLengths;
00065 };
00066 
00067 #endif
00068 
Generated on Tue Sep 6 17:51:59 2011 for libStatGen Software by  doxygen 1.6.3