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

Go to the SVN repository for this file.

1 /*
2 * $Id: BackAlignInfo.hpp 63941 2014-08-06 15:28:23Z kiryutin $
3 *
4 * =========================================================================
5 *
6 * PUBLIC DOMAIN NOTICE
7 * National Center for Biotechnology Information
8 *
9 * This software/database is a "United States Government Work" under the
10 * terms of the United States Copyright Act. It was written as part of
11 * the author's official duties as a United States Government employee and
12 * thus cannot be copyrighted. This software/database is freely available
13 * to the public for use. The National Library of Medicine and the U.S.
14 * Government have not placed any restriction on its use or reproduction.
15 *
16 * Although all reasonable efforts have been taken to ensure the accuracy
17 * and reliability of the software and data, the NLM and the U.S.
18 * Government do not and cannt warrant the performance or results that
19 * may be obtained by using this software or data. The NLM and the U.S.
20 * Government disclaim all warranties, express or implied, including
21 * warranties of performance, merchantability or fitness for any particular
22 * purpose.
23 *
24 * Please cite the author in any work or product based on this material.
25 *
26 * =========================================================================
27 *
28 * Author: Boris Kiryutin
29 *
30 * =========================================================================
31 */
32 
33 
34 #ifndef PROSPLIGN_BACKALIGNINFO_HPP
35 #define PROSPLIGN_BACKALIGNINFO_HPP
36 
37 #include <corelib/ncbi_limits.hpp>
38 
40 BEGIN_SCOPE(prosplign)
41 
42 template <class el>
43 class MATR
44 {
45 public:
46  void Init(int rownum, int colnum) {
47  coln = colnum;
48  if(pels.max_size()/colnum +1 <= /*(vector<el>::size_type) bug in Linux*/(unsigned)rownum) throw bad_alloc();
49  if(numeric_limits<unsigned long>::max()/colnum +1 <= /*(vector<el>::size_type) bug in Linux*/(unsigned long)rownum) throw bad_alloc();
50  pels.resize(rownum*(unsigned long)colnum);
51  }
52  el *operator[](int row) { return &pels[0] + row*(unsigned long)coln; }
53 private:
54  vector<el> pels;
55  int coln;
56 };
57 
58 
59 template<class T>
61 {
62 public:
64  int ilen; //sequence1 length = number of rows in B
65  int jlen; //sequence2 length = number of columns in B
66  int maxi, maxj; //indexes to start back alignment from
67 // int maxsc; //maximum score at the last column
68 
69  void Init(int oilen, int ojlen)
70  {
71  // maxsc = 0;
72  ilen = oilen;
73  jlen = ojlen;
74  b.Init(ilen, jlen);
75  }
76 
77 };
78 
80 
81 END_SCOPE(prosplign)
83 
84 #endif //PROSPLIGN_BACKALIGNINFO_HPP
CTBackAlignInfo< char > CBackAlignInfo
void Init(int oilen, int ojlen)
el * operator[](int row)
void Init(int rownum, int colnum)
vector< el > pels
int coln
#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
T max(T x_, T y_)
#define row(bind, expected)
Definition: string_bind.c:73
Modified on Fri Sep 20 14:58:31 2024 by modify_doxy.py rev. 669887