annot_ci.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:6k
源码类别:

生物技术

开发平台:

C/C++

  1. /*
  2.  * ===========================================================================
  3.  * PRODUCTION $Log: annot_ci.cpp,v $
  4.  * PRODUCTION Revision 1000.2  2004/06/01 19:22:29  gouriano
  5.  * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.32
  6.  * PRODUCTION
  7.  * ===========================================================================
  8.  */
  9. /*  $Id: annot_ci.cpp,v 1000.2 2004/06/01 19:22:29 gouriano Exp $
  10. * ===========================================================================
  11. *
  12. *                            PUBLIC DOMAIN NOTICE
  13. *               National Center for Biotechnology Information
  14. *
  15. *  This software/database is a "United States Government Work" under the
  16. *  terms of the United States Copyright Act.  It was written as part of
  17. *  the author's official duties as a United States Government employee and
  18. *  thus cannot be copyrighted.  This software/database is freely available
  19. *  to the public for use. The National Library of Medicine and the U.S.
  20. *  Government have not placed any restriction on its use or reproduction.
  21. *
  22. *  Although all reasonable efforts have been taken to ensure the accuracy
  23. *  and reliability of the software and data, the NLM and the U.S.
  24. *  Government do not and cannot warrant the performance or results that
  25. *  may be obtained by using this software or data. The NLM and the U.S.
  26. *  Government disclaim all warranties, express or implied, including
  27. *  warranties of performance, merchantability or fitness for any particular
  28. *  purpose.
  29. *
  30. *  Please cite the author in any work or product based on this material.
  31. *
  32. * ===========================================================================
  33. *
  34. * Author: Aleksey Grichenko, Eugene Vasilchenko
  35. *
  36. * File Description:
  37. *   Object manager iterators
  38. *
  39. */
  40. #include <ncbi_pch.hpp>
  41. #include <objmgr/annot_ci.hpp>
  42. #include <objmgr/seq_entry_handle.hpp>
  43. #include <objmgr/seq_annot_handle.hpp>
  44. #include <objmgr/impl/annot_object.hpp>
  45. BEGIN_NCBI_SCOPE
  46. BEGIN_SCOPE(objects)
  47. CAnnot_CI::CAnnot_CI(void)
  48. {
  49. }
  50. CAnnot_CI::CAnnot_CI(const CAnnot_CI& iter)
  51.     : CAnnotTypes_CI(iter)
  52. {
  53.     m_SeqAnnotSet = iter.m_SeqAnnotSet;
  54.     if (iter) {
  55.         m_Iterator = m_SeqAnnotSet.find(*iter.m_Iterator);
  56.     }
  57.     else {
  58.         m_Iterator = m_SeqAnnotSet.end();
  59.     }
  60. }
  61. CAnnot_CI::CAnnot_CI(CScope& scope, const CSeq_loc& loc,
  62.                      const SAnnotSelector& sel)
  63.     : CAnnotTypes_CI(CSeq_annot::C_Data::e_not_set,
  64.                      scope, loc,
  65.                      SAnnotSelector(sel)
  66.                      .SetNoMapping(true)
  67.                      .SetSortOrder(SAnnotSelector::eSortOrder_None))
  68. {
  69.     x_Collect();
  70. }
  71. CAnnot_CI::CAnnot_CI(const CBioseq_Handle& bioseq,
  72.                      TSeqPos start, TSeqPos stop,
  73.                      const SAnnotSelector& sel)
  74.     : CAnnotTypes_CI(CSeq_annot::C_Data::e_not_set,
  75.                      bioseq, start, stop,
  76.                      SAnnotSelector(sel)
  77.                      .SetNoMapping(true)
  78.                      .SetSortOrder(SAnnotSelector::eSortOrder_None))
  79. {
  80.     x_Collect();
  81. }
  82. CAnnot_CI& CAnnot_CI::operator= (const CAnnot_CI& iter)
  83. {
  84.     CAnnotTypes_CI::operator=(iter);
  85.     m_SeqAnnotSet.clear();
  86.     m_SeqAnnotSet = iter.m_SeqAnnotSet;
  87.     if (iter) {
  88.         m_Iterator = m_SeqAnnotSet.find(*iter.m_Iterator);
  89.     }
  90.     else {
  91.         m_Iterator = m_SeqAnnotSet.end();
  92.     }
  93.     return *this;
  94. }
  95. CAnnot_CI::CAnnot_CI(CScope& scope,
  96.                      const CSeq_loc& loc,
  97.                      SAnnotSelector::EOverlapType overlap_type,
  98.                      SAnnotSelector::EResolveMethod resolve)
  99.     : CAnnotTypes_CI(CSeq_annot::C_Data::e_not_set,
  100.                      scope, loc,
  101.                      SAnnotSelector()
  102.                      .SetNoMapping(true)
  103.                      .SetSortOrder(SAnnotSelector::eSortOrder_None)
  104.                      .SetOverlapType(overlap_type)
  105.                      .SetResolveMethod(resolve))
  106. {
  107.     x_Collect();
  108. }
  109. CAnnot_CI::CAnnot_CI(const CBioseq_Handle& bioseq, TSeqPos start, TSeqPos stop,
  110.                      SAnnotSelector::EOverlapType overlap_type,
  111.                      SAnnotSelector::EResolveMethod resolve)
  112.     : CAnnotTypes_CI(CSeq_annot::C_Data::e_not_set,
  113.                      bioseq, start, stop,
  114.                      SAnnotSelector()
  115.                      .SetNoMapping(true)
  116.                      .SetSortOrder(SAnnotSelector::eSortOrder_None)
  117.                      .SetOverlapType(overlap_type)
  118.                      .SetResolveMethod(resolve))
  119. {
  120.     x_Collect();
  121. }
  122. CAnnot_CI::~CAnnot_CI(void)
  123. {
  124.     return;
  125. }
  126. void CAnnot_CI::x_Collect(void)
  127. {
  128.     while ( IsValid() ) {
  129.         if (Get().GetObjectType() != CAnnotObject_Ref::eType_Seq_annot_Info) {
  130.             Next();
  131.             continue;
  132.         }
  133.         CSeq_annot_Handle h(GetScope(),
  134.                             Get().GetAnnotObject_Info().GetSeq_annot_Info());
  135.         m_SeqAnnotSet.insert(h);
  136.         Next();
  137.     }
  138.     m_Iterator = m_SeqAnnotSet.begin();
  139. }
  140. END_SCOPE(objects)
  141. END_NCBI_SCOPE
  142. /*
  143. * ---------------------------------------------------------------------------
  144. * $Log: annot_ci.cpp,v $
  145. * Revision 1000.2  2004/06/01 19:22:29  gouriano
  146. * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.32
  147. *
  148. * Revision 1.32  2004/05/21 21:42:12  gorelenk
  149. * Added PCH ncbi_pch.hpp
  150. *
  151. * Revision 1.31  2004/05/10 18:26:37  grichenk
  152. * Fixed 'not used' warnings
  153. *
  154. * Revision 1.30  2004/04/05 15:56:14  grichenk
  155. * Redesigned CAnnotTypes_CI: moved all data and data collecting
  156. * functions to CAnnotDataCollector. CAnnotTypes_CI is no more
  157. * inherited from SAnnotSelector.
  158. *
  159. * Revision 1.29  2004/03/16 15:47:27  vasilche
  160. * Added CBioseq_set_Handle and set of EditHandles
  161. *
  162. * Revision 1.28  2003/09/11 17:45:07  grichenk
  163. * Added adaptive-depth option to annot-iterators.
  164. *
  165. * Revision 1.27  2003/08/27 14:29:52  vasilche
  166. * Reduce object allocations in feature iterator.
  167. *
  168. * Revision 1.26  2003/08/22 15:00:49  grichenk
  169. * Redesigned CAnnot_CI to iterate over seq-annots, containing
  170. * given location.
  171. *
  172. * Revision 1.25  2003/08/15 15:22:00  grichenk
  173. * Initial revision
  174. *
  175. *
  176. * ===========================================================================
  177. */