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

📄 splign_compartment_finder.hpp

📁 ncbi源码
💻 HPP
字号:
/* * =========================================================================== * PRODUCTION $Log: splign_compartment_finder.hpp,v $ * PRODUCTION Revision 1000.0  2004/06/01 18:12:38  gouriano * PRODUCTION PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.4 * PRODUCTION * =========================================================================== */#ifndef ALGO_ALIGN_SPLIGN_COMPARTMENT_FINDER__HPP#define ALGO_ALIGN_SPLIGN_COMPARTMENT_FINDER__HPP/* $Id: splign_compartment_finder.hpp,v 1000.0 2004/06/01 18:12:38 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:  Yuri Kapustin** File Description:  Compartment Finder*                   * ===========================================================================*/#include <algo/align/splign/splign_hit.hpp>#include <corelib/ncbi_limits.hpp>#include <vector>BEGIN_NCBI_SCOPE// Detect all compartments over a hit setclass CCompartmentFinder {public:  // hits must be in plus strand  CCompartmentFinder(vector<CHit>::const_iterator start,                     vector<CHit>::const_iterator finish);  // setters and getters  void SetIntronLimits(size_t intr_min, size_t intr_max) {    m_intron_min = intr_min;    m_intron_max = intr_max;  }  static size_t GetDefaultIntronMin(void) {    return 0;  }  static size_t GetDefaultIntronMax(void) {    return 750000;  }  void SetPenalty(size_t penalty) {    m_penalty = penalty;  }  void SetMinCoverage(size_t mincov) {    m_min_coverage = mincov;  }  static size_t GetDefaultPenalty(void) {    return 1000;  }  static size_t GetDefaultMinCoverage(void) {    return 500;  }  size_t Run(void); // do the compartment search  // order compartments by lower subj coordinate  void OrderCompartments(void);  // single compartment representation  class CCompartment {  public:    CCompartment(void) {      m_coverage = 0;      m_box[0] = m_box[2] = kMax_UInt;      m_box[1] = m_box[3] = 0;    }        const vector<const CHit*>& GetMembers(void) {      return m_members;    }        void AddMember(const CHit* hit) {      m_members.push_back(hit);    }        void UpdateMinMax(void);    bool GetStrand(void) const;    const CHit* GetFirst(void) const {      m_iter = 0;      return GetNext();    }    const CHit* GetNext(void) const {      if(m_iter < m_members.size()) {        return m_members[m_iter++];      }      return 0;    }    const size_t* GetBox(void) const {      return m_box;    }    bool operator < (const CCompartment& rhs) {      return m_coverage < rhs.m_coverage;    }    friend bool PLowerSubj(const CCompartment& c1, const CCompartment& c2) {      return c1.m_box[2] < c2.m_box[2];    }  protected:    size_t              m_coverage;    vector<const CHit*> m_members;    size_t              m_box[4];    mutable size_t      m_iter;  };  // iterate through compartments  CCompartment* GetFirst(void);  CCompartment* GetNext(void);private:  size_t                m_intron_min, m_intron_max; // intron limits  size_t                m_penalty;                  // penalty per compartment  size_t                m_min_coverage;  vector<const CHit*>   m_hits;         // input hits  vector<CCompartment>  m_compartments; // final compartments  int                   m_iter;         // GetFirst/Next index  // this structure describes the best target reached   // at a given query coordinatea    struct SQueryMark {    size_t       m_coord;    int          m_score;    int          m_hit;    SQueryMark(size_t coord, int score, int hit):      m_coord(coord), m_score(score), m_hit(hit) {}    bool operator < (const SQueryMark& rhs) const {      return m_coord < rhs.m_coord;    }  };  struct SHitStatus {    enum EType {      eNone,       eExtension,      eOpening    };    EType m_type;    int   m_prev;    SHitStatus(void): m_type(eNone), m_prev(-1) {}    SHitStatus(EType type, int prev): m_type(type), m_prev(prev) {}  };};// Facilitate access to compartments over a hit setclass CCompartmentAccessor{public:  // [start,finish) are assumed to share same query and subj  CCompartmentAccessor(vector<CHit>::iterator start,                       vector<CHit>::iterator finish,                       size_t comp_penalty_bps,                       size_t min_coverage);    bool GetFirst(vector<CHit>& compartment);  bool GetNext(vector<CHit>& compartment);  size_t GetCount(void) const {    return m_pending.size();  }  void Get(size_t i, vector<CHit>& compartment) const {    compartment = m_pending[i];  }  const size_t* GetBox(size_t i) const {    return &m_ranges.front() + i*4;  }  bool GetStrand(size_t i) const {    return m_strands[i];  }private:  vector<vector<CHit> > m_pending;  vector<size_t>        m_ranges;  vector<bool>          m_strands;  size_t                m_iter;  void x_Copy2Pending(CCompartmentFinder& finder);};END_NCBI_SCOPE/* * =========================================================================== * $Log: splign_compartment_finder.hpp,v $ * Revision 1000.0  2004/06/01 18:12:38  gouriano * PRODUCTION: IMPORTED [GCC34_MSVC7] Dev-tree R1.4 * * Revision 1.4  2004/05/04 15:23:45  ucko * Split splign code out of xalgoalign into new xalgosplign. * * Revision 1.3  2004/04/23 14:37:44  kapustin * *** empty log message *** * * ========================================================================== */#endif

⌨️ 快捷键说明

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