ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/gclib/GAlnExtend.cpp
(Generate patch)
# Line 93 | Line 93
93      else
94          g = BLAST_Gcd(*a, BLAST_Gcd(*b, *c));
95      if (g > 1) {
96 <        *a /= g;
96 >                *a /= g;
97          *b /= g;
98          *c /= g;
99      }
# Line 103 | Line 103
103  
104   uint16 get6mer(char* p) {
105    uint16 r=gdna2bit(p,3);
106 <  if (*p) {
107 <   uint16 v=gdna2bit(p,3);
108 <   r |= (v<<8);
109 <   }
106 >  r <<= 6;
107 >  r |= gdna2bit(p,3);
108    return r;
109   }
110  
111 +
112 + void table6mers(const char* s, int slen, GVec<uint16>* amers[]) {
113 + for (uint16 i=0; i < slen; i++) {
114 +   char* p = (char*)(s+i);
115 +   uint16 v=get6mer(p);
116 +   if (amers[v]==NULL) {
117 +      amers[v]=new GVec<uint16>(1);
118 +      }
119 +   amers[v]->Add(i);
120 + }
121 + }
122 +
123 + GVec<uint16>* match6mer(char* start, GVec<uint16>* amers[]) {
124 +  //careful: this is broken if start+5 falls beyond the end of the string!
125 +  uint16 r=get6mer(start);
126 +  return amers[r];
127 + }
128 +
129   //signal that a diagonal is invalid
130   static const int kInvalidOffset = -2;
131  
# Line 686 | Line 702
702  
703  
704   GXBandSet* collectSeeds_R(GList<GXSeed>& seeds, const char* seqa, int a_len,
705 <        GVec<uint16> amers[], const char* seqb, int b_len) {
705 >        GVec<uint16>* amers[], const char* seqb, int b_len) {
706   //overlap of right (3') end of seqb
707   //hash the first 12 bases of seqa:
708   int aimin=0;
# Line 748 | Line 764
764   }
765  
766   GXBandSet* collectSeeds_L(GList<GXSeed>& seeds, const char* seqa, int a_len,
767 <        GVec<uint16> amers[], const char* seqb, int b_len) {
767 >        GVec<uint16>* amers[], const char* seqb, int b_len) {
768   //overlap of left (5') end of seqb
769   //hash the last 12 bases of seqa:
770   int aimin=GMAX(0,(a_len-16));
# Line 954 | Line 970
970       reward, penalty, xdrop, gxmem, trim, editscript);
971   }
972  
973 < GXAlnInfo* match_RightEnd(const char* seqa, int seqa_len, GVec<uint16> amers[],
973 > GXAlnInfo* match_RightEnd(const char* seqa, int seqa_len, GVec<uint16>* amers[],
974                   const char* seqb, int seqb_len, CGreedyAlignData* gxmem, int min_pid) {
975    bool editscript=false;
976    #ifdef GDEBUG
# Line 1061 | Line 1077
1077    else return NULL;
1078   }
1079  
1080 < GXAlnInfo* match_LeftEnd(const char* seqa, int seqa_len, GVec<uint16> amers[],
1080 > GXAlnInfo* match_LeftEnd(const char* seqa, int seqa_len, GVec<uint16>* amers[],
1081                   const char* seqb, int seqb_len, CGreedyAlignData* gxmem, int min_pid) {
1082    bool editscript=false;
1083    #ifdef GDEBUG

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines