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

Go to the SVN repository for this file.

1 #ifndef OBJTOOLS_ALNMGR___ALN_USER_OPTIONS__HPP
2 #define OBJTOOLS_ALNMGR___ALN_USER_OPTIONS__HPP
3 /* $Id: aln_user_options.hpp 53721 2012-04-12 15:23:21Z grichenk $
4 * ===========================================================================
5 *
6 * PUBLIC DOMAIN NOTICE
7 * National Center for Biotechnology Information
8 *
9 * This software/database is a "United States Government Work" under the
10 * terms of the United States Copyright Act. It was written as part of
11 * the author's official duties as a United States Government employee and
12 * thus cannot be copyrighted. This software/database is freely available
13 * to the public for use. The National Library of Medicine and the U.S.
14 * Government have not placed any restriction on its use or reproduction.
15 *
16 * Although all reasonable efforts have been taken to ensure the accuracy
17 * and reliability of the software and data, the NLM and the U.S.
18 * Government do not and cannot warrant the performance or results that
19 * may be obtained by using this software or data. The NLM and the U.S.
20 * Government disclaim all warranties, express or implied, including
21 * warranties of performance, merchantability or fitness for any particular
22 * purpose.
23 *
24 * Please cite the author in any work or product based on this material.
25 *
26 * ===========================================================================
27 *
28 * Authors: Kamen Todorov, NCBI
29 *
30 * File Description:
31 * Alignment user options
32 *
33 * ===========================================================================
34 */
35 
36 
37 #include <corelib/ncbistd.hpp>
38 #include <corelib/ncbiobj.hpp>
39 
42 
43 
45 
46 
47 /// Options for different alignment manager operations.
48 class CAlnUserOptions : public CObject
49 {
50 public:
52 
53  /// Row direction flags.
54  /// NOTE: in most cases directions are relative to the anchor row.
55  enum EDirection {
56  /// No filtering: use both direct and reverse sequences.
58 
59  /// Use only sequences whose strand is the same as that of the anchor.
60  eDirect = 1,
61 
62  /// Use only sequences whose strand is opposite to that of the anchor.
63  eReverse = 2,
64 
65  /// By default don't filter by direction.
67  };
69 
70  /// Alignment merging algorithm.
71  enum EMergeAlgo {
72  /// Merge all sequences (greedy algo).
74 
75  /// Only put the query seq on same row (input order is not significant).
77 
78  /// Preserve all rows as they were in the input (e.g. self-align a
79  /// sequence). Greedy algo.
81 
83  };
85 
86  /// Additional merge flags.
87  enum EMergeFlags {
88  /// Truncate overlapping ranges. If not set, the overlaps are put
89  /// on separate rows.
91 
92  /// Allow mixed strands on the same row. Experimental feature,
93  /// not supported for all alignment types.
95 
96  /// Allow translocations on the same row.
98 
99  /// In greedy algos, skip sorting input alignments by score thus
100  /// allowing for user-defined sort order.
102 
103  /// Use the anchor sequence as the alignment sequence. Otherwise
104  /// (by default) a pseudo sequence is created whose coordinates are
105  /// the alignment coordinates.
106  /// NOTE: Setting this flag is not recommended. Using it will make
107  /// all CSparseAln::*AlnPos* methods inconsistent with
108  /// CAlnVec::*AlnPos* methods.
110 
111  /// Store anchor row in the first pairwise alignment (by default it's
112  /// stored in the last one).
113  fAnchorRowFirst = 1 << 5,
114 
115  /// Do not collect and store insertions (gaps on the anchor).
116  fIgnoreInsertions = 1 << 6
117  };
118  typedef int TMergeFlags;
120 
122  objects::CBioseq_Handle m_ClipSeq;
125 
128 
131  eShowFlankingN, // show N residues on each side
133  };
134 
137 
141  m_MergeFlags(0),
143  m_ClipStart(0), m_ClipEnd(1),
145  m_Extension(1),
147  m_ShowUnalignedN(10)
148  {
149  }
150 
151  /// Set anchor id.
152  void SetAnchorId(const TAlnSeqIdIRef& anchor_id)
153  {
154  m_AnchorId = anchor_id;
155  }
156 
157  /// Get anchor id.
158  const TAlnSeqIdIRef& GetAnchorId(void) const
159  {
160  return m_AnchorId;
161  }
162 
163  /// Set/clear merge flags.
165  {
166  if (set) {
167  m_MergeFlags |= flags;
168  }
169  else {
170  m_MergeFlags &= ~flags;
171  }
172  }
173 
174  /// Anchor bioseq - if null then a multiple alignment shall be built.
175  objects::CBioseq_Handle m_Anchor;
176 
177 private:
179 
180 // enum EAddFlags {
181 // // Determine score of each aligned segment in the process of mixing
182 // // (only makes sense if scope was provided at construction time)
183 // fCalcScore = 0x01,
184 
185 // // Force translation of nucleotide rows
186 // // This will result in an output Dense-seg that has Widths,
187 // // no matter if the whole alignment consists of nucleotides only.
188 // fForceTranslation = 0x02,
189 
190 // // Used for mapping sequence to itself
191 // fPreserveRows = 0x04
192 // };
193 
194 // enum EMergeFlags {
195 // fTruncateOverlaps = 0x0001, // otherwise put on separate rows
196 // fNegativeStrand = 0x0002,
197 // fGapJoin = 0x0004, // join equal len segs gapped on refseq
198 // fMinGap = 0x0008, // minimize segs gapped on refseq
199 // fRemoveLeadTrailGaps = 0x0010, // Remove all leading or trailing gaps
200 // fSortSeqsByScore = 0x0020, // Better scoring seqs go towards the top
201 // fSortInputByScore = 0x0040, // Process better scoring input alignments first
202 // fQuerySeqMergeOnly = 0x0080, // Only put the query seq on same row,
203 // // other seqs from diff densegs go to diff rows
204 // fFillUnalignedRegions = 0x0100,
205 // fAllowTranslocation = 0x0200 // allow translocations when truncating overlaps
206 // };
207 
208 };
209 
210 
212 
213 #endif // OBJTOOLS_ALNMGR___ALN_USER_OPTIONS__HPP
Options for different alignment manager operations.
objects::CBioseq_Handle m_Anchor
Anchor bioseq - if null then a multiple alignment shall be built.
void SetAnchorId(const TAlnSeqIdIRef &anchor_id)
Set anchor id.
TAlnSeqIdIRef m_AnchorId
EMergeAlgo m_MergeAlgo
TMergeFlags m_MergeFlags
const TAlnSeqIdIRef & GetAnchorId(void) const
Get anchor id.
EDirection m_Direction
EMergeAlgo
Alignment merging algorithm.
@ eMergeAllSeqs
Merge all sequences (greedy algo).
@ ePreserveRows
Preserve all rows as they were in the input (e.g.
@ eQuerySeqMergeOnly
Only put the query seq on same row (input order is not significant).
EDirection
Row direction flags.
@ eBothDirections
No filtering: use both direct and reverse sequences.
@ eDefaultDirection
By default don't filter by direction.
@ eDirect
Use only sequences whose strand is the same as that of the anchor.
@ eReverse
Use only sequences whose strand is opposite to that of the anchor.
void SetMergeFlags(TMergeFlags flags, bool set)
Set/clear merge flags.
EMergeFlags
Additional merge flags.
@ fUseAnchorAsAlnSeq
Use the anchor sequence as the alignment sequence.
@ fAllowTranslocation
Allow translocations on the same row.
@ fSkipSortByScore
In greedy algos, skip sorting input alignments by score thus allowing for user-defined sort order.
@ fAnchorRowFirst
Store anchor row in the first pairwise alignment (by default it's stored in the last one).
@ fTruncateOverlaps
Truncate overlapping ranges.
@ fIgnoreInsertions
Do not collect and store insertions (gaps on the anchor).
@ fAllowMixedStrand
Allow mixed strands on the same row.
CPairwiseAln::TPos TPos
objects::CBioseq_Handle m_ClipSeq
EShowUnalignedOption m_UnalignedOption
CObject –.
Definition: ncbiobj.hpp:180
TSignedSeqPos TPos
Definition: set.hpp:45
Include a standard set of the NCBI C++ Toolkit most basic headers.
static uch flags
#define false
Definition: bool.h:36
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Modified on Fri Jun 28 17:13:01 2024 by modify_doxy.py rev. 669887