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");
218 vector< CBlastFormatUtil::SDbInfo > vecDbInfo(1);
329 cerr <<
"BLAST query/options error: " << e.
GetMsg() << endl;
333 cerr <<
"Command line argument error: " << e.
GetMsg() << endl;
337 cerr <<
"BLAST engine error: " << e.
GetMsg() << endl;
343 cerr <<
"Error: " << e.
GetMsg() << endl;
346 catch (
const exception& e) {
347 cerr <<
"Error: " << e.
what() << endl;
351 cerr <<
"Unknown exception occurred" << endl;
372 #ifndef SKIP_DOXYGEN_PROCESSING
373 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)
void LogQueryInfo(CBlastUsageReport &report, const CBlastInput &q_info)
CRef< CScope > GetVDBScope(string dbAllNames)
void SortAndFetchSeqData(const blast::CSearchResultSet &results, CRef< CScope > scope, CScope::TBioseqHandles &handles)
Utility functions for BLAST VDB command line applications.
const string kArgSRASearchMode
const string kArgIncludeFilteredReads
const CSeq_id * GetFirstId() const
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)
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.
const CSeq_entry & GetQuery() const
Retrieve the query sequence.
CSeq_entry & SetQuery()
Retrieve the query sequence.
bool HasQuery() const
Has this PSSM a query in it?
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.
Handles command line arguments for blastx binary.
virtual int GetQueryBatchSize() const
Get the query batch size.
CRef< objects::CPssmWithParameters > GetInputPssm() const
Get the PSSM.
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.
void x_GetFullVDBPaths(void)
CVDBTblastnApp()
Constructor, sets up the version info.
CLocalVDBBlast::SLocalVDBStruct m_localVDBStruct
virtual void Init(void)
Initialize the application.
virtual void Exit(void)
Cleanup on application exit.
virtual int Run(void)
Run the application.
void x_FillVDBInfo(CBlastFormatUtil::SDbInfo &vecDbInfo)
CRef< CTblastnVdbAppArgs > m_CmdLineArgs
This application's command line arguments.
CRef< CScope > x_GetScope(void)
CBlastUsageReport m_UsageReport
void x_SetupLocalVDBSearch()
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)
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).
CSeq_entry_Handle AddTopLevelSeqEntry(CSeq_entry &top_entry, TPriority pri=kPriority_Default, EExist action=eExist_Default)
Add seq_entry, default priority is higher than for defaults or loaders Add object to the score with p...
vector< CBioseq_Handle > TBioseqHandles
void Reset(void)
Reset reference object.
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
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.
const TSeq & GetSeq(void) const
Get the variant data.
bool IsSeq(void) const
Check if variant Seq is selected.
unsigned int
A callback function used to compare two keys in a database.
Main class to perform a BLAST search on the local machine.
const string version
version string
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.
#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[])
Defines database alias file access classes.
Declares the CLocalVDBBlast class.