NCBI C++ ToolKit
hit_matrix_ds_builder.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: hit_matrix_ds_builder.cpp 25706 2012-04-25 00:21:04Z voronov $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Andrey Yazhuk
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
35 
37 
39 
40 #include <gui/objutils/utils.hpp>
44 
45 #include <corelib/ncbitime.hpp>
46 #include <objmgr/align_ci.hpp>
47 #include <objmgr/bioseq_handle.hpp>
48 
49 
52 
53 // TODO factor out common code and move to the base class
55 {
56 }
57 
58 
60 {
61  x_Clear();
62 }
63 
64 
65 void CHitMatrixDSBuilder::Init(objects::CScope& scope, const objects::CSeq_align& align)
66 {
67  x_Clear();
68 
69  m_Scope.Reset(&scope);
70  m_OrigAligns.push_back(CConstRef<CSeq_align>(&align));
71 }
72 
73 
74 void CHitMatrixDSBuilder::Init(objects::CScope& scope, const objects::CSeq_annot& annot)
75 {
76  x_Clear();
77 
78  m_Scope.Reset(&scope);
80 }
81 
82 
83 void CHitMatrixDSBuilder::Init(objects::CScope& scope, const objects::CBioseq& bioseq)
84 {
85  x_Clear();
86 
87  m_Scope.Reset(&scope);
89 }
90 
91 
92 void CHitMatrixDSBuilder::Init(objects::CScope& scope, const objects::CBioseq_Handle& handle)
93 {
94  x_Clear();
95 
96  m_Scope.Reset(&scope);
97 
99  CAlign_CI it(handle, sel);
100  for ( ; it; ++it) {
101  m_OrigAligns.push_back(CConstRef<CSeq_align>(&*it));
102  }
103 }
104 
105 
106 void CHitMatrixDSBuilder::Init(objects::CScope& scope, TAlignVector& aligns)
107 {
108  x_Clear();
109 
110  m_Scope.Reset(&scope);
111  m_OrigAligns = aligns;
112 }
113 
114 
115 /// initial data set from which an alignment will be build
116 void CHitMatrixDSBuilder::Init(CScope& scope, TAnnotVector& annots)
117 {
118  x_Clear();
119 
120  m_Scope.Reset(&scope);
121 
122  ITERATE(TAnnotVector, it_annot, annots) {
123  const CSeq_annot& annot = **it_annot;
124  if(annot.GetData().IsAlign() ) {
126  }
127  }
128 }
129 
130 
132 {
133  m_Scope.Reset();
134  m_OrigAligns.clear();
135 }
136 
137 
140 {
141  //LOG_POST(Info << "CHitMatrixDSBuilder::CreateDataSource() "
142  // << m_OrigAligns.size() << " m_OrigAligns");
143 
145  if(ds) {
147  params.m_RowBased = false;
149 
150  ds->SetParams(params, false);
151  }
152  return ds;
153 }
154 
155 
158 {
159  //LOG_POST(Info << "CHitMatrixDSBuilder::x_CreateSparseDataSource()");
160  //CStopWatch sw;
161  //sw.Start();
162 
164  ds->Init(*m_Scope, m_OrigAligns);
165 
166  //LOG_POST(Info << "CHitMatrixDSBuilder::x_CreateSparseDataSource() " << 1000 * sw.Elapsed() << "ms");
167  return ds;
168 }
169 
170 
CAlign_CI –.
Definition: align_ci.hpp:63
@ eBothDirections
No filtering: use both direct and reverse sequences.
CIRef< IHitMatrixDataSource > CreateDataSource()
vector< CConstRef< objects::CSeq_align > > TAlignVector
void Init(objects::CScope &scope, const objects::CSeq_align &align)
initial data set from which an alignment will be build
CRef< objects::CScope > m_Scope
CIRef< IHitMatrixDataSource > x_CreateDataSource()
vector< CConstRef< objects::CSeq_annot > > TAnnotVector
CHitMatrixDataSource.
Definition: dense_ds.hpp:106
CScope –.
Definition: scope.hpp:92
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
static objects::SAnnotSelector GetAnnotSelector(TAnnotFlags flags=0)
request an annotation selector for a given type
Definition: utils.cpp:167
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
bool IsAlign(void) const
Check if variant Align is selected.
Definition: Seq_annot_.hpp:635
const TData & GetData(void) const
Get the Data member data.
Definition: Seq_annot_.hpp:873
USING_SCOPE(ncbi::objects)
Defines: CTimeFormat - storage class for time format.
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.
SAnnotSelector –.
Modified on Wed May 29 18:43:45 2024 by modify_doxy.py rev. 669887