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

Go to the SVN repository for this file.

1 #ifndef OBJECTS_ALNMGR___ALNMIX__HPP
2 #define OBJECTS_ALNMGR___ALNMIX__HPP
3 
4 /* $Id: alnmix.hpp 33815 2007-05-04 17:18:18Z kazimird $
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 * Alignment mix
33 *
34 */
35 
39 
40 
42 
43 BEGIN_objects_SCOPE // namespace ncbi::objects::
44 
45 
46 class CScope;
47 class CAlnMixSeq;
48 class CAlnMixMerger;
49 
50 
52  public CSeq_align::SSeqIdChooser, // Note that SSeqIdChooser derives from
53  // CObject, so CAlnMix *is* also a CObject.
55 {
56 public:
57 
59 
60  // Constructors
61  CAlnMix(void);
62  CAlnMix(CScope& scope,
63  TCalcScoreMethod calc_score = 0);
64 
65  // Destructor
66  ~CAlnMix(void);
67 
68 
69  enum EAddFlags {
70  // Determine score of each aligned segment in the process of mixing
71  // (only makes sense if scope was provided at construction time)
72  fCalcScore = 0x01,
73 
74  // Force translation of nucleotide rows
75  // This will result in an output Dense-seg that has Widths,
76  // no matter if the whole alignment consists of nucleotides only.
77  fForceTranslation = 0x02,
78 
79  // Used for mapping sequence to itself
80  fPreserveRows = 0x04
81  };
82  typedef int TAddFlags;
83 
84  // Iteratively building the mix
85  void Add(const CDense_seg& ds, TAddFlags flags = 0);
86  void Add(const CSeq_align& aln, TAddFlags flags = 0);
87 
88 
89 
90  typedef vector<CConstRef<CDense_seg> > TConstDSs;
91  typedef vector<CConstRef<CSeq_align> > TConstAlns;
92 
93  // Input accessors
94  CScope& GetScope (void) const;
95  const TConstDSs& GetInputDensegs (void) const;
96  const TConstAlns& GetInputSeqAligns(void) const;
97 
98 
99 
100  enum EMergeFlags {
101  fTruncateOverlaps = 0x0001, //< otherwise put on separate rows
102  fNegativeStrand = 0x0002,
103  fGapJoin = 0x0004, //< join equal len segs gapped on refseq
104  fMinGap = 0x0008, //< minimize segs gapped on refseq
105  fRemoveLeadTrailGaps = 0x0010, //< Remove all leading or trailing gaps
106  fSortSeqsByScore = 0x0020, //< Better scoring seqs go towards the top
107  fSortInputByScore = 0x0040, //< Process better scoring input alignments first
108  fQuerySeqMergeOnly = 0x0080, //< Only put the query seq on same row,
109  //< other seqs from diff densegs go to
110  //< diff rows
111  fFillUnalignedRegions = 0x0100,
112  fAllowTranslocation = 0x0200 //< allow translocations when truncating overlaps
113  };
114  typedef int TMergeFlags;
115 
116  // Merge the mix
117  void Merge (TMergeFlags flags = 0);
118 
119 
120 
121  // Obtain the resulting alignment
122  const CDense_seg& GetDenseg (void) const;
123  const CSeq_align& GetSeqAlign (void) const;
124 
125 
126 
127 private:
128 
129  // Prohibit copy constructor and assignment operator
132 
135 
136  void x_Init (void);
137  void x_Reset (void);
138 
139  // SChooseSeqId implementation
140  virtual void ChooseSeqId(CSeq_id& id1, const CSeq_id& id2);
141 
142 
143  CRef<CDense_seg> x_ExtendDSWithWidths(const CDense_seg& ds);
144 
145 
152 
154 
158 };
159 
160 
161 
162 ///////////////////////////////////////////////////////////
163 ///////////////////// inline methods //////////////////////
164 ///////////////////////////////////////////////////////////
165 
166 inline
168 {
169  return const_cast<CScope&>(*m_Scope);
170 }
171 
172 
173 inline
175 {
176  return m_InputDSs;
177 }
178 
179 
180 inline
182 {
183  return m_InputAlns;
184 }
185 
186 
187 ///////////////////////////////////////////////////////////
188 ////////////////// end of inline methods //////////////////
189 ///////////////////////////////////////////////////////////
190 
191 
192 END_objects_SCOPE // namespace ncbi::objects::
193 
195 
196 #endif // OBJECTS_ALNMGR___ALNMIX__HPP
int(* TCalcScoreMethod)(const string &s1, const string &s2, bool s1_is_prot, bool s2_is_prot, int gene_code1, int gene_code2)
Typedefs.
Definition: alnmatch.hpp:53
int TMergeFlags
Definition: alnmix.hpp:114
EAddFlags
Definition: alnmix.hpp:69
const TConstAlns & GetInputSeqAligns(void) const
Definition: alnmix.hpp:181
TConstAlns m_InputAlns
Definition: alnmix.hpp:149
CRef< CAlnMixSequences > m_AlnMixSequences
Definition: alnmix.hpp:155
CRef< CAlnMixMerger > m_AlnMixMerger
Definition: alnmix.hpp:157
TCalcScoreMethod x_CalculateScore
Definition: alnmix.hpp:147
EMergeFlags
Definition: alnmix.hpp:100
CAlnMixMatches::TCalcScoreMethod TCalcScoreMethod
Definition: alnmix.hpp:58
vector< CConstRef< CSeq_align > > TConstAlns
Definition: alnmix.hpp:91
CRef< CAlnMixMatches > m_AlnMixMatches
Definition: alnmix.hpp:156
TAddFlags m_AddFlags
Definition: alnmix.hpp:153
int TAddFlags
Definition: alnmix.hpp:82
TConstDSs m_InputDSs
Definition: alnmix.hpp:148
map< void *, CConstRef< CDense_seg > > TConstDSsMap
Definition: alnmix.hpp:133
vector< CConstRef< CDense_seg > > TConstDSs
Definition: alnmix.hpp:90
TConstDSsMap m_InputDSsMap
Definition: alnmix.hpp:150
map< void *, CConstRef< CSeq_align > > TConstAlnsMap
Definition: alnmix.hpp:134
CAlnMix(const CAlnMix &value)
const TConstDSs & GetInputDensegs(void) const
Definition: alnmix.hpp:174
CScope & GetScope(void) const
Definition: alnmix.hpp:167
CRef< CScope > m_Scope
Definition: alnmix.hpp:146
CAlnMix & operator=(const CAlnMix &value)
TConstAlnsMap m_InputAlnsMap
Definition: alnmix.hpp:151
CScope –.
Definition: scope.hpp:92
Tasks that report progress derive from this class.
Definition: map.hpp:338
static uch flags
#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 NCBI_XALNMGR_EXPORT
Definition: ncbi_export.h:1065
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Create a Dense-seg from a Std-seg Used by AlnMgr to handle nucl2prot alignments.
Definition: Seq_align.hpp:348
virtual void ChooseSeqId(CSeq_id &id1, const CSeq_id &id2)=0
CScope & GetScope()
void Merge(wxMenu &menu_1, const wxMenu &menu_2)
merges all items form menu_2 into menu_1, preserving the structure if possible
Definition: wx_utils.cpp:579
Modified on Fri Sep 20 14:57:33 2024 by modify_doxy.py rev. 669887