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

Search Toolkit Book for CGapStatsApplication

+ Inheritance diagram for CGapStatsApplication:
+ Collaboration diagram for CGapStatsApplication:

Public Member Functions

 CGapStatsApplication (void)
virtual void Init (void)
 Initialize the application. More...
virtual int Run (void)
 Run the application. More...
- 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 Types

enum  EOutFormat { eOutFormat_ASCIITable = 1 , eOutFormat_XML }
typedef set< GA::EGapType > TGapTypeCont
typedef vector< GA::TGapLength > TGapLengthVec

Private Member Functions

bool x_IncludeGapType (GA::EGapType eGapType) const
int RunNoCatch (void)
 "Run" will catch all exceptions and try to do something reasonable, and calls RunNoCatch where the real work happens. More...
CRef< CScopex_GetScope (void)
AutoPtr< TGapLengthVecx_CalcAllGapLens (void) const
 Returns a vector of all possible gap lengths we've seen. More...
void x_ReadFileOrAccn (const string &sFileOrAccn)
 Reads and loads into m_gapAnalysis. More...
void x_PrintSummaryView (void)
void x_PrintSeqsForGapLengths (void)
void x_PrintHistogram (Uint8 num_bins, CHistogramBinning::EHistAlgo eHistAlgo)
void x_PrintOutMessage (const SOutMessage &out_message, CNcbiOstream &out_strm) const
 x_PrintOutMessage More...

Static Private Member Functions

static string x_GapNameToGapXMLNodeName (const CTempString &gap_name)

Private Attributes

CSeq_inst::EMol m_MolFilter
size_t m_MaxResolveCount
GA m_gapAnalysis
GA::ESortGapLength m_eSort
GA::ESortDir m_eSortDir
TGapTypeCont m_IncludedGapTypes
GA::TAddFlag m_fGapAddFlags
FR::TFlags m_fFastaFlags
EOutFormat m_eOutFormat

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...
- 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

Definition at line 291 of file gap_stats.cpp.

Member Typedef Documentation

◆ TGapLengthVec

typedef vector<GA::TGapLength> CGapStatsApplication::TGapLengthVec

Definition at line 328 of file gap_stats.cpp.

◆ TGapTypeCont

typedef set<GA::EGapType> CGapStatsApplication::TGapTypeCont

Definition at line 306 of file gap_stats.cpp.

Member Enumeration Documentation

◆ EOutFormat


Definition at line 312 of file gap_stats.cpp.

Constructor & Destructor Documentation

◆ CGapStatsApplication()

CGapStatsApplication::CGapStatsApplication ( void  )

Member Function Documentation

◆ Init()

void CGapStatsApplication::Init ( void  )

Initialize the application.

The default behavior of this is "do nothing". If you have special initialization logic that needs to be peformed, then you must override this method with your own logic.

Reimplemented from CNcbiApplicationAPI.

Definition at line 367 of file gap_stats.cpp.

References CArgDescriptions::eInt8, CArgDescriptions::eInteger, CArgDescriptions::eRequires, CArgDescriptions::eString, CNcbiApplicationAPI::GetArguments(), ITERATE, NStr::Join(), kEmptyStr, kMax_I8, kMax_Int, kMax_UInt, NStr::NumericToString(), and CNcbiApplicationAPI::SetupArgDescriptions().

◆ Run()

int CGapStatsApplication::Run ( void  )

Run the application.

It is defined as a pure virtual method – so you must(!) supply the Run() method to implement the application-specific logic.

Exit code.

Implements CNcbiApplicationAPI.

Definition at line 506 of file gap_stats.cpp.

References _ASSERT, _TROUBLE, eOutFormat_ASCIITable, eOutFormat_XML, CNcbiApplicationAPI::GetArgs(), kEmptyStr, m_eOutFormat, AutoPtr< X, Del >::reset(), RunNoCatch(), and x_PrintOutMessage().

◆ RunNoCatch()

int CGapStatsApplication::RunNoCatch ( void  )

◆ x_CalcAllGapLens()

AutoPtr< CGapStatsApplication::TGapLengthVec > CGapStatsApplication::x_CalcAllGapLens ( void  ) const

Returns a vector of all possible gap lengths we've seen.

Definition at line 811 of file gap_stats.cpp.

References _ASSERT, BEGIN_COMMA_END, ITERATE, m_eSort, m_eSortDir, m_gapAnalysis, and ct::sort().

Referenced by x_PrintSeqsForGapLengths(), and x_PrintSummaryView().

◆ x_GapNameToGapXMLNodeName()

string CGapStatsApplication::x_GapNameToGapXMLNodeName ( const CTempString gap_name)

Definition at line 788 of file gap_stats.cpp.

References NStr::ReplaceInPlace(), and NStr::ToLower().

Referenced by x_PrintSummaryView().

◆ x_GetScope()

CRef< CScope > CGapStatsApplication::x_GetScope ( void  )

◆ x_IncludeGapType()

bool CGapStatsApplication::x_IncludeGapType ( GA::EGapType  eGapType) const

◆ x_PrintHistogram()

void CGapStatsApplication::x_PrintHistogram ( Uint8  num_bins,
CHistogramBinning::EHistAlgo  eHistAlgo 

◆ x_PrintOutMessage()

void CGapStatsApplication::x_PrintOutMessage ( const SOutMessage &  out_message,
CNcbiOstream out_strm 
) const


Definition at line 1416 of file gap_stats.cpp.

References _TROUBLE, eOutFormat_ASCIITable, eOutFormat_XML, and m_eOutFormat.

Referenced by Run(), and RunNoCatch().

◆ x_PrintSeqsForGapLengths()

void CGapStatsApplication::x_PrintSeqsForGapLengths ( void  )

◆ x_PrintSummaryView()

void CGapStatsApplication::x_PrintSummaryView ( void  )

◆ x_ReadFileOrAccn()

void CGapStatsApplication::x_ReadFileOrAccn ( const string sFileOrAccn)

Member Data Documentation

◆ m_eOutFormat

EOutFormat CGapStatsApplication::m_eOutFormat

◆ m_eSort

GA::ESortGapLength CGapStatsApplication::m_eSort

Definition at line 303 of file gap_stats.cpp.

Referenced by RunNoCatch(), x_CalcAllGapLens(), and x_PrintSummaryView().

◆ m_eSortDir

GA::ESortDir CGapStatsApplication::m_eSortDir

Definition at line 304 of file gap_stats.cpp.

Referenced by RunNoCatch(), x_CalcAllGapLens(), and x_PrintSummaryView().

◆ m_fFastaFlags

FR::TFlags CGapStatsApplication::m_fFastaFlags

Definition at line 310 of file gap_stats.cpp.

Referenced by RunNoCatch(), and x_ReadFileOrAccn().

◆ m_fGapAddFlags

GA::TAddFlag CGapStatsApplication::m_fGapAddFlags

Definition at line 309 of file gap_stats.cpp.

Referenced by RunNoCatch(), and x_ReadFileOrAccn().

◆ m_gapAnalysis

GA CGapStatsApplication::m_gapAnalysis

◆ m_IncludedGapTypes

TGapTypeCont CGapStatsApplication::m_IncludedGapTypes

Definition at line 307 of file gap_stats.cpp.

Referenced by CGapStatsApplication(), RunNoCatch(), and x_IncludeGapType().

◆ m_MaxResolveCount

size_t CGapStatsApplication::m_MaxResolveCount

Definition at line 301 of file gap_stats.cpp.

Referenced by RunNoCatch(), and x_ReadFileOrAccn().

◆ m_MolFilter

CSeq_inst::EMol CGapStatsApplication::m_MolFilter

Definition at line 300 of file gap_stats.cpp.

Referenced by RunNoCatch(), and x_ReadFileOrAccn().

The documentation for this class was generated from the following file:
Modified on Fri Jan 05 07:25:38 2024 by rev. 669887