X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Fapi%2Finternal%2FBamRandomAccessController_p.cpp;h=1e44b7daef47ccc52e96df28c6e1471b7e9cf270;hb=9f1ce8c47aeadb6dc1320b52ee671c3341b97935;hp=7f5c3506a9fc85d4912c0fec99c8fae620f0c759;hpb=2e049ed7f28881bce09653e60f5aea54bfd7afbf;p=bamtools.git diff --git a/src/api/internal/BamRandomAccessController_p.cpp b/src/api/internal/BamRandomAccessController_p.cpp index 7f5c350..1e44b7d 100644 --- a/src/api/internal/BamRandomAccessController_p.cpp +++ b/src/api/internal/BamRandomAccessController_p.cpp @@ -2,16 +2,16 @@ // BamRandomAccessController_p.cpp (c) 2011 Derek Barnett // Marth Lab, Department of Biology, Boston College // --------------------------------------------------------------------------- -// Last modified: 6 October 2011(DB) +// Last modified: 10 October 2011(DB) // --------------------------------------------------------------------------- // Manages random access operations in a BAM file // ************************************************************************** -#include -#include -#include -#include -#include +#include "api/BamIndex.h" +#include "api/internal/BamException_p.h" +#include "api/internal/BamRandomAccessController_p.h" +#include "api/internal/BamReader_p.h" +#include "api/internal/BamIndexFactory_p.h" using namespace BamTools; using namespace BamTools::Internal; @@ -79,9 +79,9 @@ BamRandomAccessController::AlignmentState(const BamAlignment& alignment) const { // if alignment starts at or after left bound position if ( alignment.Position >= m_region.LeftPosition) { - if ( m_region.isRightBoundSpecified() && // right bound is specified AND - m_region.LeftRefID == m_region.RightRefID && // left & right bounds on same reference AND - alignment.Position > m_region.RightPosition ) // alignment starts after right bound position + if ( m_region.isRightBoundSpecified() && // right bound is specified AND + m_region.LeftRefID == m_region.RightRefID && // left & right bounds on same reference AND + alignment.Position >= m_region.RightPosition ) // alignment starts on or after right bound position return AfterRegion; // otherwise, alignment overlaps region @@ -92,7 +92,7 @@ BamRandomAccessController::AlignmentState(const BamAlignment& alignment) const { else { // if alignment overlaps left bound position - if ( alignment.GetEndPosition() >= m_region.LeftPosition ) + if ( alignment.GetEndPosition() > m_region.LeftPosition ) return OverlapsRegion; else return BeforeRegion; @@ -116,15 +116,15 @@ BamRandomAccessController::AlignmentState(const BamAlignment& alignment) const { // alignment is on right bound reference else { - // if alignment starts on or before right bound position - if ( alignment.Position <= m_region.RightPosition ) + // if alignment starts before right bound position + if ( alignment.Position < m_region.RightPosition ) return OverlapsRegion; else return AfterRegion; } } - // otherwise, alignment starts after left bound and there is no right bound + // otherwise, alignment starts after left bound and there is no right bound given else return OverlapsRegion; } }