reader_pubseq.cpp
来自「ncbi源码」· C++ 代码 · 共 772 行 · 第 1/2 页
CPP
772 行
bool is_external = is_snp; bool load_external = is_external || !TrySNPSplit(); CDB_Int ext_feat(load_external); _TRACE("x_SendRequest: "<<seqref.print()<<", ext_feat="<<load_external); cmd->SetParam("@gi", &giIn); cmd->SetParam("@sat_key", &satKeyIn); cmd->SetParam("@sat", &satIn); cmd->SetParam("@ext_feat", &ext_feat); cmd->Send(); return cmd.release();}CDB_Result* CPubseqReader::x_ReceiveData(CDB_RPCCmd& cmd){ // new row CDB_VarChar descrOut("-"); CDB_Int classOut(0); CDB_Int confidential(0),withdrawn(0); while( cmd.HasMoreResults() ) { _TRACE("next result"); if ( cmd.HasFailed() && confidential.Value()>0 || withdrawn.Value()>0 ) { break; } auto_ptr<CDB_Result> result(cmd.Result()); if ( !result.get() || result->ResultType() != eDB_RowResult ) { continue; } while ( result->Fetch() ) { _TRACE("next fetch: " << result->NofItems() << " items"); for ( unsigned pos = 0; pos < result->NofItems(); ++pos ) { const string& name = result->ItemName(pos); _TRACE("next item: " << name); if ( name == "asn1" ) { return result.release(); } else if ( name == "confidential" ) { result->GetItem(&confidential); } else if ( name == "override" ) { result->GetItem(&withdrawn); } else { result->SkipItem(); } } } } if ( confidential.Value()>0 || withdrawn.Value()>0 ) { NCBI_THROW(CLoaderException, ePrivateData, "gi is private"); } NCBI_THROW(CLoaderException, eNoData, "no data");}CRef<CTSE_Info> CPubseqReader::x_ReceiveMainBlob(CDB_Result& result){ CRef<CSeq_entry> seq_entry(new CSeq_entry); CResultBtSrcRdr reader(&result); CObjectIStreamAsnBinary in(reader); CReader::SetSeqEntryReadHooks(in); in >> *seq_entry; return Ref(new CTSE_Info(*seq_entry));}CRef<CSeq_annot_SNP_Info> CPubseqReader::x_ReceiveSNPAnnot(CDB_Result& result){ CRef<CSeq_annot_SNP_Info> snp_annot_info(new CSeq_annot_SNP_Info); {{ CResultBtSrcRdr src(&result); CNlmZipBtRdr src2(&src); CObjectIStreamAsnBinary in(src2); CSeq_annot_SNP_Info_Reader::Parse(in, *snp_annot_info); }} return snp_annot_info;}CResultBtSrcRdr::CResultBtSrcRdr(CDB_Result* result) : m_Result(result){}CResultBtSrcRdr::~CResultBtSrcRdr(){}size_t CResultBtSrcRdr::Read(char* buffer, size_t bufferLength){ size_t ret; while ( (ret = m_Result->ReadItem(buffer, bufferLength)) == 0 ) { if ( !m_Result->Fetch() ) break; } return ret;}END_SCOPE(objects)const string kPubseqReaderDriverName("pubseq_reader");/// Class factory for Pubseq reader////// @internal///class CPubseqReaderCF : public CSimpleClassFactoryImpl<objects::CReader, objects::CPubseqReader>{public: typedef CSimpleClassFactoryImpl<objects::CReader, objects::CPubseqReader> TParent;public: CPubseqReaderCF() : TParent(kPubseqReaderDriverName, 0) { } ~CPubseqReaderCF() { }};void NCBI_EntryPoint_ReaderPubseqos( CPluginManager<objects::CReader>::TDriverInfoList& info_list, CPluginManager<objects::CReader>::EEntryPointRequest method){ CHostEntryPointImpl<CPubseqReaderCF>::NCBI_EntryPointImpl(info_list, method);}END_NCBI_SCOPE/** $Log: reader_pubseq.cpp,v $* Revision 1000.1 2004/06/01 19:42:05 gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.52** Revision 1.52 2004/05/21 21:42:52 gorelenk* Added PCH ncbi_pch.hpp** Revision 1.51 2004/02/18 14:01:26 dicuccio* Added new satellites for TRACE_ASSM, TR_ASSM_CH. Added support for overloading* the ID1 named service** Revision 1.50 2004/02/04 17:47:42 kuznets* Fixed naming of entry points** Revision 1.49 2004/01/22 20:10:38 vasilche* 1. Splitted ID2 specs to two parts.* ID2 now specifies only protocol.* Specification of ID2 split data is moved to seqsplit ASN module.* For now they are still reside in one resulting library as before - libid2.* As the result split specific headers are now in objects/seqsplit.* 2. Moved ID2 and ID1 specific code out of object manager.* Protocol is processed by corresponding readers.* ID2 split parsing is processed by ncbi_xreader library - used by all readers.* 3. Updated OBJMGR_LIBS correspondingly.** Revision 1.48 2004/01/20 16:55:28 vasilche* Do more common check first.** Revision 1.47 2004/01/13 21:54:50 vasilche* Requrrected new version** Revision 1.4 2004/01/13 16:55:57 vasilche* CReader, CSeqref and some more classes moved from xobjmgr to separate lib.* Headers moved from include/objmgr to include/objtools/data_loaders/genbank.** Revision 1.3 2003/12/30 22:14:43 vasilche* Updated genbank loader and readers plugins.** Revision 1.45 2003/12/19 19:47:45 vasilche* Added support for TRACE data, Seq-id ::= general { db "ti", tag id NNN }.** Revision 1.44 2003/12/03 16:15:29 ucko* Correct spelling of NCBI_Pubseq_ReaderEntryPoint.** Revision 1.43 2003/12/03 14:30:03 kuznets* Code clean up.* Made use of driver name constant instead of immediate in-place string.** Revision 1.42 2003/12/02 16:18:17 kuznets* Added plugin manager support for CReader interface and implementaions* (id1 reader, pubseq reader)** Revision 1.41 2003/11/26 17:55:59 vasilche* Implemented ID2 split in ID1 cache.* Fixed loading of splitted annotations.** Revision 1.40 2003/11/04 14:43:26 vasilche* Load SNP only when bit 1 in ext_feat is set.** Revision 1.39 2003/10/22 16:12:38 vasilche* Added CLoaderException::eNoConnection.* Added check for 'fail' state of ID1 connection stream.* CLoaderException::eNoConnection will be rethrown from CGBLoader.** Revision 1.38 2003/10/21 14:27:35 vasilche* Added caching of gi -> sat,satkey,version resolution.* SNP blobs are stored in cache in preprocessed format (platform dependent).* Limit number of connections to GenBank servers.* Added collection of ID1 loader statistics.** Revision 1.37 2003/10/14 21:06:25 vasilche* Fixed compression statistics.* Disabled caching of SNP blobs.** Revision 1.36 2003/09/30 16:22:02 vasilche* Updated internal object manager classes to be able to load ID2 data.* SNP blobs are loaded as ID2 split blobs - readers convert them automatically.* Scope caches results of requests for data to data loaders.* Optimized CSeq_id_Handle for gis.* Optimized bioseq lookup in scope.* Reduced object allocations in annotation iterators.* CScope is allowed to be destroyed before other objects using this scope are* deleted (feature iterators, bioseq handles etc).* Optimized lookup for matching Seq-ids in CSeq_id_Mapper.* Added 'adaptive' option to objmgr_demo application.** Revision 1.35 2003/08/27 14:25:22 vasilche* Simplified CCmpTSE class.** Revision 1.34 2003/08/14 20:05:19 vasilche* Simple SNP features are stored as table internally.* They are recreated when needed using CFeat_CI.** Revision 1.33 2003/07/24 20:35:16 vasilche* Fix includes.** Revision 1.32 2003/07/24 19:28:09 vasilche* Implemented SNP split for ID1 loader.** Revision 1.31 2003/07/18 20:27:54 vasilche* Check if reference counting is working before trying ot use it.** Revision 1.30 2003/07/17 22:23:27 vasilche* Fixed unsigned <-> size_t argument.** Revision 1.29 2003/07/17 20:07:56 vasilche* Reduced memory usage by feature indexes.* SNP data is loaded separately through PUBSEQ_OS.* String compression for SNP data.** Revision 1.28 2003/06/02 16:06:38 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.27 2003/05/13 20:14:40 vasilche* Catching exceptions and reconnection were moved from readers to genbank loader.** Revision 1.26 2003/04/24 16:12:38 vasilche* Object manager internal structures are splitted more straightforward.* Removed excessive header dependencies.** Revision 1.25 2003/04/15 16:33:29 dicuccio* Minor logic reorganization to appease MSVC - wasn't dealing well with a verbose* cast** Revision 1.24 2003/04/15 15:30:15 vasilche* Added include <memory> when needed.* Removed buggy buffer in printing methods.* Removed unnecessary include of stream_util.hpp.** Revision 1.23 2003/04/15 14:24:08 vasilche* Changed CReader interface to not to use fake streams.** Revision 1.22 2003/04/02 03:57:09 kimelman* packet size tuning** Revision 1.21 2003/03/03 20:34:51 vasilche* Added NCBI_THREADS macro - it's opposite to NCBI_NO_THREADS.* Avoid using _REENTRANT macro - use NCBI_THREADS instead.** Revision 1.20 2003/03/01 22:26:56 kimelman* performance fixes** Revision 1.19 2003/01/18 08:42:25 kimelman* 1.added SNP retrieval per M.DiCuccio request; 2.avoid gi relookup** Revision 1.18 2002/12/30 23:36:22 vakatov* CPubseqStreamBuf::underflow() -- strstream::freeze(false) to avoid mem.leak** Revision 1.17 2002/12/26 20:53:41 dicuccio* Minor tweaks to relieve compiler warnings in MSVC** Revision 1.16 2002/09/19 20:05:44 vasilche* Safe initialization of static mutexes** Revision 1.15 2002/07/22 22:55:55 kimelman* bugfixes: a) null termination added for text seqid strstream.* b) processing of failed request.** Revision 1.14 2002/07/10 16:49:59 grichenk* Removed CRef<CSeq_entry>, use pointer instead** Revision 1.13 2002/06/04 17:18:33 kimelman* memory cleanup : new/delete/Cref rearrangements** Revision 1.12 2002/05/09 21:40:59 kimelman* MT tuning** Revision 1.11 2002/05/06 03:28:47 vakatov* OM/OM1 renaming** Revision 1.10 2002/05/03 21:28:10 ucko* Introduce T(Signed)SeqPos.** Revision 1.9 2002/04/25 20:54:07 kimelman* noise off** Revision 1.8 2002/04/12 22:56:23 kimelman* processing of ctlib fail** Revision 1.7 2002/04/12 14:52:34 butanaev* Typos fixed, code cleanup.** Revision 1.6 2002/04/11 20:03:26 kimelman* switch to pubseq** Revision 1.5 2002/04/11 17:59:36 butanaev* Typo fixed.** Revision 1.4 2002/04/11 17:47:17 butanaev* Switched to using dbapi driver manager.** Revision 1.3 2002/04/10 22:47:56 kimelman* added pubseq_reader as default one** Revision 1.2 2002/04/09 16:10:57 ucko* Split CStrStreamBuf out into a common location.** Revision 1.1 2002/04/08 20:52:27 butanaev* Added PUBSEQ reader.** Revision 1.8 2002/04/03 18:37:33 butanaev* Replaced DBLink with dbapi.** Revision 1.7 2002/01/10 16:24:26 butanaev* Fixed possible memory leaks.** Revision 1.6 2001/12/21 15:01:49 butanaev* Removed debug code, bug fixes.** Revision 1.5 2001/12/19 19:42:13 butanaev* Implemented construction of PUBSEQ blob stream, CPubseqReader family interfaces.** Revision 1.4 2001/12/14 20:48:07 butanaev* Implemented fetching Seqrefs from PUBSEQ.** Revision 1.3 2001/12/13 17:50:34 butanaev* Adjusted for new interface changes.** Revision 1.2 2001/12/12 22:08:58 butanaev* Removed duplicate code, created frame for CPubseq* implementation.**/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?