📄 blast_options.hpp
字号:
/* * =========================================================================== * PRODUCTION $Log: blast_options.hpp,v $ * PRODUCTION Revision 1000.2 2004/06/01 18:02:42 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.61 * PRODUCTION * =========================================================================== *//* $Id: blast_options.hpp,v 1000.2 2004/06/01 18:02:42 gouriano Exp $ * =========================================================================== * * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information * * This software/database is a "United States Government Work" under the * terms of the United States Copyright Act. It was written as part of * the author's official duties as a United States Government employee and * thus cannot be copyrighted. This software/database is freely available * to the public for use. The National Library of Medicine and the U.S. * Government have not placed any restriction on its use or reproduction. * * Although all reasonable efforts have been taken to ensure the accuracy * and reliability of the software and data, the NLM and the U.S. * Government do not and cannot warrant the performance or results that * may be obtained by using this software or data. The NLM and the U.S. * Government disclaim all warranties, express or implied, including * warranties of performance, merchantability or fitness for any particular * purpose. * * Please cite the author in any work or product based on this material. * * =========================================================================== * * Author: Christiam Camacho * *//** @file blast_options.hpp * Class to encapsulate all NewBlast options */#ifndef ALGO_BLAST_API___BLAST_OPTION__HPP#define ALGO_BLAST_API___BLAST_OPTION__HPP#include <objects/blast/Blast4_value.hpp>#include <objects/blast/Blast4_parameter.hpp>#include <objects/blast/Blast4_parameters.hpp>#include <objects/blast/Blast4_queue_search_reques.hpp>#include <algo/blast/api/blast_aux.hpp>#include <algo/blast/api/blast_exception.hpp>#include <algo/blast/core/blast_options.h>// Forward declaration of a unit test classclass CBlastGapAlignTest;class CBlastDbTest;class CBlastTraceBackTest; class CScoreBlkTest; class CRPSTest; class CBlastRedoAlignmentTest; /** @addtogroup AlgoBlast * * @{ */BEGIN_NCBI_SCOPEBEGIN_SCOPE(objects) class CSeq_loc;END_SCOPE(objects)BEGIN_SCOPE(blast)enum EBlastOptIdx { eBlastOpt_Program = 100, eBlastOpt_WordThreshold, eBlastOpt_LookupTableType, eBlastOpt_WordSize, eBlastOpt_AlphabetSize, eBlastOpt_ScanStep, eBlastOpt_MBTemplateLength, eBlastOpt_MBTemplateType, eBlastOpt_MBMaxPositions, eBlastOpt_FilterString, eBlastOpt_StrandOption, eBlastOpt_QueryGeneticCode, eBlastOpt_WindowSize, eBlastOpt_SeedContainerType, eBlastOpt_SeedExtensionMethod, eBlastOpt_VariableWordSize, eBlastOpt_UngappedExtension, eBlastOpt_XDropoff, eBlastOpt_GapXDropoff, eBlastOpt_GapXDropoffFinal, eBlastOpt_GapTrigger, eBlastOpt_GapExtnAlgorithm, eBlastOpt_HitlistSize, eBlastOpt_PrelimHitlistSize, eBlastOpt_MaxNumHspPerSequence, eBlastOpt_TotalHspLimit, eBlastOpt_CullingMode, eBlastOpt_RequiredStart, eBlastOpt_RequiredEnd, eBlastOpt_EvalueThreshold, eBlastOpt_CutoffScore, eBlastOpt_PercentIdentity, eBlastOpt_SumStatisticsMode, eBlastOpt_LongestIntronLength, eBlastOpt_GappedMode, eBlastOpt_NeighboringMode, eBlastOpt_MatrixName, eBlastOpt_MatrixPath, eBlastOpt_MatchReward, eBlastOpt_MismatchPenalty, eBlastOpt_GapOpeningCost, eBlastOpt_GapExtensionCost, eBlastOpt_FrameShiftPenalty, eBlastOpt_Decline2AlignPenalty, eBlastOpt_OutOfFrameMode, eBlastOpt_DbLength, eBlastOpt_DbSeqNum, eBlastOpt_EffectiveSearchSpace, eBlastOpt_UseRealDbSize, eBlastOpt_DbGeneticCode, eBlastOpt_PHIPattern, eBlastOpt_SkipTraceback, eBlastOpt_InclusionThreshold, eBlastOpt_PseudoCount, eBlastOpt_GapTracebackAlgorithm};/// Encapsulates all blast input parametersclass NCBI_XBLAST_EXPORT CBlastOptionsLocal : public CObject{public: enum EAPILocality { eLocal, eRemote, eBoth }; CBlastOptionsLocal(); ~CBlastOptionsLocal(); /// Validate the options bool Validate() const; /// Accessors/Mutators for individual options EProgram GetProgram() const; void SetProgram(EProgram p); /******************* Lookup table options ***********************/ int GetWordThreshold() const; void SetWordThreshold(int w); int GetLookupTableType() const; void SetLookupTableType(int type); short GetWordSize() const; void SetWordSize(short ws); int GetAlphabetSize() const; void SetAlphabetSize(int s); unsigned char GetScanStep() const; void SetScanStep(unsigned char s); /// Megablast only lookup table options unsigned char GetMBTemplateLength() const; void SetMBTemplateLength(unsigned char len); unsigned char GetMBTemplateType() const; void SetMBTemplateType(unsigned char type); int GetMBMaxPositions() const; void SetMBMaxPositions(int m); /******************* Query setup options ************************/ const char* GetFilterString() const; void SetFilterString(const char* f); objects::ENa_strand GetStrandOption() const; void SetStrandOption(objects::ENa_strand s); int GetQueryGeneticCode() const; void SetQueryGeneticCode(int gc); /******************* Initial word options ***********************/ int GetWindowSize() const; void SetWindowSize(int w); SeedContainerType GetSeedContainerType() const; void SetSeedContainerType(SeedContainerType type); SeedExtensionMethod GetSeedExtensionMethod() const; void SetSeedExtensionMethod(SeedExtensionMethod method); bool GetVariableWordSize() const; void SetVariableWordSize(bool val = true); bool GetUngappedExtension() const; void SetUngappedExtension(bool val = true); double GetXDropoff() const; void SetXDropoff(double x); /******************* Gapped extension options *******************/ double GetGapXDropoff() const; void SetGapXDropoff(double x); double GetGapXDropoffFinal() const; void SetGapXDropoffFinal(double x); double GetGapTrigger() const; void SetGapTrigger(double g); EBlastPrelimGapExt GetGapExtnAlgorithm() const; void SetGapExtnAlgorithm(EBlastPrelimGapExt a); EBlastTbackExt GetGapTracebackAlgorithm() const; void SetGapTracebackAlgorithm(EBlastTbackExt a); void SetSkipTraceback(bool skip); /******************* Hit saving options *************************/ int GetHitlistSize() const; void SetHitlistSize(int s); int GetPrelimHitlistSize() const; void SetPrelimHitlistSize(int s); int GetMaxNumHspPerSequence() const; void SetMaxNumHspPerSequence(int m); /// Maximum total number of HSPs to keep int GetTotalHspLimit() const; void SetTotalHspLimit(int l); bool GetCullingMode() const; void SetCullingMode(bool m = true); /// Start of the region required to be part of the alignment int GetRequiredStart() const; void SetRequiredStart(int s); /// End of the region required to be part of the alignment int GetRequiredEnd() const; void SetRequiredEnd(int e); // Expect value cut-off threshold for an HSP, or a combined hit if sum // statistics is used double GetEvalueThreshold() const; void SetEvalueThreshold(double eval); double GetOriginalEvalue() const; //void SetOriginalEvalue(double e); // Raw score cutoff threshold int GetCutoffScore() const; void SetCutoffScore(int s); double GetPercentIdentity() const; void SetPercentIdentity(double p); /// Sum statistics options bool GetSumStatisticsMode() const; void SetSumStatisticsMode(bool m = true); int GetLongestIntronLength() const; // for tblastn w/ linking HSPs void SetLongestIntronLength(int l); // for tblastn w/ linking HSPs /// Returns true if gapped BLAST is set, false otherwise bool GetGappedMode() const; void SetGappedMode(bool m = true); // Deprecated bool GetNeighboringMode() const; // Deprecated void SetNeighboringMode(bool m = true); /************************ Scoring options ************************/ const char* GetMatrixName() const; void SetMatrixName(const char* matrix); const char* GetMatrixPath() const; void SetMatrixPath(const char* path); int GetMatchReward() const; void SetMatchReward(int r); // r should be a positive integer int GetMismatchPenalty() const; void SetMismatchPenalty(int p); // p should be a negative integer int GetGapOpeningCost() const; void SetGapOpeningCost(int g); // g should be a positive integer int GetGapExtensionCost() const; void SetGapExtensionCost(int e); // e should be a positive integer int GetFrameShiftPenalty() const; void SetFrameShiftPenalty(int p); int GetDecline2AlignPenalty() const; void SetDecline2AlignPenalty(int p); bool GetOutOfFrameMode() const; void SetOutOfFrameMode(bool m = true); /******************** Effective Length options *******************/ Int8 GetDbLength() const; void SetDbLength(Int8 l); unsigned int GetDbSeqNum() const; void SetDbSeqNum(unsigned int n); Int8 GetEffectiveSearchSpace() const; void SetEffectiveSearchSpace(Int8 eff); bool GetUseRealDbSize() const; void SetUseRealDbSize(bool u = true); int GetDbGeneticCode() const; //const unsigned char* GetDbGeneticCodeStr() const; //void SetDbGeneticCodeStr(const unsigned char* gc_str); // Set both integer and string genetic code in one call void SetDbGeneticCode(int gc); /// @todo PSI-Blast options could go on their own subclass? const char* GetPHIPattern() const; void SetPHIPattern(const char* pattern, bool is_dna); /// Allows to dump a snapshot of the object void DebugDump(CDebugDumpContext ddc, unsigned int depth) const; /******************** PSIBlast options *******************/ double GetInclusionThreshold() const; void SetInclusionThreshold(double incthr); short GetPseudoCount() const; void SetPseudoCount(short ps); QuerySetUpOptions * GetQueryOpts() const { return m_QueryOpts; } LookupTableOptions * GetLutOpts() const { return m_LutOpts; } BlastInitialWordOptions * GetInitWordOpts() const { return m_InitWordOpts; } BlastExtensionOptions * GetExtnOpts() const { return m_ExtnOpts; } BlastHitSavingOptions * GetHitSaveOpts() const { return m_HitSaveOpts; } PSIBlastOptions * GetPSIBlastOpts() const { return m_PSIBlastOpts; } BlastDatabaseOptions * GetDbOpts() const { return m_DbOpts; } BlastScoringOptions * GetScoringOpts() const { return m_ScoringOpts; } BlastEffectiveLengthsOptions * GetEffLenOpts() const { return m_EffLenOpts.get(); } bool operator==(const CBlastOptionsLocal& rhs) const; bool operator!=(const CBlastOptionsLocal& rhs) const;protected: /// Query sequence settings CQuerySetUpOptions m_QueryOpts; /// Lookup table settings CLookupTableOptions m_LutOpts; /// Word settings CBlastInitialWordOptions m_InitWordOpts; /// Hit extension settings CBlastExtensionOptions m_ExtnOpts; /// Hit saving settings CBlastHitSavingOptions m_HitSaveOpts; /// PSI-Blast settings CPSIBlastOptions m_PSIBlastOpts; /// Blast database settings CBlastDatabaseOptions m_DbOpts; /// Scoring options CBlastScoringOptions m_ScoringOpts; /// Effective lengths options //CBlastEffectiveLengthsOptions m_EffLenOpts; AutoPtr<BlastEffectiveLengthsOptions, CDeleter<BlastEffectiveLengthsOptions> > m_EffLenOpts; /// Blast program EProgram m_Program;private: /// Prohibit copy c-tor CBlastOptionsLocal(const CBlastOptionsLocal& bo); /// Prohibit assignment operator CBlastOptionsLocal& operator=(const CBlastOptionsLocal& bo);};/// Encapsulates all blast input parametersclass NCBI_XBLAST_EXPORT CBlastOptionsRemote : public CObject{public: CBlastOptionsRemote(void) : m_DoneDefaults(false) { //m_Req.Reset(new objects::CBlast4_queue_search_request); m_ReqOpts.Reset(new objects::CBlast4_parameters); } ~CBlastOptionsRemote() { } // typedef ncbi::objects::CBlast4_queue_search_request TBlast4Req;// CRef<TBlast4Req> GetBlast4Request()// {// return m_Req;// } // the "new paradigm" typedef ncbi::objects::CBlast4_parameters TBlast4Opts; TBlast4Opts * GetBlast4AlgoOpts() { return m_ReqOpts; } typedef vector< CConstRef<objects::CSeq_loc> > TSeqLocVector; // // Basic mandatory functions// void SetProgram(const char * v)// {// m_Req->SetProgram(v);// } // void SetService(const char * v)// {// m_Req->SetService(v);// } // SetValue(x,y) with different types: void SetValue(EBlastOptIdx opt, const EProgram & x); void SetValue(EBlastOptIdx opt, const int & x); void SetValue(EBlastOptIdx opt, const double & x); void SetValue(EBlastOptIdx opt, const char * x); void SetValue(EBlastOptIdx opt, const TSeqLocVector & x); void SetValue(EBlastOptIdx opt, const SeedContainerType & x); void SetValue(EBlastOptIdx opt, const SeedExtensionMethod & x); void SetValue(EBlastOptIdx opt, const bool & x); void SetValue(EBlastOptIdx opt, const Int8 & x); // Pseudo-types: void SetValue(EBlastOptIdx opt, const short & x) { int x2 = x; SetValue(opt, x2); } void SetValue(EBlastOptIdx opt, const unsigned int & x) { int x2 = x; SetValue(opt, x2); } void SetValue(EBlastOptIdx opt, const unsigned char & x) { int x2 = x; SetValue(opt, x2); } void SetValue(EBlastOptIdx opt, const objects::ENa_strand & x) { int x2 = x; SetValue(opt, x2); } void DoneDefaults() { m_DoneDefaults = true; } private: //CRef<objects::CBlast4_queue_search_request> m_Req; CRef<objects::CBlast4_parameters> m_ReqOpts; bool m_DoneDefaults; // void x_SetProgram(const char * program)// {// m_Req->SetProgram(program);// } // void x_SetService(const char * service)// {// m_Req->SetService(service);// } template<class T> void x_SetParam(const char * name, T & value)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -