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

Go to the SVN repository for this file.

1 #ifndef MERGE_TREE__HPP
2 #define MERGE_TREE__HPP
3 
4 /* $Id: merge_tree.hpp 95345 2021-11-08 14:35:07Z mozese2 $
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 * Authors: Nathan Bouk
30 *
31 * File Description:
32 * Alignment merge by way of depth-first tree search
33 *
34 * ===========================================================================
35 */
36 
37 #include <corelib/ncbistr.hpp>
38 #include <corelib/ncbidiag.hpp>
39 #include <corelib/ncbistd.hpp>
40 #include <corelib/ncbiobj.hpp>
41 #include <corelib/ncbi_system.hpp>
42 
43 #include <serial/serialbase.hpp>
44 #include <serial/serial.hpp>
45 
47 
51 
52 
53 
56 #include <objmgr/scope.hpp>
57 #include <objmgr/seq_vector.hpp>
58 #include <objmgr/bioseq_handle.hpp>
59 
60 #include <util/range.hpp>
61 
62 
66 
67 
69 
71 class CSeq_id;
72 class CSeq_align;
74 
75 
77 {
78 public:
79 
80  CTreeAlignMerger() : m_Scope(NULL), Callback(NULL), CallbackData(NULL), m_Explored(512), m_Inserted(512), m_FrameBuffer(CMergeTree::kFrameBufSize) { }
81 
82  void SetScope(objects::CScope* Scope) { m_Scope = Scope; }
83  void SetScoring(CMergeTree::SScoring Scoring) { m_Scoring = Scoring; }
84 
86  SetInterruptCallback(CMergeTree::TInterruptFnPtr callback, void* callback_data)
87  { this->Callback = callback; this->CallbackData = callback_data; return callback; }
88 
89 
90  // Calls Merge_Dist
91  void Merge(const list< CRef<objects::CSeq_align> >& Input,
92  list< CRef<objects::CSeq_align> >& Output ) ;
93 
94  void Merge_AllAtOnce(const list< CRef<objects::CSeq_align> >& Input,
95  list< CRef<objects::CSeq_align> >& Output ) ;
96  void Merge_Pairwise(const list< CRef<objects::CSeq_align> >& Input,
97  list< CRef<objects::CSeq_align> >& Output ) ;
98 
99  void Merge_Dist(const list< CRef<objects::CSeq_align> >& Input,
100  list< CRef<objects::CSeq_align> >& Output ) ;
101 
102 
103 private:
104 
105  friend class CMergeTree;
106 
107  objects::CScope* m_Scope;
109 
112 
114 
116 
118  x_MakeSeqAlign(TEquivList& Equivs,
119  objects::CSeq_id_Handle QueryIDH,
120  objects::CSeq_id_Handle SubjtIDH);
121 
122 
123  typedef pair<objects::CSeq_id_Handle, objects::ENa_strand> TSeqIdPair;
124  typedef pair<TSeqIdPair, TSeqIdPair> TMapKey;
125  typedef vector<CRef<objects::CSeq_align> > TAlignVec;
127 
128  void
129  x_MakeMergeableGroups(list<CRef<objects::CSeq_align> > Input,
130  TAlignGroupMap& AlignGroupMap);
131 
132  void x_SplitGlobalUnique(const TAlignVec& Input, TAlignVec& Unique, TAlignVec& Other);
133 
134  void
135  x_Merge_Dist_Impl(TAlignVec& Aligns,
136  objects::CSeq_id_Handle QueryIDH, objects::CSeq_id_Handle SubjtIDH,
137  objects::CBioseq_Handle QueryBSH, objects::CBioseq_Handle SubjtBSH,
138  list< CRef<objects::CSeq_align> >& Output);
139 
140 };
141 
142 
144 
145 
146 #endif // end MERGE_TREE__HPP
static CRef< CScope > m_Scope
deque< SFindBeforesIterFrame > TFrameBuffer
bool(* TInterruptFnPtr)(void *callback_data)
pair< TSeqIdPair, TSeqIdPair > TMapKey
Definition: merge_tree.hpp:124
CMergeTree::TFrameBuffer m_FrameBuffer
Definition: merge_tree.hpp:115
map< TMapKey, TAlignVec > TAlignGroupMap
Definition: merge_tree.hpp:126
void SetScope(objects::CScope *Scope)
Definition: merge_tree.hpp:82
vector< CRef< objects::CSeq_align > > TAlignVec
Definition: merge_tree.hpp:125
void SetScoring(CMergeTree::SScoring Scoring)
Definition: merge_tree.hpp:83
CMergeTree::TInterruptFnPtr Callback
Definition: merge_tree.hpp:110
CMergeTree::TBitVec m_Inserted
Definition: merge_tree.hpp:113
objects::CScope * m_Scope
Definition: merge_tree.hpp:107
pair< objects::CSeq_id_Handle, objects::ENa_strand > TSeqIdPair
Definition: merge_tree.hpp:123
CMergeTree::SScoring m_Scoring
Definition: merge_tree.hpp:108
CMergeTree::TInterruptFnPtr SetInterruptCallback(CMergeTree::TInterruptFnPtr callback, void *callback_data)
Definition: merge_tree.hpp:86
Definition: map.hpp:338
Include a standard set of the NCBI C++ Toolkit most basic headers.
The NCBI C++ standard methods for dealing with std::string.
vector< CEquivRange > TEquivList
Definition: equiv_range.hpp:48
#define NULL
Definition: ncbistd.hpp:225
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
Defines NCBI C++ diagnostic APIs, classes, and macros.
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
The Object manager core.
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 Thu Apr 25 08:21:23 2024 by modify_doxy.py rev. 669887