NCBI C++ ToolKit
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
CAlignRangeCollection< TAlnRange > Class Template Reference

Search Toolkit Book for CAlignRangeCollection

class CAlignRangeCollection<TAlignRange> represent a sorted collection of TAlignRange. More...

#include <util/align_range_coll.hpp>

+ Inheritance diagram for CAlignRangeCollection< TAlnRange >:

Public Types

enum  EFlags {
  fKeepNormalized = 0x0001 , fAllowMixedDir = 0x0002 , fAllowOverlap = 0x0004 , fAllowAbutting = 0x0008 ,
  fIgnoreInsertions = 0x0010 , fDefaultPolicy = fKeepNormalized , fDefaultPoicy = fDefaultPolicy , fPolicyMask = 0x001f ,
  fNotValidated = 0x0100 , fInvalid = 0x0200 , fUnsorted = 0x010000 , fDirect = 0x020000 ,
  fReversed = 0x040000 , fMixedDir = fDirect | fReversed , fOverlap = 0x080000 , fAbutting = 0x100000
}
 
enum  ESearchDirection {
  eNone , eForward , eBackwards , eLeft ,
  eRight
}
 adding empty ranges is considered valid, they are simply ignored More...
 
typedef TAlnRange TAlignRange
 
typedef TAlignRange::position_type position_type
 
typedef CAlignRangeCollection< TAlignRangeTThisType
 
typedef vector< TAlignRangeTAlignRangeVector
 
typedef TAlignRangeVector::const_iterator const_iterator
 
typedef TAlignRangeVector::const_reverse_iterator const_reverse_iterator
 
typedef TAlignRangeVector::size_type size_type
 

Public Member Functions

 CAlignRangeCollection (int flags=fDefaultPolicy)
 
 CAlignRangeCollection (const TAlignRangeVector &v, int flags)
 
position_type GetFirstFrom () const
 
position_type GetFirstToOpen () const
 
position_type GetFirstTo () const
 
position_type GetFirstLength (void) const
 
CRange< position_typeGetFirstRange () const
 
int GetFlags () const
 
bool IsSet (int flags) const
 
int GetPolicyFlags () const
 
int GetStateFlags () const
 
TSignedSeqPos GetSecondPosByFirstPos (position_type pos, ESearchDirection dir=eNone) const
 
TSignedSeqPos GetFirstPosBySecondPos (position_type pos, ESearchDirection dir=eNone) const
 
void Sort ()
 
void SortInsertions (void)
 
void CombineAbutting ()
 merge adjacent segments together, merging changes collection size and invalidates iterators More...
 
void Validate ()
 analyses segements and updates flags More...
 
void Normalize ()
 ensures that segments are sorted, if fAllowAdjust is not set - merges adjacent segments More...
 
void AddInsertion (const TAlignRange &r)
 
void AddInsertions (const TAlignRangeVector &insertions)
 
void AddInsertions (const TThisType &collection)
 
const TAlignRangeVectorGetInsertions () const
 Each insertion shows where the 'first' sequence has a gap while the 'second' sequence has the insertion of the specified length. More...
 
void IntersectFirst (const CRange< position_type > &range)
 
void IntersectSecond (const CRange< position_type > &range)
 
Container Interface

immitating vector, but providing only "const" access to elements

void reserve (int count)
 
void Assign (const CAlignRangeCollectionList< TAlignRange > &src)
 
const_iterator begin () const
 
const_iterator end () const
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
size_type size () const
 
bool empty () const
 
const_iterator find_insertion_point (const TAlignRange &r)
 
const_iterator insert (const TAlignRange &r)
 
const_iterator insert (const_iterator where, const TAlignRange &r)
 
const_iterator erase (const_iterator it)
 
void push_back (const TAlignRange &r)
 
void pop_back ()
 
const TAlignRangeoperator[] (size_type pos) const
 
TAlignRangeoperator[] (size_type pos)
 
void clear ()
 
const_iterator find (position_type pos) const
 
pair< const_iterator, boolfind_2 (position_type pos) const
 returns an iterator pointing to a range containing "pos"; if such a range does not exists an iterator points to a first range that has ToOpen > pos; the bool element of pair specifies whether the range contains the position. More...
 
const_iterator lower_bound (position_type pos) const
 
const_iterator upper_bound (position_type pos) const
 

Static Public Member Functions

static int ValidateRanges (const TAlignRange &r_1, const TAlignRange &r_2)
 determine conflicts between two ranges More...
 

Protected Types

