📄 id1_fetch.cpp
字号:
return s + string(m_Width - s.size(), ' '); } SIZE_TYPE Width() const { return m_Width; } size_t Height() const { return m_Strings.size(); } private: SIZE_TYPE m_Width; vector<string> m_Strings;};void CId1FetchApp::WriteHistoryTable(const CID1server_back& id1_reply){ CTextColumn gis, dates, dbs, numbers; gis.Add("GI").Add("--"); dates.Add("Loaded").Add("------"); dbs.Add("DB").Add("--"); numbers.Add("Retrieval No.").Add("-------------"); for (CTypeConstIterator<CSeq_hist_rec> it = ConstBegin(id1_reply); it; ++it) { int gi = 0; string dbname, number; if ( it->GetDate().IsStr() ) { dates.Add(it->GetDate().GetStr()); } else { CNcbiOstrstream oss; const CDate_std& date = it->GetDate().GetStd(); oss << setfill('0') << setw(2) << date.GetMonth() << '/' << setw(2) << date.GetDay() << '/' << date.GetYear(); dates.Add(CNcbiOstrstreamToString(oss)); } ITERATE (CSeq_hist_rec::TIds, it2, it->GetIds()) { if ( (*it2)->IsGi() ) { gi = (*it2)->GetGi(); } else if ( (*it2)->IsGeneral() ) { dbname = (*it2)->GetGeneral().GetDb(); const CObject_id& tag = (*it2)->GetGeneral().GetTag(); if ( tag.IsStr() ) { number = tag.GetStr(); } else { number = NStr::IntToString(tag.GetId()); } } } gis.Add(NStr::IntToString(gi)); dbs.Add(dbname); numbers.Add(number); } for (unsigned int n = 0; n < gis.Height(); n++) { *m_OutputFile << gis.Get(n) << " " << dates.Get(n) << " " << dbs.Get(n) << " " << numbers.Get(n) << NcbiEndl; }}void CId1FetchApp::WriteQualityScores(CBioseq_Handle& handle){ /* Test case: * /net/ncbi/ncbi/ftp/genbank/quality_scores/gbvrt.qscore.gz * GI 13508865: gotseqentry.set.annot.data.graph * >AL590146.2 Phrap Quality (Length:121086, Min: 31, Max: 99) * 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 * ... */ string id = FindBestChoice(handle.GetBioseqCore()->GetId(), CSeq_id::Score) ->GetSeqIdString(true); for (CGraph_CI it(handle, 0, 0); it; ++it) { string title = it->GetTitle(); if (title.find("uality") == NPOS) { continue; } const CByte_graph& data = it->GetGraph().GetByte(); *m_OutputFile << '>' << id << ' ' << title << " (Length: " << it->GetNumval() << ", Min: " << data.GetMin() << ", Max: " << data.GetMax() << ')' << NcbiEndl; for (SIZE_TYPE n = 0; n < data.GetValues().size(); ++n) { *m_OutputFile << setw(3) << static_cast<int>(data.GetValues()[n]); if (n % 20 == 19) { *m_OutputFile << NcbiEndl; } } }}END_NCBI_SCOPE/////////////////////////////////////////////////////////////////////////////// MAIN//USING_NCBI_SCOPE;int main(int argc, const char* argv[]) { return CId1FetchApp().AppMain(argc, argv);}/** ===========================================================================** ---------------------------------------------------------------------------* $Log: id1_fetch.cpp,v $* Revision 1000.2 2004/06/01 18:30:30 gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.50** Revision 1.50 2004/05/21 21:41:40 gorelenk* Added PCH ncbi_pch.hpp** Revision 1.49 2004/04/26 20:46:11 ucko* Fix typo that accidentally introduced an implicit temporary CSeq_id.** Revision 1.48 2004/04/26 16:53:17 ucko* Don't try to pass temporary CSeq_id objects, even by const reference,* as CSeq_id has no public copy constructor.** Revision 1.47 2004/01/05 17:59:32 vasilche* Moved genbank loader and its readers sources to new location in objtools.* Genbank is now in library libncbi_xloader_genbank.* Id1 reader is now in library libncbi_xreader_id1.* OBJMGR_LIBS macro updated correspondingly.** Old headers temporarily will contain redirection to new location* for compatibility:* objmgr/gbloader.hpp > objtools/data_loaders/genbank/gbloader.hpp* objmgr/reader_id1.hpp > objtools/data_loaders/genbank/readers/id1/reader_id1.hpp** Revision 1.46 2003/10/21 13:48:48 grichenk* Redesigned type aliases in serialization library.* Fixed the code (removed CRef-s, added explicit* initializers etc.)** Revision 1.45 2003/06/02 16:06:16 dicuccio* Rearranged src/objects/ subtree. This includes the following shifts:* - src/objects/asn2asn --> arc/app/asn2asn* - src/objects/testmedline --> src/objects/ncbimime/test* - src/objects/objmgr --> src/objmgr* - src/objects/util --> src/objmgr/util* - src/objects/alnmgr --> src/objtools/alnmgr* - src/objects/flat --> src/objtools/flat* - src/objects/validator --> src/objtools/validator* - src/objects/cddalignview --> src/objtools/cddalignview* In addition, libseq now includes six of the objects/seq... libs, and libmmdb* replaces the three libmmdb? libs.** Revision 1.44 2003/05/13 17:14:17 ucko* Direct flat output to *m_OutputFile rather than hard-coding cout.** Revision 1.43 2003/04/24 16:17:10 vasilche* Added '-repeat' option.* Updated includes.** Revision 1.42 2003/04/09 16:00:15 ucko* Give all RPC clients unique basenames.** Revision 1.41 2003/04/03 17:45:25 ucko* Switch to new (differently buggy ;-)) flat-file generator.* Drop s_SplitString, as NStr::Tokenize does the same thing.** Revision 1.40 2003/03/10 18:48:48 kuznets* iterate->ITERATE** Revision 1.39 2002/11/13 20:14:51 ucko* Rework to take advantage of new ID1 and Entrez2 client classes* generated by datatool** Revision 1.38 2002/08/27 21:41:53 ucko* Use CFastaOstream rather than custom code.* Fix spelling of NONEXISTENT.** Revision 1.37 2002/08/14 20:28:02 ucko* Fix behavior when given a list of IDs.** Revision 1.36 2002/07/11 14:23:48 gouriano* exceptions replaced by CNcbiException-type ones** Revision 1.35 2002/06/28 17:25:53 grichenk* +Error message if a GI was not found** Revision 1.34 2002/06/12 16:51:55 lavr* Take advantage of CONNECT_Init()** Revision 1.33 2002/06/07 16:11:40 ucko* GetTitle() is now in sequence::.** Revision 1.32 2002/06/06 23:46:24 vakatov* Use GetTitle() from <objects/util/sequence.hpp>** Revision 1.31 2002/05/06 16:13:46 ucko* Merge in Andrei Gourianov's changes to use the new OM (thanks!)* Remove some dead code.* Don't automatically turn on tracing, even when building with _DEBUG;* it is always possible to set DIAG_TRACE in the environment instead.* Move CVS log to end.*** *** These four entries are from src/app/id1_fetch1/id1_fetch1.cpp **** Revision 1.5 2002/05/06 03:31:52 vakatov* OM/OM1 renaming** Revision 1.4 2002/05/03 21:28:21 ucko* Introduce T(Signed)SeqPos.** Revision 1.3 2002/04/10 21:02:21 gouriano* moved construction of iterators out of "for" loop initialization:* Sun Workshop compiler does not call destructors of such objects* in case we use break to exit the loop** Revision 1.2 2002/04/10 16:07:30 gouriano* corrected data output in different formats** Revision 1.1 2002/04/04 16:31:36 gouriano* id1_fetch1 - modified version of id1_fetch, which uses objmgr1** Revision 1.29 2002/03/11 21:52:05 lavr* Print complete debug and trace information when compiled with _DEBUG** Revision 1.28 2002/01/16 22:14:00 ucko* Removed CRef<> argument from choice variant setter, updated sources to* use references instead of CRef<>s** Revision 1.27 2001/12/07 21:15:16 ucko* Remove duplicate includes.** Revision 1.26 2001/12/07 21:11:01 grichenk* Fixed includes to work with the updated datatool** Revision 1.25 2001/12/07 21:03:47 ucko* Add #includes required by new datatool version.** Revision 1.24 2001/11/16 16:06:45 ucko* Handle new Entrez docsum interface properly.** Revision 1.23 2001/10/26 14:49:16 ucko* Restructured to avoid CRefs as arguments.** Revision 1.22 2001/10/23 20:05:12 ucko* Request ASCII from CSeq_vector.** Revision 1.21 2001/10/17 21:17:53 ucko* Seq_vector now properly starts from zero rather than one; adjust code* that uses it accordingly.** Revision 1.20 2001/10/12 19:32:58 ucko* move BREAK to a central location; move CBioseq::GetTitle to object manager** Revision 1.19 2001/10/12 15:34:01 ucko* Edit in-source version of CVS log to avoid end-of-comment marker. (Oops.)** Revision 1.18 2001/10/12 15:29:08 ucko* Drop {src,include}/objects/util/asciiseqdata.* in favor of CSeq_vector.* Rewrite GenBank output code to take fuller advantage of the object manager.** Revision 1.17 2001/10/10 16:02:53 ucko* Clean up includes.** Revision 1.16 2001/10/04 19:11:56 ucko* Centralize (rudimentary) code to get a sequence's title.** Revision 1.15 2001/09/25 20:31:13 ucko* Work around bug in Workshop's handling of declarations in for-loop* initializers.** Revision 1.14 2001/09/25 20:12:02 ucko* More cleanups from Denis.* Put utility code in the objects namespace.* Moved utility code to {src,include}/objects/util (to become libxobjutil).* Moved static members of CGenbankWriter to above their first use.** Revision 1.13 2001/09/25 13:26:36 lavr* CConn_ServiceStream() - arguments adjusted** Revision 1.12 2001/09/24 03:22:09 vakatov* Un-#include <cstdlib> and <cctype> which break IRIX/MIPSpro compilation and* apparently are not needed after all** Revision 1.11 2001/09/21 22:38:59 ucko* Cope with new Entrez interface; fix MSVC build.** Revision 1.10 2001/09/05 16:25:56 ucko* Adapted to latest revision of object manager interface.** Revision 1.9 2001/09/05 14:44:37 ucko* Use NStr::IntToString instead of Stringify.** Revision 1.8 2001/09/04 16:20:53 ucko* Dramatically fleshed out id1_fetch** Revision 1.7 2001/07/19 19:40:20 lavr* Typo fixed** Revision 1.6 2001/06/01 18:43:44 vakatov* Comment out excessive debug/trace printout** Revision 1.5 2001/05/16 17:55:37 grichenk* Redesigned support for non-blocking stream read operations** Revision 1.4 2001/05/11 20:41:16 grichenk* Added support for non-blocking stream reading** Revision 1.3 2001/05/11 14:06:45 grichenk* The first working revision** Revision 1.2 2001/04/13 14:09:34 grichenk* Next debug version, still not working** Revision 1.1 2001/04/10 22:39:04 vakatov* Initial revision.* Compiles and links, but apparently is not working yet.** ===========================================================================*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -