⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 seq_vector.hpp

📁 ncbi源码
💻 HPP
📖 第 1 页 / 共 2 页
字号:
/* * =========================================================================== * PRODUCTION $Log: seq_vector.hpp,v $ * PRODUCTION Revision 1000.2  2004/04/12 17:28:00  gouriano * PRODUCTION PRODUCTION: UPGRADED [CATCHUP_003] Dev-tree R1.50 * PRODUCTION * =========================================================================== */#ifndef SEQ_VECTOR__HPP#define SEQ_VECTOR__HPP/*  $Id: seq_vector.hpp,v 1000.2 2004/04/12 17:28: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: Aleksey Grichenko, Michael Kimelman, Eugene Vasilchenko** File Description:*   Sequence data container for object manager**/#include <objmgr/bioseq_handle.hpp>#include <objmgr/scope.hpp>#include <objmgr/seq_map.hpp>#include <objmgr/seq_vector_ci.hpp>#include <objects/seq/Seq_data.hpp>#include <vector>BEGIN_NCBI_SCOPEBEGIN_SCOPE(objects)class CScope;class CSeq_loc;class CSeqMap;class CSeq_data;class CSeqVector_CI;// Sequence datastruct NCBI_XOBJMGR_EXPORT SSeqData {    TSeqPos              length;      /// Length of the sequence data piece    TSeqPos              dest_start;  /// Starting pos in the dest. Bioseq    TSeqPos              src_start;   /// Starting pos in the source Bioseq    CConstRef<CSeq_data> src_data;    /// Source sequence data};class NCBI_XOBJMGR_EXPORT CSeqVector : public CObject{public:    typedef CSeqVector_CI::TResidue TResidue;    typedef CSeqVector_CI::TCoding  TCoding;    typedef CBioseq_Handle::EVectorCoding EVectorCoding;    typedef CSeqVector_CI const_iterator;    typedef TResidue value_type;    typedef TSeqPos size_type;    typedef TSignedSeqPos difference_type;    CSeqVector(void);    CSeqVector(const CSeqMap& seqMap, CScope& scope,               EVectorCoding coding = CBioseq_Handle::eCoding_Ncbi,               ENa_strand strand = eNa_strand_unknown);    CSeqVector(CConstRef<CSeqMap> seqMap, CScope& scope,               EVectorCoding coding = CBioseq_Handle::eCoding_Ncbi,               ENa_strand strand = eNa_strand_unknown);    CSeqVector(const CSeq_loc& loc, CScope& scope,               EVectorCoding coding = CBioseq_Handle::eCoding_Ncbi,               ENa_strand strand = eNa_strand_unknown);    CSeqVector(const CSeqVector& vec);    virtual ~CSeqVector(void);    CSeqVector& operator= (const CSeqVector& vec);    bool empty(void) const;    TSeqPos size(void) const;    // 0-based array of residues    TResidue operator[] (TSeqPos pos) const;    // Fill the buffer string with the sequence data for the interval    // [start, stop).    void GetSeqData(TSeqPos start, TSeqPos stop, string& buffer) const;    void GetSeqData(const const_iterator& start,                    const const_iterator& stop,                    string& buffer) const;    typedef CSeq_inst::TMol TMol;    TMol GetSequenceType(void) const;    bool IsProtein(void) const;    bool IsNucleotide(void) const;    CScope& GetScope(void) const;    const CSeqMap& GetSeqMap(void) const;    ENa_strand GetStrand(void) const;    // Target sequence coding. CSeq_data::e_not_set -- do not    // convert sequence (use GetCoding() to check the real coding).    TCoding GetCoding(void) const;    void SetCoding(TCoding coding);    // Set coding to either Iupacaa or Iupacna depending on molecule type    void SetIupacCoding(void);    // Set coding to either Ncbi8aa or Ncbi8na depending on molecule type    void SetNcbiCoding(void);    // Set coding to either Iupac or Ncbi8xx    void SetCoding(EVectorCoding coding);    // Return gap symbol corresponding to the selected coding    TResidue GetGapChar(void) const;    bool CanGetRange(TSeqPos from, TSeqPos to) const;    bool CanGetRange(const const_iterator& from,                     const const_iterator& to) const;    const_iterator begin(void) const;    const_iterator end(void) const;private:    friend class CBioseq_Handle;    friend class CSeqVector_CI;    void x_InitSequenceType(void);    static TResidue x_GetGapChar(TCoding coding);    CSeqVector_CI& x_GetIterator(TSeqPos pos) const;    CSeqVector_CI* x_CreateIterator(TSeqPos pos) const;    static const char* sx_GetConvertTable(TCoding src, TCoding dst,                                          bool reverse);    CConstRef<CSeqMap>    m_SeqMap;    CHeapScope            m_Scope;    TSeqPos               m_Size;    TMol                  m_Mol;    ENa_strand            m_Strand;    TCoding               m_Coding;    mutable CSeqVector_CI m_Iterator;};/////////////////////////////////////////////////////////////////////////  Inline methods///////////////////////////////////////////////////////////////////////inlineCSeqVector::TResidue CSeqVector::operator[] (TSeqPos pos) const{    return *m_Iterator.SetPos(pos);}inlinebool CSeqVector::empty(void) const{    return m_Size == 0;}inlineTSeqPos CSeqVector::size(void) const{    return m_Size;}inlineCSeqVector_CI CSeqVector::begin(void) const{    return CSeqVector_CI(*this, 0);}inlineCSeqVector_CI CSeqVector::end(void) const{    return CSeqVector_CI(*this, size());}inlineCSeqVector::TCoding CSeqVector::GetCoding(void) const{    return m_Coding;}inlineCSeqVector::TResidue CSeqVector::GetGapChar(void) const{    return x_GetGapChar(GetCoding());}inlineconst CSeqMap& CSeqVector::GetSeqMap(void) const{    return *m_SeqMap;}inlineCScope& CSeqVector::GetScope(void) const{    return m_Scope;}inlineENa_strand CSeqVector::GetStrand(void) const{    return m_Strand;}inlinebool CSeqVector::CanGetRange(const const_iterator& from,                             const const_iterator& to) const{    return CanGetRange(from.GetPos(), to.GetPos());}inlineCSeqVector::TMol CSeqVector::GetSequenceType(void) const

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -