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

Go to the SVN repository for this file.

1 #ifndef OBJECTS_ALNMGR___ALNMAP__HPP
2 #define OBJECTS_ALNMGR___ALNMAP__HPP
3 
4 /* $Id: alnmap.hpp 89002 2020-02-11 15:01:11Z ucko $
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 * Author: Kamen Todorov, NCBI
30 *
31 * File Description:
32 * Interface for examining alignments (of type Dense-seg)
33 *
34 */
35 
39 #include <util/range.hpp>
40 
42 BEGIN_objects_SCOPE // namespace ncbi::objects::
43 
45 {
46  typedef CObject TParent;
47 
48 public:
49  // data types
50  typedef unsigned int TSegTypeFlags; // binary OR of ESegTypeFlags
52  fSeq = 0x0001,
53  fNotAlignedToSeqOnAnchor = 0x0002,
54  fInsert = fSeq | fNotAlignedToSeqOnAnchor,
55  fUnalignedOnRight = 0x0004, // unaligned region to the right of this segment
56  fUnalignedOnLeft = 0x0008,
57  fNoSeqOnRight = 0x0010, // maybe gaps on the right but no seq
58  fNoSeqOnLeft = 0x0020,
59  fEndOnRight = 0x0040, // this is the last segment
60  fEndOnLeft = 0x0080,
61  fUnaligned = 0x0100, // this is an unaligned region
62  fUnalignedOnRightOnAnchor = 0x0200, // unaligned region to the right of the corresponding segment on the anchor
63  fUnalignedOnLeftOnAnchor = 0x0400,
64  // reserved for internal use
65  fTypeIsSet = (TSegTypeFlags) 0x80000000
66  };
67 
69  typedef TDim TNumrow;
73  typedef list<TSeqPos> TSeqPosList;
74 
75 
77  fAllChunks = 0x0000,
78  fIgnoreUnaligned = 0x0001,
79  // fInsertSameAsSeq, fDeletionSameAsGap and fIgnoreAnchor
80  // are used to consolidate adjacent segments which whose type
81  // only differs in how they relate to the anchor.
82  // Still, when obtaining the type of the chunks, the info about
83  // the relationship to anchor (fNotAlignedToSeqOnAnchor) will be
84  // present.
85  fInsertSameAsSeq = 0x0002,
86  fDeletionSameAsGap = 0x0004,
87  fIgnoreAnchor = fInsertSameAsSeq | fDeletionSameAsGap,
88  fIgnoreGaps = 0x0008,
89  fChunkSameAsSeg = 0x0010,
90 
91  fSkipUnalignedGaps = 0x0020,
92  fSkipDeletions = 0x0040,
93  fSkipAllGaps = fSkipUnalignedGaps | fSkipDeletions,
94  fSkipInserts = 0x0080,
95  fSkipAlnSeq = 0x0100,
96  fSeqOnly = fSkipAllGaps | fSkipInserts,
97  fInsertsOnly = fSkipAllGaps | fSkipAlnSeq,
98  fAlnSegsOnly = fSkipInserts | fSkipUnalignedGaps,
99 
100  // preserve the wholeness of the segments when intersecting
101  // with the given range instead of truncating them
102  fDoNotTruncateSegs = 0x0200,
103 
104  // In adition to other chunks, intoduce chunks representing
105  // regions of sequence which are implicit inserts but are
106  // not tecnically present in the underlying alignment,
107  // AKA "unaligned regions"
108  fAddUnalignedChunks = 0x0400
109  };
110  typedef int TGetChunkFlags; // binary OR of EGetChunkFlags
111 
113 
114  // constructors
115  CAlnMap(const CDense_seg& ds);
116  CAlnMap(const CDense_seg& ds, TNumrow anchor);
117 
118  // Flag indicating how to treat partially overlapping segment
119  // when creating a sub-range of an alignment.
121  eSegment_Include, // include whole segment
122  eSegment_Trim, // trim segment to the requested range
123  eSegment_Remove // do not include partial segments
124  };
125 
126  // Create CAlnMap using a sub-range and rows sub-set of the source
127  // alignment.
128  CRef<CSeq_align> CreateAlignFromRange(const vector<TNumrow>& selected_rows,
129  TSignedSeqPos aln_from,
130  TSignedSeqPos aln_to,
131  ESegmentTrimFlag seg_flag = eSegment_Trim);
132 
133  // destructor
134  ~CAlnMap(void);
135 
136  // Underlying Dense_seg accessor
137  const CDense_seg& GetDenseg(void) const;
138 
139  // Dimensions
140  TNumseg GetNumSegs(void) const;
141  TDim GetNumRows(void) const;
142 
143  // Seq ids
144  const CSeq_id& GetSeqId(TNumrow row) const;
145 
146  // Strands
147  bool IsPositiveStrand(TNumrow row) const;
148  bool IsNegativeStrand(TNumrow row) const;
149  int StrandSign (TNumrow row) const; // returns +/- 1
150 
151  // Widths
152  int GetWidth (TNumrow row) const;
153 
154  // Sequence visible range
155  TSignedSeqPos GetSeqAlnStart(TNumrow row) const; //aln coords, strand ignored
156  TSignedSeqPos GetSeqAlnStop (TNumrow row) const;
157  TSignedRange GetSeqAlnRange(TNumrow row) const;
158  TSeqPos GetSeqStart (TNumrow row) const; //seq coords, with strand
159  TSeqPos GetSeqStop (TNumrow row) const;
160  TRange GetSeqRange (TNumrow row) const;
161 
162  // Segment info
163  TSignedSeqPos GetStart (TNumrow row, TNumseg seg, int offset = 0) const;
164  TSignedSeqPos GetStop (TNumrow row, TNumseg seg, int offset = 0) const;
165  TSignedRange GetRange (TNumrow row, TNumseg seg, int offset = 0) const;
166  TSeqPos GetLen ( TNumseg seg, int offset = 0) const;
167  TSeqPos GetSeqLen (TNumrow row, TNumseg seg, int offset = 0) const;
168  TSegTypeFlags GetSegType(TNumrow row, TNumseg seg, int offset = 0) const;
169 
170  TSegTypeFlags GetTypeAtAlnPos(TNumrow row, TSeqPos aln_pos) const;
171 
172  static bool IsTypeInsert(TSegTypeFlags type);
173 
174  // Alignment segments
175  TSeqPos GetAlnStart(TNumseg seg) const;
176  TSeqPos GetAlnStop (TNumseg seg) const;
177  TSeqPos GetAlnStart(void) const { return 0; }
178  TSeqPos GetAlnStop (void) const;
179 
180  bool IsSetAnchor(void) const;
181  TNumrow GetAnchor (void) const;
182  void SetAnchor (TNumrow anchor);
183  void UnsetAnchor(void);
184 
185  //
186  // Position mapping funcitons
187  //
188  // Note: Some of the mapping functions have optional parameters
189  // ESearchDirection dir and bool try_reverse_dir
190  // which are used in case an exact match is not found.
191  // If nothing is found in the ESearchDirection dir and
192  // try_reverse_dir == true will search in the opposite dir.
193 
194  TNumseg GetSeg (TSeqPos aln_pos) const;
195  // if seq_pos falls outside the seq range or into an unaligned region
196  // and dir is provided, will return the first seg in according to dir
197  TNumseg GetRawSeg (TNumrow row, TSeqPos seq_pos,
198  ESearchDirection dir = eNone,
199  bool try_reverse_dir = true) const;
200  // if seq_pos is outside the seq range or within an unaligned region or
201  // within an insert dir/try_reverse_dir will be used
202  TSignedSeqPos GetAlnPosFromSeqPos (TNumrow row, TSeqPos seq_pos,
203  ESearchDirection dir = eNone,
204  bool try_reverse_dir = true) const;
205  // if target seq pos is a gap, will use dir/try_reverse_dir
206  TSignedSeqPos GetSeqPosFromSeqPos (TNumrow for_row,
207  TNumrow row, TSeqPos seq_pos,
208  ESearchDirection dir = eNone,
209  bool try_reverse_dir = true) const;
210  // if seq pos is a gap, will use dir/try_reverse_dir
211  TSignedSeqPos GetSeqPosFromAlnPos (TNumrow for_row,
212  TSeqPos aln_pos,
213  ESearchDirection dir = eNone,
214  bool try_reverse_dir = true) const;
215 
216  // Create a vector of relative mapping positions from row0 to row1.
217  // Input: row0, row1, aln_rng (vertical slice)
218  // Output: result (the resulting vector of positions),
219  // rng0, rng1 (affected ranges in native sequence coords)
220  void GetResidueIndexMap (TNumrow row0,
221  TNumrow row1,
222  TRange aln_rng,
223  vector<TSignedSeqPos>& result,
224  TRange& rng0,
225  TRange& rng1) const;
226 
227  // AlnChunks -- declared here for access to typedefs
228  class CAlnChunk;
229  class CAlnChunkVec;
230 
231 protected:
232  void x_GetChunks (CAlnChunkVec * vec,
233  TNumrow row,
234  TNumseg left_seg,
235  TNumseg right_seg,
236  TGetChunkFlags flags) const;
237 
238 public:
239  // Get a vector of chunks defined by flags
240  // in alignment coords range
241  CRef<CAlnChunkVec> GetAlnChunks(TNumrow row, const TSignedRange& range,
242  TGetChunkFlags flags = fAlnSegsOnly) const;
243  // or in native sequence coords range
244  CRef<CAlnChunkVec> GetSeqChunks(TNumrow row, const TSignedRange& range,
245  TGetChunkFlags flags = fAlnSegsOnly) const;
246 
248  {
249  public:
250  CAlnChunkVec(const CAlnMap& aln_map, TNumrow row) :
251  m_AlnMap(aln_map),
252  m_Row(row),
253  m_LeftDelta(0),
254  m_RightDelta(0) {}
255 
256  CConstRef<CAlnChunk> operator[] (TNumchunk i) const;
257 
258  TNumchunk size(void) const { return TNumchunk(m_StartSegs.size()); };
259 
260  private:
261 #if defined(NCBI_COMPILER_MSVC) || defined(NCBI_COMPILER_ANY_CLANG) // kludge
262  friend class CAlnMap;
263 #elif defined(NCBI_COMPILER_WORKSHOP) && NCBI_COMPILER_VERSION >= 550
264  friend class CAlnMap;
265 #else
266  friend
268  const TSignedRange& range,
269  TGetChunkFlags flags) const;
270  friend
272  const TSignedRange& range,
273  TGetChunkFlags flags) const;
274  friend
276  TNumrow row,
277  TNumseg left_seg,
278  TNumseg right_seg,
279  TGetChunkFlags flags) const;
280 #endif
281 
282  // can only be created by CAlnMap::GetAlnChunks
283  CAlnChunkVec(void);
284 
287  vector<TNumseg> m_StartSegs;
288  vector<TNumseg> m_StopSegs;
291  };
292 
294  {
295  public:
296  TSegTypeFlags GetType(void) const { return m_TypeFlags; }
298  { m_TypeFlags = type_flags; return *this; }
299 
300  const TSignedRange& GetRange(void) const { return m_SeqRange; }
301 
302  const TSignedRange& GetAlnRange(void) const { return m_AlnRange; }
303 
304  bool IsGap(void) const { return m_SeqRange.GetFrom() < 0; }
305 
306  private:
307  // can only be created or modified by
308  friend CConstRef<CAlnChunk> CAlnChunkVec::operator[](TNumchunk i)
309  const;
310  CAlnChunk(void) {}
311  TSignedRange& SetRange(void) { return m_SeqRange; }
312  TSignedRange& SetAlnRange(void) { return m_AlnRange; }
313 
317  };
318 
319 
320 protected:
322  {
323  public:
325  : m_AlnSeg(seg), m_Offset(offset) { }
326 
327  TNumseg GetAlnSeg(void) const { return m_AlnSeg; };
328  int GetOffset(void) const { return m_Offset; };
329 
330  private:
332  int m_Offset;
333  };
334 
335  // Prohibit copy constructor and assignment operator
338 
339  friend CConstRef<CAlnChunk> CAlnChunkVec::operator[](TNumchunk i) const;
340 
341  // internal functions for handling alignment segments
342  typedef vector<TSegTypeFlags> TRawSegTypes;
343  void x_Init (void);
344  void x_CreateAlnStarts (void);
345  TRawSegTypes& x_GetRawSegTypes () const;
346  TSegTypeFlags x_GetRawSegType (TNumrow row, TNumseg seg, int hint_idx = -1) const;
347  TSegTypeFlags x_SetRawSegType (TNumrow row, TNumseg seg) const;
348  void x_SetRawSegTypes (TNumrow row) const;
349  CNumSegWithOffset x_GetSegFromRawSeg (TNumseg seg) const;
350  TNumseg x_GetRawSegFromSeg (TNumseg seg) const;
351  TSignedSeqPos x_GetRawStart (TNumrow row, TNumseg seg) const;
352  TSignedSeqPos x_GetRawStop (TNumrow row, TNumseg seg) const;
353  TSeqPos x_GetLen (TNumrow row, TNumseg seg) const;
354  const TNumseg& x_GetSeqLeftSeg (TNumrow row) const;
355  const TNumseg& x_GetSeqRightSeg (TNumrow row) const;
356 
357  TSignedSeqPos x_FindClosestSeqPos(TNumrow row,
358  TNumseg seg,
359  ESearchDirection dir,
360  bool try_reverse_dir) const;
361 
362  bool x_SkipType (TSegTypeFlags type,
363  TGetChunkFlags flags) const;
364  bool x_CompareAdjacentSegTypes(TSegTypeFlags left_type,
365  TSegTypeFlags right_type,
366  TGetChunkFlags flags) const;
367  // returns true if types are the same (as specified by flags)
368 
379  vector<TNumseg> m_AlnSegIdx;
380  mutable vector<TNumseg> m_SeqLeftSegs;
381  mutable vector<TNumseg> m_SeqRightSegs;
383  vector<CNumSegWithOffset> m_NumSegWithOffsets;
385 };
386 
387 
388 
390 {
391 public:
392  /// Constructor
393  CAlnMapPrinter(const CAlnMap& aln_map,
394  CNcbiOstream& out);
395 
396  /// Printing methods
397  void CsvTable(char delim = ',');
398  void Segments();
400 
401  /// Fasta style Ids
402  const string& GetId (CAlnMap::TNumrow row) const;
403 
404  /// Field printers
405  void PrintId (CAlnMap::TNumrow row) const;
406  void PrintNumRow(CAlnMap::TNumrow row) const;
407  void PrintSeqPos(TSeqPos pos) const;
408 
409 private:
411  mutable vector<string> m_Ids;
412 
413 protected:
414  size_t m_IdFieldLen;
419 };
420 
421 
422 
423 ///////////////////////////////////////////////////////////
424 ///////////////////// inline methods //////////////////////
425 ///////////////////////////////////////////////////////////
426 
427 inline
429  : m_DS(&ds),
430  m_NumRows(ds.GetDim()),
431  m_NumSegs(ds.GetNumseg()),
432  m_Ids(ds.GetIds()),
433  m_Starts(ds.GetStarts()),
434  m_Lens(ds.GetLens()),
435  m_Strands(ds.GetStrands()),
436  m_Scores(ds.GetScores()),
437  m_Widths(ds.GetWidths()),
438  m_Anchor(-1),
439  m_RawSegTypes(0)
440 {
441  x_Init();
443 }
444 
445 
446 inline
448  : m_DS(&ds),
449  m_NumRows(ds.GetDim()),
450  m_NumSegs(ds.GetNumseg()),
451  m_Ids(ds.GetIds()),
452  m_Starts(ds.GetStarts()),
453  m_Lens(ds.GetLens()),
454  m_Strands(ds.GetStrands()),
455  m_Scores(ds.GetScores()),
456  m_Widths(ds.GetWidths()),
457  m_Anchor(-1),
458  m_RawSegTypes(0)
459 {
460  x_Init();
461  SetAnchor(anchor);
462 }
463 
464 
465 inline
467 {
468  if (m_RawSegTypes) {
469  delete m_RawSegTypes;
470  }
471 }
472 
473 
474 inline
476 {
477  return *m_DS;
478 }
479 
480 
482 {
483  return m_AlnStarts[seg];
484 }
485 
486 
487 inline
489 {
490  return m_AlnStarts[seg] + m_Lens[x_GetRawSegFromSeg(seg)] - 1;
491 }
492 
493 
494 inline
496 {
497  return GetAlnStop(GetNumSegs() - 1);
498 }
499 
500 
501 inline
504 {
506 }
507 
508 
509 inline
511 {
512  return IsSetAnchor() ? TNumseg(m_AlnSegIdx.size()) : m_NumSegs;
513 }
514 
515 
516 inline
518 {
519  return m_NumRows;
520 }
521 
522 
523 inline
524 bool CAlnMap::IsSetAnchor(void) const
525 {
526  return m_Anchor >= 0;
527 }
528 
529 inline
531 {
532  return m_Anchor;
533 }
534 
535 
536 
537 inline
540 {
541  return IsSetAnchor() ? m_NumSegWithOffsets[raw_seg] : raw_seg;
542 }
543 
544 
545 inline
548 {
549  return IsSetAnchor() ? m_AlnSegIdx[seg] : seg;
550 }
551 
552 
553 inline
555 {
556  return m_Starts[seg * m_NumRows + row];
557 }
558 
559 inline
561 {
562  if ( !m_Widths.empty() ) {
563  _ASSERT(m_Widths.size() == (size_t) m_NumRows);
564  return m_Widths[row];
565  } else {
566  return 1;
567  }
568 }
569 
570 inline
572 {
573  /// Optimization for return m_Lens[seg] * GetWidth(row);
574  if (GetWidth(row) != 1) {
575  _ASSERT(GetWidth(row) == 3);
576  TSeqPos len = m_Lens[seg];
577  return len + len + len;
578  } else {
579  return m_Lens[seg];
580  }
581 }
582 
583 inline
585 {
586  TSignedSeqPos start = x_GetRawStart(row, seg);
587  return ((start > -1) ? (start + (TSignedSeqPos)x_GetLen(row, seg) - 1)
588  : -1);
589 }
590 
591 
592 inline
594 {
595  return IsPositiveStrand(row) ? 1 : -1;
596 }
597 
598 
599 inline
601 {
602  return (m_Strands.empty() || m_Strands[row] != eNa_strand_minus);
603 }
604 
605 
606 inline
608 {
609  return ! IsPositiveStrand(row);
610 }
611 
612 
613 inline
615 {
616  return m_Starts
617  [(x_GetRawSegFromSeg(seg) + offset) * m_NumRows + row];
618 }
619 
620 inline
622 {
623  return m_Lens[x_GetRawSegFromSeg(seg) + offset];
624 }
625 
626 
627 inline
629 {
630  return x_GetLen(row, x_GetRawSegFromSeg(seg) + offset);
631 }
632 
633 
634 inline
636 {
637  TSignedSeqPos start = GetStart(row, seg, offset);
638  return ((start > -1) ?
639  (start + (TSignedSeqPos)GetSeqLen(row, seg, offset) - 1) :
640  -1);
641 }
642 
643 
644 inline
646 {
647  return *(m_Ids[row]);
648 }
649 
650 
651 inline
654 {
655  TSignedSeqPos start = GetStart(row, seg, offset);
656  if (start > -1) {
657  return TSignedRange(start, start + GetSeqLen(row, seg, offset) - 1);
658  } else {
659  return TSignedRange(-1, -1);
660  }
661 }
662 
663 
664 inline
666 {
667  return
671 }
672 
673 
674 inline
676 {
677  const TNumseg& seg = IsPositiveStrand(row) ?
679  return m_Starts[seg * m_NumRows + row] + x_GetLen(row, seg) - 1;
680 }
681 
682 
683 inline
685 {
686  return TRange(GetSeqStart(row), GetSeqStop(row));
687 }
688 
689 
690 inline
692 {
694 }
695 
696 
697 inline
700  if ( !m_RawSegTypes ) {
701  // Using kZero for 0 works around a bug in Compaq's C++ compiler.
702  static const TSegTypeFlags kZero = 0;
703  m_RawSegTypes = new vector<TSegTypeFlags>
704  (m_NumRows * m_NumSegs, kZero);
705  }
706  return *m_RawSegTypes;
707 }
708 
709 
710 inline
712 CAlnMap::x_GetRawSegType(TNumrow row, TNumseg seg, int hint_idx) const
713 {
715  if ( !(types[row] & fTypeIsSet) ) {
717  }
718  _ASSERT(hint_idx < 0 || hint_idx == m_NumRows * seg + row);
719  return types[hint_idx >= 0 ? hint_idx : m_NumRows * seg + row] & (~ fTypeIsSet);
720 }
721 
722 inline
724 {
725  return (type & fInsert) == fInsert;
726 }
727 
728 inline
731 {
732  return GetSegType(row, GetSeg(aln_pos));
733 }
734 
735 inline
736 const string&
738 {
739  return m_Ids[row];
740 }
741 
742 ///////////////////////////////////////////////////////////
743 ////////////////// end of inline methods //////////////////
744 ///////////////////////////////////////////////////////////
745 
746 
747 END_objects_SCOPE // namespace ncbi::objects::
748 
750 
751 #endif // OBJECTS_ALNMGR___ALNMAP__HPP
CAnchoredAln::TDim TDim
CNcbiOstream * m_Out
Definition: alnmap.hpp:418
size_t m_IdFieldLen
Definition: alnmap.hpp:414
const CAlnMap::TNumrow m_NumRows
Definition: alnmap.hpp:417
const CAlnMap & m_AlnMap
Definition: alnmap.hpp:410
size_t m_RowFieldLen
Definition: alnmap.hpp:415
size_t m_SeqPosFieldLen
Definition: alnmap.hpp:416
const string & GetId(CAlnMap::TNumrow row) const
Fasta style Ids.
Definition: alnmap.hpp:737
vector< string > m_Ids
Definition: alnmap.hpp:411
CAlnChunkVec(const CAlnMap &aln_map, TNumrow row)
Definition: alnmap.hpp:250
const CAlnMap & m_AlnMap
Definition: alnmap.hpp:285
vector< TNumseg > m_StartSegs
Definition: alnmap.hpp:287
vector< TNumseg > m_StopSegs
Definition: alnmap.hpp:288
TNumchunk size(void) const
Definition: alnmap.hpp:258
const TSignedRange & GetRange(void) const
Definition: alnmap.hpp:300
const TSignedRange & GetAlnRange(void) const
Definition: alnmap.hpp:302
TSignedRange m_AlnRange
Definition: alnmap.hpp:316
TSegTypeFlags GetType(void) const
Definition: alnmap.hpp:296
bool IsGap(void) const
Definition: alnmap.hpp:304
TSignedRange & SetRange(void)
Definition: alnmap.hpp:311
TSegTypeFlags m_TypeFlags
Definition: alnmap.hpp:314
TSignedRange & SetAlnRange(void)
Definition: alnmap.hpp:312
CAlnChunk & SetType(TSegTypeFlags type_flags)
Definition: alnmap.hpp:297
TSignedRange m_SeqRange
Definition: alnmap.hpp:315
TNumseg GetAlnSeg(void) const
Definition: alnmap.hpp:327
int GetOffset(void) const
Definition: alnmap.hpp:328
CNumSegWithOffset(TNumseg seg, int offset=0)
Definition: alnmap.hpp:324
TSignedSeqPos GetStop(TNumrow row, TNumseg seg, int offset=0) const
Definition: alnmap.hpp:635
void x_GetChunks(CAlnChunkVec *vec, TNumrow row, TNumseg left_seg, TNumseg right_seg, TGetChunkFlags flags) const
Definition: alnmap.cpp:1145
TRawSegTypes * m_RawSegTypes
Definition: alnmap.hpp:384
TDim TNumrow
Definition: alnmap.hpp:69
TSeqPos GetSeqLen(TNumrow row, TNumseg seg, int offset=0) const
Definition: alnmap.hpp:628
const CDense_seg::TScores & m_Scores
Definition: alnmap.hpp:376
bool IsSetAnchor(void) const
Definition: alnmap.hpp:524
list< TSeqPos > TSeqPosList
Definition: alnmap.hpp:73
TNumseg TNumchunk
Definition: alnmap.hpp:112
int GetWidth(TNumrow row) const
Definition: alnmap.hpp:560
void x_Init(void)
Definition: alnmap.cpp:42
CRef< CAlnChunkVec > GetSeqChunks(TNumrow row, const TSignedRange &range, TGetChunkFlags flags=fAlnSegsOnly) const
Definition: alnmap.cpp:1039
const TNumseg & x_GetSeqLeftSeg(TNumrow row) const
Definition: alnmap.cpp:716
const CDense_seg::TStarts & m_Starts
Definition: alnmap.hpp:373
TSegTypeFlags GetSegType(TNumrow row, TNumseg seg, int offset=0) const
Definition: alnmap.hpp:503
CNumSegWithOffset x_GetSegFromRawSeg(TNumseg seg) const
Definition: alnmap.hpp:539
TSeqPos x_GetLen(TNumrow row, TNumseg seg) const
Definition: alnmap.hpp:571
TNumseg m_NumSegs
Definition: alnmap.hpp:371
TSignedSeqPos GetStart(TNumrow row, TNumseg seg, int offset=0) const
Definition: alnmap.hpp:614
ESegmentTrimFlag
Definition: alnmap.hpp:120
@ eSegment_Include
Definition: alnmap.hpp:121
@ eSegment_Trim
Definition: alnmap.hpp:122
const CSeq_id & GetSeqId(TNumrow row) const
Definition: alnmap.hpp:645
bool IsPositiveStrand(TNumrow row) const
Definition: alnmap.hpp:600
~CAlnMap(void)
Definition: alnmap.hpp:466
const CDense_seg::TIds & m_Ids
Definition: alnmap.hpp:372
TSegTypeFlags GetTypeAtAlnPos(TNumrow row, TSeqPos aln_pos) const
Definition: alnmap.hpp:730
int TGetChunkFlags
Definition: alnmap.hpp:110
TNumseg GetSeg(TSeqPos aln_pos) const
Definition: alnmap.cpp:373
ESegTypeFlags
Definition: alnmap.hpp:51
@ fTypeIsSet
Definition: alnmap.hpp:65
@ fInsert
Definition: alnmap.hpp:54
TNumseg x_GetRawSegFromSeg(TNumseg seg) const
Definition: alnmap.hpp:547
CRange< TSeqPos > TRange
Definition: alnmap.hpp:70
vector< CNumSegWithOffset > m_NumSegWithOffsets
Definition: alnmap.hpp:383
TRawSegTypes & x_GetRawSegTypes() const
Definition: alnmap.hpp:699
TSignedSeqPos GetSeqAlnStart(TNumrow row) const
Definition: alnmap.cpp:969
CObject TParent
Definition: alnmap.hpp:46
TDim GetNumRows(void) const
Definition: alnmap.hpp:517
CDense_seg::TDim TDim
Definition: alnmap.hpp:68
TNumrow m_Anchor
Definition: alnmap.hpp:378
bool IsNegativeStrand(TNumrow row) const
Definition: alnmap.hpp:607
CRange< TSignedSeqPos > TSignedRange
Definition: alnmap.hpp:71
void SetAnchor(TNumrow anchor)
Definition: alnmap.cpp:79
TSignedRange GetSeqAlnRange(TNumrow row) const
Definition: alnmap.hpp:691
CDense_seg::TStarts m_AlnStarts
Definition: alnmap.hpp:382
vector< TNumseg > m_AlnSegIdx
Definition: alnmap.hpp:379
void x_CreateAlnStarts(void)
Definition: alnmap.cpp:49
vector< TNumseg > m_SeqLeftSegs
Definition: alnmap.hpp:380
const CDense_seg::TStrands & m_Strands
Definition: alnmap.hpp:375
CConstRef< CDense_seg > m_DS
Definition: alnmap.hpp:369
const TNumseg & x_GetSeqRightSeg(TNumrow row) const
Definition: alnmap.cpp:736
TSegTypeFlags x_GetRawSegType(TNumrow row, TNumseg seg, int hint_idx=-1) const
Definition: alnmap.hpp:712
vector< TNumseg > m_SeqRightSegs
Definition: alnmap.hpp:381
TRange GetSeqRange(TNumrow row) const
Definition: alnmap.hpp:684
CAlnMap & operator=(const CAlnMap &value)
CRef< CAlnChunkVec > GetAlnChunks(TNumrow row, const TSignedRange &range, TGetChunkFlags flags=fAlnSegsOnly) const
Definition: alnmap.cpp:1002
unsigned int TSegTypeFlags
Definition: alnmap.hpp:50
TNumrow GetAnchor(void) const
Definition: alnmap.hpp:530
CAlnMap(const CAlnMap &value)
TSeqPos GetAlnStart(void) const
Definition: alnmap.hpp:177
TSignedSeqPos x_GetRawStop(TNumrow row, TNumseg seg) const
Definition: alnmap.hpp:584
TSeqPos GetLen(TNumseg seg, int offset=0) const
Definition: alnmap.hpp:621
CDense_seg::TNumseg TNumseg
Definition: alnmap.hpp:72
const CDense_seg::TWidths & m_Widths
Definition: alnmap.hpp:377
const CDense_seg & GetDenseg(void) const
Definition: alnmap.hpp:475
TNumrow m_NumRows
Definition: alnmap.hpp:370
TSeqPos GetAlnStop(void) const
Definition: alnmap.hpp:495
TSeqPos GetSeqStop(TNumrow row) const
Definition: alnmap.hpp:675
TSignedRange GetRange(TNumrow row, TNumseg seg, int offset=0) const
Definition: alnmap.hpp:653
EGetChunkFlags
Definition: alnmap.hpp:76
@ fAlnSegsOnly
Definition: alnmap.hpp:98
int StrandSign(TNumrow row) const
Definition: alnmap.hpp:593
TSignedSeqPos GetSeqAlnStop(TNumrow row) const
Definition: alnmap.cpp:985
TNumseg GetNumSegs(void) const
Definition: alnmap.hpp:510
TSeqPos GetSeqStart(TNumrow row) const
Definition: alnmap.hpp:665
void x_SetRawSegTypes(TNumrow row) const
Definition: alnmap.cpp:235
CAlnMap(const CDense_seg &ds)
Definition: alnmap.hpp:428
static bool IsTypeInsert(TSegTypeFlags type)
Definition: alnmap.hpp:723
TSignedSeqPos x_GetRawStart(TNumrow row, TNumseg seg) const
Definition: alnmap.hpp:554
vector< TSegTypeFlags > TRawSegTypes
Definition: alnmap.hpp:342
const CDense_seg::TLens & m_Lens
Definition: alnmap.hpp:374
CConstRef –.
Definition: ncbiobj.hpp:1266
vector< int > TWidths
Definition: Dense_seg.hpp:73
CObject –.
Definition: ncbiobj.hpp:180
Alignment explorer interface.
ESearchDirection
Position search options.
static uch flags
std::ofstream out("events_result.xml")
main entry point for tests
type_flags
Definition: proto.h:431
static const struct type types[]
Definition: type.c:22
int offset
Definition: replacements.h:160
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
int TSignedSeqPos
Type for signed sequence position.
Definition: ncbimisc.hpp:887
TSeqPos GetStop(const CSeq_loc &loc, CScope *scope, ESeqLocExtremes ext=eExtreme_Positional)
If only one CBioseq is represented by CSeq_loc, returns the position at the stop of the location.
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
TSeqPos GetStart(const CSeq_loc &loc, CScope *scope, ESeqLocExtremes ext=eExtreme_Positional)
If only one CBioseq is represented by CSeq_loc, returns the position at the start of the location.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
#define NCBI_XALNMGR_EXPORT
Definition: ncbi_export.h:1065
vector< TSeqPos > TLens
Definition: Dense_seg_.hpp:108
vector< ENa_strand > TStrands
Definition: Dense_seg_.hpp:109
vector< TSignedSeqPos > TStarts
Definition: Dense_seg_.hpp:107
vector< CRef< CSeq_id > > TIds
Definition: Dense_seg_.hpp:106
vector< CRef< CScore > > TScores
Definition: Dense_seg_.hpp:110
@ eNa_strand_minus
Definition: Na_strand_.hpp:67
int i
int len
range(_Ty, _Ty) -> range< _Ty >
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
static bool GetIds(const T &d, set< string > &labels, const string name="", bool detect=false, bool found=false)
static bool GetSeqId(const T &d, set< string > &labels, const string name="", bool detect=false, bool found=false)
static Int4 GetSeqLen(DataBlkPtr entry)
Definition: sp_ascii.cpp:3987
#define row(bind, expected)
Definition: string_bind.c:73
Definition: type.c:6
#define _ASSERT
else result
Definition: token2.c:20
Modified on Tue May 14 16:16:54 2024 by modify_doxy.py rev. 669887