00001 #ifndef NGALIGN_BANDED_ALIGNER__HPP
00002 #define NGALIGN_BANDED_ALIGNER__HPP
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #include <corelib/ncbistd.hpp>
00036 #include <corelib/ncbiobj.hpp>
00037 #include <objects/seqloc/Na_strand.hpp>
00038
00039 #include <objects/seqloc/Seq_loc.hpp>
00040 #include <objects/seqloc/Seq_id.hpp>
00041 #include <objmgr/scope.hpp>
00042 #include <algo/blast/api/blast_types.hpp>
00043 #include <algo/blast/api/bl2seq.hpp>
00044 #include <algo/blast/api/blast_options_handle.hpp>
00045 #include <algo/blast/api/blast_nucl_options.hpp>
00046 #include <objects/seqalign/Seq_align.hpp>
00047 #include <objects/seqalign/Seq_align_set.hpp>
00048 #include <objects/seqalign/Dense_seg.hpp>
00049
00050 #include <algo/blast/api/blast_types.hpp>
00051 #include <algo/blast/api/blast_options_handle.hpp>
00052 #include <algo/blast/api/sseqloc.hpp>
00053
00054 #include <algo/align/ngalign/ngalign_interface.hpp>
00055
00056
00057 BEGIN_NCBI_SCOPE
00058
00059 BEGIN_SCOPE(objects)
00060 class CScope;
00061 class CSeq_align;
00062 class CSeq_align_set;
00063 class CSeq_id;
00064 class CDense_seg;
00065 END_SCOPE(objects)
00066
00067 BEGIN_SCOPE(blast)
00068 class SSeqLoc;
00069 class CBlastOptionsHandle;
00070 END_SCOPE(blast)
00071
00072
00073 class CSimpleBandedAligner : public IAlignmentFactory
00074 {
00075 public:
00076
00077 CSimpleBandedAligner(int Threshold, unsigned int BandWidth)
00078 : m_Threshold(Threshold), m_BandWidth(BandWidth) { ; }
00079
00080 TAlignResultsRef GenerateAlignments(objects::CScope& Scope,
00081 ISequenceSet* QuerySet,
00082 ISequenceSet* SubjectSet,
00083 TAlignResultsRef AccumResults);
00084
00085 protected:
00086
00087
00088 private:
00089
00090 int m_Threshold;
00091 unsigned int m_BandWidth;
00092
00093 void x_RunBanded(objects::CScope& Scope,
00094 CQuerySet& QueryAligns,
00095 TAlignResultsRef Results);
00096
00097 CRef<objects::CDense_seg> x_RunBandedGlobal(objects::CSeq_id& QueryId,
00098 objects::CSeq_id& SubjectId,
00099 objects::ENa_strand Strand,
00100 TSeqPos Diagonal,
00101 int BandHalfWidth,
00102 objects::CScope& Scope);
00103
00104 };
00105
00106
00107 class CInstance : public CObject {
00108 public:
00109
00110 CInstance(const CRef<objects::CSeq_align> Align);
00111 CInstance(const objects::CSeq_align_set& AlignSet);
00112
00113 void MergeIn(CRef<objects::CSeq_align> Align);
00114
00115 bool IsAlignmentContained(const objects::CSeq_align& Align) const;
00116 int GapDistance(const objects::CSeq_align& Align) const;
00117
00118 objects::CSeq_interval Query;
00119 objects::CSeq_interval Subject;
00120 objects::CSeq_align_set Alignments;
00121 };
00122
00123 class CInstancedAligner : public IAlignmentFactory
00124 {
00125 public:
00126
00127 CInstancedAligner(int TimeOutSeconds, int Threshold)
00128 : m_TimeOutSeconds(TimeOutSeconds), m_Threshold(Threshold),
00129 m_Match(2), m_Mismatch(-3), m_GapOpen(-100), m_GapExtend(-1) { ; }
00130
00131
00132 void SetPathValues(int Match, int Mismatch, int GapOpen, int GapExtend)
00133 {
00134 m_Match = Match;
00135 m_Mismatch = Mismatch;
00136 m_GapOpen = GapOpen;
00137 m_GapExtend = GapExtend;
00138 }
00139
00140 TAlignResultsRef GenerateAlignments(objects::CScope& Scope,
00141 ISequenceSet* QuerySet,
00142 ISequenceSet* SubjectSet,
00143 TAlignResultsRef AccumResults);
00144
00145 protected:
00146
00147
00148 private:
00149
00150 int m_TimeOutSeconds;
00151 int m_Threshold;
00152
00153 int m_Match, m_Mismatch, m_GapOpen, m_GapExtend;
00154
00155
00156 void x_RunAligner(objects::CScope& Scope,
00157 CQuerySet& QueryAligns,
00158 TAlignResultsRef Results);
00159
00160 CRef<objects::CDense_seg> x_RunMMGlobal(const objects::CSeq_id& QueryId,
00161 const objects::CSeq_id& SubjectId,
00162 objects::ENa_strand Strand,
00163 TSeqPos QueryStart,
00164 TSeqPos QueryStop,
00165 TSeqPos SubjectStart,
00166 TSeqPos SubjectStop,
00167 objects::CScope& Scope);
00168
00169 CRef<objects::CSeq_align_set> x_RunCleanup(const objects::CSeq_align_set& AlignSet,
00170 objects::CScope& Scope);
00171
00172 void x_GetCleanupInstances(CQuerySet& QueryAligns, objects::CScope& Scope,
00173 vector<CRef<CInstance> >& Instances);
00174 void x_GetDistanceInstances(CQuerySet& QueryAligns, objects::CScope& Scope,
00175 vector<CRef<CInstance> >& Instances);
00176 };
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187 END_NCBI_SCOPE
00188
00189 #endif
00190
00191