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

Go to the SVN repository for this file.

1 #ifndef GUI_OBJUTILS___SPARSE_FUNCTIONS__HPP
2 #define GUI_OBJUTILS___SPARSE_FUNCTIONS__HPP
3 
4 /* $Id: sparse_functions.hpp 25706 2012-04-25 00:21:04Z voronov $
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: Andrey Yazhuk
30  *
31  * File Description:
32  *
33  */
34 
35 #include <corelib/ncbistd.hpp>
36 #include <corelib/ncbiobj.hpp>
37 
38 #include <gui/gui_export.h>
39 
41 
42 #include <objects/seqalign/Dense_seg.hpp> // TODO - remove
44 #include <serial/iterator.hpp>
45 
46 
48  class CSeq_id;
49  class CSeq_align;
51 
52 
54 
55 /// This is the place where elements of the new Alignment Library will be collected
56 
57 ///////////////////////////////////////////////////////////////////////////////
58 /// Extractors
59 
60 /// Generic Extractor
61 template<class T>
62  void ExtractSeqAligns(const T& obj,
63  vector< CConstRef<objects::CSeq_align> >& aligns)
64 {
66  while(it) {
67  aligns.push_back(CConstRef<objects::CSeq_align>(&*it));
68  ++it;
69  }
70 }
71 
72 
73 ///////////////////////////////////////////////////////////////////////////////
74 /// Converters
75 
76 /// Converter CSeq_align -> SAlignedSeq-s
78  bool ConvertToPairwise(const objects::CSeq_align& align,
79  const objects::CSeq_id& master_id,
80  vector<SAlignedSeq*>& aln_seqs);
81 
82 /// Converter vector of CSeq_align -> SAlignedSeq-s
84  bool ConvertToPairwise(const vector< CConstRef<objects::CSeq_align> >& aligns,
85  const objects::CSeq_id& master_id,
86  vector<SAlignedSeq*>& aln_seqs);
87 
88 /// Converter CSparse_seg -> vector<SAlignedSeq*>
90  bool ConvertToPairwise(const objects::CSparse_seg& sparse_seg,
91  vector<SAlignedSeq*>& aln_seqs);
92 
93 /// TODO not Sparse - move to a different file
95  bool ConvertToPairwise(const objects::CDense_seg& dense_seg,
96  objects::CDense_seg::TDim anchor_row,
97  vector<SAlignedSeq*>& aln_seqs);
98 
99 ///////////////////////////////////////////////////////////////////////////////
100 /// Helper functions used by Converters
102  SAlignedSeq* CreateAlignRow(const objects::CSparse_align& align,
103  bool master_first);
104 
105 /// Converter CSparse_align ->
106 /// TODO redesign API
108  void GetAlignColl(const objects::CSparse_align& sparse_align,
109  const objects::CSeq_id& master_id,
111 
112 /// TODO not Sparse - move to a different file
114  SAlignedSeq* CreateAlignRow(const objects::CDense_seg& dense_seg,
117 
118 ///////////////////////////////////////////////////////////////////////////////
119 /// Builder functions
120 
121 /// Build a Sparse Alignment
123  BuildSparseAlignment(const objects::CSeq_id& master_id,
124  vector<SAlignedSeq*>& aln_seqs,
125  objects::CScope& scope);
126 
127 
128 /// Build a Dense Alignment
129 NCBI_GUIOBJUTILS_EXPORT objects::CAlnVec*
130  BuildDenseAlignment(const objects::CSeq_id& master_id,
131  vector<SAlignedSeq*>& aln_seqs,
132  objects::CScope& scope);
133 
134 ///////////////////////////////////////////////////////////////////////////////
135 /// Reverse Converters
136 
139  CreateSparseAlign(const objects::CSeq_id& id_1,
140  const objects::CSeq_id& id_2,
141  const SAlignTools::TAlignColl& coll);
142 
144 
145 #endif // GUI_OBJUTILS___SPARSE_FUNCTIONS__HPP
CAnchoredAln::TDim TDim
CRef –.
Definition: ncbiobj.hpp:618
CSparseAlignment - an alignment based on CSparse_seg and CAlingRangeCollection classes rather than on...
Template class for iteration on objects of class C (non-medifiable version)
Definition: iterator.hpp:767
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define T(s)
Definition: common.h:230
#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
#define NCBI_GUIOBJUTILS_EXPORT
Definition: gui_export.h:512
Defines to provide correct exporting from DLLs in Windows.
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
objects::CAlnVec * BuildDenseAlignment(const objects::CSeq_id &master_id, vector< SAlignedSeq * > &aln_seqs, objects::CScope &scope)
Build a Dense Alignment.
bool ConvertToPairwise(const objects::CSeq_align &align, const objects::CSeq_id &master_id, vector< SAlignedSeq * > &aln_seqs)
Converters.
void GetAlignColl(const objects::CSparse_align &sparse_align, const objects::CSeq_id &master_id, SAlignTools::TAlignColl &coll)
Converter CSparse_align -> TODO redesign API.
CSparseAlignment * BuildSparseAlignment(const objects::CSeq_id &master_id, vector< SAlignedSeq * > &aln_seqs, objects::CScope &scope)
Builder functions.
void ExtractSeqAligns(const T &obj, vector< CConstRef< objects::CSeq_align > > &aligns)
This is the place where elements of the new Alignment Library will be collected.
CRef< objects::CSparse_align > CreateSparseAlign(const objects::CSeq_id &id_1, const objects::CSeq_id &id_2, const SAlignTools::TAlignColl &coll)
Reverse Converters.
SAlignedSeq * CreateAlignRow(const objects::CSparse_align &align, bool master_first)
Helper functions used by Converters.
This is a building block for a Builder represents a Sequence aligned to an Anchor (pairwise alignment...
Modified on Fri Jun 14 16:54:25 2024 by modify_doxy.py rev. 669887