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

Go to the SVN repository for this file.

1 /*
2 * $Id: NSeq.hpp 46653 2010-07-28 17:47:35Z 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 #ifndef NSEQ_H
34 #define NSEQ_H
35 
36 #include <corelib/ncbistl.hpp>
37 #include <vector>
38 
41  class CScope;
42  class CSeq_loc;
44 BEGIN_SCOPE(prosplign)
46 
47 enum Nucleotides { nA, nC, nG, nT, nN };
48 
49 typedef vector<char> NSEQ;
50 
51 class CNSeq
52 {
53 public:
54  CNSeq();
55  CNSeq(CScope& scope, CSeq_loc& genomic)
56  {
57  Init(scope,genomic);
58  }
59  ~CNSeq(void);
60 
61 //both init methods try to preserve three extra letters at the end of seq for stop presence check
62 
63  void Init(CScope& scope, CSeq_loc& genomic);
64  //just cut ranges given in igi from fullseq
65  void Init(const CNSeq& fullseq, const vector<pair<int, int> >& igi);
66 
67  // letter by position
68  char Upper(int pos) const;
69  inline int GetNuc(NSEQ::size_type j) const { return seq[j]; }
70  inline int operator[](NSEQ::size_type j) const { return seq[j]; }
71  inline int size(void) const{ return m_size; }
72  //can a letter be taken at position 'pos'?
73  inline bool ValidPos(int pos) const{ return pos >= 0 && pos < (int)seq.size(); }
74 private:
75  int m_size;//represents part of sequence involved into alignment; m_size could be less than seq.size()
76  NSEQ seq; //real sequence may have up to three extra letters for stop check that are not involved
77  // into alignment.
78  CNSeq(const CNSeq&);
80 };
81 
82 END_SCOPE(prosplign)
84 
85 #endif//NSEQ_H
USING_SCOPE(ncbi::objects)
vector< char > NSEQ
Definition: NSeq.hpp:49
Nucleotides
Definition: NSeq.hpp:47
@ nA
Definition: NSeq.hpp:47
@ nG
Definition: NSeq.hpp:47
@ nT
Definition: NSeq.hpp:47
@ nN
Definition: NSeq.hpp:47
@ nC
Definition: NSeq.hpp:47
Definition: NSeq.hpp:52
int m_size
Definition: NSeq.hpp:75
int operator[](NSEQ::size_type j) const
Definition: NSeq.hpp:70
int size(void) const
Definition: NSeq.hpp:71
CNSeq(CScope &scope, CSeq_loc &genomic)
Definition: NSeq.hpp:55
CNSeq operator=(const CNSeq &)
~CNSeq(void)
Definition: NSeq.cpp:53
void Init(CScope &scope, CSeq_loc &genomic)
Definition: NSeq.cpp:83
int GetNuc(NSEQ::size_type j) const
Definition: NSeq.hpp:69
bool ValidPos(int pos) const
Definition: NSeq.hpp:73
char Upper(int pos) const
Definition: NSeq.cpp:58
CNSeq(const CNSeq &)
CNSeq()
Definition: NSeq.cpp:48
NSEQ seq
Definition: NSeq.hpp:76
CScope –.
Definition: scope.hpp:92
#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
unsigned int
A callback function used to compare two keys in a database.
Definition: types.hpp:1210
Magic spell ;-) needed for some weird compilers... very empiric.
The NCBI C++/STL use hints.
Modified on Wed Sep 04 15:06:02 2024 by modify_doxy.py rev. 669887