typedef TAlignRangeVector::iterator iterator
 
typedef TAlignRangeVector::reverse_iterator reverse_iterator
 

Protected Member Functions

void x_SetFlags (int flags)
 
void x_ResetFlags (int flags)
 
void x_ValidateFlags ()
 
iterator begin_nc ()
 
iterator end_nc ()
 
bool x_Equals (const TThisType &c) const
 
void x_MultiplyCoordsBy3 ()
 
void x_IntersectFirst (TAlignRangeVector &ranges, const CRange< position_type > &range)
 
void x_IntersectSecond (TAlignRangeVector &ranges, const CRange< position_type > &range)
 

Protected Attributes

TAlignRangeVector m_Ranges
 
TAlignRangeVector m_Insertions
 
int m_Flags
 

Detailed Description

template<class TAlnRange>
class CAlignRangeCollection< TAlnRange >

class CAlignRangeCollection<TAlignRange> represent a sorted collection of TAlignRange.

The collection has two coordinate spaces: "First" - primary, usually represents alignment or consensus space, "Second" - represents a coordinate space associated with the aligned sequence. policies - do not overlap on master

Definition at line 75 of file align_range_coll.hpp.

Member Typedef Documentation

◆ const_iterator

template<class TAlnRange >
typedef TAlignRangeVector::const_iterator CAlignRangeCollection< TAlnRange >::const_iterator

Definition at line 82 of file align_range_coll.hpp.

◆ const_reverse_iterator

template<class TAlnRange >
typedef TAlignRangeVector::const_reverse_iterator CAlignRangeCollection< TAlnRange >::const_reverse_iterator

Definition at line 83 of file align_range_coll.hpp.

◆ iterator

template<class TAlnRange >
typedef TAlignRangeVector::iterator CAlignRangeCollection< TAlnRange >::iterator
protected

Definition at line 667 of file align_range_coll.hpp.

◆ position_type

template<class TAlnRange >
typedef TAlignRange::position_type CAlignRangeCollection< TAlnRange >::position_type

Definition at line 79 of file align_range_coll.hpp.

◆ reverse_iterator

template<class TAlnRange >
typedef TAlignRangeVector::reverse_iterator CAlignRangeCollection< TAlnRange >::reverse_iterator
protected

Definition at line 668 of file align_range_coll.hpp.

◆ size_type

template<class TAlnRange >
typedef TAlignRangeVector::size_type CAlignRangeCollection< TAlnRange >::size_type

Definition at line 84 of file align_range_coll.hpp.

◆ TAlignRange

template<class TAlnRange >
typedef TAlnRange CAlignRangeCollection< TAlnRange >::TAlignRange

Definition at line 78 of file align_range_coll.hpp.

◆ TAlignRangeVector

template<class TAlnRange >
typedef vector<TAlignRange> CAlignRangeCollection< TAlnRange >::TAlignRangeVector

Definition at line 81 of file align_range_coll.hpp.

◆ TThisType

template<class TAlnRange >
typedef CAlignRangeCollection<TAlignRange> CAlignRangeCollection< TAlnRange >::TThisType

Definition at line 80 of file align_range_coll.hpp.

Member Enumeration Documentation

◆ EFlags

template<class TAlnRange >
enum CAlignRangeCollection::EFlags
Enumerator
fKeepNormalized 

Policies:

fAllowMixedDir 

enforce all policies after any modification

if normalization is not possible exception will be thrown

fAllowOverlap 

allow segments with different orientation

fAllowAbutting 

allow segments overlapping on the first sequence

fIgnoreInsertions 

allows segments not separated by gaps

fDefaultPolicy 

do not store insertions

fDefaultPoicy 
fPolicyMask 

Keep compatible with SC-8.0.

fNotValidated 

State flags:

fInvalid 

collection was modified and not validated

fUnsorted 

one or more policies violated

fDirect 
fReversed 

contains at least one direct range

fMixedDir 

contains at least one reversed range

fOverlap 
fAbutting 

Definition at line 86 of file align_range_coll.hpp.

◆ ESearchDirection

template<class TAlnRange >
enum CAlignRangeCollection::ESearchDirection

adding empty ranges is considered valid, they are simply ignored

Enumerator
eNone 
eForward 
eBackwards 
eLeft 
eRight 

Definition at line 116 of file align_range_coll.hpp.

Constructor & Destructor Documentation

◆ CAlignRangeCollection() [1/2]

