include/algo/align/util/score_builder.hpp

Go to the documentation of this file.
00001 #ifndef ALGO_ALIGN_UTIL___SCORE_BUILDER__HPP
00002 #define ALGO_ALIGN_UTIL___SCORE_BUILDER__HPP
00003 
00004 /*  $Id: score_builder.hpp 170018 2009-09-08 14:50:58Z dicuccio $
00005  * ===========================================================================
00006  *
00007  *                            PUBLIC DOMAIN NOTICE
00008  *               National Center for Biotechnology Information
00009  *
00010  *  This software/database is a "United States Government Work" under the
00011  *  terms of the United States Copyright Act.  It was written as part of
00012  *  the author's official duties as a United States Government employee and
00013  *  thus cannot be copyrighted.  This software/database is freely available
00014  *  to the public for use. The National Library of Medicine and the U.S.
00015  *  Government have not placed any restriction on its use or reproduction.
00016  *
00017  *  Although all reasonable efforts have been taken to ensure the accuracy
00018  *  and reliability of the software and data, the NLM and the U.S.
00019  *  Government do not and cannot warrant the performance or results that
00020  *  may be obtained by using this software or data. The NLM and the U.S.
00021  *  Government disclaim all warranties, express or implied, including
00022  *  warranties of performance, merchantability or fitness for any particular
00023  *  purpose.
00024  *
00025  *  Please cite the author in any work or product based on this material.
00026  *
00027  * ===========================================================================
00028  *
00029  * Authors:  Mike DiCuccio
00030  *
00031  * File Description:
00032  *
00033  */
00034 
00035 #include <corelib/ncbiobj.hpp>
00036 #include <algo/blast/api/blast_types.hpp>
00037 
00038 struct BlastScoreBlk; // C structure
00039 
00040 BEGIN_NCBI_SCOPE
00041 
00042 BEGIN_SCOPE(blast)
00043     class CBlastOptionsHandle;
00044 END_SCOPE(blast)
00045 
00046 BEGIN_SCOPE(objects)
00047 
00048 class CScope;
00049 class CSeq_align;
00050 
00051 class  CScoreBuilder
00052 {
00053 public:
00054 
00055     CScoreBuilder();
00056     CScoreBuilder(enum blast::EProgram program_type);
00057     CScoreBuilder(blast::CBlastOptionsHandle& options);
00058     ~CScoreBuilder();
00059 
00060     enum EScoreType {
00061         //< typical blast 'score'
00062         eScore_Blast,
00063 
00064         //< blast 'bit_score' score
00065         eScore_Blast_BitScore,
00066 
00067         //< blast 'e_value' score
00068         eScore_Blast_EValue,
00069 
00070         //< count of ungapped identities as 'num_ident'
00071         eScore_IdentityCount,
00072 
00073         //< count of ungapped identities as 'num_mismatch'
00074         eScore_MismatchCount,
00075 
00076         //< percent identity as 'pct_identity', range 0.0-100.0
00077         //< this will also create 'num_ident' and 'num_mismatch'
00078         eScore_PercentIdentity,
00079 
00080         //< percent coverage of query as 'pct_coverage', range 0.0-100.0
00081         eScore_PercentCoverage
00082     };
00083 
00084     /// @name Functions to add scores directly to Seq-aligns
00085     /// @{
00086 
00087     void AddScore(CScope& scope, CSeq_align& align,
00088                   EScoreType score);
00089     void AddScore(CScope& scope, list< CRef<CSeq_align> >& aligns,
00090                   EScoreType score);
00091 
00092     /// @}
00093 
00094     /// @name Functions to compute scores without adding
00095     /// @{
00096 
00097     /// Compute ungapped percent identity (range 0-100)
00098     double GetPercentIdentity(CScope& scope, const CSeq_align& align);
00099 
00100     /// Compute percent coverage of the query (sequence 0) (range 0-100)
00101     double GetPercentCoverage(CScope& scope, const CSeq_align& align);
00102 
00103     int GetIdentityCount  (CScope& scope, const CSeq_align& align);
00104     int GetMismatchCount  (CScope& scope, const CSeq_align& align);
00105     void GetMismatchCount  (CScope& scope, const CSeq_align& align,
00106                             int& identities, int& mismatches);
00107     int GetBlastScore     (CScope& scope, const CSeq_align& align);
00108     double GetBlastBitScore(CScope& scope, const CSeq_align& align);
00109     double GetBlastEValue (CScope& scope, const CSeq_align& align);
00110     int GetGapCount       (const CSeq_align& align);
00111     TSeqPos GetAlignLength(const CSeq_align& align);
00112 
00113     /// @}
00114 
00115     /// @name Functions for configuring blast scores
00116     /// @{
00117 
00118     void SetEffectiveSearchSpace(Int8 searchsp) // required for blast e-values
00119     {
00120         m_EffectiveSearchSpace = searchsp;
00121     }
00122 
00123     /// @}
00124 
00125 private:
00126 
00127     struct BlastScoreBlk *m_ScoreBlk;
00128     enum blast::EProgram m_BlastType;
00129     int m_GapOpen;
00130     int m_GapExtend;
00131     Int8 m_EffectiveSearchSpace;
00132 
00133     void x_Initialize(blast::CBlastOptionsHandle& options);
00134 };
00135 
00136 
00137 
00138 END_SCOPE(objects)
00139 END_NCBI_SCOPE
00140 
00141 #endif  // ALGO_ALIGN_UTIL___SCORE_BUILDER__HPP
00142 
00143 

Generated on Wed Dec 9 02:54:28 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Wed Dec 09 08:17:25 2009 by modify_doxy.py rev. 173732