]> git.donarmstrong.com Git - bamtools.git/blobdiff - src/api/BamAlignment.h
Added SAM header-handling classes for read/write/validate.
[bamtools.git] / src / api / BamAlignment.h
index ce22650e3c0df0f42698989127cda60d269485df..6eb7618b2e25544ca2df3db22a6910a544fec7b4 100644 (file)
@@ -3,7 +3,7 @@
 // Marth Lab, Department of Biology, Boston College
 // All rights reserved.
 // ---------------------------------------------------------------------------
-// Last modified: 19 November 2010 (DB)
+// Last modified: 22 December 2010 (DB)
 // ---------------------------------------------------------------------------
 // Provides the BamAlignment data structure
 // ***************************************************************************
@@ -25,7 +25,6 @@ namespace Internal {
 } // namespace Internal
 
 // BamAlignment data structure
-// explicitly labeled as 'struct' to indicate that (most of) its fields are public
 struct API_EXPORT BamAlignment {
 
     // constructors & destructor
@@ -52,15 +51,20 @@ struct API_EXPORT BamAlignment {
     public:        
         void SetIsDuplicate(bool ok);           // Sets "PCR duplicate" flag        
         void SetIsFailedQC(bool ok);            // Sets "failed quality control" flag        
-        void SetIsFirstMate(bool ok);           // Sets "alignment is first mate" flag        
-        void SetIsMateUnmapped(bool ok);        // Sets "alignment's mate is mapped" flag        
+        void SetIsFirstMate(bool ok);           // Sets "alignment is first mate" flag
+        void SetIsMapped(bool ok);              // Sets "alignment is mapped" flag
+        void SetIsMateMapped(bool ok);          // Sets "alignment's mate is mapped" flag
         void SetIsMateReverseStrand(bool ok);   // Sets "alignment's mate mapped to reverse strand" flag        
-        void SetIsPaired(bool ok);              // Sets "alignment part of paired-end read" flag        
+        void SetIsPaired(bool ok);              // Sets "alignment part of paired-end read" flag
+        void SetIsPrimaryAlignment(bool ok);    // Sets "position is primary alignment" flag
         void SetIsProperPair(bool ok);          // Sets "alignment is part of read that satisfied paired-end resolution" flag        
         void SetIsReverseStrand(bool ok);       // Sets "alignment mapped to reverse strand" flag        
-        void SetIsSecondaryAlignment(bool ok);  // Sets "position is primary alignment" flag        
-        void SetIsSecondMate(bool ok);          // Sets "alignment is second mate on read" flag        
-        void SetIsUnmapped(bool ok);            // Sets "alignment is mapped" flag
+        void SetIsSecondMate(bool ok);          // Sets "alignment is second mate on read" flag
+
+        // legacy methods (deprecated, but available)
+        void SetIsMateUnmapped(bool ok);        // Complement of IsMateMapped() flag
+        void SetIsSecondaryAlignment(bool ok);  // Complement of IsPrimaryAlignment() flag
+        void SetIsUnmapped(bool ok);            // Complement of IsMapped() flag
 
     // Tag data access methods
     public:
@@ -117,6 +121,11 @@ struct API_EXPORT BamAlignment {
         // @tag - two character tag name
         bool RemoveTag(const std::string& tag);
 
+    // Populate an alignment retrieved by BamAlignment::GetNextAlignmentCore() with full character data
+    // (read name, bases, qualities, tag data)
+    public:
+        bool BuildCharData(void);
+
     // Additional data access methods
     public:
         // calculates & returns alignment end position, based on starting position and CIGAR operations
@@ -131,21 +140,21 @@ struct API_EXPORT BamAlignment {
 
     // Data members
     public:
-        std::string Name;              // Read name
-        int32_t     Length;            // Query length
-        std::string QueryBases;        // 'Original' sequence (as reported from sequencing machine)
-        std::string AlignedBases;      // 'Aligned' sequence (includes any indels, padding, clipping)
-        std::string Qualities;         // FASTQ qualities (ASCII characters, not numeric values)
-        std::string TagData;           // Tag data (accessor methods will pull the requested information out)
-        int32_t     RefID;             // ID number for reference sequence
-        int32_t     Position;          // Position (0-based) where alignment starts
-        uint16_t    Bin;               // Bin in BAM file where this alignment resides
-        uint16_t    MapQuality;        // Mapping quality score
-        uint32_t    AlignmentFlag;     // Alignment bit-flag - see Is<something>() methods to query this value, SetIs<something>() methods to manipulate 
+        std::string Name;               // Read name
+        int32_t     Length;             // Query length
+        std::string QueryBases;         // 'Original' sequence (as reported from sequencing machine)
+        std::string AlignedBases;       // 'Aligned' sequence (includes any indels, padding, clipping)
+        std::string Qualities;          // FASTQ qualities (ASCII characters, not numeric values)
+        std::string TagData;            // Tag data (accessor methods will pull the requested information out)
+        int32_t     RefID;              // ID number for reference sequence
+        int32_t     Position;           // Position (0-based) where alignment starts
+        uint16_t    Bin;                // Bin in BAM file where this alignment resides
+        uint16_t    MapQuality;         // Mapping quality score
+        uint32_t    AlignmentFlag;      // Alignment bit-flag - see Is<something>() methods to query this value, SetIs<something>() methods to manipulate
         std::vector<CigarOp> CigarData; // CIGAR operations for this alignment
-        int32_t     MateRefID;         // ID number for reference sequence where alignment's mate was aligned
-        int32_t     MatePosition;      // Position (0-based) where alignment's mate starts
-        int32_t     InsertSize;        // Mate-pair insert size
+        int32_t     MateRefID;          // ID number for reference sequence where alignment's mate was aligned
+        int32_t     MatePosition;       // Position (0-based) where alignment's mate starts
+        int32_t     InsertSize;         // Mate-pair insert size
           
     // Internal data, inaccessible to client code
     // but available BamReaderPrivate & BamWriterPrivate