template<class TAlnRange >
CAlignRangeCollection< TAlnRange >::CAlignRangeCollection ( int  flags = fDefaultPolicy)
inline

Definition at line 124 of file align_range_coll.hpp.

◆ CAlignRangeCollection() [2/2]

template<class TAlnRange >
CAlignRangeCollection< TAlnRange >::CAlignRangeCollection ( const TAlignRangeVector v,
int  flags 
)
inline

Definition at line 129 of file align_range_coll.hpp.

Member Function Documentation

◆ AddInsertion()

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::AddInsertion ( const TAlignRange r)
inline

Definition at line 589 of file align_range_coll.hpp.

◆ AddInsertions() [1/2]

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::AddInsertions ( const TAlignRangeVector insertions)
inline

Definition at line 597 of file align_range_coll.hpp.

◆ AddInsertions() [2/2]

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::AddInsertions ( const TThisType collection)
inline

Definition at line 608 of file align_range_coll.hpp.

◆ Assign()

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::Assign ( const CAlignRangeCollectionList< TAlignRange > &  src)
inline

◆ begin()

template<class TAlnRange >
const_iterator CAlignRangeCollection< TAlnRange >::begin ( void  ) const
inline

◆ begin_nc()

template<class TAlnRange >
iterator CAlignRangeCollection< TAlnRange >::begin_nc ( )
inlineprotected

◆ clear()

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::clear ( void  )
inline

◆ CombineAbutting()

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::CombineAbutting ( )
inline

merge adjacent segments together, merging changes collection size and invalidates iterators

Definition at line 498 of file align_range_coll.hpp.

Referenced by CAlignRangeCollection< CAlignRange< TSeqPos > >::Normalize().

◆ empty()

template<class TAlnRange >
bool CAlignRangeCollection< TAlnRange >::empty ( void  ) const
inline

◆ end()

template<class TAlnRange >
const_iterator CAlignRangeCollection< TAlnRange >::end ( void  ) const
inline

◆ end_nc()

template<class TAlnRange >
iterator CAlignRangeCollection< TAlnRange >::end_nc ( )
inlineprotected

◆ erase()

template<class TAlnRange >
const_iterator CAlignRangeCollection< TAlnRange >::erase ( const_iterator  it)
inline

◆ find()

template<class TAlnRange >
const_iterator CAlignRangeCollection< TAlnRange >::find ( position_type  pos) const
inline

Definition at line 315 of file align_range_coll.hpp.

◆ find_2()

template<class TAlnRange >
pair<const_iterator, bool> CAlignRangeCollection< TAlnRange >::find_2 ( position_type  pos) const
inline

returns an iterator pointing to a range containing "pos"; if such a range does not exists an iterator points to a first range that has ToOpen > pos; the bool element of pair specifies whether the range contains the position.

Definition at line 325 of file align_range_coll.hpp.

Referenced by CAlignRangeCollection< CAlignRange< TSeqPos > >::find(), CAlignRangeCollection< CAlignRange< TSeqPos > >::GetSecondPosByFirstPos(), CRuler::Render(), and CSparseIterator::x_InitIterator().

◆ find_insertion_point()

template<class TAlnRange >
const_iterator CAlignRangeCollection< TAlnRange >::find_insertion_point ( const TAlignRange r)
inline

◆ GetFirstFrom()

template<class TAlnRange >
position_type CAlignRangeCollection< TAlnRange >::GetFirstFrom ( void  ) const
inline

◆ GetFirstLength()

template<class TAlnRange >
position_type CAlignRangeCollection< TAlnRange >::GetFirstLength ( void  ) const
inline

Definition at line 377 of file align_range_coll.hpp.

◆ GetFirstPosBySecondPos()

template<class TAlnRange >
TSignedSeqPos CAlignRangeCollection< TAlnRange >::GetFirstPosBySecondPos ( position_type  pos,
ESearchDirection  dir = eNone 
) const
inline

Definition at line 434 of file align_range_coll.hpp.

Referenced by CSparseAlignment::GetAlnPosFromSeqPos().

◆ GetFirstRange()

template<class TAlnRange >
CRange<position_type> CAlignRangeCollection< TAlnRange >::GetFirstRange ( ) const
inline

Definition at line 388 of file align_range_coll.hpp.

Referenced by CSparseAlignment::Init().

◆ GetFirstTo()

template<class TAlnRange >
position_type CAlignRangeCollection< TAlnRange >::GetFirstTo ( void  ) const
inline

◆ GetFirstToOpen()

