53 #include "../blast/blast_app_util.hpp"
64 #define BLAST_SRA_EXIT_SUCCESS 0
66 #define BLAST_SRA_INPUT_ERROR 1
68 #define BLAST_SRA_ENGINE_ERROR 2
70 #define BLAST_SRA_UNKNOWN_ERROR 255
88 virtual void Init(
void);
90 virtual int Run(
void);
92 virtual void Exit(
void);
129 dbInfo.is_protein =
false;
131 dbInfo.definition = dbInfo.name;
142 version->SetVersionInfo(
new CBlastVdbVersion);
171 vector<string> paths;
196 "Must specify at least one SRA/WGS database");
226 vector< CBlastFormatUtil::SDbInfo > vecDbInfo(1);
256 input.SetBatchSize(batch_size);
261 Int4 target_hits = (total_len/3000) < 2000000 ? 2000000: total_len/3000;
277 results = local_vdb_blast.
Run();
282 formatter.
WriteArchive(*queries, *optsHandle, *results);
305 cerr <<
"BLAST query/options error: " << e.
GetMsg() << endl;
309 cerr <<
"Command line argument error: " << e.
GetMsg() << endl;
313 cerr <<
"BLAST engine error: " << e.
GetMsg() << endl;
319 cerr <<
"Error: " << e.
GetMsg() << endl;
322 catch (
const exception& e) {
323 cerr <<
"Error: " << e.
what() << endl;
327 cerr <<
"Unknown exception occurred" << endl;
348 #ifndef SKIP_DOXYGEN_PROCESSING
349 int main(
int argc,
const char* argv[])
void SaveSearchStrategy(const CArgs &args, blast::CBlastAppArgs *cmdline_args, CRef< blast::IQueryFactory > queries, CRef< blast::CBlastOptionsHandle > opts_hndl, CRef< objects::CPssmWithParameters > pssm, unsigned int num_iters)
Save the search strategy corresponding to the current command line search.
bool RecoverSearchStrategy(const CArgs &args, blast::CBlastAppArgs *cmdline_args)
Recover search strategy from input file.
string GetCmdlineArgs(const CNcbiArguments &a)
bool UseXInclude(const CFormattingArgs &f, const string &s)
void LogQueryInfo(CBlastUsageReport &report, const CBlastInput &q_info)
CRef< CScope > GetVDBScope(string dbAllNames)
Utility functions for BLAST VDB command line applications.
#define BLAST_SRA_UNKNOWN_ERROR
Exit code for all other errors and unknown exceptions.
#define BLAST_SRA_EXIT_SUCCESS
Exit code for successful completion of the Blast search.
#define BLAST_SRA_ENGINE_ERROR
Exit code for a Blast engine-related error.
#define BLAST_SRA_INPUT_ERROR
Exit code for a Blast input error (in query/options).
int main(int argc, const char *argv[])
Main argument class for BLASTN_VDB application.
const string kArgSRASearchMode
const string kArgIncludeFilteredReads
Class to mix batch size for BLAST runs.
void SetTargetHits(Int4 target)
Int4 GetBatchSize(Int4 hits=-1)
CRef< CBlastOptionsHandle > SetOptionsForSavedStrategy(const CArgs &args)
Combine the command line arguments into a CBlastOptions object recovered from saved search strategy.
virtual CNcbiIstream & GetInputStream()
Get the input stream.
size_t GetNumThreads() const
Get the number of threads to spawn.
CRef< CBlastOptionsHandle > SetOptions(const CArgs &args)
Extract the command line arguments into a CBlastOptionsHandle object.
CRef< CBlastDatabaseArgs > GetBlastDatabaseArgs() const
Get the BLAST database arguments.
CArgDescriptions * SetCommandLine()
Set the command line arguments.
bool ExecuteRemotely() const
Determine whether the search should be executed remotely or not.
CRef< CQueryOptionsArgs > GetQueryOptionsArgs() const
Get the options for the query sequence(s)
CRef< CFormattingArgs > GetFormattingArgs() const
Get the formatting options.
bool ProduceDebugOutput() const
Return whether debug (verbose) output should be produced on remote searches (only available when comp...
virtual CNcbiOstream & GetOutputStream()
Get the output stream.
string GetDatabaseName() const
Get the BLAST database name.
Defines BLAST error codes (user errors included)
Encapsulates ALL the BLAST algorithm's options.
void AddParam(EUsageParams p, int val)
Handles command line arguments for blastn binary.
virtual int GetQueryBatchSize() const
@inheritDoc
void DebugDumpText(ostream &out, const string &bundle, unsigned int depth) const
static string PreprocessDBs(CLocalVDBBlast::SLocalVDBStruct &local_vdb, const string db_names, unsigned int num_threads=kDisableThreadedSearch, ESRASearchMode seach_mode=eAligned)
CRef< CSearchResultSet > Run()
NCBI C++ Object Manager dependant implementation of IQueryFactory.
objects::ENa_strand GetStrand() const
Get strand to search in query sequence(s)
bool GetParseDeflines() const
Should the defline be parsed?
bool QueryIsProtein() const
Is the query sequence protein?
TSeqRange GetRange() const
Get query sequence range restriction.
bool UseLowercaseMasks() const
Use lowercase masking in FASTA input?
Search Results for All Queries.
static void FindVDBPaths(const string &dbname, bool isProtein, vector< string > &paths, vector< string > *db_alias_list=NULL, vector< string > *vdb_alias_list=NULL, bool recursive=true, bool expand_links=true, bool verify_dbs=true)
Get the list of vdb names.
static Uint4 SetupVDBManager()
*Note* Call this in main thread first, if you are going to instantiate this object or use any of the ...
static void ReleaseVDBManager()
Call this release vdb manager if SetupManger has been explicitly called in the main thread.
CBlastUsageReport m_UsageReport
CLocalVDBBlast::SLocalVDBStruct m_localVDBStruct
void x_SetupLocalVDBSearch()
CVDBBlastnApp()
Constructor, sets up the version info.
void x_GetFullVDBPaths(void)
CRef< CBlastnVdbAppArgs > m_CmdLineArgs
This application's command line arguments.
CRef< CScope > x_GetScope(void)
virtual int Run(void)
Run the application.
virtual void Exit(void)
Cleanup on application exit.
virtual void Init(void)
Initialize the application.
void x_FillVDBInfo(CBlastFormatUtil::SDbInfo &vecDbInfo)
const string kArgOutput
Output file name.
const string kArgDb
BLAST database name.
const string kArgNumThreads
Argument to determine the number of threads to use when running BLAST.
void Print(const CCompactSAMApplication::AlignInfo &ai)
size_t SplitQuery_GetChunkSize(EProgram program)
Returns the optimal chunk size for a given task.
EProgram GetProgram() const
Accessors/Mutators for individual options.
const CBlastOptions & GetOptions() const
Return the object which this object is a handle for.
void SetFullVersion(CRef< CVersionAPI > version)
Set version data for the program.
void HideStdArgs(THideStdArgs hide_mask)
Set the hide mask for the Hide Std Flags.
CNcbiEnvironment & SetEnvironment(void)
Get a non-const copy of the application's cached environment.
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
CVersionInfo GetVersion(void) const
Get the program version information.
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
@ fHideXmlHelp
Hide XML help description.
@ fHideLogfile
Hide log file description.
@ fHideFullVersion
Hide full version description.
@ fHideDryRun
Hide dryrun description.
@ fHideConffile
Hide configuration file description.
bool Exist(const string &name) const
Check existence of argument description.
void SetDiagPostPrefix(const char *prefix)
Specify a string to prefix all subsequent error postings with.
EDiagSev SetDiagPostLevel(EDiagSev post_sev=eDiag_Error)
Set the threshold severity for posting the messages.
void SetDiagStream(CNcbiOstream *os, bool quick_flush=true, FDiagCleanup cleanup=0, void *cleanup_data=0, const string &stream_name="")
Set diagnostic stream.
@ eDS_Default
Try standard log file (app.name + ".log") in /log/, use stderr on failure.
@ eDiag_Warning
Warning message.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string & GetMsg(void) const
Get message string.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
void Reset(void)
Reset reference object.
int32_t Int4
4-byte (32-bit) signed integer
int64_t Int8
8-byte (64-bit) signed integer
bool IsEnabled(void)
Indicates whether application usage statistics collection is enabled for a current reporter instance.
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
void Start(void)
Start the timer.
unsigned int
A callback function used to compare two keys in a database.
Main class to perform a BLAST search on the local machine.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
NOTE: This file contains work in progress and the APIs are likely to change, please do not rely on th...
Declares the CRemoteBlast class.
Configuration structure for the CBlastScopeSource.
void OptimizeForWholeLargeSequenceRetrieval(bool value=true)
Configures the BLAST database data loader to optimize the retrieval of *entire* large sequences.
Defines database alias file access classes.
Declares the CLocalVDBBlast class.