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

Go to the SVN repository for this file.

1 #ifndef OBJECTS_ALNMGR___ALNSEGMENTS__HPP
2 #define OBJECTS_ALNMGR___ALNSEGMENTS__HPP
3 
4 /* $Id: alnsegments.hpp 88953 2020-02-05 20:27:33Z vasilche $
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 sequences
33 *
34 */
35 
36 
37 #include <corelib/ncbiobj.hpp>
39 
41 
42 #ifndef BEGIN_objects_SCOPE
43 # define BEGIN_objects_SCOPE BEGIN_SCOPE(objects)
44 # define END_objects_SCOPE END_SCOPE(objects)
45 #endif
46 BEGIN_objects_SCOPE // namespace ncbi::objects::
47 
48 
49 class CAlnMixSegment;
50 
51 
53 {
54 public:
55 
56  typedef int (*TCalcScoreMethod)(const string& s1,
57  const string& s2,
58  bool s1_is_prot,
59  bool s2_is_prot);
60 
61  // Constructor
62  CAlnMixSegments(CRef<CAlnMixSequences>& aln_mix_sequences,
63  TCalcScoreMethod calc_score = 0);
64 
65 
66  typedef list<CRef<CAlnMixSegment> > TSegmentsContainer;
67  typedef list<CAlnMixSegment*> TSegments;
68 
69  void Build (bool gap_join = false,
70  bool min_gap = false,
71  bool remove_leading_and_trailing_gaps = false);
72  void FillUnalignedRegions(void);
73 
74 private:
75  friend class CAlnMixMerger;
76 
77  void x_ConsolidateGaps(TSegmentsContainer& gapped_segs);
78  void x_MinimizeGaps (TSegmentsContainer& gapped_segs);
79 
81 
83  vector<CRef<CAlnMixSeq> >& m_Rows;
84  list<CRef<CAlnMixSeq> >& m_ExtraRows;
86 };
87 
88 
89 class NCBI_XALNMGR_EXPORT CAlnMixStarts : public map<TSeqPos, CRef<CAlnMixSegment> >
90 {
91 public:
93 };
94 
95 
97 {
98 public:
99  struct SSeqComp {
100  bool operator () (const CAlnMixSeq* seq1, const CAlnMixSeq* seq2) const {
101  return seq1->m_SeqIdx < seq2->m_SeqIdx ||
102  (seq1->m_SeqIdx == seq2->m_SeqIdx &&
103  seq1->m_ChildIdx < seq2->m_ChildIdx);
104  }
105  };
107 
108  void StartItsConsistencyCheck(const CAlnMixSeq& seq,
109  const TSeqPos& start,
110  size_t match_idx) const;
111 
113  {
114  m_StartIts.insert(TStartIterators::value_type(seq, iter))
115  .first->second = iter;
116  }
117 
120  int m_DsIdx; // used by the truncate algorithm
121 };
122 
123 
124 
125 END_objects_SCOPE // namespace ncbi::objects::
126 
128 
129 #endif // OBJECTS_ALNMGR___ALNSEGMENTS__HPP
CAlnMixMatches::TCalcScoreMethod TCalcScoreMethod
Definition: alnmerger.hpp:62
map< CAlnMixSeq *, CAlnMixStarts::iterator, SSeqComp > TStartIterators
void SetStartIterator(CAlnMixSeq *seq, CAlnMixStarts::iterator iter)
TStartIterators m_StartIts
TSegments m_Segments
Definition: alnsegments.hpp:80
list< CRef< CAlnMixSegment > > TSegmentsContainer
Definition: alnsegments.hpp:66
list< CAlnMixSegment * > TSegments
Definition: alnsegments.hpp:67
list< CRef< CAlnMixSeq > > & m_ExtraRows
Definition: alnsegments.hpp:84
CRef< CAlnMixSequences > m_AlnMixSequences
Definition: alnsegments.hpp:82
TCalcScoreMethod x_CalculateScore
Definition: alnsegments.hpp:85
vector< CRef< CAlnMixSeq > > & m_Rows
Definition: alnsegments.hpp:83
int m_SeqIdx
Definition: alnseq.hpp:162
int m_ChildIdx
Definition: alnseq.hpp:163
CAlnMixStarts::const_iterator current
Definition: alnsegments.hpp:92
CObject –.
Definition: ncbiobj.hpp:180
Definition: map.hpp:338
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
#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
unsigned int
A callback function used to compare two keys in a database.
Definition: types.hpp:1210
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Modified on Wed Apr 17 13:08:52 2024 by modify_doxy.py rev. 669887