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

Go to the SVN repository for this file.

1 /* $Id: psiblast_iteration.hpp 49112 2011-03-29 17:10:41Z camacho $
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 psiblast_iteration.hpp
31  * Defines class which represents the iteration state in PSI-BLAST
32  */
33 
34 #ifndef ALGO_BLAST_API___PSIBLAST_ITERATION__HPP
35 #define ALGO_BLAST_API___PSIBLAST_ITERATION__HPP
36 
37 #include <corelib/ncbiobj.hpp>
40 #include <list>
41 #include <set>
42 
43 /** @addtogroup AlgoBlast
44  *
45  * @{
46  */
47 
49 
51  class CSeq_id;
52  class CSeq_align_set;
54 
55 BEGIN_SCOPE(blast)
56 
57 // Forward declaration
59 
60 /// Represents the iteration state in PSI-BLAST
62 {
63 public:
64  /// Constructor
65  /// @param num_iterations
66  /// Number of iterations to perform. Use 0 to indicate that iterations
67  /// must take place until convergence or the number of iterations
68  /// desired [in]
69  CPsiBlastIterationState(unsigned int num_iterations = 1);
70 
71  /// Destructor
73 
74  /// Allow implicit conversion to a boolean value, returning true if there
75  /// are more iterations to perform or false if iterations are done.
76  /// @sa HasConverged, HasMoreIterations
77  operator bool();
78 
79  /// Determines if the PSI-BLAST search has converged (i.e.: no more new
80  /// sequences have been found since the last iteration)
81  /// @return true if search has converged, otherwise false.
82  bool HasConverged();
83 
84  /// Determines if more iterations are still needed.
85  /// @return true if there are more iterations to do, otherwise false.
86  bool HasMoreIterations() const;
87 
88  /// List of CSeq_ids
90 
91  /// Retrieve the set of Seq-id's found in the previous iteration
92  TSeqIds GetPreviouslyFoundSeqIds() const;
93 
94  /// Advance the iterator by passing it the list of Seq-ids which passed the
95  /// inclusion criteria for the current iteration
96  void Advance(const TSeqIds& list);
97 
98  /// Extract the sequence ids from the sequence alignment which identify
99  /// those sequences that will be used for PSSM construction.
100  /// @param seqalign
101  /// Sequence alignment [in]
102  /// @param opts
103  /// options containing details for algorithm to select sequences from
104  /// seqalign [in]
105  /// @param retval
106  /// List of sequence identifiers for those sequences from the
107  /// seqalign which will participate in PSSM construction [out]
108  static void GetSeqIds(CConstRef<objects::CSeq_align_set> seqalign,
110  TSeqIds& retval);
111 
112  /// Return the number of the current iteration
113  unsigned int GetIterationNumber() const;
114 
115 private:
116  // No value semantics
117 
118  /// Prohibit copy constructor
120 
121  /// Prohibit assignment operator
123 
124  /// Number of iterations to perform
126 
127  /// Number of iterations already done
128  unsigned int m_IterationsDone;
129 
130  /// Identifiers for sequences found in the previous iteration
132 
133  /// Identifiers for sequences found in the current iteration
135 
136  /// After the iteration state object has converged or exhausted its
137  /// iterations, it shouldn't be modified, so it throws a CBlastException
138  /// if this happens
139  void x_ThrowExceptionOnLogicError();
140 };
141 
142 END_SCOPE(blast)
144 
145 /* @} */
146 
147 #endif /* ALGO_BLAST_API___PSIBLAST_ITERATION__HPP */
Defines to provide correct exporting from BLAST DLL in Windows.
#define NCBI_XBLAST_EXPORT
NULL operations for other cases.
Definition: blast_export.h:65
#define bool
Definition: bool.h:34
Handle to the protein-protein options to the BLAST algorithm.
Represents the iteration state in PSI-BLAST.
TSeqIds m_PreviousData
Identifiers for sequences found in the previous iteration.
TSeqIds m_CurrentData
Identifiers for sequences found in the current iteration.
unsigned int m_TotalNumIterationsToDo
Number of iterations to perform.
unsigned int m_IterationsDone
Number of iterations already done.
CPsiBlastIterationState(const CPsiBlastIterationState &rhs)
Prohibit copy constructor.
CPsiBlastIterationState & operator=(const CPsiBlastIterationState &rhs)
Prohibit assignment operator.
set< objects::CSeq_id_Handle > TSeqIds
List of CSeq_ids.
#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
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Modified on Fri Mar 01 10:08:34 2024 by modify_doxy.py rev. 669887