NCBI C++ ToolKit
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CBlastDBCmdApp Class Reference

Search Toolkit Book for CBlastDBCmdApp

The application class. More...

+ Inheritance diagram for CBlastDBCmdApp:
+ Collaboration diagram for CBlastDBCmdApp:

Public Member Functions

 CBlastDBCmdApp ()
 @inheritDoc More...
 
 CBlastDBCmdApp ()
 @inheritDoc More...
 
 ~CBlastDBCmdApp ()
 
- Public Member Functions inherited from CNcbiApplication
virtual ~CNcbiApplication (void)
 Destructor. More...
 
 CNcbiApplication (const SBuildInfo &build_info=NCBI_SBUILDINFO_DEFAULT())
 Constructor. More...
 
- Public Member Functions inherited from CNcbiApplicationAPI
 CNcbiApplicationAPI (const SBuildInfo &build_info)
 Constructor. More...
 
virtual ~CNcbiApplicationAPI (void)
 Destructor. More...
 
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. More...
 
virtual int DryRun (void)
 Test run the application. More...
 
virtual void Exit (void)
 Cleanup on application exit. More...
 
const CNcbiArgumentsGetArguments (void) const
 Get the application's cached unprocessed command-line arguments. More...
 
virtual const CArgsGetArgs (void) const
 Get parsed command line arguments. More...
 
const CNcbiEnvironmentGetEnvironment (void) const
 Get the application's cached environment. More...
 
CNcbiEnvironmentSetEnvironment (void)
 Get a non-const copy of the application's cached environment. More...
 
void SetEnvironment (const string &name, const string &value)
 Set a specified environment variable by name. More...
 
bool HasLoadedConfig (void) const
 Check if the config file has been loaded. More...
 
bool FinishedLoadingConfig (void) const
 Check if the application has finished loading config file (successfully or not). More...
 
const CNcbiRegistryGetConfig (void) const
 Get the application's cached configuration parameters (read-only). More...
 
CNcbiRegistryGetConfig (void)
 
const stringGetConfigPath (void) const
 Get the full path to the configuration file (if any) we ended up using. More...
 
bool ReloadConfig (CMetaRegistry::TFlags flags=CMetaRegistry::fReloadIfChanged, IRegistry::TFlags reg_flags=IRegistry::fWithNcbirc)
 Reload the configuration file. More...
 
SIZE_TYPE FlushDiag (CNcbiOstream *os, bool close_diag=false)
 Flush the in-memory diagnostic stream (for "eDS_ToMemory" case only). More...
 
const stringGetProgramDisplayName (void) const
 Get the application's "display" name. More...
 
const stringGetProgramExecutablePath (EFollowLinks follow_links=eIgnoreLinks) const
 Get the application's executable path. More...
 
CVersionInfo GetVersion (void) const
 Get the program version information. More...
 
const CVersionAPIGetFullVersion (void) const
 Get the program version information. More...
 
bool IsDryRun (void) const
 Check if it is a test run. More...
 
virtual bool SetupDiag_AppSpecific (void)
 Setup application specific diagnostic stream. More...
 
template<class TFunc >
void AddOnExitAction (TFunc func)
 Add callback to be executed from CNcbiApplicationAPI destructor. More...
 

Private Member Functions

virtual void Init ()
 @inheritDoc More...
 
virtual int Run ()
 @inheritDoc More...
 
virtual void Init ()
 @inheritDoc More...
 
virtual int Run ()
 @inheritDoc More...
 
void x_InitBlastDB ()
 Initializes Blast DB. More...
 
void x_InitBlastDB_TaxIdList ()
 
string x_InitSearchRequest ()
 
void x_PrintBlastDatabaseInformation ()
 Prints the BLAST database information (e.g. More...
 
int x_ProcessSearchRequest ()
 Processes all requests except printing the BLAST database information. More...
 
int x_ProcessBatchEntry (CBlastDB_Formatter &seq_fmt)
 Process batch entry with range, strand and filter id. More...
 
int x_ProcessBatchEntry_NoDup (CBlastDB_Formatter &fmt)
 
int x_ProcessEntry (CBlastDB_Formatter &fmt)
 Process entry with range, strand and filter id. More...
 
int x_ProcessTaxIdList (CBlastDB_Formatter &fmt)
 
int x_ProcessSearchType (CBlastDB_Formatter &fmt)
 
bool x_GetOids (const string &acc, vector< int > &oids)
 
int x_ModifyConfigForBatchEntry (const string &config)
 
bool x_UseLongSeqIds ()
 
void x_PrintBlastDatabaseTaxInformation ()
 
int x_ProcessBatchPig (CBlastDB_Formatter &fmt)
 
void x_AddCmdOptions ()
 

Private Attributes

CRef< CSeqDBExpertm_BlastDb
 Handle to BLAST database. More...
 
bool m_DbIsProtein
 Is the database protein. More...
 
bool m_FASTA
 output is FASTA More...
 
bool m_Asn1Bioseq
 output is ASN.1 defline More...
 
bool m_GetDuplicates
 should we find duplicate entries? More...
 
bool m_TargetOnly
 should we output target sequence only? More...
 
CBlastDB_FormatterConfig m_Config
 
set< TTaxIdm_TaxIdList
 
CBlastUsageReport m_UsageReport
 
CStopWatch m_StopWatch
 

Additional Inherited Members

- Public Types inherited from CNcbiApplicationAPI
enum  EAppNameType { eBaseName , eFullName , eRealName }
 
- Static Public Member Functions inherited from CNcbiApplication
static CNcbiApplicationInstance (void)
 Singleton method. More...
 
- Static Public Member Functions inherited from CNcbiApplicationAPI
static CNcbiApplicationAPIInstance (void)
 Singleton method. More...
 
static CNcbiApplicationGuard InstanceGuard (void)
 Singleton method. More...
 
static SSystemMutex & GetInstanceMutex (void)
 Mutex for application singleton object. More...
 
static string GetAppName (EAppNameType name_type=eBaseName, int argc=0, const char *const *argv=NULL)
 
- Protected Types inherited from CNcbiApplicationAPI
enum  EPreparseArgs { ePreparse_Continue , ePreparse_Exit }
 Result of PreparseArgs() More...
 
enum  EDisableArgDesc { fDisableStdArgs = 0x01 }
 Disable argument descriptions. More...
 
enum  EHideStdArgs {
  fHideLogfile = CArgDescriptions::fHideLogfile , fHideConffile = CArgDescriptions::fHideConffile , fHideVersion = CArgDescriptions::fHideVersion , fHideFullVersion = CArgDescriptions::fHideFullVersion ,
  fHideDryRun = CArgDescriptions::fHideDryRun , fHideHelp = CArgDescriptions::fHideHelp , fHideFullHelp = CArgDescriptions::fHideFullHelp , fHideXmlHelp = CArgDescriptions::fHideXmlHelp ,
  fHideAll = CArgDescriptions::fHideAll
}
 Which standard flag's descriptions should not be displayed in the usage message. More...
 
enum  EStdioSetup {
  fNoSyncWithStdio = 0x01 , fDefault_CinBufferSize = 0x02 , fBinaryCin = 0x04 , fBinaryCout = 0x08 ,
  fDefault_SyncWithStdio = 0x00
}
 Flags to adjust standard I/O streams' behaviour. More...
 
enum  EExitMode { eNoExits , eExceptionalExits , eAllExits }
 When to return a user-set exit code. More...
 
enum  EAppFlags { fSkipSafeStaticDestroy = 1 << 0 }
 
typedef int TDisableArgDesc
 Binary OR of "EDisableArgDesc". More...
 
typedef int THideStdArgs
 Binary OR of "EHideStdArgs". More...
 
typedef int TStdioSetupFlags
 Binary OR of "EStdioSetup". More...
 
typedef int TAppFlags
 
- Protected Member Functions inherited from CNcbiApplicationAPI
virtual EPreparseArgs PreparseArgs (int argc, const char *const *argv)
 Check the command line arguments before parsing them. More...
 
void DisableArgDescriptions (TDisableArgDesc disable=fDisableStdArgs)
 
void HideStdArgs (THideStdArgs hide_mask)
 Set the hide mask for the Hide Std Flags. More...
 
void SetStdioFlags (TStdioSetupFlags stdio_flags)
 Adjust the behavior of standard I/O streams. More...
 
void SetVersion (const CVersionInfo &version)
 Set the version number for the program. More...
 
void SetVersion (const CVersionInfo &version, const SBuildInfo &build_info)
 
void SetVersionByBuild (int major)
 
void SetFullVersion (CRef< CVersionAPI > version)
 Set version data for the program. More...
 
virtual void SetupArgDescriptions (CArgDescriptions *arg_desc)
 Setup the command line argument descriptions. More...
 
const CArgDescriptionsGetArgDescriptions (void) const
 Get argument descriptions (set by SetupArgDescriptions) More...
 
bool SetupDiag (EAppDiagStream diag)
 Setup the application diagnostic stream. More...
 
virtual bool LoadConfig (CNcbiRegistry &reg, const string *conf, CNcbiRegistry::TFlags reg_flags)
 Load settings from the configuration file to the registry. More...
 
virtual bool LoadConfig (CNcbiRegistry &reg, const string *conf)
 Load settings from the configuration file to the registry. More...
 
CNcbiRegistryGetRWConfig (void)
 Get the application's cached configuration parameters, accessible for read-write for an application's internal use only. More...
 
void SetProgramDisplayName (const string &app_name)
 Set program's display name. More...
 
virtual void AppStart (void)
 Method to be called before application start. More...
 
virtual void AppStop (int exit_code)
 Method to be called before application exit. More...
 
void SetExitCode (int exit_code, EExitMode when=eExceptionalExits)
 Force the program to return a specific exit code later, either when it exits due to an exception or unconditionally. More...
 
void SetAppFlags (TAppFlags flags)
 
void ExecuteOnExitActions ()
 Should only be called from the destructors of classes derived from CNcbiApplicationAPI - if it is necessary to access their data members and virtual methods; or to dynamic_cast<> from the base app class. More...
 
void SetPhoneHomePolicy (IPhoneHomePolicy *policy, ENcbiOwnership ownership=eNoOwnership)
 Set Phone Home Policy. More...
 
IPhoneHomePolicyGetPhoneHomePolicy () const
 Return pointer to current Phone Home Policy or NULL. More...
 
- Static Protected Member Functions inherited from CNcbiApplicationAPI
static CRWLockGetInstanceLock (void)
 
static string FindProgramExecutablePath (int argc, const char *const *argv, string *real_path=0)
 Find the application's executable file. More...
 

Detailed Description

The application class.

Definition at line 49 of file blastdb_path.cpp.

Constructor & Destructor Documentation

◆ CBlastDBCmdApp() [1/2]

CBlastDBCmdApp::CBlastDBCmdApp ( )
inline

@inheritDoc

Definition at line 53 of file blastdb_path.cpp.

References CVersion, CNcbiApplicationAPI::SetFullVersion(), and version.

◆ CBlastDBCmdApp() [2/2]

CBlastDBCmdApp::CBlastDBCmdApp ( )
inline

◆ ~CBlastDBCmdApp()

CBlastDBCmdApp::~CBlastDBCmdApp ( )
inline

Member Function Documentation

◆ Init() [1/2]

void CBlastDBCmdApp::Init ( void  )
privatevirtual

◆ Init() [2/2]

virtual void CBlastDBCmdApp::Init ( )
privatevirtual

@inheritDoc

Reimplemented from CNcbiApplicationAPI.

◆ Run() [1/2]

int CBlastDBCmdApp::Run ( void  )
privatevirtual

◆ Run() [2/2]

virtual int CBlastDBCmdApp::Run ( )
privatevirtual

@inheritDoc

Implements CNcbiApplicationAPI.

◆ x_AddCmdOptions()

void CBlastDBCmdApp::x_AddCmdOptions ( )
private

◆ x_GetOids()

bool CBlastDBCmdApp::x_GetOids ( const string acc,
vector< int > &  oids 
)
private

◆ x_InitBlastDB()

void CBlastDBCmdApp::x_InitBlastDB ( )
private

◆ x_InitBlastDB_TaxIdList()

void CBlastDBCmdApp::x_InitBlastDB_TaxIdList ( )
private

◆ x_InitSearchRequest()

string CBlastDBCmdApp::x_InitSearchRequest ( )
private

◆ x_ModifyConfigForBatchEntry()

int CBlastDBCmdApp::x_ModifyConfigForBatchEntry ( const string config)
private

◆ x_PrintBlastDatabaseInformation()

void CBlastDBCmdApp::x_PrintBlastDatabaseInformation ( )
private

◆ x_PrintBlastDatabaseTaxInformation()

void CBlastDBCmdApp::x_PrintBlastDatabaseTaxInformation ( )
private

◆ x_ProcessBatchEntry()

int CBlastDBCmdApp::x_ProcessBatchEntry ( CBlastDB_Formatter seq_fmt)
private

Process batch entry with range, strand and filter id.

Parameters
argsprogram input args
seq_fmtsequence formatter object
Returns
0 on sucess; 1 if some queries were not processed

Definition at line 441 of file blastdbcmd.cpp.

References ctll::empty(), ERR_POST, Error(), format, NStr::fSplit_MergeDelimiters, NStr::fSplit_Truncate, CNcbiApplicationAPI::GetArgs(), input(), m_Config, m_GetDuplicates, m_TargetOnly, NcbiGetlineEOL(), NStr::SplitInTwo(), CBlastDB_Formatter::Write(), x_GetOids(), and x_ModifyConfigForBatchEntry().

Referenced by x_ProcessSearchType().

◆ x_ProcessBatchEntry_NoDup()

int CBlastDBCmdApp::x_ProcessBatchEntry_NoDup ( CBlastDB_Formatter fmt)
private

◆ x_ProcessBatchPig()

int CBlastDBCmdApp::x_ProcessBatchPig ( CBlastDB_Formatter fmt)
private

◆ x_ProcessEntry()

int CBlastDBCmdApp::x_ProcessEntry ( CBlastDB_Formatter fmt)
private

Process entry with range, strand and filter id.

Parameters
argsprogram input args
seq_fmtsequence formatter object
Returns
0 on sucess; 1 if some queries were not processed

Definition at line 213 of file blastdbcmd.cpp.

References _ASSERT, CNcbiApplicationAPI::GetArgs(), i, m_BlastDb, m_Config, m_TargetOnly, NCBI_THROW, CRef< C, Locker >::NotEmpty(), CSeqDB::PigToOid(), NStr::Split(), CBlastDB_Formatter::Write(), and x_GetOids().

Referenced by x_ProcessSearchType().

◆ x_ProcessSearchRequest()

int CBlastDBCmdApp::x_ProcessSearchRequest ( )
private

Processes all requests except printing the BLAST database information.

Returns
0 on success; 1 if some sequences were not retrieved

Definition at line 869 of file blastdbcmd.cpp.

References ERR_POST, Error(), CNcbiApplicationAPI::GetArgs(), CException::GetMsg(), kArgOutput, m_Asn1Bioseq, m_BlastDb, m_FASTA, out(), x_InitSearchRequest(), x_ProcessSearchType(), and x_UseLongSeqIds().

◆ x_ProcessSearchType()

int CBlastDBCmdApp::x_ProcessSearchType ( CBlastDB_Formatter fmt)
private

◆ x_ProcessTaxIdList()

int CBlastDBCmdApp::x_ProcessTaxIdList ( CBlastDB_Formatter fmt)
private

◆ x_UseLongSeqIds()

bool CBlastDBCmdApp::x_UseLongSeqIds ( )
private

Member Data Documentation

◆ m_Asn1Bioseq

bool CBlastDBCmdApp::m_Asn1Bioseq
private

output is ASN.1 defline

Definition at line 93 of file blastdbcmd.cpp.

Referenced by x_InitSearchRequest(), and x_ProcessSearchRequest().

◆ m_BlastDb

CRef<CSeqDBExpert> CBlastDBCmdApp::m_BlastDb
private

◆ m_Config

CBlastDB_FormatterConfig CBlastDBCmdApp::m_Config
private

◆ m_DbIsProtein

bool CBlastDBCmdApp::m_DbIsProtein
private

◆ m_FASTA

bool CBlastDBCmdApp::m_FASTA
private

output is FASTA

Definition at line 91 of file blastdbcmd.cpp.

Referenced by x_InitSearchRequest(), and x_ProcessSearchRequest().

◆ m_GetDuplicates

bool CBlastDBCmdApp::m_GetDuplicates
private

should we find duplicate entries?

Definition at line 95 of file blastdbcmd.cpp.

Referenced by x_InitSearchRequest(), x_ProcessBatchEntry(), and x_ProcessSearchType().

◆ m_StopWatch

CStopWatch CBlastDBCmdApp::m_StopWatch
private

Definition at line 104 of file blastdbcmd.cpp.

Referenced by CBlastDBCmdApp(), and ~CBlastDBCmdApp().

◆ m_TargetOnly

bool CBlastDBCmdApp::m_TargetOnly
private

should we output target sequence only?

Definition at line 97 of file blastdbcmd.cpp.

Referenced by x_InitBlastDB_TaxIdList(), x_InitSearchRequest(), x_ProcessBatchEntry(), x_ProcessBatchEntry_NoDup(), and x_ProcessEntry().

◆ m_TaxIdList

set<TTaxId> CBlastDBCmdApp::m_TaxIdList
private

Definition at line 101 of file blastdbcmd.cpp.

Referenced by x_InitBlastDB_TaxIdList(), and x_ProcessTaxIdList().

◆ m_UsageReport

CBlastUsageReport CBlastDBCmdApp::m_UsageReport
private

Definition at line 103 of file blastdbcmd.cpp.

Referenced by CBlastDBCmdApp(), x_AddCmdOptions(), and ~CBlastDBCmdApp().


The documentation for this class was generated from the following files:
Modified on Mon May 20 05:00:15 2024 by modify_doxy.py rev. 669887