ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/seqalign/GXAlign.h
(Generate patch)
# Line 2 | Line 2
2  
3   #include "GBase.h"
4   #include "GList.hh"
5 + #include <string.h>
6  
7 < #define GDEBUG 1
7 > //#define GDEBUG 1
8  
9   enum {
10      EDIT_OP_MASK = 0x3,
# Line 227 | Line 228
228     int** last_seq2_off;              // 2-D array of distances
229     int* max_score;                   // array of maximum scores
230     GXMemPool* space;                // local memory pool for SGreedyOffset structs
231 <
231 >   int d_diff;
232 >   int max_d;
233     // Allocate memory for the greedy gapped alignment algorithm
234     SGreedyAlignMem(int reward, int penalty, int Xdrop) {
235 <      int max_d, d_diff;
235 >      //int max_d, diff_d;
236        if (penalty<0) penalty=-penalty;
237        if (reward % 2) {
238           //scale params
# Line 265 | Line 267
267           GError(GX_GALLOC_ERROR);
268      } //consructor
269  
270 +   void reset() {
271 +     space->refresh();
272 +     if (last_seq2_off) {
273 +         GFREE((last_seq2_off[0]));
274 +         }
275 +     GFREE(max_score);
276 +     GCALLOC(last_seq2_off[0], ((max_d + max_d + 6) * sizeof(int) * 2));
277 +     if (!last_seq2_off[0]) GError(GX_GALLOC_ERROR);
278 +     //allocates contiguous memory for 2 rows here
279 +     last_seq2_off[1] = last_seq2_off[0] + max_d + max_d + 6;
280 +     GCALLOC(max_score, (sizeof(int) * (max_d + 1 + d_diff)));
281 +     if (!max_score) GError(GX_GALLOC_ERROR);
282 +     }
283     ~SGreedyAlignMem() {
284       if (last_seq2_off) {
285           GFREE(last_seq2_off[0]);
# Line 418 | Line 433
433   int score;
434   double pid;
435   GXEditScript* editscript;
421 //GXAlnMem* abmp;
422 SGreedyAlignMem* alnmem;
436   CAlnGapInfo* gapinfo;
437   GXAlnInfo(const char* q, int q_l, int q_r, const char* s, int s_l, int s_r,
438        int sc=0, double percid=0) {
# Line 431 | Line 444
444      sr=s_r;
445      score=sc;
446      pid=percid;
447 <    //editscript=NULL;
447 >    editscript=NULL;
448      gapinfo=NULL;
449      }
450    ~GXAlnInfo() {
451      delete editscript;
439    delete alnmem;
452      delete gapinfo;
453      }
454    bool operator<(GXAlnInfo& d) {
# Line 575 | Line 587
587   };
588  
589  
590 < GXBandSet* collectSeeds_R(GList<GXSeed>& seeds, const char* seqa, int a_len, const char* seqb, int b_len); //overlap of 3' end of seqb
591 < //void collectSeeds_L(GList<GXSeed>& seeds, const char* seqa, const char* seqb); //overlap of 5' end of seqb
590 > GXBandSet* collectSeeds_R(GList<GXSeed>& seeds, const char* seqa, int a_len, const char* seqb, int b_len); //for overlap at 3' end of seqb
591 >
592 > GXBandSet* collectSeeds_L(GList<GXSeed>& seeds, const char* seqa, int a_len, const char* seqb, int b_len); //for overlap at 5' end of seqb
593  
594   void printEditScript(GXEditScript* ed_script);
595  
# Line 589 | Line 602
602                         SGreedyAlignMem& aux_data,
603                         GXEditScript *edit_block);
604  
605 +
606 + enum GAlnTrimType {
607 +  galn_NoTrim=0,
608 +  galn_TrimLeft,
609 +  galn_TrimRight
610 +  };
611 +
612   // reward MUST be >1, always
613   GXAlnInfo* GreedyAlignRegion(const char* q_seq, int q_alnstart, int q_max,
614 <                  const char* s_seq, int s_alnstart, int s_max,
615 <                     bool editscript=false, int reward=2, int penalty=3, int xdrop=8);
614 >                  const char* s_seq, int s_alnstart, int s_max, GAlnTrimType trimtype=galn_NoTrim,
615 >                     bool editscript=false, SGreedyAlignMem* gxmem=NULL, int reward=2, int penalty=3, int xdrop=8);
616   GXAlnInfo* GreedyAlign(const char* q_seq,  int q_alnstart, const char* s_seq, int s_alnstart,
617          bool editscript=false, int reward=2, int penalty=3, int xdrop=8);
618  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines