NCBI C++ ToolKit
|
Search Toolkit Book for CAppHitFilter
#include "hitfilter_app.hpp"
(Private to src/app/hfilter
.)
Classes | |
struct | SBuildIDs |
Public Types | |
enum | EReciprocity { e_Other , e_SubjectDuplication , e_QueryDuplication , e_ReciprocalBest } |
typedef CBlastTabular | THit |
typedef CRef< THit > | THitRef |
typedef vector< THitRef > | THitRefs |
Public Types inherited from CNcbiApplicationAPI | |
enum | EAppNameType { eBaseName , eFullName , eRealName } |
Public Member Functions | |
virtual void | Init () |
Initialize the application. More... | |
virtual int | Run () |
Run the application. More... | |
virtual void | Exit () |
Cleanup on application exit. 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... | |
const CNcbiArguments & | GetArguments (void) const |
Get the application's cached unprocessed command-line arguments. More... | |
virtual const CArgs & | GetArgs (void) const |
Get parsed command line arguments. More... | |
const CNcbiEnvironment & | GetEnvironment (void) const |
Get the application's cached environment. More... | |
CNcbiEnvironment & | SetEnvironment (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 CNcbiRegistry & | GetConfig (void) const |
Get the application's cached configuration parameters (read-only). More... | |
CNcbiRegistry & | GetConfig (void) |
const string & | GetConfigPath (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 string & | GetProgramDisplayName (void) const |
Get the application's "display" name. More... | |
const string & | GetProgramExecutablePath (EFollowLinks follow_links=eIgnoreLinks) const |
Get the application's executable path. More... | |
CVersionInfo | GetVersion (void) const |
Get the program version information. More... | |
const CVersionAPI & | GetFullVersion (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 | |
typedef list< CRef< objects::CSeq_align > > | TSeqAlignList |
typedef map< string, string > | TMapIds |
typedef map< string, SBuildIDs > | TMapIdPairs |
Private Member Functions | |
void | x_ReadInputHits (THitRefs *phitrefs, bool one_pair=false) |
void | x_IterateSeqAlignList (const TSeqAlignList &sa_list, THitRefs *phitrefs, bool parse_aln, const THit::TCoord &min_len, const double &min_idty) const |
void | x_DumpOutput (const THitRefs &hitrefs) |
void | x_LoadConstraints (CNcbiIstream &istr, THitRefs &all) |
void | x_LoadIDs (CNcbiIstream &istr) |
void | x_DoPairwise (THitRefs *pall) |
void | x_DoMultiple (THitRefs *pall) |
Private Attributes | |
TMapIds | m_IDs |
TMapIdPairs | m_IDRevs |
Additional Inherited Members | |
Static Public Member Functions inherited from CNcbiApplication | |
static CNcbiApplication * | Instance (void) |
Singleton method. More... | |
Static Public Member Functions inherited from CNcbiApplicationAPI | |
static CNcbiApplicationAPI * | Instance (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 CArgDescriptions * | GetArgDescriptions (void) const |
Get argument descriptions (set by SetupArgDescriptions) More... | |
bool | SetupDiag (EAppDiagStream diag) |
Setup the application diagnostic stream. More... | |
virtual bool | LoadConfig (CNcbiRegistry ®, const string *conf, CNcbiRegistry::TFlags reg_flags) |
Load settings from the configuration file to the registry. More... | |
virtual bool | LoadConfig (CNcbiRegistry ®, const string *conf) |
Load settings from the configuration file to the registry. More... | |
CNcbiRegistry & | GetRWConfig (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... | |
IPhoneHomePolicy * | GetPhoneHomePolicy () const |
Return pointer to current Phone Home Policy or NULL. More... | |
Static Protected Member Functions inherited from CNcbiApplicationAPI | |
static CRWLock & | GetInstanceLock (void) |
static string | FindProgramExecutablePath (int argc, const char *const *argv, string *real_path=0) |
Find the application's executable file. More... | |
Definition at line 71 of file hitfilter_app.hpp.
typedef CBlastTabular CAppHitFilter::THit |
Definition at line 79 of file hitfilter_app.hpp.
typedef CRef<THit> CAppHitFilter::THitRef |
Definition at line 80 of file hitfilter_app.hpp.
typedef vector<THitRef> CAppHitFilter::THitRefs |
Definition at line 81 of file hitfilter_app.hpp.
|
private |
Definition at line 113 of file hitfilter_app.hpp.
|
private |
Definition at line 107 of file hitfilter_app.hpp.
|
private |
Definition at line 92 of file hitfilter_app.hpp.
Enumerator | |
---|---|
e_Other | |
e_SubjectDuplication | |
e_QueryDuplication | |
e_ReciprocalBest |
Definition at line 83 of file hitfilter_app.hpp.
|
virtual |
Cleanup on application exit.
Perform cleanup before exiting. The default behavior of this is "do nothing". If you have special cleanup logic that needs to be performed, then you must override this method with your own logic.
Reimplemented from CNcbiApplicationAPI.
Definition at line 751 of file hitfilter_app.cpp.
|
virtual |
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 71 of file hitfilter_app.cpp.
References CArgAllow_Strings::Allow(), CArgDescriptions::eDouble, CArgDescriptions::eInputFile, CArgDescriptions::eInteger, CArgDescriptions::eOutputFile, CArgDescriptions::eString, CArgDescriptions::fBinary, CNcbiApplicationAPI::fHideConffile, CNcbiApplicationAPI::fHideLogfile, CNcbiApplicationAPI::fHideVersion, CNcbiApplicationAPI::GetArguments(), GetProgramName, CNcbiApplicationAPI::HideStdArgs(), and CNcbiApplicationAPI::SetupArgDescriptions().
|
virtual |
Run the application.
It is defined as a pure virtual method – so you must(!) supply the Run() method to implement the application-specific logic.
Implements CNcbiApplicationAPI.
Definition at line 501 of file hitfilter_app.cpp.
References all, eUnknown, CNcbiApplicationAPI::GetArgs(), NCBI_THROW, CHitFilter< THit >::s_MergeAbutting(), x_DoMultiple(), x_DoPairwise(), and x_DumpOutput().
|
private |
Definition at line 593 of file hitfilter_app.cpp.
References all, copy(), CNcbiApplicationAPI::GetArgs(), LOG_POST, min(), remove_if(), s_PHitRefScore(), CHitFilter< THit >::s_RunGreedy(), ct::sort(), x_LoadConstraints(), x_LoadIDs(), and x_ReadInputHits().
Referenced by Run().
|
private |
Definition at line 548 of file hitfilter_app.cpp.
References all, copy(), CNcbiApplicationAPI::GetArgs(), remove_if(), s_PHitRefScore(), CHitFilter< THit >::s_RunGreedy(), ct::sort(), and x_ReadInputHits().
Referenced by Run().
Definition at line 356 of file hitfilter_app.cpp.
References CSeq_annot::AddComment(), e_QueryDuplication, e_ReciprocalBest, e_SubjectDuplication, eNa_strand_minus, eNa_strand_plus, CSeq_align_Base::eType_partial, CDense_seg::FromTranscript(), CNcbiApplicationAPI::GetArgs(), CDense_seg_Base::GetDim(), CAlignShadow::GetId(), CDense_seg_Base::GetNumseg(), CAlignShadow::GetQueryStart(), CAlignShadow::GetQueryStrand(), CBlastTabular::GetScore(), CDense_seg_Base::GetStarts(), CAlignShadow::GetSubjStart(), CAlignShadow::GetSubjStrand(), CAlignShadow::GetTranscript(), i, ITERATE, kQuery, MSerial_AsnBinary, MSerial_AsnText, CDense_seg_Base::ResetStrands(), CAlignShadow::s_RunLengthDecode(), CSeq_annot_Base::SetData(), CDense_seg_Base::SetIds(), CSeq_align_Base::SetScore(), CSeq_align_Base::SetSegs(), and CSeq_align_Base::SetType().
Referenced by Run().
|
private |
Definition at line 333 of file hitfilter_app.cpp.
Referenced by x_ReadInputHits().
|
private |
Definition at line 677 of file hitfilter_app.cpp.
References CScope::AddDefaults(), all, CSeq_id::AsFastaString(), map_checker< Container >::end(), map_checker< Container >::find(), GetAccessionForGi(), CNcbiApplicationAPI::GetArgs(), CSeq_id_Base::GetGi(), GetGiForAccession(), CObjectManager::GetInstance(), CSeq_id_Base::IsGi(), m_IDRevs, MSerial_AsnBinary, NON_CONST_ITERATE, om, CGBDataLoader::RegisterInObjectManager(), CSeq_annot_Base::SetData(), and string.
Referenced by x_DoMultiple().
|
private |
Definition at line 183 of file hitfilter_app.cpp.
References map_checker< Container >::clear(), map_checker< Container >::end(), map_checker< Container >::find(), CAppHitFilter::SBuildIDs::m_id, m_IDRevs, and m_IDs.
Referenced by x_DoMultiple().
Definition at line 213 of file hitfilter_app.cpp.
References eSerial_AsnBinary, eSerial_AsnText, eUnknown, CSeq_align_set_Base::Get(), CSeq_annot_Base::C_Data::GetAlign(), CNcbiApplicationAPI::GetArgs(), CSeq_annot_Base::GetData(), CSeq_align_Base::C_Segs::GetDisc(), CSeq_align_Base::GetSegs(), in(), CConstRef< C, Locker >::IsNull(), ITERATE, NCBI_THROW, CObjectIStream::Open(), tag, NStr::TruncateSpaces(), and x_IterateSeqAlignList().
Referenced by x_DoMultiple(), and x_DoPairwise().
|
private |
Definition at line 114 of file hitfilter_app.hpp.
Referenced by x_LoadConstraints(), and x_LoadIDs().
|
private |
Definition at line 108 of file hitfilter_app.hpp.
Referenced by x_LoadIDs().