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 InsertSize; //!< Mate-pair insert size\r
+ //unsigned int InsertSize; //!< Mate-pair insert size\r
+ signed int InsertSize; //!< Mate-pair insert size\r
\r
// Alignment flag query constants\r
private:\r
// Spit out basic BamAlignment data \r
void PrintAlignment(const BamAlignment& alignment) {\r
cout << "---------------------------------" << endl;\r
- cout << "Name: " << alignment.Name << endl;\r
- cout << "Aligned to: " << alignment.RefID << ":" << alignment.Position << endl;\r
+ cout << "Name: " << alignment.Name << endl;\r
+ cout << "Aligned to: " << alignment.RefID;\r
+ cout << ":" << alignment.Position << endl;\r
}\r
querySequenceLength = BgzfUnpackUnsignedInt(&x[16]);
bAlignment.MateRefID = BgzfUnpackUnsignedInt(&x[20]);
bAlignment.MatePosition = BgzfUnpackUnsignedInt(&x[24]);
- bAlignment.InsertSize = BgzfUnpackUnsignedInt(&x[28]);
+ //bAlignment.InsertSize = BgzfUnpackUnsignedInt(&x[28]);
+ bAlignment.InsertSize = BgzfUnpackSignedInt(&x[28]);
// calculate lengths/offsets
const unsigned int dataLength = blockLength - BAM_CORE_SIZE;
static inline unsigned int BgzfUnpackUnsignedInt(char* buffer);
// unpacks a buffer into an unsigned short
static inline unsigned short BgzfUnpackUnsignedShort(char* buffer);
+ // unpacks a buffer into a signed int
+ static inline signed int BgzfUnpackSignedInt(char* buffer);
// calculate bins that overlap region ( left to reference end for now )
int BinsFromRegion(int, unsigned int, uint16_t[MAX_BIN]);
// calculates alignment end position based on starting position and provided CIGAR operations
un.valueBuffer[1] = buffer[1];
return un.value;
}
+
+ // unpacks a buffer into a signed int
+ inline signed int BamReader::BgzfUnpackSignedInt(char* buffer) {
+ union { signed int value; unsigned char valueBuffer[sizeof(signed int)]; } un;
+ un.valueBuffer[0] = buffer[0];
+ un.valueBuffer[1] = buffer[1];
+ un.valueBuffer[2] = buffer[2];
+ un.valueBuffer[3] = buffer[3];
+ return un.value;
+ }
// --------------------------------------------------------------------------------------
// template classes/methods (internal - can exclude from main documentation)