template<class TAlnRange >
position_type CAlignRangeCollection< TAlnRange >::GetFirstToOpen ( void  ) const
inline

Definition at line 357 of file align_range_coll.hpp.

Referenced by SubtractOnFirst().

◆ GetFlags()

template<class TAlnRange >
int CAlignRangeCollection< TAlnRange >::GetFlags ( void  ) const
inline

Definition at line 393 of file align_range_coll.hpp.

Referenced by CreateAlignRow(), and CreateSparseAlign().

◆ GetInsertions()

template<class TAlnRange >
const TAlignRangeVector& CAlignRangeCollection< TAlnRange >::GetInsertions ( void  ) const
inline

Each insertion shows where the 'first' sequence has a gap while the 'second' sequence has the insertion of the specified length.

Direction of the insertion is always 'direct'.

Definition at line 622 of file align_range_coll.hpp.

◆ GetPolicyFlags()

template<class TAlnRange >
int CAlignRangeCollection< TAlnRange >::GetPolicyFlags ( ) const
inline

Definition at line 401 of file align_range_coll.hpp.

Referenced by SubtractAlnRngCollections().

◆ GetSecondPosByFirstPos()

template<class TAlnRange >
TSignedSeqPos CAlignRangeCollection< TAlnRange >::GetSecondPosByFirstPos ( position_type  pos,
ESearchDirection  dir = eNone 
) const
inline

Definition at line 409 of file align_range_coll.hpp.

Referenced by CSparseAlignment::GetSeqPosFromAlnPos().

◆ GetStateFlags()

template<class TAlnRange >
int CAlignRangeCollection< TAlnRange >::GetStateFlags ( ) const
inline

Definition at line 405 of file align_range_coll.hpp.

◆ insert() [1/2]

template<class TAlnRange >
const_iterator CAlignRangeCollection< TAlnRange >::insert ( const TAlignRange r)
inline

◆ insert() [2/2]

template<class TAlnRange >
const_iterator CAlignRangeCollection< TAlnRange >::insert ( const_iterator  where,
const TAlignRange r 
)
inline

Definition at line 199 of file align_range_coll.hpp.

◆ IntersectFirst()

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::IntersectFirst ( const CRange< position_type > &  range)
inline

Definition at line 627 of file align_range_coll.hpp.

◆ IntersectSecond()

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::IntersectSecond ( const CRange< position_type > &  range)
inline

Definition at line 632 of file align_range_coll.hpp.

◆ IsSet()

template<class TAlnRange >
bool CAlignRangeCollection< TAlnRange >::IsSet ( int  flags) const
inline

◆ lower_bound()

template<class TAlnRange >
const_iterator CAlignRangeCollection< TAlnRange >::lower_bound ( position_type  pos) const
inline

Definition at line 333 of file align_range_coll.hpp.

◆ Normalize()

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::Normalize ( void  )
inline

ensures that segments are sorted, if fAllowAdjust is not set - merges adjacent segments

Definition at line 557 of file align_range_coll.hpp.

◆ operator[]() [1/2]

template<class TAlnRange >
TAlignRange& CAlignRangeCollection< TAlnRange >::operator[] ( size_type  pos)
inline

Definition at line 300 of file align_range_coll.hpp.

◆ operator[]() [2/2]

template<class TAlnRange >
const TAlignRange& CAlignRangeCollection< TAlnRange >::operator[] ( size_type  pos) const
inline

Definition at line 295 of file align_range_coll.hpp.

◆ pop_back()

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::pop_back ( void  )
inline

Definition at line 289 of file align_range_coll.hpp.

◆ push_back()

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::push_back ( const TAlignRange r)
inline

Definition at line 284 of file align_range_coll.hpp.

◆ rbegin()

template<class TAlnRange >
const_reverse_iterator CAlignRangeCollection< TAlnRange >::rbegin ( void  ) const
inline

◆ rend()

template<class TAlnRange >
const_reverse_iterator CAlignRangeCollection< TAlnRange >::rend ( void  ) const
inline

Definition at line 161 of file align_range_coll.hpp.

◆ reserve()

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::reserve ( int  count)
inline

Definition at line 139 of file align_range_coll.hpp.

◆ size()

template<class TAlnRange >
size_type CAlignRangeCollection< TAlnRange >::size ( void  ) const
inline

◆ Sort()

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::Sort ( void  )
inline

◆ SortInsertions()

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::SortInsertions ( void  )
inline

◆ upper_bound()

template<class TAlnRange >
const_iterator CAlignRangeCollection< TAlnRange >::upper_bound ( position_type  pos) const
inline

