seq_annot_info.cpp
来自「ncbi源码」· C++ 代码 · 共 535 行 · 第 1/2 页
CPP
535 行
/* * =========================================================================== * PRODUCTION $Log: seq_annot_info.cpp,v $ * PRODUCTION Revision 1000.4 2004/06/01 19:23:51 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.16 * PRODUCTION * =========================================================================== *//* $Id: seq_annot_info.cpp,v 1000.4 2004/06/01 19:23:51 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_annot_Info info -- entry for data source information about Seq-annot**/#include <ncbi_pch.hpp>#include <objmgr/impl/seq_annot_info.hpp>#include <objmgr/impl/seq_entry_info.hpp>#include <objmgr/impl/bioseq_base_info.hpp>#include <objmgr/impl/tse_info.hpp>#include <objmgr/impl/tse_chunk_info.hpp>#include <objmgr/impl/annot_object.hpp>#include <objmgr/impl/handle_range_map.hpp>#include <objmgr/impl/data_source.hpp>#include <objmgr/impl/snp_annot_info.hpp>#include <objmgr/objmgr_exception.hpp>#include <objects/seq/Seq_annot.hpp>#include <objects/seq/Annotdesc.hpp>#include <objects/seq/Annot_descr.hpp>BEGIN_NCBI_SCOPEBEGIN_SCOPE(objects)CSeq_annot_Info::CSeq_annot_Info(const CSeq_annot& annot){ x_SetObject(annot);}CSeq_annot_Info::CSeq_annot_Info(CSeq_annot_SNP_Info& snp_annot){ x_SetSNP_annot_Info(snp_annot);}CSeq_annot_Info::CSeq_annot_Info(const CSeq_annot_Info& info){ x_SetObject(info);}CSeq_annot_Info::~CSeq_annot_Info(void){}const CBioseq_Base_Info& CSeq_annot_Info::GetParentBioseq_Base_Info(void) const{ return static_cast<const CBioseq_Base_Info&>(GetBaseParent_Info());}CBioseq_Base_Info& CSeq_annot_Info::GetParentBioseq_Base_Info(void){ return static_cast<CBioseq_Base_Info&>(GetBaseParent_Info());}const CSeq_entry_Info& CSeq_annot_Info::GetParentSeq_entry_Info(void) const{ return GetParentBioseq_Base_Info().GetParentSeq_entry_Info();}CSeq_entry_Info& CSeq_annot_Info::GetParentSeq_entry_Info(void){ return GetParentBioseq_Base_Info().GetParentSeq_entry_Info();}void CSeq_annot_Info::x_ParentAttach(CBioseq_Base_Info& parent){ x_BaseParentAttach(parent);}void CSeq_annot_Info::x_ParentDetach(CBioseq_Base_Info& parent){ x_BaseParentDetach(parent);}void CSeq_annot_Info::x_DSAttachContents(CDataSource& ds){ TParent::x_DSAttachContents(ds); x_DSMapObject(m_Object, ds); if ( m_SNP_Info ) { m_SNP_Info->x_DSAttach(ds); }}void CSeq_annot_Info::x_DSDetachContents(CDataSource& ds){ if ( m_SNP_Info ) { m_SNP_Info->x_DSDetach(ds); } ITERATE ( TDSMappedObjects, it, m_DSMappedObjects ) { x_DSUnmapObject(*it, ds); } m_DSMappedObjects.clear(); TParent::x_DSDetachContents(ds);}void CSeq_annot_Info::x_DSMapObject(CConstRef<TObject> obj, CDataSource& ds){ m_DSMappedObjects.push_back(obj); ds.x_Map(obj, this);}void CSeq_annot_Info::x_DSUnmapObject(CConstRef<TObject> obj, CDataSource& ds){ ds.x_Unmap(obj, this);}void CSeq_annot_Info::x_TSEAttachContents(CTSE_Info& tse){ TParent::x_TSEAttachContents(tse); if ( m_SNP_Info ) { m_SNP_Info->x_TSEAttach(tse); }}void CSeq_annot_Info::x_TSEDetachContents(CTSE_Info& tse){ if ( m_SNP_Info ) { m_SNP_Info->x_TSEDetach(tse); } x_UnmapAnnotObjects(tse); TParent::x_TSEDetachContents(tse);}size_tCSeq_annot_Info::GetAnnotObjectIndex(const CAnnotObject_Info& info) const{ _ASSERT(&info.GetSeq_annot_Info() == this); return m_ObjectInfos.GetIndex(info);}const CAnnotName& CSeq_annot_Info::GetName(void) const{ return m_Name.IsNamed()? m_Name: GetTSE_Info().GetName();}void CSeq_annot_Info::x_UpdateName(void){ if ( m_Object->IsSetDesc() ) { string name; ITERATE( CSeq_annot::TDesc::Tdata, it, m_Object->GetDesc().Get() ) { const CAnnotdesc& desc = **it; if ( desc.Which() == CAnnotdesc::e_Name ) { name = desc.GetName(); break; } } m_Name.SetNamed(name); } else { m_Name.SetUnnamed(); }}CConstRef<CSeq_annot> CSeq_annot_Info::GetCompleteSeq_annot(void) const{ return GetSeq_annotCore();}CConstRef<CSeq_annot> CSeq_annot_Info::GetSeq_annotCore(void) const{ x_UpdateObject(); return m_Object;}void CSeq_annot_Info::x_SetObject(const TObject& obj){ _ASSERT(!m_SNP_Info && !m_Object); m_Object.Reset(&obj); x_UpdateName();}void CSeq_annot_Info::x_SetObject(const CSeq_annot_Info& info){ _ASSERT(!m_SNP_Info && !m_Object); m_Object = info.m_Object; m_Name = info.m_Name; if ( info.m_SNP_Info ) { m_SNP_Info.Reset(new CSeq_annot_SNP_Info(*info.m_SNP_Info)); m_SNP_Info->x_ParentAttach(*this); x_AttachObject(*m_SNP_Info); }}void CSeq_annot_Info::x_SetSNP_annot_Info(CSeq_annot_SNP_Info& snp_info){ _ASSERT(!m_SNP_Info && !m_Object && !snp_info.HasParent_Info()); x_SetObject(snp_info.GetRemainingSeq_annot()); m_SNP_Info.Reset(&snp_info); snp_info.x_ParentAttach(*this); _ASSERT(&snp_info.GetParentSeq_annot_Info() == this); x_AttachObject(snp_info);}void CSeq_annot_Info::x_DoUpdateObject(void){ NCBI_THROW(CObjMgrException, eNotImplemented, "CSeq_annot_Info::x_DoUpdateObject: unimplemented");}void CSeq_annot_Info::UpdateAnnotIndex(void) const{ if ( x_DirtyAnnotIndex() ) { GetTSE_Info().UpdateAnnotIndex(*this); _ASSERT(!x_DirtyAnnotIndex()); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?