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

Go to the SVN repository for this file.

1 /* $Id: denseg_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>
38 
39 
42 #include <objects/seq/Bioseq.hpp>
43 
47 
48 
49 
52 
53 static const string kTracebacks = "Tracebacks";
54 static const string kCigar = "CIGAR";
55 static const string kMismatch = "MISMATCH";
56 
57 ///////////////////////////////////////////////////////////////////////////////
58 /// CDensegGraphicDataSource
59 
61  const objects::CSeq_align& align, objects::CScope& scope, TNumrow anchor)
62  : m_AnchorRow(anchor)
63  , m_Cigar(NULL)
64 {
65  m_Alignment.Reset(&align);
66  m_Scope.Reset(&scope);
67  x_InitCigar();
68 
69  // must be a non-empty pairwise dense-seg
70  _ASSERT(align.GetSegs().IsDenseg());
71  _ASSERT(align.CheckNumRows() == 2);
72  _ASSERT(align.GetSegs().GetDenseg().CheckNumSegs() > 0);
73  // Make sure it is not a genomic-to-protein alingment.
74  _ASSERT(!align.GetSegs().GetDenseg().IsSetWidths());
75 }
76 
77 
79 {
80  // do clean up
81  if (m_Cigar) {
82  delete m_Cigar;
83  }
84 }
85 
86 
88 {
89  const objects::CBioseq_Handle& bsh = GetBioseqHandle(m_AnchorRow);
90  if (bsh.IsProtein()) {
92  }
93 
94  return IAlnExplorer::fDNA;
95 }
96 
97 
100 {
101  return 2;
102 }
103 
104 
106 {
107  return m_Alignment->GetSeqStart(m_AnchorRow);
108 }
109 
110 
112 {
113  return m_Alignment->GetSeqStop(m_AnchorRow);
114 }
115 
116 
118 {
119  return m_Alignment->GetSeqStart(row);
120 }
121 
122 
124 {
125  return m_Alignment->GetSeqStop(row);
126 }
127 
128 
131 {
133 }
134 
135 
138 {
139  // use the same alignment range
140  return GetAlnRange();
141 }
142 
143 
145 {
146  if (row != m_AnchorRow) {
147  // for anchor row, we will never use CIGAR string
148 
149  if (HasCigar()) {
150  const TCigar& cigars = *GetCigar();
151  TSeqPos len = 0;
152  ITERATE (TCigar, iter, cigars) {
153  switch (iter->first) {
154  case eCigar_M:
155  case eCigar_Eq:
156  case eCigar_X:
157  case eCigar_I:
158  case eCigar_H:
159  case eCigar_S:
160  len += iter->second;
161  break;
162  default:
163  break;
164  }
165  }
166  return len;
167  }
168  }
169 
170  return GetBioseqHandle(row).GetBioseqLength();
171 }
172 
173 
175 {
176  // will be 1 always for either protein-to-protein alignments
177  // or genomic-to-genomic alignments
178  return 1;
179 }
180 
181 
184 {
185  return m_AnchorRow;
186 }
187 
188 
190 {
191  return m_Alignment->GetSeq_id(row);
192 }
193 
194 
195 const objects::CBioseq_Handle&
197 {
198  if (m_BioseqHandles.count(row) == 0) {
199  m_BioseqHandles[row] = m_Scope->GetBioseqHandle(m_Alignment->GetSeq_id(row));
200  }
201  return m_BioseqHandles[row];
202 }
203 
204 
206 {
207  return m_Alignment->GetSeqStrand(row) != eNa_strand_minus;
208 }
209 
210 
212 {
213  return m_Alignment->GetSeqStrand(row) == eNa_strand_minus;
214 }
215 
216 
220  bool try_reverse_dir) const
221 {
222  TSignedSeqPos seq_pos = (TSignedSeqPos)aln_pos;
223  if (row == m_AnchorRow) {
224  return seq_pos;
225  }
226 
227  CDenseg_CI curr_iter(*m_Alignment, row, m_AnchorRow,
230  CDenseg_CI pre_iter;
231 
232  while (curr_iter && seq_pos > curr_iter->GetAlnRange().GetTo()) {
233  pre_iter = curr_iter;
234  ++curr_iter;
235  }
236 
237  if (curr_iter) {
238  bool reversed = curr_iter->GetType() & IAlnSegment::fReversed;
239  if (curr_iter->GetAlnRange().GetFrom() > seq_pos) {
240  if (pre_iter) {
241  if (dir == IAlnExplorer::eRight ||
242  (!reversed && dir == IAlnExplorer::eForward) ||
243  (reversed && dir == IAlnExplorer::eBackwards)) {
244  seq_pos = reversed ? curr_iter->GetRange().GetTo() : curr_iter->GetRange().GetFrom();
245 
246  } else if (dir == IAlnExplorer::eLeft ||
247  (reversed && dir == IAlnExplorer::eForward) ||
248  (!reversed && dir == IAlnExplorer::eBackwards)) {
249  seq_pos = reversed ? pre_iter->GetRange().GetFrom() : pre_iter->GetRange().GetTo();
250  }
251 
252  } else {
253  if (try_reverse_dir ||
254  dir == IAlnExplorer::eRight ||
255  (!reversed && dir == IAlnExplorer::eForward) ||
256  (reversed && dir == IAlnExplorer::eBackwards)) {
257  seq_pos = reversed ? curr_iter->GetRange().GetTo() : curr_iter->GetRange().GetFrom();
258  }
259  }
260  } else {
261  TSignedSeqPos off = reversed ?
262  curr_iter->GetAlnRange().GetTo() - seq_pos : seq_pos - curr_iter->GetAlnRange().GetFrom();
263  seq_pos = curr_iter->GetRange().GetFrom() + off;
264  }
265  } else {
266  _ASSERT(pre_iter);
267  seq_pos = -1;
268  if (dir != IAlnExplorer::eNone) {
269  bool reversed = pre_iter->GetType() & IAlnSegment::fReversed;
270  if (try_reverse_dir ||
271  dir == IAlnExplorer::eLeft ||
272  (reversed && dir == IAlnExplorer::eForward) ||
273  (!reversed && dir == IAlnExplorer::eBackwards)) {
274  seq_pos = reversed ? pre_iter->GetRange().GetFrom() : pre_iter->GetRange().GetTo();
275  }
276  }
277  }
278 
279  return seq_pos;
280 }
281 
282 
283 
286  TSeqPos seq_pos,
288  bool try_reverse_dir) const
289 {
290  TSignedSeqPos aln_pos = (TSignedSeqPos)seq_pos;
291  if (row == m_AnchorRow) {
292  return aln_pos;
293  }
294 
295  CDenseg_CI curr_iter(*m_Alignment, row, m_AnchorRow,
298  CDenseg_CI pre_iter;
299 
300  bool reversed = IsPositiveStrand(row) != IsPositiveStrand(m_AnchorRow);
301 
302  while (curr_iter && ((reversed && aln_pos < curr_iter->GetRange().GetFrom()) ||
303  (!reversed && aln_pos > curr_iter->GetRange().GetTo()))) {
304  pre_iter = curr_iter;
305  ++curr_iter;
306  }
307 
308  if (curr_iter) {
309  bool reversed = curr_iter->GetType() & IAlnSegment::fReversed;
310  if ((reversed && aln_pos > curr_iter->GetRange().GetTo()) ||
311  (!reversed && aln_pos < curr_iter->GetRange().GetFrom())) {
312  if (pre_iter) {
313  if (dir == IAlnExplorer::eRight ||
314  (!reversed && dir == IAlnExplorer::eForward) ||
315  (reversed && dir == IAlnExplorer::eBackwards)) {
316  aln_pos = curr_iter->GetAlnRange().GetFrom();
317 
318  } else if (dir == IAlnExplorer::eLeft ||
319  (reversed && dir == IAlnExplorer::eForward) ||
320  (!reversed && dir == IAlnExplorer::eBackwards)) {
321  aln_pos = pre_iter->GetAlnRange().GetTo();
322  }
323 
324  } else {
325  if (try_reverse_dir ||
326  dir == IAlnExplorer::eRight ||
327  (!reversed && dir == IAlnExplorer::eForward) ||
328  (reversed && dir == IAlnExplorer::eBackwards)) {
329  aln_pos = curr_iter->GetAlnRange().GetFrom();
330  }
331  }
332  } else {
333  TSignedSeqPos off = reversed ?
334  curr_iter->GetRange().GetTo() - aln_pos : aln_pos - curr_iter->GetRange().GetFrom();
335  aln_pos = curr_iter->GetAlnRange().GetFrom() + off;
336  }
337  } else {
338  _ASSERT(pre_iter);
339  aln_pos = -1;
340  if (dir != IAlnExplorer::eNone) {
341  if (try_reverse_dir ||
342  dir == IAlnExplorer::eLeft ||
343  (reversed && dir == IAlnExplorer::eForward) ||
344  (!reversed && dir == IAlnExplorer::eBackwards)) {
345  aln_pos = pre_iter->GetAlnRange().GetTo();
346  }
347  }
348  }
349 
350  return aln_pos;
351 }
352 
353 
356  const TSignedRange& range,
357  IAlnSegmentIterator::EFlags flag) const
358 {
359  return new CDenseg_CI(*m_Alignment, row, m_AnchorRow, flag, range);
360 }
361 
362 
363 string&
365  string &buffer,
366  const TSignedRange& aln_range) const
367 {
368  // assume the anchor row is the reference sequence row
369  if (row == m_AnchorRow) {
371  seq_vec.GetSeqData(aln_range.GetFrom(), aln_range.GetToOpen(), buffer);
372  } else {
373  bool reversed = IsPositiveStrand(row) != IsPositiveStrand(m_AnchorRow);
374  if (HasCigar()) {
375  const TCigar& cigars = *GetCigar();
376  size_t f = (size_t)GetSeqPosFromAlnPos(row, aln_range.GetFrom(), IAlnExplorer::eRight);
377  size_t t = (size_t)GetSeqPosFromAlnPos(row, aln_range.GetTo(), IAlnExplorer::eLeft);
378  if (reversed) {
379  TSeqPos len_m1 = GetSeqLength(row) - 1;
380  t = len_m1 - t;
381  f = len_m1 - f;
382  }
383  t += 1;
384  _ASSERT(f < t);
385 
386  string mismatch_str = x_GetMismatchStr();
388  seq_vec.GetSeqData(aln_range.GetFrom(), aln_range.GetToOpen(), buffer);
389  size_t curr_p = 0;
390  size_t mis_str_idx = 0;
391  size_t curr_seq_idx = 0;
392  TCigar::const_iterator c_iter = cigars.begin();
393  while (f < t && c_iter != cigars.end()) {
394  size_t span = c_iter->second;
395  switch (c_iter->first) {
396  case eCigar_H:
397  case eCigar_S:
398  case eCigar_X:
399  if (curr_p + span > f) {
400  size_t offset = f - curr_p;
401  size_t left_over = span - offset;
402  mis_str_idx += offset;
403  buffer.replace(curr_seq_idx, left_over, mismatch_str, mis_str_idx, left_over);
404  curr_p += span;
405  mis_str_idx += left_over;
406  curr_seq_idx += left_over;
407  f += left_over;
408  } else {
409  curr_p += span;
410  mis_str_idx += span;
411  }
412  break;
413  case eCigar_M:
414  case eCigar_Eq:
415  if (curr_p + span > f) {
416  curr_p += span;
417  size_t left_over = curr_p - f;
418  curr_seq_idx += left_over;
419  f += left_over;
420  } else {
421  curr_p += span;
422  }
423  break;
424  case eCigar_D:
425  case eCigar_N:
426  if (curr_p + span > f && curr_seq_idx > 0) {
427  buffer.replace(curr_seq_idx, span, span, '-');
428  curr_seq_idx += span;
429  }
430  break;
431  case eCigar_I:
432  mis_str_idx += span;
433  curr_p += span;
434  if (curr_p > f) {
435  f = curr_p;
436  }
437  break;
438  default:
439  break;
440  }
441  ++c_iter;
442  }
443 
444  } else {
445  buffer.clear();
446  CSeqVector seq_vec = GetBioseqHandle(row).GetSeqVector(CBioseq_Handle::eCoding_Iupac);
447  buffer.resize((size_t)aln_range.GetLength());
448  CDenseg_CI curr_iter(*m_Alignment, row, m_AnchorRow,
450  aln_range);
451  TSignedSeqPos f = aln_range.GetFrom();
452  TSignedSeqPos t = aln_range.GetToOpen();
453  size_t curr_seq_idx = 0;
454  while (curr_iter && f < t) {
455  if (curr_iter->GetAlnRange().NotEmpty()) {
456  TSignedSeqPos curr_f = curr_iter->GetAlnRange().GetFrom();
457  TSignedSeqPos span = curr_iter->GetAlnRange().GetLength();
458  if (f < curr_f) {
459  size_t off = curr_f - f;
460  buffer.replace(curr_seq_idx, off, off, '-');
461  f += off;
462  curr_seq_idx += off;
463  }
464  TSignedSeqPos offset = f - curr_f;
465  TSignedSeqPos left_over = span - offset;
466  if (t < curr_f + span) {
467  left_over = t - f;
468  }
469 
470  if (curr_iter->GetRange().Empty()) {
471  buffer.replace(curr_seq_idx, left_over, left_over, '-');
472  } else {
473  string tmp_str;
474  TSignedSeqPos row_f = curr_iter->GetRange().GetFrom();
475  TSignedSeqPos row_t = curr_iter->GetRange().GetTo();
476  if (reversed) {
477  row_t -= offset;
478  row_f = row_t - left_over + 1;
479  } else {
480  row_f += offset;
481  row_t = row_f + left_over - 1;
482  }
483  seq_vec.GetSeqData(row_f, row_t + 1, tmp_str);
484  if (reversed) {
485  string tmp_seq;
487  0, tmp_str.length(), tmp_seq);
488  tmp_str = tmp_seq;
489  }
490  buffer.replace(curr_seq_idx, left_over, tmp_str, 0, left_over);
491  }
492 
493  curr_seq_idx += left_over;
494  f += left_over;
495  }
496  ++curr_iter;
497  }
498  }
499  }
500 
501  return buffer;
502 }
503 
504 
505 string&
507  const TSignedRange& seq_rng,
508  const TSignedRange& aln_rng,
509  bool anchor_direct) const
510 {
511  if (row != m_AnchorRow && HasCigar()) {
512  const TCigar& cigars = *GetCigar();
513  bool reversed = IsPositiveStrand(row) != IsPositiveStrand(m_AnchorRow);
514  size_t f = (size_t)seq_rng.GetFrom();
515  size_t t = (size_t)seq_rng.GetTo();
516  if (reversed) {
517  TSeqPos len_m1 = GetSeqLength(row) - 1;
518  f = len_m1 - f;
519  t = len_m1 - t;
520  }
521  t += 1;
522  _ASSERT(f < t);
523 
524  buffer.clear();
525  string mismatch_str = x_GetMismatchStr();
526  string anchor_seq;
527 
529  seq_vec.GetSeqData(aln_rng.GetFrom(), aln_rng.GetToOpen(), anchor_seq);
530 
531  size_t curr_p = 0;
532  size_t mis_str_idx = 0;
533  size_t curr_seq_idx = 0;
534  TCigar::const_iterator c_iter = cigars.begin();
535  while (f < t && c_iter != cigars.end()) {
536  size_t span = c_iter->second;
537  switch (c_iter->first) {
538  case eCigar_H:
539  case eCigar_S:
540  case eCigar_X:
541  if (curr_p + span > f) {
542  size_t offset = f - curr_p;
543  size_t left_over = span - offset;
544  mis_str_idx += offset;
545  buffer += mismatch_str.substr(mis_str_idx, left_over);
546  curr_p += span;
547  mis_str_idx += left_over;
548  curr_seq_idx += left_over;
549  f += left_over;
550  } else {
551  curr_p += span;
552  mis_str_idx += span;
553  }
554  break;
555  case eCigar_M:
556  case eCigar_Eq:
557  if (curr_p + span > f) {
558  curr_p += span;
559  size_t left_over = curr_p - f;
560  buffer += anchor_seq.substr(curr_seq_idx, left_over);
561  curr_seq_idx += left_over;
562  f += left_over;
563  } else {
564  curr_p += span;
565  }
566  break;
567  case eCigar_D:
568  case eCigar_N:
569  if (curr_p + span > f && curr_seq_idx > 0) {
570  curr_seq_idx += span;
571  }
572  break;
573  case eCigar_I:
574  if (curr_p + span > f) {
575  size_t offset = f - curr_p;
576  size_t left_over = span - offset;
577  mis_str_idx += offset;
578  buffer += mismatch_str.substr(mis_str_idx, left_over);
579  mis_str_idx += left_over;
580  f += left_over;
581  } else {
582  mis_str_idx += span;
583  }
584  curr_p += span;
585  break;
586  default:
587  break;
588  }
589  ++c_iter;
590  }
591 
592  if (!anchor_direct && reversed) {
593  // nucleotide sequence, get reverse and complement
594  string tmp_seq;
596  0, buffer.length(), tmp_seq);
597  buffer = tmp_seq;
598  }
599 
600  } else {
601  IAlnGraphicDataSource::GetSeqString(buffer, row, seq_rng, aln_rng, anchor_direct);
602  }
603 
604  return buffer;
605 }
606 
607 
610  TNumrow row, TSeqPos seq_pos) const
611 {
612  if (row == m_AnchorRow) {
613  return GetSeqPosFromAlnPos(for_row, seq_pos);
614  }
615  return GetAlnPosFromSeqPos(row, seq_pos);
616 }
617 
618 
621 {
622  return ePolyA_Unknown;
623 }
624 
625 
627 {
628  if (m_AnchorRow != 0 || m_Cigar != NULL) {
629  // We assume the CIGAR is stored for BAM/cSRA files only,
630  // and the anchor row must be 0. Otherwise, the behaviour
631  // will be incorrect.
632  return;
633  }
634 
635  string cigar_str = x_GetCigarStr();
636  if ( !cigar_str.empty() ) {
637  m_Cigar = new TCigar;
638 
639  size_t i = 0;
640  const size_t c_len = cigar_str.length();
641  while (i < c_len) {
642  size_t curr_i = i;
643  while(curr_i < c_len && cigar_str[curr_i] < '=') {
644  ++curr_i;
645  }
646  if (curr_i > i) {
647  ECigarOp c_op = (ECigarOp)cigar_str[curr_i];
648  size_t len = NStr::StringToSizet(cigar_str.substr(i, curr_i - i));
649  m_Cigar->push_back(TCigar::value_type(c_op, len));
650  }
651  i = curr_i + 1;
652  }
653 
654  if (m_Cigar->empty()) {
655  delete m_Cigar;
656  m_Cigar = NULL;
657  }
658  }
659 }
660 
661 
663 {
664  if (m_Alignment->CanGetExt()) {
665  ITERATE (CSeq_align::TExt, iter, m_Alignment->GetExt()) {
666  if ((*iter)->GetType().IsStr() &&
667  (*iter)->GetType().GetStr() == kTracebacks) {
668  CConstRef<CUser_field> cigar_field = (*iter)->GetFieldRef(kCigar);
669  if (cigar_field && cigar_field->GetData().IsStr()) {
670  return cigar_field->GetData().GetStr();
671  }
672  }
673  }
674  }
675 
676  return kEmptyStr;
677 }
678 
679 
681 {
682  if (m_Alignment->CanGetExt()) {
683  ITERATE (CSeq_align::TExt, iter, m_Alignment->GetExt()) {
684  if ((*iter)->GetType().IsStr() &&
685  (*iter)->GetType().GetStr() == kTracebacks) {
686  CConstRef<CUser_field> mismatch_field = (*iter)->GetFieldRef(kMismatch);
687  if (mismatch_field && mismatch_field->GetData().IsStr()) {
688  return mismatch_field->GetData().GetStr();
689  }
690  }
691  }
692  }
693 
694  return kEmptyStr;
695 }
696 
697 
Set coding to printable coding (Iupacna or Iupacaa)
int TSignedSeqPos
Type for signed sequence position.
Definition: ncbimisc.hpp:965
ESearchDirection
Position search options.
virtual bool HasCigar() const
Check if there is a CIGAR string.
double value_type
The numeric datatype used by the parser.
Definition: muParserDef.h:228
list< CRef< CUser_object > > TExt
Definition: Seq_align_.hpp:402
EPolyATail
Cetantiy of having unaligned polyA tail.
Towards lower aln coord (always to the left)
Towards lower seq coord (to the left if plus strand, right if minus)
virtual TSignedRange GetSeqAlnRange(TNumrow row) const
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:953
map< TNumrow, objects::CBioseq_Handle > m_BioseqHandles
const TStr & GetStr(void) const
Get the variant data.
static TThisType GetWhole(void)
Definition: range.hpp:272
position_type GetLength(void) const
Definition: range.hpp:158
const TData & GetData(void) const
Get the Data member data.
virtual IAlnSegmentIterator * CreateSegmentIterator(TNumrow row, const TSignedRange &range, IAlnSegmentIterator::EFlags flag) const
virtual TSignedSeqPos GetSeqPosFromAlnPos(TNumrow for_row, TSeqPos aln_pos, IAlnExplorer::ESearchDirection dir=IAlnExplorer::eNone, bool try_reverse_dir=true) const
Implementation of IAlnSegmentIterator for CDense_seg.
Definition: denseg_ci.hpp:80
Skip gap segments (show only aligned ranges)
const TSeqPos offset(200)
#define NULL
Definition: ncbistd.hpp:225
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:1343
#define kEmptyStr
Definition: ncbistr.hpp:120
virtual TSeqPos GetSeqStop(TNumrow row) const
IAlnExplorer::TNumrow TNumrow
position_type GetToOpen(void) const
Definition: range.hpp:138
USING_SCOPE(ncbi::objects)
virtual TSeqPos GetSeqLength(TNumrow row) const
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:893
int i
virtual const TSignedRange & GetAlnRange(void) const =0
Get alignment range for the segment.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:101
void GetSeqData(TSeqPos start, TSeqPos stop, string &buffer) const
Fill the buffer string with the sequence data for the interval [start, stop).
Definition: seq_vector.cpp:304
Towards higher seq coord (to the right if plus strand, left if minus)
bool IsStr(void) const
Check if variant Str is selected.
CConstRef< objects::CSeq_align > m_Alignment
virtual IAlnExplorer::EAlignType GetAlignType() const
CConstRef< CUser_field > GetFieldRef(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase) const
Return a field reference representing the tokenized key, or a NULL reference if the key doesn't exist...
Definition: User_field.cpp:226
virtual TSignedSeqPos GetSeqPosFromSeqPos(TNumrow for_row, TNumrow row, TSeqPos seq_pos) const
virtual bool IsPositiveStrand(TNumrow row) const
static SIZE_TYPE ReverseComplement(const string &src, TCoding src_coding, TSeqPos pos, TSeqPos length, string &dst)
CDensegGraphicDataSource(const objects::CSeq_align &align, objects::CScope &scope, TNumrow anchor)
CDensegGraphicDataSource.
virtual const objects::CSeq_id & GetSeqId(TNumrow row) const
double f(double x_, const double &y_)
Definition: njn_root.hpp:188
virtual string & GetAlnSeqString(TNumrow row, string &buffer, const TSignedRange &aln_rng) const
bool Empty(void) const
Definition: range.hpp:148
static const string kCigar
CSeqVector –.
Definition: seq_vector.hpp:64
vector< TCigarPair > TCigar
virtual string & GetSeqString(string &buffer, TNumrow row, const TSignedRange &seq_rng, const TSignedRange &, bool anchor_direct) const
Get sequence string for a given row in sequence range.
Alignment segment iterator interface.
virtual TSeqPos GetBaseWidth(TNumrow row) const
virtual const objects::CBioseq_Handle & GetBioseqHandle(TNumrow row) const
EFlags
Iterator options.
CRef< objects::CScope > m_Scope
bool NotEmpty(void) const
Definition: range.hpp:152
position_type GetTo(void) const
Definition: range.hpp:142
IAlnExplorer::TSignedRange TSignedRange
virtual TSeqPos GetSeqStart(TNumrow row) const
virtual const TCigar * GetCigar() const
Get CIGAR vector.
static size_t StringToSizet(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to size_t.
Definition: ncbistr.cpp:1670
virtual const TSignedRange & GetRange(void) const =0
Get the selected row range.
position_type GetFrom(void) const
Definition: range.hpp:134
virtual TSignedRange GetAlnRange(void) const
static const string kMismatch
int len
virtual TSignedSeqPos GetAlnPosFromSeqPos(TNumrow row, TSeqPos seq_pos, IAlnExplorer::ESearchDirection dir=IAlnExplorer::eNone, bool try_reverse_dir=true) const
Towards higher aln coord (always to the right)
static const string kTracebacks
virtual TSeqPos GetAlnStart(void) const
virtual EPolyATail HasPolyATail() const
Check if there is any unaligned polyA tail.
#define _ASSERT
virtual TSeqPos GetAlnStop(void) const
virtual TNumrow GetAnchor(void) const
The selected row is reversed (relative to the anchor).
virtual string & GetSeqString(string &buffer, TNumrow row, const TSignedRange &seq_rng, const TSignedRange &aln_rng, bool anchor_direct) const
Get sequence string for a given row in sequence range.
IAlnExplorer::TNumrow TNumrow
virtual TNumrow GetNumRows(void) const
number of rows in alignment
virtual TSegTypeFlags GetType(void) const =0
Get current segment type.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:98
static uschar * buffer
Definition: pcretest.c:187
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:756
virtual bool IsNegativeStrand(TNumrow row) const
Modified on Mon Mar 27 16:07:49 2017 by modify_doxy.py rev. 506947