NCBI C++ ToolKit
rpsblast_args.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: rpsblast_args.cpp 98643 2022-12-15 13:21:52Z fongah2 $
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: Jason Papadopoulos
27  *
28  */
29 
30 /** @file rpsblast_args.cpp
31  * Implementation of the RPSBLAST command line arguments
32  */
33 #include <ncbi_pch.hpp>
39 
41 BEGIN_SCOPE(blast)
43 
44 void
45 CRPSBlastMTArgs::SetArgumentDescriptions(CArgDescriptions& arg_desc)
46 {
47  arg_desc.SetCurrentGroup("Miscellaneous options");
48 #ifdef NCBI_THREADS
49  const int kDfltRpsThreadingMode = 1;
50  arg_desc.AddDefaultKey(kArgNumThreads, "int_value",
51  "Number of threads to use in RPS BLAST search:\n "
52  "0 (auto = num of databases)\n "
53  "1 (disable)\n max number of threads = num of databases",
55  NStr::IntToString(kDfltRpsThreadingMode));
56  arg_desc.SetConstraint(kArgNumThreads,
58  arg_desc.AddDefaultKey(kArgMTMode, "int_value",
59  "Multi-thread mode to use in RPS BLAST search:\n "
60  "0 (auto) split by database vols\n "
61  "1 split by queries",
64  arg_desc.SetConstraint(kArgMTMode,
65  new CArgAllowValuesBetween(0, 1, true));
66 #endif
67  arg_desc.SetCurrentGroup("");
68 }
69 
71 {
72  const bool kQueryIsProtein = true;
73  const bool kIsRpsBlast = true;
74  const bool kIsCBS2and3Supported = false;
75  const bool kFilterByDefault = false;
77  static const string kProgram("rpsblast");
78  arg.Reset(new CProgramDescriptionArgs(kProgram,
79  "Reverse Position Specific BLAST"));
80  m_Args.push_back(arg);
81  m_ClientId = kProgram + " " + CBlastVersion().Print();
82 
83  static const char kDefaultTask[] = "rpsblast";
84  SetTask(kDefaultTask);
85 
86  m_BlastDbArgs.Reset(new CBlastDatabaseArgs(false, kIsRpsBlast));
87  arg.Reset(m_BlastDbArgs);
88  m_Args.push_back(arg);
89 
92  m_Args.push_back(arg);
93 
94  arg.Reset(new CGenericSearchArgs(kQueryIsProtein, kIsRpsBlast));
95  m_Args.push_back(arg);
96 
97  arg.Reset(new CFilteringArgs(kQueryIsProtein, kFilterByDefault));
98  m_Args.push_back(arg);
99 
100  arg.Reset(new CWindowSizeArg);
101  m_Args.push_back(arg);
102 
103  m_QueryOptsArgs.Reset(new CQueryOptionsArgs(kQueryIsProtein));
104  arg.Reset(m_QueryOptsArgs);
105  m_Args.push_back(arg);
106 
108  arg.Reset(m_FormattingArgs);
109  m_Args.push_back(arg);
110 
112  arg.Reset(m_MTArgs);
113  m_Args.push_back(arg);
114 
116  arg.Reset(m_RemoteArgs);
117  m_Args.push_back(arg);
118 
120  arg.Reset(m_DebugArgs);
121  m_Args.push_back(arg);
122 
123  string cbs_opt_zero_descr = "Simplified Composition-based statistics as in"
124  " Bioinformatics 15:1000-1011, 1999";
125  arg.Reset(new CCompositionBasedStatsArgs(kIsCBS2and3Supported,
127  cbs_opt_zero_descr));
128  m_Args.push_back(arg);
129 }
130 
133  const CArgs& /*args*/)
134 {
136  (new CBlastRPSOptionsHandle(locality));
137  return retval;
138 }
139 
140 int
142 {
143  bool is_remote = (m_RemoteArgs.NotEmpty() && m_RemoteArgs->ExecuteRemotely());
144  return blast::GetQueryBatchSize(eRPSBlast, m_IsUngapped, is_remote);
145 }
146 
147 /// Get the input stream
150 {
152 }
153 /// Get the output stream
156 {
158 }
159 
160 /// Get the input stream
163 {
164  if ( !m_InputStream ) {
165  abort();
166  }
167  return *m_InputStream;
168 }
169 /// Get the output stream
172 {
173  return m_OutputStream;
174 }
175 
177 {
179 }
180 
182 {
183  if (m_InputStream) {
184  delete m_InputStream;
186  }
187 }
188 
189 int
191 {
192  bool is_remote = (m_RemoteArgs.NotEmpty() && m_RemoteArgs->ExecuteRemotely());
193  return blast::GetQueryBatchSize(eRPSBlast, m_IsUngapped, is_remote);
194 }
195 
198  const CArgs& /*args*/)
199 {
201  (new CBlastRPSOptionsHandle(locality));
202  return retval;
203 }
204 END_SCOPE(blast)
206 
Declares singleton objects to store the version and reference for the BLAST engine.
Declares the BLAST exception class.
Auxiliary classes/functions for BLAST input library.
int GetQueryBatchSize(EProgram program, bool is_ungapped=false, bool remote=false, bool use_default=true, string task="", bool mt_mode=false)
Retrieve the appropriate batch size for the specified task.
Declares the CBlastRPSOptionsHandle class.
@ eRPSBlast
protein-pssm (reverse-position-specific BLAST)
Definition: blast_types.hpp:63
Class to constrain the values of an argument to those in between the values specified in the construc...
Class to constrain the values of an argument to those greater than or equal to the value specified in...
CArgDescriptions –.
Definition: ncbiargs.hpp:541
CArgs –.
Definition: ncbiargs.hpp:379
CRef< CRemoteArgs > m_RemoteArgs
remote vs. local execution options
virtual CNcbiIstream & GetInputStream()
Get the input stream.
CRef< CQueryOptionsArgs > m_QueryOptsArgs
query options object
CRef< CBlastDatabaseArgs > m_BlastDbArgs
database/subject object
CRef< CDebugArgs > m_DebugArgs
Debugging arguments.
CRef< CMTArgs > m_MTArgs
multi-threaded options
CRef< CFormattingArgs > m_FormattingArgs
formatting options
bool m_IsUngapped
Is this application being run ungapped.
TBlastCmdLineArgs m_Args
Set of command line argument objects.
void SetTask(const string &task)
Set the task for this object.
virtual CNcbiOstream & GetOutputStream()
Get the output stream.
CRef< CStdCmdLineArgs > m_StdCmdLineArgs
standard command line arguments class
string m_ClientId
Client ID used for remote BLAST submissions, must be populated by subclasses.
Argument class to collect database/subject arguments.
Definition: blast_args.hpp:889
EAPILocality
Enumerates the possible contexts in which objects of this type can be used.
Handle to the rpsblast options to the BLAST algorithm.
Keeps track of the version of the BLAST engine in the NCBI C++ toolkit.
Definition: version.hpp:53
Argument class for collecting composition based statistics options.
Definition: blast_args.hpp:397
Argument class to collect debugging options.
Argument class for collecting filtering options.
Definition: blast_args.hpp:333
Argument class to collect formatting options, use this to create a CBlastFormat object.
Argument class for general search BLAST algorithm options: evalue, gap penalties, query filter string...
Definition: blast_args.hpp:292
Argument class to populate an application's name and description.
Definition: blast_args.hpp:178
Argument class to collect query options.
Definition: blast_args.hpp:775
CRPSBlastAppArgs()
Constructor.
virtual CNcbiIstream & GetInputStream()
Get the input stream.
virtual CRef< CBlastOptionsHandle > x_CreateOptionsHandle(CBlastOptions::EAPILocality locality, const CArgs &args)
@inheritDoc
virtual int GetQueryBatchSize() const
@inheritDoc
virtual CNcbiOstream & GetOutputStream()
Get the output stream.
CNcbiStrstream m_OutputStream
CNcbiIstrstream * m_InputStream
virtual ~CRPSBlastNodeArgs()
virtual CNcbiOstream & GetOutputStream()
Get the output stream.
virtual CRef< CBlastOptionsHandle > x_CreateOptionsHandle(CBlastOptions::EAPILocality locality, const CArgs &args)
@inheritDoc
virtual int GetQueryBatchSize() const
@inheritDoc
virtual CNcbiIstream & GetInputStream()
Get the input stream.
CRPSBlastNodeArgs(const string &input)
Constructor.
CRef –.
Definition: ncbiobj.hpp:618
Argument class to collect remote vs. local execution.
bool ExecuteRemotely() const
Return whether the search should be executed remotely or not.
Argument class to retrieve input and output streams for a command line program.
Definition: blast_args.hpp:110
Argument class to retrieve and set the window size BLAST algorithm option.
Definition: blast_args.hpp:223
const string kDfltArgCompBasedStatsRPS
const string kArgMTMode
Argument to specify mt mode (split by db or split by queries)
const string kArgNumThreads
Argument to determine the number of threads to use when running BLAST.
virtual string Print(void) const
Print version information.
Definition: version.hpp:59
@ eInteger
Convertible into an integer number (int or Int8)
Definition: ncbiargs.hpp:592
#define NULL
Definition: ncbistd.hpp:225
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty – pointing to an object and has a non-null value.
Definition: ncbiobj.hpp:726
#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
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
Definition: ncbistre.hpp:146
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5084
static int input()
void abort()
USING_SCOPE(objects)
Main argument class for RPSBLAST application.
Modified on Wed May 22 11:30:08 2024 by modify_doxy.py rev. 669887