]> git.donarmstrong.com Git - bamtools.git/commitdiff
Modified BamAlignment data members to match BAM specs (signed vs unsigned ints)
authorbarnett <barnett@9efb377e-2e27-44b9-b91a-ec4abb80ed8b>
Thu, 1 Oct 2009 04:11:55 +0000 (04:11 +0000)
committerbarnett <barnett@9efb377e-2e27-44b9-b91a-ec4abb80ed8b>
Thu, 1 Oct 2009 04:11:55 +0000 (04:11 +0000)
git-svn-id: svn+ssh://gene.bc.edu/home/subversion/Derek/BamTools/trunk@28 9efb377e-2e27-44b9-b91a-ec4abb80ed8b

BamAux.h
BamReader.cpp

index 7e46bd79025a345fdc1dec9d510ce2ca4c43c36e..5784198336f1330dd7157cba5f20e999e4207f27 100644 (file)
--- a/BamAux.h
+++ b/BamAux.h
@@ -3,7 +3,7 @@
 // Marth Lab, Department of Biology, Boston College\r
 // All rights reserved.\r
 // ---------------------------------------------------------------------------\r
-// Last modified: 24 June 2009 (DB)\r
+// Last modified: 1 October 2009 (DB)\r
 // ---------------------------------------------------------------------------\r
 // The BGZF routines were adapted from the bgzf.c code developed at the Broad\r
 // Institute.\r
@@ -272,16 +272,20 @@ namespace BamTools {
                        std::string  AlignedBases;      //!< 'Aligned' sequence (includes any indels, padding, clipping) \r
                        std::string  Qualities;         //!< FASTQ qualities (ASCII characters, not numeric values)\r
                        std::string  TagData;           //!< Tag data (accessor methods will pull the requested information out)\r
-                       unsigned int RefID;             //!< ID number for reference sequence\r
-                       unsigned int Position;          //!< Position (0-based) where alignment starts \r
+                       //unsigned int RefID;             //!< ID number for reference sequence\r
+                       //unsigned int Position;          //!< Position (0-based) where alignment starts \r
+                       signed int RefID;             //!< ID number for reference sequence (-1)\r
+                       signed int Position;          //!< Position (0-based) where alignment starts (-1) \r
                        unsigned int Bin;               //!< Bin in BAM file where this alignment resides\r
                        unsigned int MapQuality;        //!< Mapping quality score \r
                        unsigned int AlignmentFlag;     //!< Alignment bit-flag - see Is<something>() methods for available queries\r
                        std::vector<CigarOp> CigarData; //!< CIGAR operations for this alignment\r
-                       unsigned int MateRefID;         //!< ID number for reference sequence where alignment's mate was aligned\r
-                       unsigned int MatePosition;      //!< Position (0-based) where alignment's mate starts\r
+                       //unsigned int MateRefID;         //!< ID number for reference sequence where alignment's mate was aligned\r
+                       //unsigned int MatePosition;      //!< Position (0-based) where alignment's mate starts\r
                        //unsigned int InsertSize;        //!< Mate-pair insert size\r
-                       signed int   InsertSize;                //!< Mate-pair insert size\r
+                       signed int MateRefID;         //!< ID number for reference sequence where alignment's mate was aligned (-1)\r
+                       signed int MatePosition;      //!< Position (0-based) where alignment's mate starts (-1)\r
+                       signed int InsertSize;            //!< Mate-pair insert size(0)\r
                \r
                // Alignment flag query constants\r
                private:\r
index f9df5cf95dd93cf4398bcad277bbc0c77505f15b..cdcf7536b4fece0a20b198745f32f803ad7ce23c 100644 (file)
@@ -557,8 +557,10 @@ bool BamReader::LoadNextAlignment(BamAlignment& bAlignment) {
        unsigned int numCigarOperations;
        unsigned int querySequenceLength;
 
-       bAlignment.RefID    = BgzfUnpackUnsignedInt(&x[0]);
-       bAlignment.Position = BgzfUnpackUnsignedInt(&x[4]);
+       //bAlignment.RefID    = BgzfUnpackUnsignedInt(&x[0]);
+       //bAlignment.Position = BgzfUnpackUnsignedInt(&x[4]);
+       bAlignment.RefID    = BgzfUnpackSignedInt(&x[0]);
+       bAlignment.Position = BgzfUnpackSignedInt(&x[4]);
 
        tempValue             = BgzfUnpackUnsignedInt(&x[8]);           
        bAlignment.Bin        = tempValue >> 16;
@@ -570,9 +572,11 @@ bool BamReader::LoadNextAlignment(BamAlignment& bAlignment) {
        numCigarOperations       = tempValue & 0xffff;
 
        querySequenceLength     = BgzfUnpackUnsignedInt(&x[16]);
-       bAlignment.MateRefID    = BgzfUnpackUnsignedInt(&x[20]);
-       bAlignment.MatePosition = BgzfUnpackUnsignedInt(&x[24]);
+       //bAlignment.MateRefID    = BgzfUnpackUnsignedInt(&x[20]);
+       //bAlignment.MatePosition = BgzfUnpackUnsignedInt(&x[24]);
        //bAlignment.InsertSize   = BgzfUnpackUnsignedInt(&x[28]);
+       bAlignment.MateRefID    = BgzfUnpackSignedInt(&x[20]);
+       bAlignment.MatePosition = BgzfUnpackSignedInt(&x[24]);
        bAlignment.InsertSize   = BgzfUnpackSignedInt(&x[28]);
 
        // calculate lengths/offsets