SamHeader.h

Go to the documentation of this file.
00001 // ***************************************************************************
00002 // SamHeader.h (c) 2010 Derek Barnett
00003 // Marth Lab, Department of Biology, Boston College
00004 // ---------------------------------------------------------------------------
00005 // Last modified: 10 October 2011 (DB)
00006 // ---------------------------------------------------------------------------
00007 // Provides direct read/write access to the SAM header data fields.
00008 // ***************************************************************************
00009 
00010 #ifndef SAM_HEADER_H
00011 #define SAM_HEADER_H
00012 
00013 #include "api/api_global.h"
00014 #include "api/SamProgramChain.h"
00015 #include "api/SamReadGroupDictionary.h"
00016 #include "api/SamSequenceDictionary.h"
00017 #include <string>
00018 #include <vector>
00019 
00020 namespace BamTools {
00021 
00022 struct API_EXPORT SamHeader {
00023 
00024     // ctor & dtor
00025     SamHeader(const std::string& headerText = "");
00026     SamHeader(const SamHeader& other);
00027     ~SamHeader(void);
00028 
00029     // query/modify entire SamHeader
00030     void Clear(void);                                   // clears all header contents
00031     std::string GetErrorString(void) const;
00032     bool HasError(void) const;
00033     bool IsValid(bool verbose = false) const;           // returns true if SAM header is well-formed
00034     void SetHeaderText(const std::string& headerText);  // replaces data fields with contents of SAM-formatted text
00035     std::string ToString(void) const;                   // returns the printable, SAM-formatted header text
00036 
00037     // convenience query methods
00038     bool HasVersion(void) const;     // returns true if header contains format version entry
00039     bool HasSortOrder(void) const;   // returns true if header contains sort order entry
00040     bool HasGroupOrder(void) const;  // returns true if header contains group order entry
00041     bool HasSequences(void) const;   // returns true if header contains any sequence entries
00042     bool HasReadGroups(void) const;  // returns true if header contains any read group entries
00043     bool HasPrograms(void) const;    // returns true if header contains any program record entries
00044     bool HasComments(void) const;    // returns true if header contains comments
00045 
00046     // --------------
00047     // data members
00048     // --------------
00049 
00050     // header metadata (@HD line)
00051     std::string Version;             // VN:<Version>  *Required, if @HD record is present*
00052     std::string SortOrder;           // SO:<SortOrder>
00053     std::string GroupOrder;          // GO:<GroupOrder>
00054 
00055     // header sequences (@SQ entries)
00056     SamSequenceDictionary Sequences;
00057 
00058     // header read groups (@RG entries)
00059     SamReadGroupDictionary ReadGroups;
00060 
00061     // header program data (@PG entries)
00062     SamProgramChain Programs;
00063 
00064     // header comments (@CO entries)
00065     std::vector<std::string> Comments;
00066 
00067     // internal data
00068     private:
00069         mutable std::string m_errorString;
00070 };
00071 
00072 } // namespace BamTools
00073 
00074 #endif // SAM_HEADER_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Aug 29 17:43:46 2012 for BamTools by  doxygen 1.6.3