📄 objmgr_demo.cpp
字号:
} // Region set to interval 0..9 on the bioseq. Any feature // intersecting with the region should be selected. loc.SetInt().SetId(*id); loc.SetInt().SetFrom(0); loc.SetInt().SetTo(9); count = 0; // Iterate features. No feature type restrictions. for (CFeat_CI it(scope, loc, base_sel); it; ++it) { count++; } NcbiCout << "Feat count (int. 0..9, any): " << count << NcbiEndl; // Search features only in the TSE containing the target bioseq. // Since only one seq-id may be used as the target bioseq, the // iterator is constructed not from a seq-loc, but from a bioseq handle // and start/stop points on the bioseq. If both start and stop are 0 the // whole bioseq is used. The last parameter may be used for type filtering. count = 0; for ( CFeat_CI it(handle, 0, 999, base_sel); it; ++it ) { count++; if ( print_features ) { NcbiCout << MSerial_AsnText << it->GetMappedFeature() << it->GetLocation(); } } NcbiCout << "Feat count (bh, 0..999, any): " << count << NcbiEndl; // The same way may be used to iterate aligns and graphs, // except that there is no type filter for both of them. // No region restrictions -- the whole bioseq is used: loc.SetWhole(*id); count = 0; for (CGraph_CI it(scope, loc, base_sel); it; ++it) { count++; // Get seq-annot containing the feature if ( get_mapped_location ) it->GetLoc(); if ( get_original_feature ) it->GetOriginalGraph(); if ( get_mapped_feature ) it->GetMappedGraph(); if ( print_features ) { NcbiCout << MSerial_AsnText << it->GetMappedGraph() << it->GetLoc(); } CSeq_annot_Handle annot = it.GetAnnot(); } NcbiCout << "Graph count (whole, any): " << count << NcbiEndl; if ( !skip_alignments ) { count = 0; // Create CAlign_CI using the current scope and location. for (CAlign_CI it(scope, loc, base_sel); it; ++it) { count++; if ( get_mapped_alignments ) { *it; } if ( print_alignments ) { NcbiCout << MSerial_AsnText << *it; } } NcbiCout << "Align count (whole, any): " << count << NcbiEndl; } } NcbiCout << "Done" << NcbiEndl; return 0;}END_NCBI_SCOPE/////////////////////////////////////////////////////////////////////////////// MAINUSING_NCBI_SCOPE;int main(int argc, const char* argv[]){ return CDemoApp().AppMain(argc, argv);}/** ---------------------------------------------------------------------------* $Log: objmgr_demo.cpp,v $* Revision 1000.2 2004/06/01 18:30:37 gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.68** Revision 1.68 2004/05/21 21:41:40 gorelenk* Added PCH ncbi_pch.hpp** Revision 1.67 2004/05/13 19:50:48 vasilche* Added options to skip and get mapped alignments.** Revision 1.66 2004/05/13 19:33:15 vasilche* Added option for printing descriptors.** Revision 1.65 2004/04/27 19:00:08 kuznets* Commented out old cache modes** Revision 1.64 2004/04/09 20:37:48 vasilche* Added optional test to get mapped location and object for graphs.** Revision 1.63 2004/04/08 14:11:57 vasilche* Added option to dump loaded Seq-entry.** Revision 1.62 2004/04/05 15:56:13 grichenk* Redesigned CAnnotTypes_CI: moved all data and data collecting* functions to CAnnotDataCollector. CAnnotTypes_CI is no more* inherited from SAnnotSelector.** Revision 1.61 2004/03/18 16:30:24 grichenk* Changed type of seq-align containers from list to vector.** Revision 1.60 2004/02/09 19:18:50 grichenk* Renamed CDesc_CI to CSeq_descr_CI. Redesigned CSeq_descr_CI* and CSeqdesc_CI to avoid using data directly.** Revision 1.59 2004/02/09 14:54:22 vasilche* Dump synonyms of the sequence.** Revision 1.58 2004/02/05 14:53:53 vasilche* Used "new" cache interface by default.** Revision 1.57 2004/02/04 18:05:34 grichenk* Added annotation filtering by set of types/subtypes.* Renamed *Choice to *Type in SAnnotSelector.** Revision 1.56 2004/01/30 19:18:49 vasilche* Added -seq_map flag.** Revision 1.55 2004/01/29 20:38:47 vasilche* Removed loading of whole sequence by CSeqMap_CI.** Revision 1.54 2004/01/26 18:06:35 vasilche* Add option for printing Seq-align.* Use MSerial_Asn* manipulators.* Removed unused includes.** Revision 1.53 2004/01/07 17:38:02 vasilche* Fixed include path to genbank loader.** Revision 1.52 2004/01/05 18:14:03 vasilche* Fixed name of project and path to header.** Revision 1.51 2003/12/30 20:00:41 vasilche* Added test for CGBDataLoader::GetSatSatKey().** Revision 1.50 2003/12/30 19:51:54 vasilche* Test CGBDataLoader::GetSatSatkey() method.** Revision 1.49 2003/12/30 16:01:41 vasilche* Added possibility to specify type of cache to use: -cache_mode (old|newid|new).** Revision 1.48 2003/12/19 19:50:22 vasilche* Removed obsolete split code.* Do not use intemediate gi.** Revision 1.47 2003/12/02 23:20:22 vasilche* Allow to specify any Seq-id via ASN.1 text.** Revision 1.46 2003/11/26 17:56:01 vasilche* Implemented ID2 split in ID1 cache.* Fixed loading of splitted annotations.** Revision 1.45 2003/10/27 15:06:31 vasilche* Added option to set ID1 cache keep time.** Revision 1.44 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.43 2003/10/14 18:29:05 vasilche* Added -exclude_named option.** Revision 1.42 2003/10/09 20:20:58 vasilche* Added possibility to include and exclude Seq-annot names to annot iterator.* Fixed adaptive search. It looked only on selected set of annot names before.** Revision 1.41 2003/10/08 17:55:32 vasilche* Print sequence gi when -id option is used.** Revision 1.40 2003/10/07 13:43:23 vasilche* Added proper handling of named Seq-annots.* Added feature search from named Seq-annots.* Added configurable adaptive annotation search (default: gene, cds, mrna).* Fixed selection of blobs for loading from GenBank.* Added debug checks to CSeq_id_Mapper for easier finding lost CSeq_id_Handles.* Fixed leaked split chunks annotation stubs.* Moved some classes definitions in separate *.cpp files.** Revision 1.39 2003/09/30 20:13:38 vasilche* Print original feature location if requested.** Revision 1.38 2003/09/30 16:22:05 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.37 2003/08/27 14:22:01 vasilche* Added options get_mapped_location, get_mapped_feature and get_original_feature* to test feature iterator speed.** Revision 1.36 2003/08/15 19:19:16 vasilche* Fixed memory leak in string packing hooks.* Fixed processing of 'partial' flag of features.* Allow table packing of non-point SNP.* Allow table packing of SNP with long alleles.** Revision 1.35 2003/08/14 20:05:20 vasilche* Simple SNP features are stored as table internally.* They are recreated when needed using CFeat_CI.** Revision 1.34 2003/07/25 21:41:32 grichenk* Implemented non-recursive mode for CSeq_annot_CI,* fixed friend declaration in CSeq_entry_Info.** Revision 1.33 2003/07/25 15:25:27 grichenk* Added CSeq_annot_CI class** Revision 1.32 2003/07/24 20:36:17 vasilche* Added arguemnt to choose ID1<->PUBSEQOS on Windows easier.** Revision 1.31 2003/07/17 20:06:18 vasilche* Added OBJMGR_LIBS definition.** Revision 1.30 2003/07/17 19:10:30 grichenk* Added methods for seq-map and seq-vector validation,* updated demo.** Revision 1.29 2003/07/08 15:09:44 vasilche* Added argument to test depth of segment resolution.** Revision 1.28 2003/06/25 20:56:32 grichenk* Added max number of annotations to annot-selector, updated demo.** Revision 1.27 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.26 2003/05/27 20:54:52 grichenk* Fixed CRef<> to bool convertion** Revision 1.25 2003/05/06 16:52:54 vasilche* Added 'pause' argument.** Revision 1.24 2003/04/29 19:51:14 vasilche* Fixed interaction of Data Loader garbage collector and TSE locking mechanism.* Made some typedefs more consistent.** Revision 1.23 2003/04/24 16:12:38 vasilche* Object manager internal structures are splitted more straightforward.* Removed excessive header dependencies.** Revision 1.22 2003/04/15 14:24:08 vasilche* Changed CReader interface to not to use fake streams.** Revision 1.21 2003/04/03 14:17:43 vasilche* Allow using data loaded from file.** Revision 1.20 2003/03/27 19:40:11 vasilche* Implemented sorting in CGraph_CI.* Added Rewind() method to feature/graph/align iterators.** Revision 1.19 2003/03/26 17:27:04 vasilche* Added optinal reverse feature traversal.** Revision 1.18 2003/03/21 14:51:41 vasilche* Added debug printing of features collected.** Revision 1.17 2003/03/18 21:48:31 grichenk* Removed obsolete class CAnnot_CI** Revision 1.16 2003/03/10 16:33:44 vasilche* Added dump of features if errors were detected.** Revision 1.15 2003/02/27 20:57:36 vasilche* Addef some options for better performance testing.** Revision 1.14 2003/02/24 19:02:01 vasilche* Reverted testing shortcut.** Revision 1.13 2003/02/24 18:57:22 vasilche* Make feature gathering in one linear pass using CSeqMap iterator.* Do not use feture index by sub locations.* Sort features at the end of gathering in one vector.* Extracted some internal structures and classes in separate header.* Delay creation of mapped features.** Revision 1.12 2002/12/06 15:36:01 grichenk* Added overlap type for annot-iterators** Revision 1.11 2002/12/05 19:28:33 grichenk* Prohibited postfix operator ++()** Revision 1.10 2002/11/08 19:43:36 grichenk* CConstRef<> constructor made explicit** Revision 1.9 2002/11/04 21:29:13 grichenk* Fixed usage of const CRef<> and CRef<> constructor** Revision 1.8 2002/10/02 17:58:41 grichenk* Added CBioseq_CI sample code** Revision 1.7 2002/09/03 21:27:03 grichenk* Replaced bool arguments in CSeqVector constructor and getters* with enums.** Revision 1.6 2002/06/12 14:39:03 grichenk* Renamed enumerators** Revision 1.5 2002/05/06 03:28:49 vakatov* OM/OM1 renaming** Revision 1.4 2002/05/03 21:28:11 ucko* Introduce T(Signed)SeqPos.** Revision 1.3 2002/05/03 18:37:34 grichenk* Added more examples of using CFeat_CI and GetSequenceView()** Revision 1.2 2002/03/28 14:32:58 grichenk* Minor fixes** Revision 1.1 2002/03/28 14:07:25 grichenk* Initial revision*** ===========================================================================*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -