NCBI C++ ToolKit
sparse_ci.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef __OBJTOOLS_ALNMGR___SPARSE_CI__HPP
2 #define __OBJTOOLS_ALNMGR___SPARSE_CI__HPP
3 
4 /* $Id: sparse_ci.hpp 53721 2012-04-12 15:23:21Z grichenk $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Andrey Yazhuk
30  *
31  * File Description:
32  *
33  */
34 
35 #include <corelib/ncbimisc.hpp>
36 
38 
40 
41 /// Implementation of IAlnSegment for CSparseAln.
43 {
44 public:
45  CSparseSegment(void);
46  virtual operator bool(void) const;
47  virtual TSegTypeFlags GetType(void) const;
48  virtual const TSignedRange& GetAlnRange(void) const;
49  virtual const TSignedRange& GetRange(void) const;
50 
51  void Init(TSignedSeqPos aln_from,
52  TSignedSeqPos aln_to,
53  TSignedSeqPos from,
54  TSignedSeqPos to,
56  {
57  m_AlnRange.Set(aln_from, aln_to);
58  m_RowRange.Set(from, to);
59  m_Type = type;
60  }
61 
62 private:
63  friend class CSparse_CI;
64 
68 };
69 
70 
71 /// Implementation of IAlnSegmentIterator for CSparseAln.
73 {
74 public:
77 
78  /// Create 'empty' iterator.
79  CSparse_CI(void);
80 
81  /// Iterate the specified row of the alignment.
82  CSparse_CI(const CSparseAln& aln,
83  TDim row,
84  EFlags flags);
85 
86  /// Iterate the selected range on the alignment row.
87  CSparse_CI(const CSparseAln& aln,
88  TDim row,
89  EFlags flags,
90  const TSignedRange& range);
91 
92  CSparse_CI(const CSparse_CI& orig);
93 
94  virtual ~CSparse_CI(void);
95 
96  /// Create a copy of the iterator.
97  virtual IAlnSegmentIterator* Clone(void) const;
98 
99  /// Return true if iterator points to a valid segment
100  virtual operator bool(void) const;
101 
102  // Postfix operators are not defined to avoid performance overhead.
103  virtual IAlnSegmentIterator& operator++(void);
104 
105  virtual bool operator==(const IAlnSegmentIterator& it) const;
106  virtual bool operator!=(const IAlnSegmentIterator& it) const;
107 
108  virtual const value_type& operator*(void) const;
109  virtual const value_type* operator->(void) const;
110 
111  /// Check if the anchor row coordinates are on plus strand.
112  bool IsAnchorDirect(void) const { return m_AnchorDirect; }
113 
114 private:
115  void x_InitIterator(void);
116  void x_InitSegment(void);
117  void x_CheckSegment(void);
118  void x_NextSegment(void);
119  bool x_Equals(const CSparse_CI& other) const;
120 
121  EFlags m_Flags; // iterating mode
124  TDim m_Row; // Selected row
125  TSignedRange m_TotalRange; // Total requested range
126  CPairwise_CI m_AnchorIt; // Anchor iterator
127  CPairwise_CI m_RowIt; // Selected row iterator
128  TSignedRange m_NextAnchorRg; // Next alignment range on the anchor
129  TSignedRange m_NextRowRg; // Next alignment range on the selected row
130  bool m_AnchorDirect; // Anchor row direction.
131  bool m_RowDirect; // Row direction relative to the anchor
132 };
133 
134 
136 
137 #endif // __OBJTOOLS_ALNMGR___SPARSE_ITERATOR__HPP
bool operator!=(const _Ht_iterator< _Val, _Nonconst_traits< _Val >, _Key, _HF, _ExK, _EqK, _All > &__x, const _Ht_iterator< _Val, _Const_traits< _Val >, _Key, _HF, _ExK, _EqK, _All > &__y)
Definition: _hashtable.h:173
#define bool
Definition: bool.h:34
CPairwiseAln iterator. Iterates over aligned ranges and gaps.
Sparse alignment.
Definition: sparse_aln.hpp:51
CAnchoredAln::TDim TDim
Synonym of TNumrow.
Definition: sparse_aln.hpp:56
Implementation of IAlnSegment for CSparseAln.
Definition: sparse_ci.hpp:43
void Init(TSignedSeqPos aln_from, TSignedSeqPos aln_to, TSignedSeqPos from, TSignedSeqPos to, TSegTypeFlags type)
Definition: sparse_ci.hpp:51
TSegTypeFlags m_Type
Definition: sparse_ci.hpp:65
TSignedRange m_RowRange
Definition: sparse_ci.hpp:67
TSignedRange m_AlnRange
Definition: sparse_ci.hpp:66
Implementation of IAlnSegmentIterator for CSparseAln.
Definition: sparse_ci.hpp:73
TSignedRange m_TotalRange
Definition: sparse_ci.hpp:125
CConstRef< CAnchoredAln > m_Aln
Definition: sparse_ci.hpp:123
bool m_RowDirect
Definition: sparse_ci.hpp:131
CPairwise_CI m_AnchorIt
Definition: sparse_ci.hpp:126
CPairwise_CI m_RowIt
Definition: sparse_ci.hpp:127
CSparseSegment m_Segment
Definition: sparse_ci.hpp:122
bool IsAnchorDirect(void) const
Check if the anchor row coordinates are on plus strand.
Definition: sparse_ci.hpp:112
TSignedRange m_NextRowRg
Definition: sparse_ci.hpp:129
CSparseAln::TDim TDim
Definition: sparse_ci.hpp:76
EFlags m_Flags
Definition: sparse_ci.hpp:121
bool m_AnchorDirect
Definition: sparse_ci.hpp:130
CPairwise_CI::TSignedRange TSignedRange
Definition: sparse_ci.hpp:75
TSignedRange m_NextAnchorRg
Definition: sparse_ci.hpp:128
Alignment segment iterator interface.
EFlags
Iterator options.
Alignment segment interface.
virtual const TSignedRange & GetRange(void) const =0
Get the selected row range.
virtual TSegTypeFlags GetType(void) const =0
Get current segment type.
virtual const TSignedRange & GetAlnRange(void) const =0
Get alignment range for the segment.
unsigned TSegTypeFlags
static uch flags
bool operator==(const CEquivRange &A, const CEquivRange &B)
static int type
Definition: getdata.c:31
int TSignedSeqPos
Type for signed sequence position.
Definition: ncbimisc.hpp:887
CVect2< NCBI_PROMOTE(int,U) > operator*(int v1, const CVect2< U > &v2)
Definition: globals.hpp:371
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_XALNMGR_EXPORT
Definition: ncbi_export.h:1065
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is orig
range(_Ty, _Ty) -> range< _Ty >
Miscellaneous common-use basic types and functionality.
Definition: type.c:6
Modified on Sat Feb 24 07:49:43 2024 by modify_doxy.py rev. 669887