📄 search_opts.hpp
字号:
// Translated DB (tblastx, tblastn)#define OPT_HANDLER_SUPPORT_TRD(NAME) \OPT_HANDLER_START(NAME, V) \OPT_HANDLER_SUPPORT(CTBlastnOptionsHandle) \OPT_HANDLER_SUPPORT(CTBlastxOptionsHandle) \OPT_HANDLER_END()// CRemoteBlast option .. i.e. a program option rather than an// algorithmic option. Because it is sent to CRemoteBlast, it does// not need to deal with Protein vs. Nucleot; rather, it needs to// support only the CRemoteBlast type. Only EXPR type is defined.#define OPT_HANDLER_RB_EXPR(NAME,EXPR) \OPT_HANDLER_START(NAME, EXPR) \OPT_HANDLER_SUPPORT(CRemoteBlast) \OPT_HANDLER_END()// CBlastOptions based handlersOPT_HANDLER_SUPPORT_ALL(GapOpeningCost);OPT_HANDLER_SUPPORT_ALL(GapExtensionCost);OPT_HANDLER_SUPPORT_ALL(WordSize);OPT_HANDLER_EXPR_ALL (MatrixName, V.c_str());OPT_HANDLER_SUPPORT_TRQ(QueryGeneticCode);OPT_HANDLER_SUPPORT_TRD(DbGeneticCode);OPT_HANDLER_EXPR_ALL (EffectiveSearchSpace, (long long) V);OPT_HANDLER_EXPR_ALL (FilterString, V.c_str());OPT_HANDLER_SUPPORT_ALL(GappedMode);OPT_HANDLER_SUPPORT_ALL(HitlistSize);OPT_HANDLER_SUPPORT_ALL(EvalueThreshold);// Nucleotide onlyOPT_HANDLER_SUPPORT_NUCL(MismatchPenalty);OPT_HANDLER_SUPPORT_NUCL(MatchReward);// CBlast4Options based handlersOPT_HANDLER_RB_EXPR(EntrezQuery, V.c_str());class CNetblastSearchOpts{public: /// Default constructor - used by CreateInterface(). CNetblastSearchOpts(void) { } /// CArgs constructor - reads the values from the provided CArgs object. CNetblastSearchOpts(const CArgs & a); /// Create an interface for the program based on parameters in Apply(). static void CreateInterface(CArgDescriptions & ui); /// Apply the operation specified by "op" to each search option. /// /// This will apply the operation specified by "op" (which is /// probably derived from OptionWalker) to each search option. /// The object should have methods Local(), Remote(), and Same(), /// which take 4, 2, and 5 parameters) respectively. To add a new /// option, you should another op.xxx() line here (or for remote /// options, calculate the field's value (possibly from local /// options) in the section marked "Computations & Remote values"). /// @param op Object defining an operation over the search options. /// @sa OptionWalker, InterfaceBuilder, OptionReader, SearchParamBuilder. // Non-remote versions don't need to know about the algo/blast/api // class objects, so we send null CRef<>s here. template <class OpWlkTp> void Apply(OpWlkTp & op) { // This could perhaps be done better.. CRef<CRemoteBlast> cb4o; Apply(op, cb4o, cb4o); } template <class OpWlkTp, class BlOptTp> void Apply(OpWlkTp & op, CRef<BlOptTp> cboh, CRef<CRemoteBlast> cb4o) { // Local values op.Local(m_Evalue, CUserOpt("E"), CArgKey ("ExpectValue"), COptDesc("Expect value (cutoff).")); op.Same(m_GapOpen, CUserOpt("gap_open"), COptHandler_GapOpeningCost<BlOptTp>(), CArgKey ("GapOpenCost"), COptDesc("Gap-open cost."), cboh); op.Same(m_GapExtend, CUserOpt("gap_extend"), COptHandler_GapExtensionCost<BlOptTp>(), CArgKey ("GapExtendCost"), COptDesc("Gap-extend cost."), cboh); op.Same(m_WordSize, CUserOpt("wordsize"), COptHandler_WordSize<BlOptTp>(), CArgKey ("WordSize"), COptDesc("Word size."), cboh); op.Same(m_MatrixName, CUserOpt("matrixname"), COptHandler_MatrixName<BlOptTp>(), CArgKey ("MatrixName"), COptDesc("Search frequency matrix (name of matrix)."), cboh); op.Same(m_NucPenalty, CUserOpt("nucpenalty"), COptHandler_MismatchPenalty<BlOptTp>(), CArgKey ("NucPenalty"), COptDesc("Penalty for a nucleotide mismatch (blastn only)."), cboh); op.Same(m_NucReward, CUserOpt("nucreward"), COptHandler_MatchReward<BlOptTp>(), CArgKey ("NucReward"), COptDesc("Reward for a nucleotide match (blastn only)."), cboh); op.Local(m_NumDesc, CUserOpt("numdesc"), CArgKey ("NumDesc"), COptDesc("Number of one line database sequence descriptions to show.")); op.Local(m_NumAlgn, CUserOpt("numalign"), CArgKey ("NumAligns"), COptDesc("Number of database sequence alignments to show.")); op.Local(m_Gapped, CUserOpt("gapped"), CArgKey ("GappedAlign"), COptDesc("Perform gapped alignment.")); op.Same(m_QuGenCode, CUserOpt("qugencode"), COptHandler_QueryGeneticCode<BlOptTp>(), CArgKey ("QuGenCode"), COptDesc("Query Genetic code to use."), cboh); op.Same(m_DbGenCode, CUserOpt("dbgencode"), COptHandler_DbGeneticCode<BlOptTp>(), CArgKey ("DbGenCode"), COptDesc("DB Genetic code to use."), cboh); op.Same(m_Searchspc, CUserOpt("searchspc"), COptHandler_EffectiveSearchSpace<BlOptTp>(), CArgKey ("SearchSpc"), COptDesc("Effective length of the search space."), cboh); #if 0 op.Same(m_PhiQuery, CUserOpt("phi_query"), COptHandler_PHIPattern<BlOptTp>(), CArgKey ("PhiQuery"), COptDesc("Pattern Hit Initiated search expression."), cboh);#endif op.Same(m_FilterString, CUserOpt("filter_string"), COptHandler_FilterString<BlOptTp>(), CArgKey ("FilterString"), COptDesc("Specifies the types of filtering to do."), cboh); op.Same(m_EntrezQuery, CUserOpt("entrez_query"), COptHandler_EntrezQuery<BlOptTp>(), CArgKey ("EntrezQuery"), COptDesc("Search only in entries matching this Entrez query."), cb4o); // Computations & Remote values if (op.NeedRemote()) { // Gapped is the default ---- Note that BlastAPI and netblast // disagree on this point.. may one day erupt in violence. op.Remote(m_Gapped, COptHandler_GappedMode<BlOptTp>(), cboh); // Network only needs max TOptInteger num_hits = TOptInteger::Max(m_NumAlgn, m_NumDesc); op.Remote(num_hits, COptHandler_HitlistSize<BlOptTp>(), cboh); if (m_Evalue.Exists()) { typedef objects::CBlast4_cutoff TCutoff; CRef<TCutoff> cutoff(new TCutoff); cutoff->SetE_value(m_Evalue.GetValue()); COptional< CRef<TCutoff> > cutoff_opt(cutoff); op.Remote(cutoff_opt, COptHandler_EvalueThreshold<BlOptTp>(), cboh); } } } /// Get the number of alignments to display. TOptInteger NumAligns(void) { return m_NumAlgn; } /// Returns gapped alignment flag. TOptBool Gapped(void) { return m_Gapped; } private: // Optional search parameters TOptDouble m_Evalue; TOptInteger m_GapOpen; TOptInteger m_GapExtend; TOptInteger m_WordSize; TOptString m_MatrixName; TOptInteger m_NucPenalty; TOptInteger m_NucReward; TOptInteger m_NumDesc; TOptInteger m_NumAlgn; TOptInteger m_Thresh; TOptBool m_Gapped; TOptInteger m_QuGenCode; TOptInteger m_DbGenCode; TOptBool m_BelieveDef; TOptDouble m_Searchspc; TOptString m_PhiQuery; TOptString m_FilterString; TOptString m_EntrezQuery; /// Internal method used by CreateInterface. void x_CreateInterface2(CArgDescriptions & ui);};/* * =========================================================================== * * $Log: search_opts.hpp,v $ * Revision 1000.1 2004/04/16 17:12:31 gouriano * PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.5 * * Revision 1.5 2004/04/16 14:30:03 bealer * - Fix compiler warnings. * * Revision 1.4 2004/04/15 21:18:56 bealer * - Remove semi-colons so that solaris compiler will not choke. * * Revision 1.3 2004/03/16 19:41:56 vasilche * Namespace qualifier is invalid in extern declaration. Removed extra semicolons * * Revision 1.2 2004/02/18 18:29:59 bealer * - Fix entrez query and add support (to Apply) for Remote Blast program * options. * * Revision 1.1 2004/02/18 17:04:43 bealer * - Adapt blast_client code for Remote Blast API, merging code into the * remote_blast demo application. * * =========================================================================== */END_NCBI_SCOPE#endif // ALGO_BLAST_API_DEMO___SEARCH_OPTS__HPP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -