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

Go to the SVN repository for this file.

1 #ifndef GUI_WIDGETS_ALN_MULTIPLE___ALNVEC_MULTI_DS__HPP
2 #define GUI_WIDGETS_ALN_MULTIPLE___ALNVEC_MULTI_DS__HPP
3 
4 /* $Id: alnvec_multi_ds.hpp 45564 2020-09-08 19:05:27Z shkeda $
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 
36 
40 
42 
43 
45 
47 
48 ////////////////////////////////////////////////////////////////////////////////
49 /// CAlnVecMultiDataSource - implementation of IAlnMultiDataSource for
50 /// CAlnVec-based alignments.
52  : public IAlnMultiDataSource,
53  public CEventHandler
54 {
55 public:
56  CAlnVecMultiDataSource(objects::CScope& scope);
58 
59  virtual void Init(const objects::CSeq_annot& annot, bool sync = false, bool select_anchor = false);
60  virtual void Init(const objects::CBioseq_Handle& handle, bool sync = false, bool select_anchor = false);
61  virtual void Init(const vector< CConstRef<objects::CSeq_align> >& aligns,
62  bool sync = false, bool select_anchor = false);
63 
64  //virtual void OnTaskFinished(CEvent* event);
65 
66  /// @name IAlnMultiDataSource implementation
67  /// @{
68  virtual bool IsEmpty() const;
69 
70  virtual void SetGapChar(TResidue gap_char);
71 
72  virtual IAlnExplorer::EAlignType GetAlignType() const;
73 
74  virtual int GetConsensusRow() const;
75 
76  virtual bool CanCreateConsensus();
77  void CreateConsensus(vector<string>& consens) const;
78  virtual void CreateConsensus();
79  virtual void SetCreateConsensus(bool b) { m_CreateConsensus = b; }
80 
81  virtual TNumrow GetNumRows(void) const;
82 
83  virtual TSeqPos GetAlnStart(void) const;
84  virtual TSeqPos GetAlnStop(void) const;
85 
86  virtual TSeqPos GetSeqStart(TNumrow row) const;
87  virtual TSeqPos GetSeqStop(TNumrow row) const;
88 
89  virtual bool IsSetAnchor (void) const;
90  virtual TNumrow GetAnchor (void) const;
91  virtual bool CanChangeAnchor(void) const;
92  virtual bool SetAnchor (TNumrow anchor);
93  virtual bool UnsetAnchor (void);
94 
95  virtual bool CanGetId(TNumrow row) const;
96  virtual const objects::CSeq_id& GetSeqId(TNumrow row) const;
97  virtual const objects::CBioseq_Handle& GetBioseqHandle(TNumrow row) const;
98 
99  virtual TSeqPos GetBaseWidth(TNumrow row) const;
100  virtual int GetGenCode(IAlnExplorer::TNumrow row) const;
101 
102  virtual bool IsPositiveStrand(TNumrow row) const;
103  virtual bool IsNegativeStrand(TNumrow row) const;
104 
105  virtual TSignedSeqPos GetSeqPosFromAlnPos(TNumrow for_row, TSeqPos aln_pos,
106  TSearchDirection dir = IAlnExplorer::eNone,
107  bool try_reverse_dir = true) const;
108  virtual TSignedSeqPos GetAlnPosFromSeqPos(TNumrow row, TSeqPos seq_pos,
109  TSearchDirection dir = IAlnExplorer::eNone,
110  bool try_reverse_dir = true) const;
111 
112  virtual string& GetAlnSeqString(TNumrow row, string &buffer,
113  const IAlnExplorer::TSignedRange& aln_range) const;
114 
115  virtual const IAlignRowHandle* GetRowHandle(TNumrow row) const;
116 
120 
121  virtual void GetAlnFromSeq(TNumrow row, const TRangeColl& seq_coll,
122  TRangeColl& aln_coll) const;
123  virtual void GetSeqFromAln(TNumrow row, const TRangeColl& aln_coll,
124  TRangeColl& seq_coll) const;
125  virtual bool IsDataReadSync() const { return m_isDataReadSync; }
126 
127  /// @}
128 
129  /// @name ITimerListener implementation
130  /// @{
131  //virtual void OnTimeout(int timer_id);
132  /// @}
133  void OnAppJobNotification(CEvent* evt);
134 
135 protected:
136 
137  virtual void x_ClearHandles();
138  virtual void x_CreateHandles();
139  virtual void x_Assign(objects::CAlnVec& aln_vec);
140 
141  virtual bool x_IsJobRunning();
142  virtual void x_DeleteJob();
143  virtual void x_OnJobProgress(CAppJobNotification& notn);
144 
146 
147 private:
148  // prohibit copying!
151 
152 protected:
153  typedef vector<CAlnVecRowHandle*> THandleVector;
154 
159 
161  int m_JobID;
162 
164 
165 private:
167 
168 };
169 
170 
171 
172 
173 
175 
176 #endif // GUI_WIDGETS_ALN_MULTIPLE___ALNVEC_MULTI_DS__HPP
void x_Assign(CObject_id &dst, const CObject_id &src)
Definition: Seq_id.cpp:203
CAlnVecMultiDataSource - implementation of IAlnMultiDataSource for CAlnVec-based alignments.
CAlnVecMultiDataSource(const CAlnVecMultiDataSource &ds)
vector< CAlnVecRowHandle * > THandleVector
virtual void Init(const vector< CConstRef< objects::CSeq_align > > &aligns, bool sync=false, bool select_anchor=false)
CAlnVecMultiDataSource(objects::CScope &scope)
CRef< objects::CScope > m_Scope
CRef< objects::CAlnVec > m_AlnVec
virtual bool IsDataReadSync() const
virtual void SetCreateConsensus(bool b)
CRef< CBuildAlnVecJob > m_Job
CAlnVecMultiDataSource & operator=(const CAlnVecMultiDataSource &ds)
CAppJobNotification Notification send by CAppJobEventTranslator.
CEventHandler.
CEvent - generic event implementation TODO TODO - Attachments.
Definition: event.hpp:86
IAlignRowHandle provides an abstract way to access alignment row data.
Definition: alnmulti_ds.hpp:59
@ eNone
No search.
IAlnMultiDataSource - interface to a data source representing an abstract multiple alignment.
virtual IAlnExplorer::EAlignType GetAlignType() const =0
virtual void SetGapChar(TResidue gap_char)=0
virtual void GetAlnFromSeq(TNumrow row, const TRangeColl &seq_coll, TRangeColl &aln_coll) const =0
virtual TSignedSeqPos GetSeqPosFromAlnPos(TNumrow for_row, TSeqPos aln_pos, IAlnExplorer::ESearchDirection dir=IAlnExplorer::eNone, bool try_reverse_dir=true) const =0
virtual const IAlignRowHandle * GetRowHandle(TNumrow row) const =0
virtual bool IsPositiveStrand(TNumrow row) const =0
virtual TSeqPos GetAlnStart(void) const =0
virtual TSignedSeqPos GetAlnPosFromSeqPos(TNumrow row, TSeqPos seq_pos, IAlnExplorer::ESearchDirection dir=IAlnExplorer::eNone, bool try_reverse_dir=true) const =0
virtual bool CanGetId(TNumrow row) const =0
virtual int GetConsensusRow() const =0
returns index of the Consensus row or -1 if it doesn't exist
virtual bool CanChangeAnchor(void) const =0
virtual void GetSeqFromAln(TNumrow row, const TRangeColl &aln_coll, TRangeColl &seq_coll) const =0
IAlnExplorer::TResidue TResidue
virtual IAlnSegmentIterator * CreateSegmentIterator(TNumrow row, const IAlnExplorer::TSignedRange &range, IAlnSegmentIterator::EFlags flags) const =0
virtual TNumrow GetNumRows(void) const =0
number of rows in alignment
virtual TSeqPos GetAlnStop(void) const =0
virtual bool SetAnchor(TNumrow anchor)=0
virtual TSeqPos GetSeqStop(TNumrow row) const =0
virtual TSeqPos GetSeqStart(TNumrow row) const =0
virtual bool IsSetAnchor(void) const =0
Anchoring methods.
virtual TNumrow GetAnchor(void) const =0
virtual bool CanCreateConsensus()=0
virtual bool UnsetAnchor(void)=0
virtual bool IsNegativeStrand(TNumrow row) const =0
virtual bool IsEmpty() const =0
virtual void CreateConsensus()=0
virtual string & GetAlnSeqString(TNumrow row, string &buffer, const IAlnExplorer::TSignedRange &aln_range) const =0
Alignment segment iterator interface.
EFlags
Iterator options.
virtual TSeqPos GetBaseWidth(IAlnExplorer::TNumrow) const =0
virtual int GetGenCode(IAlnExplorer::TNumrow row) const =0
static uch flags
static void Init(void)
Definition: cursor6.c:76
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
int TSignedSeqPos
Type for signed sequence position.
Definition: ncbimisc.hpp:887
#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_GUIWIDGETS_ALNMULTIPLE_EXPORT
Definition: gui_export.h:520
range(_Ty, _Ty) -> range< _Ty >
static pcre_uint8 * buffer
Definition: pcretest.c:1051
static bool GetSeqId(const T &d, set< string > &labels, const string name="", bool detect=false, bool found=false)
#define row(bind, expected)
Definition: string_bind.c:73
Modified on Wed Apr 17 13:11:02 2024 by modify_doxy.py rev. 669887