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

Go to the SVN repository for this file.

1 #ifndef ALGO_ALIGN_UTIL_BLAST_TABULAR__HPP
2 #define ALGO_ALIGN_UTIL_BLAST_TABULAR__HPP
3 
4 /* $Id: blast_tabular.hpp 65450 2014-12-03 16:09:21Z kiryutin $
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 * CBlastTabular (a.k.a "m8") format representation
33 *
34 */
35 
36 #include <corelib/ncbistd.hpp>
39 
41 
42 
44 {
45 public:
46 
49 
50  // c'tors
51  CBlastTabular(void) {};
52 
53  CBlastTabular(const objects::CSeq_align& seq_align, bool save_xcript = false);
54 
55  CBlastTabular(const TId& idquery, TCoord qstart, bool qstrand,
56  const TId& idsubj, TCoord sstart, bool sstrand,
57  const string& xcript);
58 
59  CBlastTabular(const char* m8, bool force_local_ids = false);
60 
61  /// Construct CBlastTabular from m8 line,
62  /// use score_func to select seq-id from FASTA-style ids
63  typedef int (*SCORE_FUNC)(const CRef<objects::CSeq_id>& id);
64  CBlastTabular(const char* m8, SCORE_FUNC score_func);
65 
66  // getters / setters
67  void SetLength(TCoord length);
68  TCoord GetLength(void) const;
69 
70  void SetMismatches(TCoord mismatches);
71  TCoord GetMismatches(void) const;
72 
73  void SetGaps(TCoord gaps);
74  TCoord GetGaps(void) const;
75 
76  void SetRawScore(TCoord score);
77  TCoord GetRawScore(void) const;
78 
79  void SetEValue(double evalue);
80  double GetEValue(void) const;
81 
82  void SetIdentity(float identity);
83  float GetIdentity(void) const;
84 
85  void SetScore(float score);
86  float GetScore(void) const;
87 
88  virtual void Modify(Uint1 where, TCoord new_pos);
89 
90 protected:
91 
92  TCoord m_Length; // length of the alignment
93  TCoord m_Mismatches; // number of mismatches
94  TCoord m_Gaps; // number of gap openings
95  TCoord m_RawScore; // blast score
96  double m_EValue; // e-Value
97  float m_Identity; // Percent identity (ranging from 0 to 1)
98  float m_Score; // bit score
99 
100  template <class F>
101  void x_Deserialize(const char* m8, F seq_id_extractor);
102 
103  virtual void x_PartialSerialize(CNcbiOstream& os) const;
104  virtual void x_PartialDeserialize(const char* m8);
105 
106  static void sx_MineSegment(size_t where, const objects::CStd_seg::TLoc & locs,
107  TSeqPos * delta, TSeqPos * prev);
108 };
109 
110 
111 /////////////////////////////////////////////////////////////////////////////
112 ////////////////////////////////////////////////////////////////////////////
113 
115 
116 #endif /* ALGO_ALIGN_UTIL_BLAST_TABULAR__HPP */
TSeqPos TCoord
virtual void Modify(Uint1 point, TCoord new_pos)
virtual void x_PartialSerialize(CNcbiOstream &os) const
TParent::TCoord TCoord
CBlastTabular(const objects::CSeq_align &seq_align, bool save_xcript=false)
CAlignShadow TParent
Include a standard set of the NCBI C++ Toolkit most basic headers.
static DLIST_TYPE *DLIST_NAME() prev(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
Definition: dlist.tmpl.h:61
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
uint8_t Uint1
1-byte (8-bit) unsigned integer
Definition: ncbitype.h:99
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
#define NCBI_XALGOALIGN_EXPORT
Definition: ncbi_export.h:985
unsigned int
A callback function used to compare two keys in a database.
Definition: types.hpp:1210
#define F(x)
Make a parametrized function appear to have only one variable.
Definition: ncbi_math.c:342
Int4 delta(size_t dimension_, const Int4 *score_)
vector< TSeqPos > GetMismatches(const CSeq_feat &feat, const CBioseq_Handle &prot_handle, const string &transl_prot)
Definition: utilities.cpp:2658
Modified on Tue May 14 16:19:55 2024 by modify_doxy.py rev. 669887