// Marth Lab, Department of Biology, Boston College\r
// All rights reserved.\r
// ---------------------------------------------------------------------------\r
-// Last modified: 13 September 2010 (DB)\r
+// Last modified: 15 September 2010 (DB)\r
// ---------------------------------------------------------------------------\r
// Provides the basic constants, data structures, etc. for using BAM files\r
// ***************************************************************************\r
\r
// Additional data access methods\r
public:\r
- int GetEndPosition(bool usePadded = false) const; // calculates alignment end position, based on starting position and CIGAR operations\r
+ // calculates alignment end position, based on starting position and CIGAR operations\r
+ // @zeroBased - if true, returns 0-based coordinate; else returns 1-based\r
+ int GetEndPosition(bool usePadded = false, bool zeroBased = true) const; \r
\r
// 'internal' utility methods \r
private:\r
\r
// calculates alignment end position, based on starting position and CIGAR operations\r
inline \r
-int BamAlignment::GetEndPosition(bool usePadded) const {\r
+int BamAlignment::GetEndPosition(bool usePadded, bool zeroBased) const {\r
\r
// initialize alignment end to starting position\r
int alignEnd = Position;\r
alignEnd += (*cigarIter).Length;\r
}\r
}\r
- return alignEnd - 1;\r
+ \r
+ // adjust for zeroBased, if necessary\r
+ if (zeroBased) \r
+ return alignEnd - 1;\r
+ else \r
+ return alignEnd;\r
}\r
\r
inline\r