annot_selector.cpp
来自「ncbi源码」· C++ 代码 · 共 776 行 · 第 1/2 页
CPP
776 行
/* * =========================================================================== * PRODUCTION $Log: annot_selector.cpp,v $ * PRODUCTION Revision 1000.3 2004/06/01 19:22:41 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.12 * PRODUCTION * =========================================================================== *//* $Id: annot_selector.cpp,v 1000.3 2004/06/01 19:22:41 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: Aleksey Grichenko, Eugene Vasilchenko** File Description:**/#include <ncbi_pch.hpp>#include <objmgr/annot_selector.hpp>#include <objmgr/impl/tse_info.hpp>#include <objmgr/impl/seq_entry_info.hpp>#include <objmgr/impl/seq_annot_info.hpp>#include <objmgr/impl/annot_type_index.hpp>#include <objmgr/seq_entry_handle.hpp>#include <objmgr/seq_annot_handle.hpp>#include <objects/seqset/Seq_entry.hpp>#include <objects/seq/Seq_annot.hpp>#include <algorithm>BEGIN_NCBI_SCOPEBEGIN_SCOPE(objects)//////////////////////////////////////////////////////////////////////// SAnnotSelector//SAnnotSelector::SAnnotSelector(TAnnotType annot, TFeatType feat) : SAnnotTypeSelector(annot), m_FeatProduct(false), m_ResolveDepth(kMax_Int), m_OverlapType(eOverlap_Intervals), m_ResolveMethod(eResolve_TSE), m_SegmentSelect(eSegmentSelect_All), m_SortOrder(eSortOrder_Normal), m_CombineMethod(eCombine_None), m_LimitObjectType(eLimit_None), m_IdResolving(eIgnoreUnresolved), m_MaxSize(kMax_UInt), m_NoMapping(false), m_AdaptiveDepth(false){ if ( feat != CSeqFeatData::e_not_set ) { SetFeatType(feat); }}SAnnotSelector::SAnnotSelector(TFeatType feat) : SAnnotTypeSelector(feat), m_FeatProduct(false), m_ResolveDepth(kMax_Int), m_OverlapType(eOverlap_Intervals), m_ResolveMethod(eResolve_TSE), m_SegmentSelect(eSegmentSelect_All), m_SortOrder(eSortOrder_Normal), m_CombineMethod(eCombine_None), m_LimitObjectType(eLimit_None), m_IdResolving(eIgnoreUnresolved), m_MaxSize(kMax_UInt), m_NoMapping(false), m_AdaptiveDepth(false){}SAnnotSelector::SAnnotSelector(TAnnotType annot, TFeatType feat, bool feat_product) : SAnnotTypeSelector(annot), m_FeatProduct(feat_product), m_ResolveDepth(kMax_Int), m_OverlapType(eOverlap_Intervals), m_ResolveMethod(eResolve_TSE), m_SegmentSelect(eSegmentSelect_All), m_SortOrder(eSortOrder_Normal), m_CombineMethod(eCombine_None), m_LimitObjectType(eLimit_None), m_IdResolving(eIgnoreUnresolved), m_MaxSize(kMax_UInt), m_NoMapping(false), m_AdaptiveDepth(false){ if ( feat != CSeqFeatData::e_not_set ) { SetFeatType(feat); }}SAnnotSelector::SAnnotSelector(TFeatType feat, bool feat_product) : SAnnotTypeSelector(feat), m_FeatProduct(feat_product), m_ResolveDepth(kMax_Int), m_OverlapType(eOverlap_Intervals), m_ResolveMethod(eResolve_TSE), m_SegmentSelect(eSegmentSelect_All), m_SortOrder(eSortOrder_Normal), m_CombineMethod(eCombine_None), m_LimitObjectType(eLimit_None), m_IdResolving(eIgnoreUnresolved), m_MaxSize(kMax_UInt), m_NoMapping(false), m_AdaptiveDepth(false){}SAnnotSelector::SAnnotSelector(const SAnnotSelector& sel){ *this = sel;}SAnnotSelector& SAnnotSelector::operator=(const SAnnotSelector& sel){ if ( this != &sel ) { static_cast<SAnnotTypeSelector&>(*this) = sel; m_FeatProduct = sel.m_FeatProduct; m_ResolveDepth = sel.m_ResolveDepth; m_OverlapType = sel.m_OverlapType; m_ResolveMethod = sel.m_ResolveMethod; m_SegmentSelect = sel.m_SegmentSelect; m_SortOrder = sel.m_SortOrder; m_CombineMethod = sel.m_CombineMethod; m_LimitObjectType = sel.m_LimitObjectType; m_IdResolving = sel.m_IdResolving; m_LimitObject = sel.m_LimitObject; m_MaxSize = sel.m_MaxSize; m_IncludeAnnotsNames = sel.m_IncludeAnnotsNames; m_ExcludeAnnotsNames = sel.m_ExcludeAnnotsNames; m_NoMapping = sel.m_NoMapping; m_AdaptiveDepth = sel.m_AdaptiveDepth; m_AdaptiveTriggers = sel.m_AdaptiveTriggers; m_ExcludedTSE = sel.m_ExcludedTSE; m_AnnotTypesSet = sel.m_AnnotTypesSet; } return *this;}SAnnotSelector::~SAnnotSelector(void){}SAnnotSelector& SAnnotSelector::SetLimitNone(void){ m_LimitObjectType = eLimit_None; m_LimitObject.Reset(); return *this;}SAnnotSelector&SAnnotSelector::SetLimitTSE(const CSeq_entry_Handle& limit){ if ( !limit ) return SetLimitNone(); const CTSE_Info& info = limit.x_GetInfo().GetTSE_Info(); m_LimitObjectType = eLimit_TSE_Info; m_LimitObject.Reset(&info); return *this;}SAnnotSelector&SAnnotSelector::SetLimitSeqEntry(const CSeq_entry_Handle& limit){ if ( !limit ) return SetLimitNone(); const CSeq_entry_Info& info = limit.x_GetInfo(); m_LimitObjectType = eLimit_Seq_entry_Info; m_LimitObject.Reset(&info); return *this;}SAnnotSelector&SAnnotSelector::SetLimitSeqAnnot(const CSeq_annot_Handle& limit){ if ( !limit ) return SetLimitNone(); const CSeq_annot_Info& info = limit.x_GetInfo(); m_LimitObjectType = eLimit_Seq_annot_Info; m_LimitObject.Reset(&info); return *this;}SAnnotSelector&SAnnotSelector::SetLimitTSE(const CSeq_entry* limit){ if ( !limit ) return SetLimitNone(); m_LimitObjectType = eLimit_TSE; m_LimitObject.Reset(limit); return *this;}SAnnotSelector&SAnnotSelector::SetLimitSeqEntry(const CSeq_entry* limit){ if ( !limit ) return SetLimitNone(); m_LimitObjectType = eLimit_Seq_entry; m_LimitObject.Reset(limit); return *this;}SAnnotSelector&SAnnotSelector::SetLimitSeqAnnot(const CSeq_annot* limit){ if ( !limit ) return SetLimitNone(); m_LimitObjectType = eLimit_Seq_annot; m_LimitObject.Reset(limit); return *this;}bool SAnnotSelector::x_Has(const TAnnotsNames& names, const CAnnotName& name){ return find(names.begin(), names.end(), name) != names.end();}void SAnnotSelector::x_Add(TAnnotsNames& names, const CAnnotName& name){ if ( !x_Has(names, name) ) { names.push_back(name); }}void SAnnotSelector::x_Del(TAnnotsNames& names, const CAnnotName& name){ NON_CONST_ITERATE( TAnnotsNames, it, names ) { if ( *it == name ) { names.erase(it); return; } }}bool SAnnotSelector::IncludedAnnotName(const CAnnotName& name) const{ return x_Has(m_IncludeAnnotsNames, name);}bool SAnnotSelector::ExcludedAnnotName(const CAnnotName& name) const{ return x_Has(m_ExcludeAnnotsNames, name);}SAnnotSelector& SAnnotSelector::ResetAnnotsNames(void){ m_IncludeAnnotsNames.clear(); m_ExcludeAnnotsNames.clear(); return *this;}SAnnotSelector& SAnnotSelector::AddNamedAnnots(const CAnnotName& name){ x_Add(m_IncludeAnnotsNames, name); x_Del(m_ExcludeAnnotsNames, name); return *this;}SAnnotSelector& SAnnotSelector::AddNamedAnnots(const char* name){ return AddNamedAnnots(CAnnotName(name));}SAnnotSelector& SAnnotSelector::AddUnnamedAnnots(void){ return AddNamedAnnots(CAnnotName());}SAnnotSelector& SAnnotSelector::ExcludeNamedAnnots(const CAnnotName& name){ x_Add(m_ExcludeAnnotsNames, name); x_Del(m_IncludeAnnotsNames, name); return *this;}SAnnotSelector& SAnnotSelector::ExcludeNamedAnnots(const char* name){ return ExcludeNamedAnnots(CAnnotName(name));}SAnnotSelector& SAnnotSelector::ExcludeUnnamedAnnots(void){ return ExcludeNamedAnnots(CAnnotName());}SAnnotSelector& SAnnotSelector::SetAllNamedAnnots(void){ ResetAnnotsNames(); ExcludeUnnamedAnnots(); return *this;}SAnnotSelector& SAnnotSelector::SetDataSource(const string& source){ if ( source.empty() ) { AddUnnamedAnnots(); } return AddNamedAnnots(source);}SAnnotSelector&SAnnotSelector::SetAdaptiveTrigger(const SAnnotTypeSelector& sel){ ITERATE ( TAdaptiveTriggers, it, m_AdaptiveTriggers ) { if ( *it == sel ) { return *this; } } m_AdaptiveTriggers.push_back(sel); return *this;}SAnnotSelector&SAnnotSelector::ExcludeTSE(const CSeq_entry_Handle& tse){ if ( !ExcludedTSE(tse) ) { m_ExcludedTSE.push_back(tse); } return *this;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?