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

Go to the SVN repository for this file.

1 /* $Id: sparsealn_graphic_ds.cpp 37049 2016-11-30 19:40:50Z shkeda $
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 * Authors: Lianshou Wu
27 *
28 * File Description:
29 *
30 */
31 
32 #include <ncbi_pch.hpp>
33 
34 #include <gui/objutils/utils.hpp>
35 
38 
41 #include <objects/seq/Bioseq.hpp>
42 
43 #include <objmgr/align_ci.hpp>
44 
45 
48 
49 ///////////////////////////////////////////////////////////////////////////////
50 /// CSparseAlnGraphicDataSource
51 
53 : m_Alignment(sparseAlign)
54 {
55 }
56 
57 
59 {
60 }
61 
62 
64 {
65  return m_Alignment->GetNumRows();
66 }
67 
68 
70 {
71  return m_Alignment->GetAlnRange().GetFrom();
72 }
73 
74 
76 {
77  return m_Alignment->GetAlnRange().GetTo();
78 }
79 
80 
82 {
83  return m_Alignment->GetSeqStart(row);
84 }
85 
86 
88 {
89  return m_Alignment->GetSeqStop(row);
90 }
91 
92 
95 {
96  return m_Alignment->GetAlnRange();
97 }
98 
99 
102 {
103  return m_Alignment->GetSeqAlnRange(row);
104 }
105 
106 
108 {
109  return m_Alignment->GetBioseqHandle(row).GetBioseqLength();
110 }
111 
112 
114 {
115  return (TSeqPos)m_Alignment->GetBaseWidth(row);
116 }
117 
118 
120 {
121  return m_Alignment->GetAnchor();
122 }
123 
124 
126 {
127  return m_Alignment->GetSeqId(row);
128 }
129 
130 
132 {
133  return m_Alignment->IsPositiveStrand(row);
134 }
135 
136 
138 {
139  return m_Alignment->IsNegativeStrand(row);
140 }
141 
142 
145  bool try_reverse_dir) const
146 {
147  return m_Alignment->GetSeqPosFromAlnPos(row, seq_pos, dir, try_reverse_dir);
148 }
149 
150 
152  TSeqPos seq_pos,
154  bool try_reverse_dir) const
155 {
156  return m_Alignment->GetAlnPosFromSeqPos(row, seq_pos, dir, try_reverse_dir);
157 }
158 
159 
162  const TSignedRange& range,
163  IAlnSegmentIterator::EFlags flag) const
164 {
165  return m_Alignment->CreateSegmentIterator(row, range, flag);
166 }
167 
168 
170  string &buffer,
171  const TSignedRange& aln_range) const
172 {
173  return m_Alignment->GetAlnSeqString(row, buffer, aln_range);
174 }
175 
176 
177 const objects::CBioseq_Handle& CSparseAlnGraphicDataSource::GetBioseqHandle(TNumrow row) const
178 {
179  return m_Alignment->GetBioseqHandle(row);
180 }
181 
182 
184  TNumrow row, TSeqPos seq_pos) const
185 {
186  TSignedSeqPos aln_pos = m_Alignment->GetAlnPosFromSeqPos(row, seq_pos);
187  return GetSeqPosFromAlnPos(for_row, aln_pos);
188 }
189 
190 
virtual bool IsNegativeStrand(TNumrow row) const
CConstRef< CSparseAln > m_Alignment
virtual TSeqPos GetAlnStart(void) const
virtual TSeqPos GetSeqStart(TNumrow row) const
virtual TSeqPos GetBaseWidth(TNumrow row) const
virtual TNumrow GetAnchor(void) const
virtual TSignedSeqPos GetAlnPosFromSeqPos(TNumrow row, TSeqPos seq_pos, IAlnExplorer::ESearchDirection dir=IAlnExplorer::eNone, bool try_reverse_dir=true) const
virtual string & GetAlnSeqString(TNumrow row, string &buffer, const TSignedRange &aln_rng) const
virtual bool IsPositiveStrand(TNumrow row) const
virtual TSeqPos GetSeqStop(TNumrow row) const
CSparseAlnGraphicDataSource(CConstRef< CSparseAln > sparseAlign)
CSparseAlnGraphicDataSource.
virtual const objects::CSeq_id & GetSeqId(TNumrow row) const
virtual TSeqPos GetAlnStop(void) const
virtual IAlnSegmentIterator * CreateSegmentIterator(TNumrow row, const TSignedRange &range, IAlnSegmentIterator::EFlags flag) const
virtual TSignedSeqPos GetSeqPosFromSeqPos(TNumrow for_row, TNumrow row, TSeqPos seq_pos) const
virtual TSignedRange GetAlnRange(void) const
virtual TSeqPos GetSeqLength(TNumrow row) const
virtual TSignedRange GetSeqAlnRange(TNumrow row) const
virtual TSignedSeqPos GetSeqPosFromAlnPos(TNumrow for_row, TSeqPos aln_pos, IAlnExplorer::ESearchDirection dir=IAlnExplorer::eNone, bool try_reverse_dir=true) const
virtual TNumrow GetNumRows(void) const
number of rows in alignment
virtual const objects::CBioseq_Handle & GetBioseqHandle(TNumrow row) const
TRng GetAlnRange(void) const
Get whole alignment range.
Definition: sparse_aln.cpp:238
TNumrow GetNumRows(void) const
Synonym of the above.
Definition: sparse_aln.hpp:80
int GetBaseWidth(TNumrow row) const
Get base width for the sequence (1 for nucleotides, 3 for proteins).
Definition: sparse_aln.hpp:225
TSeqPos GetSeqStop(TNumrow row) const
Definition: sparse_aln.cpp:299
virtual IAlnSegmentIterator * CreateSegmentIterator(TNumrow row, const TSignedRange &range, IAlnSegmentIterator::EFlags flags) const
Create segment iterator.
Definition: sparse_aln.cpp:710
string & GetAlnSeqString(TNumrow row, string &buffer, const TSignedRange &rq_aln_rng, bool force_translation=false) const
Fetch alignment sequence data.
Definition: sparse_aln.cpp:552
TSignedSeqPos GetAlnPosFromSeqPos(TNumrow row, TSeqPos seq_pos, ESearchDirection dir=eNone, bool try_reverse_dir=true) const
Map sequence position to alignment coordinates.
Definition: sparse_aln.cpp:373
TSignedSeqPos GetSeqPosFromAlnPos(TNumrow for_row, TSeqPos aln_pos, ESearchDirection dir=eNone, bool try_reverse_dir=true) const
Definition: sparse_aln.cpp:385
bool IsPositiveStrand(TNumrow row) const
Check direction of the row.
Definition: sparse_aln.cpp:313
const objects::CBioseq_Handle & GetBioseqHandle(TNumrow row) const
Get bioseq handle for the row.
Definition: sparse_aln.cpp:396
TNumrow GetAnchor(void) const
Get anchor row index.
Definition: sparse_aln.hpp:95
TSeqPos GetSeqStart(TNumrow row) const
Definition: sparse_aln.cpp:292
TSignedRange GetSeqAlnRange(TNumrow row) const
Get sequence range in alignment coords (strand ignored).
Definition: sparse_aln.cpp:285
bool IsNegativeStrand(TNumrow row) const
Definition: sparse_aln.cpp:321
const objects::CSeq_id & GetSeqId(TNumrow row) const
Get seq-id for the row.
Definition: sparse_aln.cpp:264
ESearchDirection
Position search options.
IAlnExplorer::TNumrow TNumrow
Alignment segment iterator interface.
EFlags
Iterator options.
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
int TSignedSeqPos
Type for signed sequence position.
Definition: ncbimisc.hpp:887
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
TTo GetTo(void) const
Get the To member data.
Definition: Range_.hpp:269
TFrom GetFrom(void) const
Get the From member data.
Definition: Range_.hpp:222
range(_Ty, _Ty) -> range< _Ty >
static pcre_uint8 * buffer
Definition: pcretest.c:1051
USING_SCOPE(ncbi::objects)
Modified on Thu Feb 29 12:18:28 2024 by modify_doxy.py rev. 669887