NCBI C++ ToolKit
alnpos_ci.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: alnpos_ci.cpp 33815 2007-05-04 17:18:18Z kazimird $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Author: Kamen Todorov, NCBI
27 *
28 * File Description:
29 * Alignment position iterator. Uses CAlnMap.
30 *
31 * ===========================================================================
32 */
33 
34 
35 #include <ncbi_pch.hpp>
37 
39 BEGIN_objects_SCOPE // namespace ncbi::objects::
40 
41 
43  TSeqPos aln_pos)
44  : m_AlnMap(alnmap),
45  m_AlnPos(aln_pos),
46  m_Valid(true),
47  m_Anchor(alnmap.GetAnchor())
48 {
49  // set iteration limits for the aln pos
53 
54  // adjust m_AlnPos in case it is out of range
55  if (m_AlnPos < m_AlnStart) {
57  } else if (m_AlnPos > m_AlnStop) {
59  }
60 
61  // set m_AlnSeg, m_RDelta, m_LDelta
64  m_RDelta = m_AlnMap.GetAlnStop(m_AlnSeg) - aln_pos;
65 
66  // resize & initialize cache
67  m_SeqStartsCache.resize(m_AlnMap.GetNumRows(), -2);
68 };
69 
70 
71 END_objects_SCOPE // namespace ncbi::objects::
#define true
Definition: bool.h:35
TNumseg GetSeg(TSeqPos aln_pos) const
Definition: alnmap.cpp:373
TDim GetNumRows(void) const
Definition: alnmap.hpp:517
TSeqPos GetAlnStop(TNumseg seg) const
Definition: alnmap.hpp:488
TSeqPos GetAlnStart(TNumseg seg) const
Definition: alnmap.hpp:481
TSeqPos m_AlnStop
Definition: alnpos_ci.hpp:62
TSeqPos m_AlnStart
Definition: alnpos_ci.hpp:61
CAlnPos_CI(const CAlnMap &alnmap, TSeqPos aln_pos=0)
Definition: alnpos_ci.cpp:42
TSeqPos m_RDelta
Definition: alnpos_ci.hpp:66
TSeqPos m_LDelta
Definition: alnpos_ci.hpp:65
const CAlnMap & m_AlnMap
Definition: alnpos_ci.hpp:59
TSeqPos m_AlnPos
Definition: alnpos_ci.hpp:60
TSeqStartsCache m_SeqStartsCache
Definition: alnpos_ci.hpp:63
CAlnMap::TNumseg m_AlnSeg
Definition: alnpos_ci.hpp:64
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
#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 _ASSERT
Modified on Fri Feb 23 11:50:50 2024 by modify_doxy.py rev. 669887