SamSequence.h

Go to the documentation of this file.
00001 // ***************************************************************************
00002 // SamSequence.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 sequence data fields.
00008 // ***************************************************************************
00009 
00010 #ifndef SAM_SEQUENCE_H
00011 #define SAM_SEQUENCE_H
00012 
00013 #include "api/api_global.h"
00014 #include <string>
00015 
00016 namespace BamTools {
00017 
00018 struct API_EXPORT SamSequence {
00019 
00020     // ctor & dtor
00021     SamSequence(void);
00022     SamSequence(const std::string& name, const int& length);
00023     SamSequence(const std::string& name, const std::string& length);
00024     SamSequence(const SamSequence& other);
00025     ~SamSequence(void);
00026 
00027     // query/modify entire sequence
00028     void Clear(void);                // clears all contents
00029 
00030     // convenience query methods
00031     bool HasAssemblyID(void) const;  // returns true if sequence has an assembly ID
00032     bool HasChecksum(void) const;    // returns true if sequence has an MD5 checksum
00033     bool HasLength(void) const;      // returns true if sequence has a length
00034     bool HasName(void) const;        // returns true if sequence has a name
00035     bool HasSpecies(void) const;     // returns true if sequence has a species ID
00036     bool HasURI(void) const;         // returns true if sequence has a URI
00037 
00038     // data members
00039     std::string AssemblyID;          // AS:<AssemblyID>
00040     std::string Checksum;            // M5:<Checksum>
00041     std::string Length;              // LN:<Length>      *Required for valid SAM header*
00042     std::string Name;                // SN:<Name>        *Required for valid SAM header*
00043     std::string Species;             // SP:<Species>
00044     std::string URI;                 // UR:<URI>
00045 };
00046 
00050 API_EXPORT inline bool operator==(const SamSequence& lhs, const SamSequence& rhs) {
00051     if ( lhs.Name   != rhs.Name   ) return false;
00052     if ( lhs.Length != rhs.Length ) return false;
00053     if ( lhs.HasChecksum() && rhs.HasChecksum() )
00054         return (lhs.Checksum == rhs.Checksum);
00055     else return true;
00056 }
00057 
00058 } // namespace BamTools
00059 
00060 #endif // SAM_SEQUENCE_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