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

Go to the SVN repository for this file.

1 /* $Id: blastx_args.cpp 100875 2023-09-22 12:46:36Z madden $
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 blastx_args.cpp
31  * Implementation of the BLASTX command line arguments
32  */
33 
34 #include <ncbi_pch.hpp>
39 
41 BEGIN_SCOPE(blast)
43 
45 {
47  static const string kProgram("blastx");
48  arg.Reset(new CProgramDescriptionArgs(kProgram,
49  "Translated Query-Protein Subject BLAST"));
50  const bool kQueryIsProtein = false;
51  m_Args.push_back(arg);
52  m_ClientId = kProgram + " " + CBlastVersion().Print();
53 
54  static const char kDefaultTask[] = "blastx";
55  SetTask(kDefaultTask);
56  set<string> tasks;
57  tasks.insert(kDefaultTask);
58  tasks.insert("blastx-fast");
59  arg.Reset(new CTaskCmdLineArgs(tasks, kDefaultTask));
60  m_Args.push_back(arg);
61 
62  m_BlastDbArgs.Reset(new CBlastDatabaseArgs);
63  m_BlastDbArgs->SetDatabaseMaskingSupport(true);
64  m_BlastDbArgs->SetIPGFilteringSupport(true);
65  arg.Reset(m_BlastDbArgs);
66  m_Args.push_back(arg);
67 
68  m_StdCmdLineArgs.Reset(new CStdCmdLineArgs);
69  arg.Reset(m_StdCmdLineArgs);
70  m_Args.push_back(arg);
71 
72  // N.B.: query is not protein because the options are applied on the
73  // translated query
74  arg.Reset(new CGenericSearchArgs( !kQueryIsProtein ));
75  m_Args.push_back(arg);
76 
77  //Disable until OOF is supported in align manager
78  //SB-1043
79  //arg.Reset(new CFrameShiftArgs);
80  //m_Args.push_back(arg);
81 
83  m_Args.push_back(arg);
84 
85  // N.B.: query is not protein because the filtering is applied on the
86  // translated query
87  arg.Reset(new CFilteringArgs( !kQueryIsProtein ));
88  m_Args.push_back(arg);
89 
90  arg.Reset(new CMatrixNameArg);
91  m_Args.push_back(arg);
92 
93  arg.Reset(new CWordThresholdArg);
94  m_Args.push_back(arg);
95 
96  m_HspFilteringArgs.Reset(new CHspFilteringArgs);
97  arg.Reset(m_HspFilteringArgs);
98  m_Args.push_back(arg);
99 
100  arg.Reset(new CWindowSizeArg);
101  m_Args.push_back(arg);
102 
103  arg.Reset(new CGappedArgs);
104  m_Args.push_back(arg);
105 
106  m_QueryOptsArgs.Reset(new CQueryOptionsArgs(kQueryIsProtein));
107  arg.Reset(m_QueryOptsArgs);
108  m_Args.push_back(arg);
109 
111  m_Args.push_back(arg);
112 
113  m_FormattingArgs.Reset(new CFormattingArgs);
114  arg.Reset(m_FormattingArgs);
115  m_Args.push_back(arg);
116 
118  arg.Reset(m_MTArgs);
119  m_Args.push_back(arg);
120 
121  m_RemoteArgs.Reset(new CRemoteArgs);
122  arg.Reset(m_RemoteArgs);
123  m_Args.push_back(arg);
124 
126  m_Args.push_back(arg);
127 
128  m_DebugArgs.Reset(new CDebugArgs);
129  arg.Reset(m_DebugArgs);
130  m_Args.push_back(arg);
131 }
132 
135  const CArgs& args)
136 {
137  _ASSERT(args.Exist(kTask));
138  _ASSERT(args[kTask].HasValue());
139  return x_CreateOptionsHandleWithTask(locality, args[kTask].AsString());
140 }
141 
142 int
144 {
145  bool is_remote = (m_RemoteArgs.NotEmpty() && m_RemoteArgs->ExecuteRemotely());
146  bool is_default = true;
147  return blast::GetQueryBatchSize(eBlastx, m_IsUngapped, is_remote, is_default,
148  GetTask());
149 }
150 
151 /// Get the input stream
154 {
155  if ( !m_InputStream ) {
156  abort();
157  }
158  return *m_InputStream;
159 }
160 /// Get the output stream
163 {
164  return m_OutputStream;
165 }
166 
168 {
170 }
171 
173 {
174  if (m_InputStream) {
175  delete m_InputStream;
177  }
178 }
179 
180 int
182 {
183  bool is_remote = (m_RemoteArgs.NotEmpty() && m_RemoteArgs->ExecuteRemotely());
184  bool split_by_query = true;
185  bool use_default = true;
186  return blast::GetQueryBatchSize(eBlastx, m_IsUngapped, is_remote, use_default, GetTask(), split_by_query);
187 }
188 
191 {
192  return CBlastxAppArgs::x_CreateOptionsHandle(locality, args);
193 }
194 
195 END_SCOPE(blast)
197 
Declares singleton objects to store the version and reference for the BLAST engine.
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.
@ eBlastx
Translated nucl-Protein.
Definition: blast_types.hpp:60
USING_SCOPE(objects)
Main argument class for BLASTX application.
Declares the CBlastxOptionsHandle class.
CArgs –.
Definition: ncbiargs.hpp:379
CRef< CRemoteArgs > m_RemoteArgs
remote vs. local execution options
string GetTask() const
Get the task for this object.
CRef< CBlastOptionsHandle > x_CreateOptionsHandleWithTask(CBlastOptions::EAPILocality locality, const string &task)
Creates the BLAST options handle based on the task argument.
bool m_IsUngapped
Is this application being run ungapped.
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.
Keeps track of the version of the BLAST engine in the NCBI C++ toolkit.
Definition: version.hpp:53
Handles command line arguments for blastx binary.
Definition: blastx_args.hpp:44
virtual int GetQueryBatchSize() const
@inheritDoc
virtual CRef< CBlastOptionsHandle > x_CreateOptionsHandle(CBlastOptions::EAPILocality locality, const CArgs &args)
@inheritDoc
virtual CNcbiIstream & GetInputStream()
Get the input stream.
virtual CRef< CBlastOptionsHandle > x_CreateOptionsHandle(CBlastOptions::EAPILocality locality, const CArgs &args)
@inheritDoc
virtual ~CBlastxNodeArgs()
virtual CNcbiOstream & GetOutputStream()
Get the output stream.
CNcbiStrstream m_OutputStream
Definition: blastx_args.hpp:85
virtual int GetQueryBatchSize() const
@inheritDoc
CBlastxNodeArgs(const string &input)
Constructor.
CNcbiIstrstream * m_InputStream
Definition: blastx_args.hpp:86
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 collecting gapped options.
Definition: blast_args.hpp:430
Argument class for general search BLAST algorithm options: evalue, gap penalties, query filter string...
Definition: blast_args.hpp:292
Argument class to collect the genetic code for all queries/subjects.
Definition: blast_args.hpp:463
@ eQuery
Query genetic code.
Definition: blast_args.hpp:467
Argument class to retrieve options for filtering HSPs (e.g.
Argument class for collecting the largest intron size.
Definition: blast_args.hpp:441
Argument class to collect multi-threaded arguments.
Argument class to retrieve and set the scoring matrix name BLAST algorithm option.
Definition: blast_args.hpp:278
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
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 specify the supported tasks a given program.
Definition: blast_args.hpp:198
Argument class to retrieve and set the window size BLAST algorithm option.
Definition: blast_args.hpp:223
Argument class to retrieve and set the word threshold BLAST algorithm option.
Definition: blast_args.hpp:251
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
const string kTask
Task to perform.
virtual string Print(void) const
Print version information.
Definition: version.hpp:59
bool Exist(const string &name) const
Check existence of argument description.
Definition: ncbiargs.cpp:1813
#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 int input()
void abort()
#define _ASSERT
Modified on Wed May 22 11:31:43 2024 by modify_doxy.py rev. 669887