seq_entry_info.cpp
来自「ncbi源码」· C++ 代码 · 共 630 行 · 第 1/2 页
CPP
630 行
/* * =========================================================================== * PRODUCTION $Log: seq_entry_info.cpp,v $ * PRODUCTION Revision 1000.3 2004/06/01 19:24:00 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.15 * PRODUCTION * =========================================================================== *//* $Id: seq_entry_info.cpp,v 1000.3 2004/06/01 19:24:00 gouriano Exp $* ===========================================================================** PUBLIC DOMAIN NOTICE* National Center for Biotechnology Information** This software/database is a "United States Government Work" under the* terms of the United States Copyright Act. It was written as part of* the author's official duties as a United States Government employee and* thus cannot be copyrighted. This software/database is freely available* to the public for use. The National Library of Medicine and the U.S.* Government have not placed any restriction on its use or reproduction.** Although all reasonable efforts have been taken to ensure the accuracy* and reliability of the software and data, the NLM and the U.S.* Government do not and cannot warrant the performance or results that* may be obtained by using this software or data. The NLM and the U.S.* Government disclaim all warranties, express or implied, including* warranties of performance, merchantability or fitness for any particular* purpose.** Please cite the author in any work or product based on this material.** ===========================================================================** Author: Eugene Vasilchenko** File Description:* CSeq_entry_Info info -- entry for data source information about Seq-entry**/#include <ncbi_pch.hpp>#include <objmgr/impl/seq_entry_info.hpp>#include <objmgr/impl/tse_info.hpp>#include <objmgr/impl/seq_annot_info.hpp>#include <objmgr/impl/bioseq_info.hpp>#include <objmgr/impl/bioseq_set_info.hpp>#include <objmgr/impl/data_source.hpp>#include <objmgr/objmgr_exception.hpp>#include <objects/general/Object_id.hpp>#include <objects/seqloc/Seq_id.hpp>#include <objects/seqset/Seq_entry.hpp>#include <objects/seqset/Bioseq_set.hpp>#include <objects/seq/Bioseq.hpp>#include <objects/seq/Seq_annot.hpp>BEGIN_NCBI_SCOPEBEGIN_SCOPE(objects)CSeq_entry_Info::CSeq_entry_Info(void) : m_Which(CSeq_entry::e_not_set){}CSeq_entry_Info::CSeq_entry_Info(CSeq_entry& entry) : m_Which(CSeq_entry::e_not_set){ x_SetObject(entry);}CSeq_entry_Info::CSeq_entry_Info(const CSeq_entry_Info& info) : m_Which(CSeq_entry::e_not_set){ x_SetObject(info);}CSeq_entry_Info::~CSeq_entry_Info(void){}const CBioseq_set_Info& CSeq_entry_Info::GetParentBioseq_set_Info(void) const{ return static_cast<const CBioseq_set_Info&>(GetBaseParent_Info());}CBioseq_set_Info& CSeq_entry_Info::GetParentBioseq_set_Info(void){ return static_cast<CBioseq_set_Info&>(GetBaseParent_Info());}const CSeq_entry_Info& CSeq_entry_Info::GetParentSeq_entry_Info(void) const{ return GetParentBioseq_set_Info().GetParentSeq_entry_Info();}CSeq_entry_Info& CSeq_entry_Info::GetParentSeq_entry_Info(void){ return GetParentBioseq_set_Info().GetParentSeq_entry_Info();}void CSeq_entry_Info::x_CheckWhich(E_Choice which) const{ if ( Which() != which ) { NCBI_THROW(CUnassignedMember,eGet, which == CSeq_entry::e_Set? "Seq_entry.set": "Seq_entry.seq"); }}const CBioseq_Info& CSeq_entry_Info::GetSeq(void) const{ x_CheckWhich(CSeq_entry::e_Seq); const CBioseq_Base_Info& base = *m_Contents; return dynamic_cast<const CBioseq_Info&>(base);}CBioseq_Info& CSeq_entry_Info::SetSeq(void){ x_CheckWhich(CSeq_entry::e_Seq); CBioseq_Base_Info& base = *m_Contents; return dynamic_cast<CBioseq_Info&>(base);}const CBioseq_set_Info& CSeq_entry_Info::GetSet(void) const{ x_CheckWhich(CSeq_entry::e_Set); const CBioseq_Base_Info& base = *m_Contents; return dynamic_cast<const CBioseq_set_Info&>(base);}CBioseq_set_Info& CSeq_entry_Info::SetSet(void){ x_CheckWhich(CSeq_entry::e_Set); CBioseq_Base_Info& base = *m_Contents; return dynamic_cast<CBioseq_set_Info&>(base);}void CSeq_entry_Info::x_Select(CSeq_entry::E_Choice which, CRef<CBioseq_Base_Info> contents){ if ( Which() != which || m_Contents != contents ) { if ( m_Contents ) { x_DetachContents(); m_Contents.Reset(); } m_Which = which; m_Contents = contents; switch ( m_Which ) { case CSeq_entry::e_Seq: x_AttachObjectVariant(SetSeq().x_GetObject()); break; case CSeq_entry::e_Set: x_AttachObjectVariant(SetSet().x_GetObject()); break; default: x_DetachObjectVariant(); break; } x_AttachContents(); }}inlinevoid CSeq_entry_Info::x_Select(CSeq_entry::E_Choice which, CBioseq_Base_Info* contents){ x_Select(which, Ref(contents));}void CSeq_entry_Info::Reset(void){ x_Select(CSeq_entry::e_not_set, 0);}CBioseq_set_Info& CSeq_entry_Info::SelectSet(CBioseq_set_Info& seqset){ if ( Which() != CSeq_entry::e_not_set ) { NCBI_THROW(CObjMgrException, eModifyDataError, "Reset CSeq_entry_Handle before selecting set"); } x_Select(CSeq_entry::e_Set, &seqset); return SetSet();}CBioseq_set_Info& CSeq_entry_Info::SelectSet(CBioseq_set& seqset){ return SelectSet(*new CBioseq_set_Info(seqset));}CBioseq_set_Info& CSeq_entry_Info::SelectSet(void){ if ( !IsSet() ) { SelectSet(*new CBioseq_set); } return SetSet();}CBioseq_Info& CSeq_entry_Info::SelectSeq(CBioseq_Info& seq){ if ( Which() != CSeq_entry::e_not_set ) { NCBI_THROW(CObjMgrException, eModifyDataError, "Reset CSeq_entry_Handle before selecting seq"); } x_Select(CSeq_entry::e_Seq, &seq); return SetSeq();}CBioseq_Info& CSeq_entry_Info::SelectSeq(CBioseq& seq){ return SelectSeq(*new CBioseq_Info(seq));}void CSeq_entry_Info::x_DoUpdateObject(void){ if ( m_Contents ) { m_Contents->x_UpdateObject(); _ASSERT(!m_Contents->x_NeedUpdateObject()); _ASSERT(!IsSet() || GetSet().GetBioseq_setCore() == &m_Object->GetSet()); _ASSERT(!IsSeq() || GetSeq().GetBioseqCore() == &m_Object->GetSeq()); }}CConstRef<CSeq_entry> CSeq_entry_Info::GetCompleteSeq_entry(void) const{ return GetSeq_entryCore();}CConstRef<CSeq_entry> CSeq_entry_Info::GetSeq_entryCore(void) const{ x_UpdateObject(); _ASSERT(!x_NeedUpdateObject()); return m_Object;}void CSeq_entry_Info::x_ParentAttach(CBioseq_set_Info& parent){ x_BaseParentAttach(parent); if ( parent.HasParent_Info() ) { CSeq_entry& entry = parent.GetParentSeq_entry_Info().x_GetObject(); if ( m_Object->GetParentEntry() != &entry ) { entry.ParentizeOneLevel(); } _ASSERT(m_Object->GetParentEntry() == &entry); }}void CSeq_entry_Info::x_ParentDetach(CBioseq_set_Info& parent){ m_Object->ResetParentEntry(); x_BaseParentDetach(parent);}void CSeq_entry_Info::x_TSEAttachContents(CTSE_Info& tse){ TParent::x_TSEAttachContents(tse); if ( m_Contents ) { m_Contents->x_TSEAttach(tse); }}void CSeq_entry_Info::x_TSEDetachContents(CTSE_Info& tse){ if ( m_Contents ) { m_Contents->x_TSEDetach(tse); } TParent::x_TSEDetachContents(tse);}void CSeq_entry_Info::x_DSAttachContents(CDataSource& ds){ TParent::x_DSAttachContents(ds); x_DSMapObject(m_Object, ds); if ( m_Contents ) { m_Contents->x_DSAttach(ds); }}void CSeq_entry_Info::x_DSDetachContents(CDataSource& ds){ if ( m_Contents ) { m_Contents->x_DSDetach(ds);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?