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

Go to the SVN repository for this file.

1 /* $Id: rps_aux.hpp 85261 2019-01-29 14:28:02Z rackerst $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author: Christiam Camacho
27  *
28  */
29 
30 /// @file rps_aux.hpp
31 /// Declares auxiliary classes to manage RPS-BLAST related C-structures
32 
33 #ifndef ALGO_BLAST_API__RPS_AUX___HPP
34 #define ALGO_BLAST_API__RPS_AUX___HPP
35 
37 #include <algo/blast/core/blast_aalookup.h> // for BlastRPSLookupTable
39 
40 /** @addtogroup AlgoBlast
41  *
42  * @{
43  */
44 
46 BEGIN_SCOPE(blast)
47 
48 // Forward declarations
49 class CBlastRPSAuxInfo;
50 class CRpsAuxFile;
51 class CRpsLookupTblFile;
52 class CRpsPssmFile;
53 class CRpsFreqsFile;
54 class CRpsObsrFile;
55 class CRpsFreqRatiosFile;
56 
57 // The BLAST Engine currently needs the BlastRPSInfo structure for both the
58 // preliminary stage and the traceback search. In practice, the setup code
59 // needs the aux_info field to copy the orig_score_matrix field, gap costs and
60 // scaling factor. The preliminary stage needs its lookup_header and
61 // profile_header fields, and the traceback search needs the profile_header
62 // field and the aux_info's karlin_k field. This suggests that a better
63 // organization might be needed.
64 
65 /// Wrapper class to manage the BlastRPSInfo structure, as currently
66 /// there aren't any allocation or deallocation functions for this structure in
67 /// the CORE of BLAST. This class is meant to be kept in a CRef<>.
69 public:
70 
71  /// Flags for opening database files
72  enum EOpenFlags {
73  // Open lookup table file
74  fLookupTableFile = 1,
75  /// Open pssm file
76  fPssmFile = 2,
77  /// Open auxiliary information file
78  fAuxInfoFile = 4,
79  /// Open residue frequencies file
80  fFrequenciesFile = 8,
81  /// Open file with numbers of independent observations
82  fObservationsFile = 16,
83  /// Open file with frequency ratios
84  fFreqRatiosFile = 32,
85 
86  // The freq ratios file is large and needed only in the traceback.
87  // It may be needed to add closing and loading separate files.
88 
89  /// Flags set for RPS-BLAST
90  fRpsBlast = fLookupTableFile | fPssmFile | fAuxInfoFile,
91 
92  /// Flags set for DELTA-BLAST
93  fDeltaBlast = fFrequenciesFile | fObservationsFile,
94 
95  /// Flags set for RPS-BLAST running in CBS mode
96  fRpsBlastWithCBS = fRpsBlast | fFreqRatiosFile
97  };
98 
99 public:
100  /// Parametrized constructor
101  /// @param rps_dbname name of the RPS-BLAST database
102  CBlastRPSInfo(const string& rps_dbname);
103 
104  /// Parametrized constructor
105  /// @param rps_dbname name of the RPS-BLAST database
106  /// @param flags Flags for which database files to open
107  CBlastRPSInfo(const string& rps_dbname, int flags);
108 
109  /// Destructor
110  ~CBlastRPSInfo();
111 
112  /// Accessor for the underlying C structure (managed by this class)
113  const BlastRPSInfo* operator()() const;
114 
115  /// Returns the scaling factor used to build RPS-BLAST database
116  double GetScalingFactor() const;
117 
118  /// Returns the name of the scoring matrix used to build the RPS-BLAST
119  /// database
120  const char* GetMatrixName() const;
121 
122  // FIXME: the following two methods are an interface that return the
123  // permissible gap costs associated with the matrix used when building the
124  // RPS-BLAST database... these could be removed if some other interface
125  // provided those given the matrix name.
126 
127  /// Returns the gap opening cost associated with the scoring matrix above
128  int GetGapOpeningCost() const;
129 
130  /// Returns the gap extension cost associated with the scoring matrix above
131  int GetGapExtensionCost() const;
132 
133 
134 protected:
135 
136  /// Initialize attributes
137  void x_Init(const string& rps_dbname, int flags);
138 
139 private:
140  /// Prohibit copy-constructor
142  /// Prohibit assignment operator
144 
145  /// The auxiliary RPS-BLAST file (.aux)
147  /// The PSSM RPS-BLAST file (.rps)
149  /// The lookup table RPS-BLAST file (.loo)
151 
152  /// Weighted residue frequencies file (.wcounts)
153  /// used by delta-blast
155 
156  /// Number of independent observations file (.obsr)
157  /// used by delta-blast
159 
160  /// Frequency ratios file (.freq)
161  /// used for composition based statistics and cobalt
163 
164 
165  /// Pointer which contains pointers to data managed by the data members
166  /// above
167  unique_ptr<BlastRPSInfo> m_RpsInfo;
168 };
169 
170 END_SCOPE(blast)
172 
173 /* @} */
174 
175 #endif /* ALGO_BLAST_API__RPS_AUX___HPP */
Routines for creating protein BLAST lookup tables.
Defines to provide correct exporting from BLAST DLL in Windows.
#define NCBI_XBLAST_EXPORT
NULL operations for other cases.
Definition: blast_export.h:65
RPS BLAST structure definitions.
Wrapper class to manage the BlastRPSAuxInfo structure, as currently there aren't any allocation or de...
Definition: rps_aux.cpp:60
Wrapper class to manage the BlastRPSInfo structure, as currently there aren't any allocation or deall...
Definition: rps_aux.hpp:68
CObject –.
Definition: ncbiobj.hpp:180
This class represents the .aux file in a RPS-BLAST file, which contains information about the scoring...
Definition: rps_aux.cpp:159
This class represents the .freq file in a RPS-BLAST file, which contains the frequency ratios for the...
Definition: rps_aux.cpp:465
This class represents the .wcounts file in a RPS-BLAST file, which contains the weighted residue freq...
Definition: rps_aux.cpp:367
This class represents the .loo file in a RPS-BLAST file, which contains the pre-computed lookup table...
Definition: rps_aux.cpp:272
This class represents the .obsr file in a RPS-BLAST file, which contains the numbers of independent o...
Definition: rps_aux.cpp:417
This class represents the .rps file in a RPS-BLAST file, which contains the PSSMs for the database.
Definition: rps_aux.cpp:319
static uch flags
CRef< CRpsLookupTblFile > m_LutFile
The lookup table RPS-BLAST file (.loo)
Definition: rps_aux.hpp:150
CRef< CRpsFreqRatiosFile > m_FreqRatiosFile
Frequency ratios file (.freq) used for composition based statistics and cobalt.
Definition: rps_aux.hpp:162
unique_ptr< BlastRPSInfo > m_RpsInfo
Pointer which contains pointers to data managed by the data members above.
Definition: rps_aux.hpp:167
CRef< CRpsAuxFile > m_AuxFile
The auxiliary RPS-BLAST file (.aux)
Definition: rps_aux.hpp:146
CRef< CRpsPssmFile > m_PssmFile
The PSSM RPS-BLAST file (.rps)
Definition: rps_aux.hpp:148
CRef< CRpsObsrFile > m_ObsrFile
Number of independent observations file (.obsr) used by delta-blast.
Definition: rps_aux.hpp:158
CBlastRPSInfo & operator=(const CBlastRPSInfo &rhs)
Prohibit assignment operator.
CRef< CRpsFreqsFile > m_FreqsFile
Weighted residue frequencies file (.wcounts) used by delta-blast.
Definition: rps_aux.hpp:154
CBlastRPSInfo(const CBlastRPSInfo &rhs)
Prohibit copy-constructor.
EOpenFlags
Flags for opening database files.
Definition: rps_aux.hpp:72
#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
The RPS engine uses this structure to access all of the RPS blast related data (assumed to be collect...
Definition: blast_rps.h:120
Modified on Fri Sep 20 14:57:36 2024 by modify_doxy.py rev. 669887