ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/fqtrim/fqtrim.cpp
(Generate patch)
# Line 957 | Line 957
957   int wlen=rlen;
958   GXSeqData seqdata;
959   int numruns=revCompl ? 2 : 1;
960 +
961   for (int ai=0;ai<adaptors3.Count();ai++) {
962     for (int r=0;r<numruns;r++) {
963       if (r) {
# Line 968 | Line 969
969                   adaptors3[ai].pz, wseq.chars(), wlen, adaptors3[ai].amlen);
970          }
971  
972 <  GXAlnInfo* bestaln=match_adaptor(seqdata, adaptors3[ai].trim_type, gxmem_r, 86);
973 <  if (bestaln) {
972 >  GXAlnInfo* aln=match_adaptor(seqdata, adaptors3[ai].trim_type, gxmem_r, 86);
973 >  if (aln) {
974       trimmed=true;
975       //keep unmatched region on the left OR right (the longer one)
976 <     if (bestaln->sl > wlen-bestaln->sr) {
976 >     if (aln->sl > wlen-aln->sr) {
977           //keep left side
978 <         l3-=(wlen-bestaln->sl+1);
978 >         l3-=(wlen-aln->sl+1);
979           if (l3<0) l3=0;
980           }
981       else { //keep right side
982 <         l5+=bestaln->sr;
982 >         l5+=aln->sr;
983           if (l5>=rlen) l5=rlen-1;
984           }
985 <     delete bestaln;
985 >     delete aln;
986       if (l3-l5+1<min_read_len) return true;
987       wseq=seq.substr(l5,l3-l5+1);
988       wlen=wseq.length();
# Line 1011 | Line 1012
1012              seqdata.update(adaptors5[ai].seq.chars(), adaptors5[ai].seq.length(),
1013                   adaptors5[ai].pz, wseq.chars(), wlen, adaptors5[ai].amlen);
1014          }
1015 <         GXAlnInfo* bestaln=match_adaptor(seqdata, adaptors5[ai].trim_type, gxmem_l, 90);
1016 <         if (bestaln) {
1015 >         GXAlnInfo* aln=match_adaptor(seqdata, adaptors5[ai].trim_type, gxmem_l, 90);
1016 >         if (aln) {
1017             trimmed=true;
1018 <           if (bestaln->sl-1 > wlen-bestaln->sr) {
1018 >           if (aln->sl-1 > wlen-aln->sr) {
1019                     //keep left side
1020 <                   l3-=(wlen-bestaln->sl+1);
1020 >                   l3-=(wlen-aln->sl+1);
1021                     if (l3<0) l3=0;
1022                     }
1023             else { //keep right side
1024 <                   l5+=bestaln->sr;
1024 >                   l5+=aln->sr;
1025                     if (l5>=rlen) l5=rlen-1;
1026                     }
1027 <           delete bestaln;
1027 >           delete aln;
1028             if (l3-l5+1<min_read_len) return true;
1029             wseq=seq.substr(l5,l3-l5+1);
1030             wlen=wseq.length();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines