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

Go to the SVN repository for this file.

1 /* $Id: blastn_vdb_args.cpp 101102 2023-10-30 13:07:22Z fongah2 $
2  * ===========================================================================
3  *
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  */
30 /** @file blastn_args.cpp
31  * Implementation of the BLASTN command line arguments
32  */
34 #include <ncbi_pch.hpp>
42 BEGIN_SCOPE(blast)
45 const string kArgSRASearchMode("sra_mode");
46 const string kArgIncludeFilteredReads("include_filtered_reads");
48 void
49 CBlastVDatabaseArgs::SetArgumentDescriptions(CArgDescriptions& arg_desc)
50 {
51  arg_desc.SetCurrentGroup("General search options");
52  // database filename
53  arg_desc.AddOptionalKey(kArgDb, "database_name", "SRA or WGS database name",
56  arg_desc.SetCurrentGroup("");
58  vector<string> database_args;
59  database_args.push_back(kArgDb);
61  // DB size
62  arg_desc.SetCurrentGroup("Statistical options");
63  arg_desc.AddOptionalKey(kArgDbSize, "num_letters",
64  "Effective length of the database ",
67  arg_desc.SetCurrentGroup("");
68 }
70 void
72 {
73  arg_desc.SetCurrentGroup("General search options");
74  string kSRASearchMode = string(
75  "SRA Search Mode:\n"
76  "0 = unaligned reads only\n"
77  "1 = aligned reference seqs only\n"
78  "2 = both unaligned reads and aligned reference seqs n");
79  arg_desc.AddDefaultKey(kArgSRASearchMode, "SRA_search_mode", kSRASearchMode,
82  string kIncludeFilteredReads = string ("Include filtered reads\n");
83  arg_desc.AddFlag(kArgIncludeFilteredReads, kIncludeFilteredReads, true);
84 }
87 {
89  static const string kProgram("blastn");
90  arg.Reset(new CProgramDescriptionArgs(kProgram,
91  "Nucleotide-Nucleotide BLAST"));
92  const bool kQueryIsProtein = false;
93  m_Args.push_back(arg);
94  m_ClientId = kProgram + " " + CBlastVersion().Print();
96  static const string kDefaultTask = "megablast";
97  SetTask(kDefaultTask);
98  set<string> tasks
100  tasks.erase("vecscreen"); // vecscreen has its own program
101  arg.Reset(new CTaskCmdLineArgs(tasks, kDefaultTask));
102  m_Args.push_back(arg);
106  arg.Reset(m_BlastDbArgs);
107  m_Args.push_back(arg);
110  arg.Reset(m_StdCmdLineArgs);
111  m_Args.push_back(arg);
114  m_Args.push_back(arg);
116  arg.Reset(new CNuclArgs);
117  m_Args.push_back(arg);
120  m_Args.push_back(arg);
122  arg.Reset(new CFilteringArgs(kQueryIsProtein));
123  m_Args.push_back(arg);
125  arg.Reset(new CGappedArgs);
126  m_Args.push_back(arg);
130  m_Args.push_back(arg);
132  arg.Reset(new CWindowSizeArg);
133  m_Args.push_back(arg);
135  arg.Reset(new COffDiagonalRangeArg);
136  m_Args.push_back(arg);
138  m_QueryOptsArgs.Reset(new CQueryOptionsArgs(kQueryIsProtein));
139  arg.Reset(m_QueryOptsArgs);
140  m_Args.push_back(arg);
143  arg.Reset(m_FormattingArgs);
144  m_Args.push_back(arg);
146  m_MTArgs.Reset(new CMTArgs);
147  arg.Reset(m_MTArgs);
148  m_Args.push_back(arg);
152  m_Args.push_back(arg);
157  arg.Reset(m_DebugArgs);
158  m_Args.push_back(arg);
159 }
163  const CArgs& args)
164 {
166  SetTask(args[kTask].AsString());
167  retval.Reset(CBlastOptionsFactory::CreateTask(GetTask(), locality));
168  _ASSERT(retval.NotEmpty());
169  return retval;
170 }
172 int
174 {
175  bool is_remote = (m_RemoteArgs.NotEmpty() && m_RemoteArgs->ExecuteRemotely());
176  return blast::GetQueryBatchSize(ProgramNameToEnum(GetTask()), m_IsUngapped, is_remote, false);
177 }
179 END_SCOPE(blast)
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.
@ eBlastTypeBlastn
Definition: blast_program.h:74
const string kArgIncludeFilteredReads("include_filtered_reads")
const string kArgSRASearchMode("sra_mode")
Main argument class for BLASTN_VDB application.
CArgDescriptions –.
Definition: ncbiargs.hpp:541
CArgs –.
Definition: ncbiargs.hpp:379
CRef< CRemoteArgs > m_RemoteArgs
remote vs. local execution options
string GetTask() const
Get the task for this object.
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.
CRef< CStdCmdLineArgs > m_StdCmdLineArgs
standard command line arguments class
CRef< CHspFilteringArgs > m_HspFilteringArgs
HSP filtering arguments.
string m_ClientId
Client ID used for remote BLAST submissions, must be populated by subclasses.
void SetDatabaseMaskingSupport(bool val)
Turns on/off database masking support.
Definition: blast_args.hpp:921
Enumerates the possible contexts in which objects of this type can be used.
Argument class to collect database/subject arguments.
Keeps track of the version of the BLAST engine in the NCBI C++ toolkit.
Definition: version.hpp:53
virtual int GetQueryBatchSize() const
virtual CRef< CBlastOptionsHandle > x_CreateOptionsHandle(CBlastOptions::EAPILocality locality, const CArgs &args)
CRef< CSRASearchModeArgs > m_VDBSearchModeArgs
Argument class to collect debugging options.
Argument class to retrieve discontiguous megablast arguments.
Definition: blast_args.hpp:379
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 retrieve options for filtering HSPs (e.g.
Argument class to collect multi-threaded arguments.
Defines values for match and mismatch in nucleotide comparisons as well as non-greedy extension.
Definition: blast_args.hpp:368
Argument class to retrieve and set the off-diagonal range used in 2-hit algorithm.
Definition: blast_args.hpp:237
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 collect database/subject arguments.
virtual void SetArgumentDescriptions(CArgDescriptions &arg_desc)
Sets the command line descriptions in the CArgDescriptions object relevant to the subclass.
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
void erase(iterator pos)
Definition: set.hpp:151
const string kArgDbSize
Effective length of BLAST database.
const string kTask
Task to perform.
const string kArgDb
BLAST database name.
Declares the CDiscNucleotideOptionsHandle class.
static set< string > GetTasks(ETaskSets choice=eAll)
Retrieve the set of supported tasks.
EProgram ProgramNameToEnum(const std::string &program_name)
Map a string into an element of the ncbi::blast::EProgram enumeration (except eBlastProgramMax).
Definition: blast_aux.cpp:757
virtual string Print(void) const
Print version information.
Definition: version.hpp:59
static CBlastOptionsHandle * CreateTask(string task, EAPILocality locality=CBlastOptions::eLocal)
Creates an options handle object configured with default options for the requested task,...
@ eNuclNucl
Nucleotide-nucleotide tasks.
void AddFlag(const string &name, const string &comment, CBoolEnum< EFlagValue > set_value=eFlagHasValueIfSet, TFlags flags=0)
Add description for flag argument.
Definition: ncbiargs.cpp:2459
void SetCurrentGroup(const string &group)
Set current arguments group name.
Definition: ncbiargs.cpp:2632
void AddDefaultKey(const string &name, const string &synopsis, const string &comment, EType type, const string &default_value, TFlags flags=0, const string &env_var=kEmptyStr, const char *display_value=nullptr)
Add description for optional key with default value.
Definition: ncbiargs.cpp:2442
@ eInt8
Convertible into an integer number (Int8 only)
Definition: ncbiargs.hpp:591
@ eString
An arbitrary string.
Definition: ncbiargs.hpp:589
@ eInteger
Convertible into an integer number (int or Int8)
Definition: ncbiargs.hpp:592
Definition: cgiapp.hpp:687
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
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
#define _ASSERT
#define const
Definition: zconf.h:230
Modified on Sat Dec 09 04:47:39 2023 by rev. 669887