Definition at line 339 of file align_range_coll.hpp.

◆ Validate()

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::Validate ( void  )
inline

analyses segements and updates flags

Definition at line 535 of file align_range_coll.hpp.

Referenced by CAlignRangeCollection< CAlignRange< TSeqPos > >::Normalize().

◆ ValidateRanges()

template<class TAlnRange >
static int CAlignRangeCollection< TAlnRange >::ValidateRanges ( const TAlignRange r_1,
const TAlignRange r_2 
)
inlinestatic

◆ x_Equals()

template<class TAlnRange >
bool CAlignRangeCollection< TAlnRange >::x_Equals ( const TThisType c) const
inlineprotected

Definition at line 678 of file align_range_coll.hpp.

◆ x_IntersectFirst()

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::x_IntersectFirst ( TAlignRangeVector ranges,
const CRange< position_type > &  range 
)
inlineprotected

◆ x_IntersectSecond()

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::x_IntersectSecond ( TAlignRangeVector ranges,
const CRange< position_type > &  range 
)
inlineprotected

◆ x_MultiplyCoordsBy3()

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::x_MultiplyCoordsBy3 ( )
inlineprotected

Definition at line 688 of file align_range_coll.hpp.

◆ x_ResetFlags()

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::x_ResetFlags ( int  flags)
inlineprotected

◆ x_SetFlags()

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::x_SetFlags ( int  flags)
inlineprotected

◆ x_ValidateFlags()

template<class TAlnRange >
void CAlignRangeCollection< TAlnRange >::x_ValidateFlags ( )
inlineprotected

Member Data Documentation

◆ m_Flags

template<class TAlnRange >
int CAlignRangeCollection< TAlnRange >::m_Flags
protected

◆ m_Insertions

template<class TAlnRange >
TAlignRangeVector CAlignRangeCollection< TAlnRange >::m_Insertions
protected

◆ m_Ranges

template<class TAlnRange >
TAlignRangeVector CAlignRangeCollection< TAlnRange >::m_Ranges
protected

Definition at line 734 of file align_range_coll.hpp.

Referenced by CAlignRangeCollection< CAlignRange< TSeqPos > >::begin(), CAlignRangeCollection< CAlignRange< TSeqPos > >::begin_nc(), CAlignRangeCollection< CAlignRange< TSeqPos > >::CAlignRangeCollection(), CAlignRangeCollection< CAlignRange< TSeqPos > >::clear(), CAlignRangeCollection< CAlignRange< TSeqPos > >::CombineAbutting(), CAlignRangeCollection< CAlignRange< TSeqPos > >::empty(), CAlignRangeCollection< CAlignRange< TSeqPos > >::end(), CAlignRangeCollection< CAlignRange< TSeqPos > >::end_nc(), CAlignRangeCollection< CAlignRange< TSeqPos > >::erase(), CAlignRangeCollection< CAlignRange< TSeqPos > >::find(), CAlignRangeCollection< CAlignRange< TSeqPos > >::GetFirstFrom(), CAlignRangeCollection< CAlignRange< TSeqPos > >::GetFirstLength(), CAlignRangeCollection< CAlignRange< TSeqPos > >::GetFirstTo(), CAlignRangeCollection< CAlignRange< TSeqPos > >::GetFirstToOpen(), CAlignRangeCollection< CAlignRange< TSeqPos > >::insert(), CAlignRangeCollection< CAlignRange< TSeqPos > >::IntersectFirst(), CAlignRangeCollection< CAlignRange< TSeqPos > >::IntersectSecond(), CAlignRangeCollection< CAlignRange< TSeqPos > >::operator[](), CAlignRangeCollection< CAlignRange< TSeqPos > >::rbegin(), CAlignRangeCollection< CAlignRange< TSeqPos > >::rend(), CAlignRangeCollection< CAlignRange< TSeqPos > >::reserve(), CAlignRangeCollection< CAlignRange< TSeqPos > >::size(), CAlignRangeCollection< CAlignRange< TSeqPos > >::Sort(), CAlignRangeCollection< CAlignRange< TSeqPos > >::Validate(), CAlignRangeCollection< CAlignRange< TSeqPos > >::x_Equals(), and CAlignRangeCollection< CAlignRange< TSeqPos > >::x_MultiplyCoordsBy3().


The documentation for this class was generated from the following file:
Modified on Fri Sep 20 14:57:58 2024 by modify_doxy.py rev. 669887