1 /*  $Id: psibl2seq.hpp 413493 2013-09-16 17:55:21Z boratyng $
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 psibl2seq.hpp
31 /// Declares CPsiBl2Seq, the C++ API for the PSI-BLAST 2 Sequences engine.
32 
33 #ifndef ALGO_BLAST_API___PSIBL2SEQ__HPP
34 #define ALGO_BLAST_API___PSIBL2SEQ__HPP
35 
36 #include <algo/blast/api/uniform_search.hpp>
37 #include <algo/blast/api/psiblast_options.hpp>
38 #include <algo/blast/api/local_db_adapter.hpp>
39 
40 /** @addtogroup AlgoBlast
41  *
42  * @{
43  */
44 
45 BEGIN_NCBI_SCOPE
46 
47 BEGIN_SCOPE(objects)
48     class CPssmWithParameters;
49 END_SCOPE(objects)
50 
51 BEGIN_SCOPE(blast)
52 
53 // Forward declarations
54 class IQueryFactory;
55 
56 /// Runs a single iteration of the PSI-BLAST algorithm between 2 sequences.
57 class NCBI_XBLAST_EXPORT CPsiBl2Seq : public CObject
58 {
59 public:
60     /// Constructor to compare a PSSM against protein sequences
61     /// @param pssm
62     ///     PSSM to use as query. This must contain the query sequence which
63     ///     represents the master sequence for the PSSM. PSSM data might be
64     ///     provided as scores or as frequency ratios, in which case the PSSM
65     ///     engine will be invoked to convert them to scores (and save them as a
66     ///     effect). If both the scores and frequency ratios are provided, the
67     ///     scores are given priority and are used in the search. [in|out]
68     ///     @todo how should scaled PSSM scores be handled?
69     /// @param subject
70     ///     Subject sequence(s) to search [in]
71     /// @param options
72     ///     PSI-BLAST options [in]
73     CPsiBl2Seq(CRef<objects::CPssmWithParameters> pssm,
74                CRef<IQueryFactory> subject,
75                CConstRef<CPSIBlastOptionsHandle> options);
76 
77     /// Constructor to compare a PSSM against protein sequences
78     /// @param pssm
79     ///     PSSM to use as query. This must contain the query sequence which
80     ///     represents the master sequence for the PSSM. PSSM data might be
81     ///     provided as scores or as frequency ratios, in which case the PSSM
82     ///     engine will be invoked to convert them to scores (and save them as a
83     ///     effect). If both the scores and frequency ratios are provided, the
84     ///     scores are given priority and are used in the search. [in|out]
85     ///     @todo how should scaled PSSM scores be handled?
86     /// @param subject
87     ///     Subject sequence(s) to search [in]
88     /// @param options
89     ///     PSI-BLAST options [in]
90     CPsiBl2Seq(CRef<objects::CPssmWithParameters> pssm,
91                CRef<CLocalDbAdapter> subject,
92                CConstRef<CPSIBlastOptionsHandle> options);
93 
94 
95     /// Constructor to compare protein sequences in an object manager-free
96     /// manner.
97     /// @param query
98     ///     Protein query sequence to search (only 1 is allowed!) [in]
99     /// @param subject
100     ///     Protein sequence(s) to search [in]
101     /// @param options
102     ///     Protein options [in]
103     CPsiBl2Seq(CRef<IQueryFactory> query,
104                CRef<IQueryFactory> subject,
105                CConstRef<CBlastProteinOptionsHandle> options);
106 
107     /// Destructor
108     ~CPsiBl2Seq();
109 
110     /// Run the PSI-BLAST 2 Sequences engine
111     CRef<CSearchResultSet> Run();
112 
113 private:
114 
115     /// Reference to a BLAST subject/database object
116     CRef<CLocalDbAdapter> m_Subject;
117 
118     /// Implementation class
119     class CPsiBlastImpl* m_Impl;
120 
121     /// Auxiliary method to initialize the subject
122     /// @param subject query factory describing the subject sequence(s) [in]
123     /// @param options PSI-BLAST options [in]
124     /// @throws CBlastException if options is empty
125     /// @post the m_Subject member will be initialized
126     void x_InitSubject(CRef<IQueryFactory> subject,
127                        const CBlastOptionsHandle* options);
128 
129     /// Prohibit copy constructor
130     CPsiBl2Seq(const CPsiBl2Seq& rhs);
131 
132     /// Prohibit assignment operator
133     CPsiBl2Seq& operator=(const CPsiBl2Seq& rhs);
134 
135 };
136 
137 END_SCOPE(blast)
138 END_NCBI_SCOPE
139 
140 /* @} */
141 
142 #endif  /* ALGO_BLAST_API___PSIBL2SEQ__HPP */
143