NCBI C++ ToolKit
banded_aligner.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef NGALIGN_BANDED_ALIGNER__HPP
2 #define NGALIGN_BANDED_ALIGNER__HPP
3 
4 /* $Id: banded_aligner.hpp 47096 2010-09-10 16:21:43Z dicuccio $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Nathan Bouk
30  *
31  * File Description:
32  *
33  */
34 
35 #include <corelib/ncbistd.hpp>
36 #include <corelib/ncbiobj.hpp>
38 
41 #include <objmgr/scope.hpp>
49 
51 
52 
54 
56  class CScope;
57  class CSeq_align;
58  class CSeq_align_set;
59  class CSeq_id;
60  class CDense_seg;
62 
63 
64 
65 
66 class CInstance : public CObject {
67 public:
68 
70  CInstance(const objects::CSeq_align_set& AlignSet);
71 
72  void MergeIn(CRef<objects::CSeq_align> Align);
73 
74  bool IsAlignmentContained(const objects::CSeq_align& Align) const;
75  int GapDistance(const objects::CSeq_align& Align) const;
76 
77  double SubjToQueryRatio() const;
78  TSeqPos QueryLength() const;
79 
80  objects::CSeq_interval Query;
81  objects::CSeq_interval Subject;
82  objects::CSeq_align_set Alignments;
83 };
84 
85 
87 {
88 public:
89 
90  CInstancedAligner(int TimeOutSeconds, float MaxRatio, float MinPctCoverage, int Threshold)
91  : m_TimeOutSeconds(TimeOutSeconds), m_MaxRatio(MaxRatio),
92  m_MinPctCoverage(MinPctCoverage), m_Threshold(Threshold),
93  m_Match(2), m_Mismatch(-3), m_GapOpen(-100), m_GapExtend(-1) { ; }
94 
95  // Defaults to +2, -3, -100, -1
96  void SetPathValues(int Match, int Mismatch, int GapOpen, int GapExtend)
97  {
98  m_Match = Match;
99  m_Mismatch = Mismatch;
100  m_GapOpen = GapOpen;
101  m_GapExtend = GapExtend;
102  }
103 
104  string GetName() const { return "instanced_mm_aligner"; }
105 
106  TAlignResultsRef GenerateAlignments(objects::CScope& Scope,
107  ISequenceSet* QuerySet,
108  ISequenceSet* SubjectSet,
109  TAlignResultsRef AccumResults);
110 
111 protected:
112 
113 
114 private:
115 
117  float m_MaxRatio;
120 
122 
123 
124  void x_RunAligner(objects::CScope& Scope,
125  CQuerySet& QueryAligns,
126  TAlignResultsRef Results);
127 
128  CRef<objects::CDense_seg> x_RunMMGlobal(const objects::CSeq_id& QueryId,
129  const objects::CSeq_id& SubjectId,
130  objects::ENa_strand Strand,
131  TSeqPos QueryStart,
132  TSeqPos QueryStop,
133  TSeqPos SubjectStart,
134  TSeqPos SubjectStop,
135  objects::CScope& Scope);
136 
137  CRef<objects::CSeq_align_set> x_RunCleanup(const objects::CSeq_align_set& AlignSet,
138  objects::CScope& Scope);
139 
140  void x_GetCleanupInstances(CQuerySet& QueryAligns, objects::CScope& Scope,
141  vector<CRef<CInstance> >& Instances);
142  void x_GetDistanceInstances(CQuerySet& QueryAligns, objects::CScope& Scope,
143  vector<CRef<CInstance> >& Instances);
144 
145  void x_FilterInstances(vector<CRef<CInstance> >& Instances, double MaxRatio);
146 
147  bool x_MinCoverageCheck(const CQuerySet& QueryAligns);
148 };
149 
150 
151 
152 
153 //TSeqPos x_CalcQueryCoverage(TAlignSetRef Alignments, int Row, objects::CScope& Scope);
154 
155 
156 
157 
158 
160 
161 #endif
Declares the CBl2Seq (BLAST 2 Sequences) class.
Declares the CBlastNucleotideOptionsHandle class.
Declares the CBlastOptionsHandle and CBlastOptionsFactory classes.
Definitions of special type used in BLAST.
objects::CSeq_interval Subject
CInstance(const objects::CSeq_align_set &AlignSet)
objects::CSeq_align_set Alignments
CInstance(const CRef< objects::CSeq_align > Align)
objects::CSeq_interval Query
string GetName() const
TAlignResultsRef GenerateAlignments(objects::CScope &Scope, ISequenceSet *QuerySet, ISequenceSet *SubjectSet, TAlignResultsRef AccumResults)
void SetPathValues(int Match, int Mismatch, int GapOpen, int GapExtend)
void x_FilterInstances(vector< CRef< CInstance > > &Instances, double MaxRatio)
CRef< objects::CSeq_align_set > x_RunCleanup(const objects::CSeq_align_set &AlignSet, objects::CScope &Scope)
void x_RunAligner(objects::CScope &Scope, CQuerySet &QueryAligns, TAlignResultsRef Results)
void x_GetDistanceInstances(CQuerySet &QueryAligns, objects::CScope &Scope, vector< CRef< CInstance > > &Instances)
void x_GetCleanupInstances(CQuerySet &QueryAligns, objects::CScope &Scope, vector< CRef< CInstance > > &Instances)
CRef< objects::CDense_seg > x_RunMMGlobal(const objects::CSeq_id &QueryId, const objects::CSeq_id &SubjectId, objects::ENa_strand Strand, TSeqPos QueryStart, TSeqPos QueryStop, TSeqPos SubjectStart, TSeqPos SubjectStop, objects::CScope &Scope)
CInstancedAligner(int TimeOutSeconds, float MaxRatio, float MinPctCoverage, int Threshold)
bool x_MinCoverageCheck(const CQuerySet &QueryAligns)
CObject –.
Definition: ncbiobj.hpp:180
CScope –.
Definition: scope.hpp:92
Include a standard set of the NCBI C++ Toolkit most basic headers.
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
ENa_strand
strand of nucleic acid
Definition: Na_strand_.hpp:64
Portable reference counted smart and weak pointers using CWeakRef, CRef, CObject and CObjectEx.
Modified on Mon Apr 01 03:54:48 2024 by modify_doxy.py rev. 669887