📄 blast2seq.cpp
字号:
} if (args["xungap"].AsDouble()) { opt.SetXDropoff(args["xungap"].AsDouble()); } if (args["ungapped"].AsBoolean()) { opt.SetGappedMode(false); } if (args["gopen"].AsInteger()) { opt.SetGapOpeningCost(args["gopen"].AsInteger()); } if (args["gext"].AsInteger()) { opt.SetGapExtensionCost(args["gext"].AsInteger()); } switch (args["greedy"].AsInteger()) { case 1: /* Immediate greedy gapped extension with traceback */ opt.SetGapExtnAlgorithm(eGreedyWithTracebackExt); opt.SetUngappedExtension(false); break; case 2: /* Two-step greedy extension, no ungapped extension */ opt.SetGapExtnAlgorithm(eGreedyExt); opt.SetUngappedExtension(false); break; case 3: /* Two-step greedy extension after ungapped extension*/ opt.SetGapExtnAlgorithm(eGreedyExt); break; default: break; } if (args["xgap"].AsDouble()) { opt.SetGapXDropoff(args["xgap"].AsDouble()); } if (args["xfinal"].AsDouble()) { opt.SetGapXDropoffFinal(args["xfinal"].AsDouble()); } if (args["evalue"].AsDouble()) { opt.SetEvalueThreshold(args["evalue"].AsDouble()); } if (args["searchsp"].AsDouble()) { opt.SetEffectiveSearchSpace((Int8) args["searchsp"].AsDouble()); } if (args["perc"].AsDouble()) { opt.SetPercentIdentity(args["perc"].AsDouble()); } if (args["gencode"].AsInteger()) { opt.SetQueryGeneticCode(args["gencode"].AsInteger()); } if (args["dbgencode"].AsInteger()) { opt.SetDbGeneticCode(args["dbgencode"].AsInteger()); } if (args["maxintron"].AsInteger()) { opt.SetLongestIntronLength(args["maxintron"].AsInteger()); } if (args["frameshift"].AsInteger()) { opt.SetFrameShiftPenalty(args["frameshift"].AsInteger()); opt.SetOutOfFrameMode(); } return retval;}#ifndef NDEBUGFILE*CBlast2seqApplication::GetOutputFilePtr(void){ FILE *retval = NULL; if (GetArgs()["out"].AsString() == "-") retval = stdout; else retval = fopen((char *)GetArgs()["out"].AsString().c_str(), "a"); ASSERT(retval); return retval;}#endif/*****************************************************************************/int CBlast2seqApplication::Run(void){ try { InitObjMgr(); int counter = 0; const CArgs args = GetArgs(); Uint1 program_number; if (args["trace"]) SetDiagTrace(eDT_Enable); BlastProgram2Number(args["program"].AsString().c_str(), &program_number); EProgram program = static_cast<EProgram>(program_number); ENa_strand query_strand = eNa_strand_unknown; ENa_strand subject_strand = eNa_strand_unknown; if (program == eBlastn || program == eBlastx) { int cmdline_strand = args["strand"].AsInteger(); if (cmdline_strand == 1) query_strand = eNa_strand_plus; else if (cmdline_strand == 2) query_strand = eNa_strand_minus; else query_strand = eNa_strand_both; } if (program == eBlastn || program == eTblastn || program == eTblastx) subject_strand = eNa_strand_plus; // Retrieve input sequences TSeqLocVector query_loc = BLASTGetSeqLocFromStream(args["query"].AsInputFile(), *m_ObjMgr, query_strand, 0, 0, &counter, args["lcase"].AsBoolean()); TSeqLocVector subject_loc = BLASTGetSeqLocFromStream(args["subject"].AsInputFile(), *m_ObjMgr, subject_strand, 0, 0, &counter); CBlastOptionsHandle& opt_handle = *ProcessCommandLineArgs();#ifndef NDEBUG CStopWatch sw; sw.Start();#endif CBl2Seq blaster(query_loc, subject_loc, opt_handle); TSeqAlignVector seqalignv = blaster.Run();#ifndef NDEBUG double t = sw.Elapsed(); cerr << "CBl2seq run took " << t << " seconds" << endl; if (seqalignv.size() == 0) { cerr << "Returned NULL SeqAlign!" << endl; exit(1); }#endif // Our poor man's formatting ... if (args["asnout"]) { auto_ptr<CObjectOStream> asnout( CObjectOStream::Open(args["asnout"].AsString(), eSerial_AsnText)); for (unsigned int index = 0; index < seqalignv.size(); ++index) *asnout << *seqalignv[index]; } } catch (const CException& e) { cerr << e.what() << endl; } return 0;}void CBlast2seqApplication::Exit(void){ SetDiagStream(0);}int main(int argc, const char* argv[]){ return CBlast2seqApplication().AppMain(argc, argv, 0, eDS_Default, 0);}/* * =========================================================================== * $Log: blast2seq.cpp,v $ * Revision 1000.5 2004/06/01 18:06:32 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.46 * * Revision 1.46 2004/05/21 21:41:02 gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.45 2004/05/19 14:52:02 camacho * 1. Added doxygen tags to enable doxygen processing of algo/blast/core * 2. Standardized copyright, CVS $Id string, $Log and rcsid formatting and i * location * 3. Added use of @todo doxygen keyword * * Revision 1.44 2004/05/17 15:33:57 madden * Int algorithm_type replaced with enum EBlastPrelimGapExt * * Revision 1.43 2004/04/30 15:56:31 papadopo * Plus/minus/both strands are acceptable for any blast program * that takes a nucleotide query * * Revision 1.42 2004/04/23 13:51:56 papadopo * handle strands for blastx correctly * * Revision 1.41 2004/04/19 21:35:23 papadopo * explicitly calculate strands for input sequences * * Revision 1.40 2004/03/26 18:50:32 camacho * Use CException::what() in catch block * * Revision 1.39 2004/03/17 20:09:08 dondosha * Use CBlastNucleotideOptionsHandle method to set both extension method and scan step, instead of directly calling CalculateBestStride * * Revision 1.38 2004/03/11 17:27:41 camacho * Minor change to avoid confusing doxygen * * Revision 1.37 2004/03/09 18:55:34 dondosha * Fix: set out-of-frame mode boolean option in addition to the frame shift penalty * * Revision 1.36 2004/02/13 03:31:51 camacho * 1. Use CBlastOptionsHandle class (still needs some work) * 2. Remove dead code, clean up, add @todo doxygen tags * * Revision 1.35 2004/01/05 18:50:27 vasilche * Fixed path to include files. * * Revision 1.34 2003/12/31 20:05:58 dondosha * For discontiguous megablast, set extension method and scanning stride correctly * * Revision 1.33 2003/12/09 15:13:58 camacho * Use difference scopes for queries and subjects * * Revision 1.32 2003/12/04 17:07:51 camacho * Remove yet another unused variable * * Revision 1.31 2003/11/26 18:36:45 camacho * Renaming blast_option*pp -> blast_options*pp * * Revision 1.30 2003/11/26 18:24:32 camacho * +Blast Option Handle classes * * Revision 1.29 2003/11/03 15:20:39 camacho * Make multiple query processing the default for Run(). * * Revision 1.28 2003/10/27 20:52:29 dondosha * Made greedy option an integer, to specify number of extension stages * * Revision 1.27 2003/10/24 20:55:30 camacho * Rename GetDefaultStride * * Revision 1.26 2003/10/22 16:48:09 dondosha * Changed "ag" option to "scantype"; * Use function from core library to calculate default value of stride if AG * scanning method is used. * * Revision 1.25 2003/10/21 22:15:33 camacho * Rearranging of C options structures, fix seed extension method * * Revision 1.24 2003/10/21 17:34:34 camacho * Renaming of gap open/extension accessors/mutators * * Revision 1.23 2003/10/17 18:22:28 dondosha * Use separate variables for different initial word extension options * * Revision 1.22 2003/10/08 15:27:02 camacho * Remove unnecessary conditional * * Revision 1.21 2003/10/07 17:37:10 dondosha * Lower case mask is now a boolean argument in call to BLASTGetSeqLocFromStream * * Revision 1.20 2003/09/26 21:36:29 dondosha * Show results for all queries in multi-query case * * Revision 1.19 2003/09/26 15:42:23 dondosha * Added second argument to SetExtendWordMethod, so bit can be set or unset * * Revision 1.18 2003/09/11 17:46:16 camacho * Changed CBlastOption -> CBlastOptions * * Revision 1.17 2003/09/09 15:43:43 ucko * Fix #include directive for blast_input.hpp. * * Revision 1.16 2003/09/05 18:24:28 camacho * Restoring printing of SeqAlign, fix setting of default word extension method * * Revision 1.15 2003/08/28 23:17:20 camacho * Add processing of command-line options * * Revision 1.14 2003/08/19 20:36:44 dondosha * EProgram enum type is no longer part of CBlastOptions class * * Revision 1.13 2003/08/18 20:58:57 camacho * Added blast namespace, removed *__.hpp includes * * Revision 1.12 2003/08/18 17:07:42 camacho * Introduce new SSeqLoc structure (replaces pair<CSeq_loc, CScope>). * Change in function to read seqlocs from files. * * Revision 1.11 2003/08/15 16:03:00 dondosha * TSeqLoc and TSeqLocVector types no longer belong to class CBl2Seq, but are common to all BLAST applications * * Revision 1.10 2003/08/11 20:16:43 camacho * Change return type of BLASTGetSeqLocFromStream and fix namespaces * * Revision 1.9 2003/08/11 15:26:30 dondosha * BLASTGetSeqLocFromStream function moved to blast_input.cpp * * Revision 1.8 2003/08/08 20:46:08 camacho * Fix to use new ReadFasta arguments * * Revision 1.7 2003/08/08 20:24:31 dicuccio * Adjustments for Unix build: rename 'ncmimath' -> 'ncbi_math'; fix #include in demo app * * Revision 1.6 2003/08/01 22:38:31 camacho * Added conditional compilation to write seqaligns * * Revision 1.5 2003/07/30 16:33:31 madden * Remove C toolkit dependencies * * Revision 1.4 2003/07/16 20:25:34 camacho * Added dummy features argument to C formatter * * Revision 1.3 2003/07/14 21:53:32 camacho * Minor * * Revision 1.2 2003/07/11 21:22:57 camacho * Use same command line option as blast to display seqalign * * Revision 1.1 2003/07/10 18:35:58 camacho * Initial revision * * =========================================================================== */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -