📄 test_helper.cpp
字号:
auto_ptr<CObjectOStream> out(CObjectOStream::Open(eSerial_AsnText, NcbiCout)); *out << feat_it->GetMappedFeature(); } //### _ASSERT(feat_it-> } if ( sm_DumpFeatures ) { NcbiCout << "-------------------- " "product CFeat_CI --------------------" << NcbiEndl; } // Get products for ( CFeat_CI feat_it(handle, 0, 0, SAnnotSelector() .SetLimitTSE(&handle.GetTopLevelSeqEntry()) .SetByProduct()); feat_it; ++feat_it) { count++; annot_set.insert(&feat_it.GetSeq_annot()); if ( sm_DumpFeatures ) { auto_ptr<CObjectOStream> out(CObjectOStream::Open(eSerial_AsnText, NcbiCout)); *out << feat_it->GetMappedFeature(); } //### _ASSERT(feat_it-> } } if ( sm_DumpFeatures ) { NcbiCout << "-------------------- " "end CFeat_CI --------------------" << NcbiEndl; } _ASSERT(count == seq_feat_cnt); _ASSERT(annot_set.size() == feat_annots_cnt); CHECK_END("get annot set"); CHECK_WRAP(); // Test CSeq_feat iterator for the specified range // Copy location seq-id count = 0; set<const CSeq_annot*> annot_set; CSeq_loc loc; loc.SetInt().SetId().Assign(id); loc.SetInt().SetFrom(0); loc.SetInt().SetTo(10); if ( !tse_feat_test ) { for ( CFeat_CI feat_it(scope, loc); feat_it; ++feat_it) { count++; annot_set.insert(&feat_it.GetSeq_annot()); //### _ASSERT(feat_it-> } } else { for ( CFeat_CI feat_it(handle, 0, 10, SAnnotSelector() .SetLimitTSE(&handle.GetTopLevelSeqEntry())); feat_it; ++feat_it) { count++; annot_set.insert(&feat_it.GetSeq_annot()); //### _ASSERT(feat_it-> } } _ASSERT(count == seq_featrg_cnt); _ASSERT(annot_set.size() == featrg_annots_cnt); CHECK_END("get annot set"); CHECK_WRAP(); // Test CSeq_align iterator count = 0; set<const CSeq_annot*> annot_set; CSeq_loc loc; loc.SetWhole(id); if ( !tse_feat_test ) { for (CAlign_CI align_it(scope, loc); align_it; ++align_it) { count++; annot_set.insert(&align_it.GetSeq_annot()); //### _ASSERT(align_it-> } } else { for (CAlign_CI align_it(handle, 0, 0, SAnnotSelector() .SetLimitTSE(&handle.GetTopLevelSeqEntry())); align_it; ++align_it) { count++; annot_set.insert(&align_it.GetSeq_annot()); //### _ASSERT(align_it-> } } _ASSERT(count == seq_align_cnt); _ASSERT(annot_set.size() == align_annots_cnt); CHECK_END("get align set"); CHECK_WRAP(); // Test CSeq_align iterator for the specified range // Copy location seq-id count = 0; set<const CSeq_annot*> annot_set; CSeq_loc loc; loc.SetInt().SetId().Assign(id); loc.SetInt().SetFrom(10); loc.SetInt().SetTo(20); if ( !tse_feat_test ) { for (CAlign_CI align_it(scope, loc); align_it; ++align_it) { count++; annot_set.insert(&align_it.GetSeq_annot()); //### _ASSERT(align_it-> } } else { for (CAlign_CI align_it(handle, 10, 20, SAnnotSelector() .SetLimitTSE(&handle.GetTopLevelSeqEntry())); align_it; ++align_it) { count++; annot_set.insert(&align_it.GetSeq_annot()); //### _ASSERT(align_it-> } } _ASSERT(count == seq_alignrg_cnt); _ASSERT(annot_set.size() == alignrg_annots_cnt); CHECK_END("get align set"); if ( sm_TestRemoveEntry ) { CHECK_WRAP(); CRef<CSeq_entry> tse (const_cast<CSeq_entry*>(&handle.GetTopLevelSeqEntry())); CRef<CSeq_entry> entry(const_cast<CSeq_entry*>( handle.GetBioseq().GetParentEntry())); CSeq_entry* parent = entry->GetParentEntry(); scope.RemoveEntry(*entry); handle = scope.GetBioseqHandle(id); _ASSERT(!handle || handle.GetBioseq().GetParentEntry() != entry); if ( parent ) { // Non-TSE scope.AttachEntry(*parent, *entry); } else { // TSE scope.AddTopLevelSeqEntry(*entry); } handle = scope.GetBioseqHandle(id); _ASSERT(handle); CHECK_END_ALWAYS("remove/attach seq-entry"); }}void CTestHelper::TestDataRetrieval(CScope& scope, int idx, int delta){ CSeq_id id; // find seq. by local id id.SetLocal().SetStr("seq" + NStr::IntToString(11+idx*1000)); // iterate through the whole Scope ProcessBioseq(scope, id, 40, "CAGCAGCGGTACAGGAGGGTGAGACATCCCAGAGCGGTGC", "GTCGTCGCCATGTCCTCCCACTCTGTAGGGTCTCGCCACG", 2, 4+delta, 4+delta, 2+delta, 1, 0, 2+delta, 2+delta, 1, 0); // iterate through the specific sequence only ProcessBioseq(scope, id, 40, "CAGCAGCGGTACAGGAGGGTGAGACATCCCAGAGCGGTGC", "GTCGTCGCCATGTCCTCCCACTCTGTAGGGTCTCGCCACG", 2, -1, 2+delta, 1+delta, 1, 0, 1+delta, 1+delta, 1, 0, true); // find seq. by GI id.SetGi(12+idx*1000); ProcessBioseq(scope, id, 40, "CAATAACCTCAGCAGCAACAAGTGGCTTCCAGCGCCCTCC", "GTTATTGGAGTCGTCGTTGTTCACCGAAGGTCGCGGGAGG", 1, 2, 3, 1, 1, 1, 2, 1, 1, 1); //1, 3, 2, 1, 1, 2, 2, 1, 1); // segmented sequence id.SetGi(21+idx*1000); ProcessBioseq(scope, id, 62, "CAGCACAATAACCTCAGCAGCAACAAGTGGCTTCCAGCGCCCTCCCAGCACAATAAAAAAAA", "GTCGTGTTATTGGAGTCGTCGTTGTTCACCGAAGGTCGCGGGAGGGTCGTGTTATTTTTTTT", 1, 6+delta, 2, 1, 0, 0, 1, 1, 0, 0); id.SetGi(22+idx*1000); ProcessBioseq(scope, id, 20, "QGCGEQTMTLLAPTLAASRY", "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); // another seq.data format id.SetGi(23+idx*1000); ProcessBioseq(scope, id, 13, "\\x00\\x03\\x02\\x01\\x00\\x02\\x01\\x03\\x02\\x03\\x00\\x01\\x02", "\\x03\\x00\\x01\\x02\\x03\\x01\\x02\\x00\\x01\\x00\\x03\\x02\\x01", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);}END_SCOPE(objects)END_NCBI_SCOPE/** ===========================================================================** $Log: test_helper.cpp,v $* Revision 1000.4 2004/06/01 19:25:11 gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.58** Revision 1.58 2004/05/21 21:42:14 gorelenk* Added PCH ncbi_pch.hpp** Revision 1.57 2004/04/01 20:18:12 grichenk* Added initialization of m_MultiId member.** Revision 1.56 2004/03/31 22:35:17 grichenk* Fixed number of features found** Revision 1.55 2004/03/24 18:30:30 vasilche* Fixed edit API.* Every *_Info object has its own shallow copy of original object.** Revision 1.54 2004/03/23 15:14:01 vasilche* Restored automatic call to Parentize() for Seq-entries in object manager.** Revision 1.53 2004/03/18 16:30:24 grichenk* Changed type of seq-align containers from list to vector.** Revision 1.52 2004/03/16 15:47:28 vasilche* Added CBioseq_set_Handle and set of EditHandles** Revision 1.51 2004/02/09 19:18:55 grichenk* Renamed CDesc_CI to CSeq_descr_CI. Redesigned CSeq_descr_CI* and CSeqdesc_CI to avoid using data directly.** Revision 1.50 2004/02/03 17:58:50 vasilche* Always test CScope::RemoveEntry() in single thread.** Revision 1.49 2003/12/22 22:32:10 grichenk* Enabled RemoveEntry/AttachEntry test in non-MT builds.** Revision 1.48 2003/12/18 18:14:47 grichenk* Removed test for CScope::RemoveEntry() since it breaks MT test.** Revision 1.47 2003/12/18 16:38:07 grichenk* Added CScope::RemoveEntry()** Revision 1.46 2003/11/10 18:12:09 grichenk* Removed extra EFlags declaration from seq_map_ci.hpp** Revision 1.45 2003/11/04 16:21:37 grichenk* Updated CAnnotTypes_CI to map whole features instead of splitting* them by sequence segments.** Revision 1.44 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.43 2003/09/05 18:45:10 grichenk* Fixed exceptions** Revision 1.42 2003/07/14 21:13:27 grichenk* Added possibility to resolve seq-map iterator withing a single TSE* and to skip intermediate references during this resolving.** Revision 1.41 2003/06/12 18:39:46 vasilche* Chech CSeqVector assignment.** Revision 1.40 2003/06/02 21:04:25 vasilche* Fixed CSeqVector_CI test to not to go beyond begin().** Revision 1.39 2003/06/02 16:06:39 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.37 2003/05/28 16:20:16 vasilche* Added check for REF segments.** Revision 1.36 2003/05/27 19:44:07 grichenk* Added CSeqVector_CI class** Revision 1.35 2003/05/23 16:32:54 vasilche* Added tests for backward traversal of CSeqMap_CI.** Revision 1.34 2003/05/12 19:17:42 vasilche* Added initialization of mandatory field.** Revision 1.33 2003/05/09 20:34:23 grichenk* Reverted to 1.31** Revision 1.32 2003/05/09 20:28:03 grichenk* Changed warnings to info** Revision 1.31 2003/04/24 16:12:39 vasilche* Object manager internal structures are splitted more straightforward.* Removed excessive header dependencies.** Revision 1.30 2003/03/26 14:30:23 lavr* Conform to modified representation of NUL char in NStr::PrintableString()** Revision 1.29 2003/03/21 14:52:28 vasilche* Modified testobjmgr1 to reflect changes in CFeat_CI and CAlign_CI* constructors' behaviour.** Revision 1.28 2003/03/05 20:56:44 vasilche* SAnnotSelector now holds all parameters of annotation iterators.** Revision 1.27 2003/03/04 16:43:53 grichenk* +Test CFeat_CI with eResolve_All flag** Revision 1.26 2003/02/28 16:37:47 vasilche* Fixed expected feature count.* Added optional flags to testobjmgr to dump generated data and found features.** Revision 1.25 2003/01/24 20:13:38 vasilche* Added check for empty CSeqVector from CBioseq_Handle::GetSequenceView().** Revision 1.24 2003/01/22 20:11:55 vasilche* Merged functionality of CSeqMapResolved_CI to CSeqMap_CI.* CSeqMap_CI now supports resolution and iteration over sequence range.* Added several caches to CScope.* Optimized CSeqVector().* Added serveral variants of CBioseqHandle::GetSeqVector().* Tried to optimize annotations iterator (not much success).* Rewritten CHandleRange and CHandleRangeMap classes to avoid sorting of list.** Revision 1.23 2003/01/22 19:25:11 ucko* Avoid use of xobjutil.** Revision 1.22 2002/12/26 20:34:53 ucko* Drop unused header <sstream>, which older compilers (such as GCC 2.9x) lack;* move CVS log to end.** Revision 1.21 2002/12/26 16:39:24 vasilche* Object manager class CSeqMap rewritten.** Revision 1.20 2002/12/20 20:54:25 grichenk* Added optional location/product switch to CFeat_CI** Revision 1.19 2002/12/19 20:18:57 grichenk* Fixed test case for minus strand location** Revision 1.18 2002/11/08 19:43:37 grichenk* CConstRef<> constructor made explicit** Revision 1.17 2002/09/10 19:55:54 grichenk* Catch exceptions when resolving seq-maps; new arguments for GetSeqVector()** Revision 1.16 2002/07/25 15:01:53 grichenk* Replaced non-const GetXXX() with SetXXX()** Revision 1.15 2002/07/03 14:40:46 ucko* Use typedef rather than hard-coded type for Dense_diag.ids.** Revision 1.14 2002/06/07 16:13:24 ucko* GetTitle() is now in sequence::.** Revision 1.13 2002/06/06 19:49:54 clausen* Changed CBioseq_Handle::GetTitle() call to GetTitle()** Revision 1.12 2002/05/24 14:57:14 grichenk* SerialAssign<>() -> CSerialObject::Assign()** Revision 1.11 2002/05/21 18:39:31 grichenk* CBioseq_Handle::GetResolvedSeqMap() -> CreateResolvedSeqMap()** Revision 1.10 2002/05/09 14:21:50 grichenk* Turned GetTitle() test on, removed unresolved seq-map test** Revision 1.9 2002/05/06 03:28:53 vakatov* OM/OM1 renaming** Revision 1.8 2002/05/03 21:28:12 ucko* Introduce T(Signed)SeqPos.** Revision 1.7 2002/04/25 18:15:25 grichenk* Adjusted tests to work with the updated CSeqVector** Revision 1.6 2002/04/23 15:26:07 gouriano* added test_assert.h** Revision 1.5 2002/04/22 20:07:45 grichenk* Commented calls to CBioseq::ConstructExcludedSequence()** Revision 1.4 2002/04/22 18:33:48 gouriano* corrected feature counts** Revision 1.3 2002/03/28 21:22:38 grichenk* More tests for location-exclusive bioseq** Revision 1.2 2002/03/18 21:47:15 grichenk* Moved most includes to test_helper.cpp* Added test for CBioseq::ConstructExcludedSequence()** Revision 1.1 2002/03/13 18:06:31 gouriano* restructured MT test. Put common functions into a separate file** ===========================================================================*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -