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

Go to the SVN repository for this file.

1 #ifndef ALGO_ALIGN_UTIL___SCORE_BUILDER__HPP
2 #define ALGO_ALIGN_UTIL___SCORE_BUILDER__HPP
3 
4 /* $Id: score_builder.hpp 66823 2015-03-26 16:08:56Z boukn $
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: Mike DiCuccio
30  *
31  * File Description:
32  *
33  */
34 
35 #include <corelib/ncbiobj.hpp>
36 #include <util/range_coll.hpp>
40 
41 struct BlastScoreBlk; // C structure
42 
44 
45 class CPairwiseAln;
46 
47 BEGIN_SCOPE(blast)
48  class CBlastOptionsHandle;
49 END_SCOPE(blast)
50 
52 
53 class CScope;
54 
56 {
57 public:
58 
59  CScoreBuilder();
60  CScoreBuilder(enum blast::EProgram program_type);
61  CScoreBuilder(blast::CBlastOptionsHandle& options);
62  ~CScoreBuilder();
63 
64 
65  void SetGapOpen(int gapopen) { m_GapOpen = gapopen; }
66  void SetGapExtend(int gapextend) { m_GapExtend = gapextend; }
67 
68  /// @name Functions to add scores directly to Seq-aligns
69  /// @{
70 
71  /// deprecated: use CSeq_align::EScoreType directly
73  void AddScore(CScope& scope, CSeq_align& align,
74  EScoreType score);
75 
76  /// deprecated: use CSeq_align::EScoreType directly
78  void AddScore(CScope& scope, list< CRef<CSeq_align> >& aligns,
79  EScoreType score);
80 
81  /// @}
82 
83  /// @name Functions to compute scores without adding
84  /// @{
85 
86  double ComputeScore(CScope& scope, const CSeq_align& align,
87  const CRangeCollection<TSeqPos> &ranges,
89 
90  double ComputeScore(CScope& scope, const CSeq_align& align,
92  {
93  return CScoreBuilderBase::ComputeScore(scope, align, score);
94  }
95 
96  double ComputeScore(CScope& scope, const CSeq_align& align,
97  const TSeqRange &range,
99  {
100  return CScoreBuilderBase::ComputeScore(scope, align, range, score);
101  }
102 
103  void AddScore(CScope& scope, CSeq_align& align,
105  {
106  CScoreBuilderBase::AddScore(scope, align, score);
107  }
108 
109  void AddScore(CScope& scope, list< CRef<CSeq_align> >& aligns,
111  {
112  CScoreBuilderBase::AddScore(scope, aligns, score);
113  }
114 
115  /// Compute the BLAST score of the alignment
116  int GetBlastScore (CScope& scope, const CSeq_align& align);
117 
118  /// Compute the BLAST bit score
119  double GetBlastBitScore(CScope& scope, const CSeq_align& align);
120 
121  /// Compute the BLAST e-value
122  double GetBlastEValue (CScope& scope, const CSeq_align& align);
123 
124 
125  void AddTracebacks(CScope& scope, CSeq_align& align);
126 
127  void AddTracebacks(CScope& scope, list< CRef<CSeq_align> >& aligns);
128 
129  string GetTraceback(const CSeq_align& align, CSeq_align::TDim row);
130 
131  string GetTraceback(CScope& scope, const CSeq_align& align,
133 
134  int ComputeTieBreaker(const CSeq_align& align);
135  void AddTieBreaker(CSeq_align& align);
136 
137  /// @}
138 
139  /// @name Functions for configuring blast scores
140  /// @{
141 
142  void SetEffectiveSearchSpace(Int8 searchsp) // required for blast e-values
143  {
144  m_EffectiveSearchSpace = searchsp;
145  }
146 
147  /// @}
148 
149 private:
150 
152  enum blast::EProgram m_BlastType;
156 
157  void x_Initialize(blast::CBlastOptionsHandle& options);
158 
159  int GetBlastScoreDenseg (CScope& scope, const CSeq_align& align);
160  int GetBlastScoreStd (CScope& scope, const CSeq_align& align);
161  int GetBlastScoreSpliced(CScope& scope, const CSeq_align& align);
162  int GetBlastScoreProtToNucl(CScope& scope, const CSeq_align& align,
163  list<CRef<CPairwiseAln> >& pairs);
164 
165 protected:
167  {
168  return m_ScoreBlk;
169  }
170 };
171 
172 
173 
176 
177 #endif // ALGO_ALIGN_UTIL___SCORE_BUILDER__HPP
Definitions of special type used in BLAST.
EProgram
This enumeration is to evolve into a task/program specific list that specifies sets of default parame...
Definition: blast_types.hpp:56
Handle to the options to the BLAST algorithm.
A pairwise aln is a collection of ranges for a pair of rows.
CScope –.
Definition: scope.hpp:92
void AddScore(CScope &scope, CSeq_align &align, CSeq_align::EScoreType score)
double ComputeScore(CScope &scope, const CSeq_align &align, CSeq_align::EScoreType score)
struct BlastScoreBlk * GetBlastScoreBlkPtr()
CScoreBuilder(enum blast::EProgram program_type)
void SetGapExtend(int gapextend)
double ComputeScore(CScope &scope, const CSeq_align &align, CSeq_align::EScoreType score)
struct BlastScoreBlk * m_ScoreBlk
void SetEffectiveSearchSpace(Int8 searchsp)
void AddScore(CScope &scope, CSeq_align &align, CSeq_align::EScoreType score)
double ComputeScore(CScope &scope, const CSeq_align &align, const TSeqRange &range, CSeq_align::EScoreType score)
void AddScore(CScope &scope, list< CRef< CSeq_align > > &aligns, CSeq_align::EScoreType score)
Int8 m_EffectiveSearchSpace
void SetGapOpen(int gapopen)
CScoreBuilder(blast::CBlastOptionsHandle &options)
EScoreType
enum controlling known named scores
Definition: Seq_align.hpp:128
#define NCBI_DEPRECATED
int64_t Int8
8-byte (64-bit) signed integer
Definition: ncbitype.h:104
#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
#define NCBI_XALGOALIGN_EXPORT
Definition: ncbi_export.h:985
range(_Ty, _Ty) -> range< _Ty >
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
#define row(bind, expected)
Definition: string_bind.c:73
Structure used for scoring calculations.
Definition: blast_stat.h:177
Modified on Sat Jun 22 10:39:08 2024 by modify_doxy.py rev. 669887