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

Go to the SVN repository for this file.

1 #ifndef ALGO_ALIGN___NW_SPLICED_ALIGNER__HPP
2 #define ALGO_ALIGN___NW_SPLICED_ALIGNER__HPP
3 
4 /* $Id: nw_spliced_aligner.hpp 37839 2008-05-08 23:53:46Z kapustin $
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: Yuri Kapustin
30 *
31 * File Description:
32 * Base class for spliced aligners.
33 *
34 */
35 
36 #include "nw_band_aligner.hpp"
37 
38 
39 /** @addtogroup AlgoAlignSpliced
40  *
41  * @{
42  */
43 
44 
46 
48 {
49 public:
50 
51  // Setters and getters
52  void SetWi(unsigned char splice_type, TScore value);
53  TScore GetWi(unsigned char splice_type);
54 
55  void SetCDS(size_t cds_start, size_t cds_stop) {
56  m_cds_start = cds_start;
57  m_cds_stop = cds_stop;
58  }
59 
60  void SetIntronMinSize(size_t s) {
61  m_IntronMinSize = s;
62  }
63 
64  size_t GetIntronMinSize(void) const {
65  return m_IntronMinSize;
66  }
67 
68  static size_t GetDefaultIntronMinSize (void) {
69  return 25;
70  }
71 
72  void CheckPreferences(void);
73 
74  virtual size_t GetSpliceTypeCount(void) = 0;
75 
76 protected:
77 
79 
80  CSplicedAligner( const char* seq1, size_t len1,
81  const char* seq2, size_t len2);
82  CSplicedAligner(const string& seq1, const string& seq2);
83 
85  size_t m_cds_start, m_cds_stop;
86 
87  virtual bool x_CheckMemoryLimit(void);
88 
89  virtual TScore* x_GetSpliceScores() = 0;
90 
91  // a trivial but helpful memory allocator for core dynprog
92  // that promptly throws std::bad_alloc on failure
93  template<class T>
94  struct SAllocator {
95 
96  SAllocator (size_t N) {
97  m_Buf = new T [N];
98  memset((void*)m_Buf, 0, N * sizeof(T));
99  }
100 
101  ~SAllocator() { delete[] m_Buf; }
102 
103  T * GetPointer(void) {
104  return m_Buf;
105  }
106 
107  T * m_Buf;
108  };
109 };
110 
111 
113 
114 /* @} */
115 
116 #endif /* ALGO_ALIGN___SPLICED_ALIGNER__HPP */
#define T(s)
Definition: common.h:230
virtual bool x_CheckMemoryLimit(void)
virtual size_t GetSpliceTypeCount(void)=0
void SetIntronMinSize(size_t s)
static size_t GetDefaultIntronMinSize(void)
size_t GetIntronMinSize(void) const
void SetCDS(size_t cds_start, size_t cds_stop)
virtual TScore * x_GetSpliceScores()=0
#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_XALGOALIGN_EXPORT
Definition: ncbi_export.h:985
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
#define N
Definition: crc32.c:57
Modified on Fri Sep 20 14:58:32 2024 by modify_doxy.py rev. 669887