📄 seq_map.hpp
字号:
/* * =========================================================================== * PRODUCTION $Log: seq_map.hpp,v $ * PRODUCTION Revision 1000.2 2004/04/12 17:27:48 gouriano * PRODUCTION PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.44 * PRODUCTION * =========================================================================== */#ifndef OBJECTS_OBJMGR___SEQ_MAP__HPP#define OBJECTS_OBJMGR___SEQ_MAP__HPP/* $Id: seq_map.hpp,v 1000.2 2004/04/12 17:27:48 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.** ===========================================================================** Authors:* Aleksey Grichenko* Michael Kimelman* Andrei Gourianov* Eugene Vasilchenko** File Description:* CSeqMap -- formal sequence map to describe sequence parts in general,* i.e. location and type only, without providing real data**/#include <objmgr/seq_id_handle.hpp>#include <objmgr/objmgr_exception.hpp>#include <objects/seqloc/Na_strand.hpp>#include <objects/seq/Seq_inst.hpp>#include <corelib/ncbimtx.hpp>#include <vector>#include <list>BEGIN_NCBI_SCOPEBEGIN_SCOPE(objects)class CBioseq;class CDelta_seq;class CSeq_loc;class CSeq_point;class CSeq_interval;class CSeq_loc_mix;class CSeq_loc_equiv;class CSeq_literal;class CSeq_data;class CPacked_seqint;class CPacked_seqpnt;// Provided for compatibility with old code; new code should just use TSeqPos.typedef TSeqPos TSeqPosition;typedef TSeqPos TSeqLength;////////////////////////////////////////////////////////////////////// CSeqMap::// Formal sequence map -- to describe sequence parts in general --// location and type only, without providing real dataclass CScope;class CBioseq_Handle;class CSegmentPtr;class CSeqMap_CI;class CSeqMap_CI_SegmentInfo;class CSeqMap_Delta_seqs;class NCBI_XOBJMGR_EXPORT CSeqMap : public CObject{public: // typedefs enum ESegmentType { eSeqGap, // gap eSeqData, // real sequence data eSeqSubMap, // sub seqmap eSeqRef, // reference to Bioseq eSeqEnd }; typedef CSeq_inst::TMol TMol;protected: class CSegment; class SPosLessSegment; friend class CSegment; friend class SPosLessSegment; friend class CSeqMap_SeqPoss; class CSegment { public: CSegment(ESegmentType seg_type = eSeqEnd, TSeqPos length = kInvalidSeqPos); // Relative position of the segment in seqmap mutable TSeqPos m_Position; // Length of the segment (kInvalidSeqPos if unresolved) mutable TSeqPos m_Length; // Segment type char m_SegType; // reference info, valid for eSeqData, eSeqSubMap, eSeqRef bool m_RefMinusStrand; TSeqPos m_RefPosition; CConstRef<CObject> m_RefObject; // CSeq_data, CSeqMap, CSeq_id typedef list<TSeqPos>::iterator TList0_I; TList0_I m_Iterator; }; class SPosLessSegment { public: bool operator()(TSeqPos pos, const CSegment& seg) { return pos < seg.m_Position + seg.m_Length; } };public: typedef CSeqMap_CI CSegmentInfo; // for compatibility typedef CSeqMap_CI const_iterator; typedef CSeqMap_CI TSegment_CI; ~CSeqMap(void); TSeqPos GetLength(CScope* scope = 0) const; TMol GetMol(void) const; // new interface // STL style methods const_iterator begin(CScope* scope = 0) const; const_iterator end(CScope* scope = 0) const; const_iterator find(TSeqPos pos, CScope* scope = 0) const; // NCBI style methods TSegment_CI Begin(CScope* scope = 0) const; TSegment_CI End(CScope* scope = 0) const; TSegment_CI FindSegment(TSeqPos pos, CScope* scope = 0) const; enum EFlags { fFindData = (1<<0), fFindGap = (1<<1), fFindLeafRef = (1<<2), fFindInnerRef = (1<<3), fFindRef = (fFindLeafRef | fFindInnerRef), fFindAny = fFindData | fFindGap | fFindRef, fFindAnyLeaf = fFindData | fFindGap | fFindLeafRef, fDefaultFlags = fFindAnyLeaf }; typedef int TFlags; // resolved iterators const_iterator begin_resolved(CScope* scope, size_t maxResolveCount = size_t(-1), TFlags flags = fDefaultFlags) const; const_iterator find_resolved(TSeqPos pos, CScope* scope, size_t maxResolveCount = size_t(-1), TFlags flags = fDefaultFlags) const; const_iterator find_resolved(TSeqPos pos, CScope* scope, ENa_strand strand, size_t maxResolveCount, TFlags flags) const; const_iterator end_resolved(CScope* scope, size_t maxResolveCount = size_t(-1), TFlags flags = fDefaultFlags) const; TSegment_CI BeginResolved(CScope* scope, size_t maxResolveCount = size_t(-1), TFlags flags = fDefaultFlags) const; TSegment_CI FindResolved(TSeqPos pos, CScope* scope, size_t maxResolveCount = size_t(-1), TFlags flags = fDefaultFlags) const; TSegment_CI FindResolved(TSeqPos pos, CScope* scope, ENa_strand strand, size_t maxResolveCount = size_t(-1), TFlags flags = fDefaultFlags) const; TSegment_CI EndResolved(CScope* scope, size_t maxResolveCount = size_t(-1), TFlags flags = fDefaultFlags) const; // iterate range with plus strand coordinates TSegment_CI ResolvedRangeIterator(CScope* scope, TSeqPos from, TSeqPos length, ENa_strand strand = eNa_strand_plus, size_t maxResolve = size_t(-1), TFlags flags = fDefaultFlags) const; // iterate range with specified strand coordinates TSegment_CI ResolvedRangeIterator(CScope* scope, ENa_strand strand, TSeqPos from, TSeqPos length, size_t maxResolve = size_t(-1), TFlags flags = fDefaultFlags) const; bool CanResolveRange(CScope* scope, TSeqPos from, TSeqPos length, ENa_strand strand = eNa_strand_plus) const; virtual void DebugDump(CDebugDumpContext ddc, unsigned int depth) const; static CConstRef<CSeqMap> CreateSeqMapForBioseq(const CBioseq& seq); static CConstRef<CSeqMap> CreateSeqMapForSeq_loc(const CSeq_loc& loc, CScope* scope); static CConstRef<CSeqMap> CreateSeqMapForStrand(CConstRef<CSeqMap> seqMap, ENa_strand strand); static TSeqPos ResolveBioseqLength(const CSeq_id& id, CScope* scope);protected: // 'ctors CSeqMap(CSeqMap* parent, size_t index); CSeqMap(void); CSeqMap(const CSeq_data& data, TSeqPos len); CSeqMap(const CSeq_loc& ref); CSeqMap(TSeqPos len); // gap void x_AddEnd(void); CSegment& x_AddSegment(ESegmentType type, TSeqPos len); CSegment& x_AddSegment(ESegmentType type, TSeqPos len, const CObject* object); CSegment& x_AddSegment(ESegmentType type, const CObject* object, TSeqPos refPos, TSeqPos len, ENa_strand strand = eNa_strand_plus); CSegment& x_AddGap(TSeqPos len); CSegment& x_Add(CSeqMap* submap); CSegment& x_Add(const CSeq_data& data, TSeqPos len); CSegment& x_Add(const CPacked_seqint& seq);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -