~ubuntu-branches/debian/experimental/ncbi-tools6/experimental

« back to all changes in this revision

Viewing changes to algo/blast/core/blast_traceback.c

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2008-07-14 19:43:15 UTC
  • mfrom: (2.1.12 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080714194315-ed44u9ek7txva2rz
Tags: 6.1.20080302-3
tools/readdb.c: enable madvise()-based code on all glibc (hence all
Debian) systems, not just Linux.  (Closes: #490437.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: blast_traceback.c,v 1.194 2006/09/13 15:10:42 papadopo Exp $
 
1
/* $Id: blast_traceback.c,v 1.206 2007/12/07 18:25:42 kazimird Exp $
2
2
 * ===========================================================================
3
3
 *
4
4
 *                            PUBLIC DOMAIN NOTICE
50
50
 
51
51
#ifndef SKIP_DOXYGEN_PROCESSING
52
52
static char const rcsid[] = 
53
 
    "$Id: blast_traceback.c,v 1.194 2006/09/13 15:10:42 papadopo Exp $";
 
53
    "$Id: blast_traceback.c,v 1.206 2007/12/07 18:25:42 kazimird Exp $";
54
54
#endif /* SKIP_DOXYGEN_PROCESSING */
55
55
 
56
56
#include <algo/blast/core/blast_traceback.h>
61
61
#include <algo/blast/core/blast_kappa.h>
62
62
#include <algo/blast/core/blast_sw.h>
63
63
#include <algo/blast/core/phi_gapalign.h>
 
64
#include <algo/blast/core/gencode_singleton.h>
64
65
#include "blast_gapalign_priv.h"
65
66
#include "blast_psi_priv.h"
66
67
#include "blast_hits_priv.h"
133
134
        const Uint1*   query_var;     /* Current character in the query */
134
135
        query_var = query + hsp->query.gapped_start + left;
135
136
        for ( ; subject_var < subject_right; subject_var++, query_var++) {
 
137
            ASSERT(*query_var < sbp->matrix->ncols);
 
138
            ASSERT(*subject_var < sbp->matrix->nrows);
136
139
           score += sbp->matrix->data[*query_var][*subject_var];
137
140
        }
138
141
    } else {
335
338
   BlastGapAlignStruct* gap_align, BlastScoreBlk* sbp, 
336
339
   const BlastScoringParameters* score_params,
337
340
   const BlastExtensionOptions* ext_options,
338
 
   const BlastHitSavingParameters* hit_params, const Uint1* gen_code_string)
 
341
   const BlastHitSavingParameters* hit_params, const Uint1* gen_code_string,
 
342
   Boolean * fence_hit)
339
343
{
340
344
   Int4 index;
341
345
   BlastHSP* hsp;
361
365
   Int4 offsets[2];
362
366
   Int4 num_initial_hsps = hsp_list->hspcnt;
363
367
   BlastIntervalTree* tree = NULL;
 
368
   BlastHSPList * orig_hsplist = NULL;
 
369
   Boolean fence_error = FALSE;
364
370
   
365
371
   if (num_initial_hsps == 0) {
366
372
      return 0;
367
373
   }
368
 
 
 
374
   
 
375
   if (fence_hit) {
 
376
       orig_hsplist = BlastHSPListDup(hsp_list);
 
377
   }
 
378
   
369
379
   hsp_array = hsp_list->hsp_array;
370
 
 
 
380
   
371
381
   /* for Smith-Waterman, the results do not overwrite 
372
382
      the input list of HSPs one by one; instead, hsp_list
373
383
      is rebuilt from scratch */
378
388
   }
379
389
 
380
390
   if (kTranslateSubject) {
381
 
      if (!gen_code_string && program_number != eBlastTypeRpsTblastn)
382
 
         return -1;
383
 
 
 
391
      if (! gen_code_string && program_number != eBlastTypeRpsTblastn) {
 
392
          if (orig_hsplist) {
 
393
              Blast_HSPListFree(orig_hsplist);
 
394
          }
 
395
          return -1;
 
396
      }
 
397
      
384
398
      if (kIsOutOfFrame) {
385
399
         Blast_SetUpSubjectTranslation(subject_blk, gen_code_string,
386
400
                                       NULL, NULL, &partial_translation);
426
440
   tree = Blast_IntervalTreeInit(0, query_blk->length + 1,
427
441
                                 0, (subject_length > 0 ? subject_length :
428
442
                                 subject_blk->length / CODON_LENGTH) + 1);
429
 
 
 
443
   
430
444
   for (index=0; index < num_initial_hsps; index++) {
431
445
      hsp = hsp_array[index];
432
446
      if (program_number == eBlastTypeBlastx && kIsOutOfFrame) {
441
455
              query_info->contexts[hsp->context].query_offset;
442
456
          query_length = query_info->contexts[hsp->context].query_length;
443
457
      }
444
 
      
 
458
 
445
459
      /* preliminary RPS blast alignments have not had
446
460
         the composition-based correction applied yet, so
447
461
         we cannot reliably check whether an HSP is contained
453
467
       * are applied there. Such corrections should be added.
454
468
       */
455
469
      if (program_number == eBlastTypeRpsBlast ||
456
 
          !BlastIntervalTreeContainsHSP(tree, hsp, query_info, 0)) {
 
470
          !BlastIntervalTreeContainsHSP(tree, hsp, query_info,
 
471
                               hit_options->min_diag_separation)) {
457
472
 
458
473
         Int4 start_shift = 0;
459
474
         Int4 adjusted_s_length;
552
567
         } else if (kGreedyTraceback) {
553
568
             BLAST_GreedyGappedAlignment(query, adjusted_subject, 
554
569
                 query_length, adjusted_s_length, gap_align, 
555
 
                 score_params, q_start, s_start, FALSE, TRUE);
 
570
                 score_params, q_start, s_start, FALSE, TRUE,
 
571
                 fence_hit);
556
572
         } else {
557
573
             BLAST_GappedAlignmentWithTraceback(program_number, query, 
558
574
                 adjusted_subject, gap_align, score_params, q_start, s_start, 
559
 
                 query_length, adjusted_s_length);
560
 
         }
561
 
 
 
575
                 query_length, adjusted_s_length,
 
576
                 fence_hit);
 
577
         }
 
578
         
 
579
         fence_error = (fence_hit && *fence_hit);
 
580
         
 
581
         if (fence_error) {
 
582
             break;
 
583
         }
 
584
         
562
585
         if (gap_align->score >= cutoff) {
563
586
            Boolean delete_hsp = FALSE;
564
587
            Blast_HSPUpdateWithTraceback(gap_align, hsp);
612
635
       sfree(frame_offsets_a);
613
636
   }
614
637
   
615
 
   /* Remove any HSPs that share a starting or ending diagonal
616
 
      with a higher-scoring HSP. */
617
 
   Blast_HSPListPurgeHSPsWithCommonEndpoints(program_number, hsp_list);
618
 
 
619
 
   /* Sort HSPs by score again, as the scores might have changed. */
620
 
   Blast_HSPListSortByScore(hsp_list);
621
 
 
622
 
   /* Remove any HSPs that are contained within other HSPs.
623
 
      Since the list is sorted by score already, any HSP
624
 
      contained by a previous HSP is guaranteed to have a
625
 
      lower score, and may be purged. */
626
 
   Blast_IntervalTreeReset(tree);
627
 
   for (index = 0; index < hsp_list->hspcnt; index++) {
628
 
       hsp = hsp_array[index];
 
638
   if (! fence_error) {
 
639
       /* Remove any HSPs that share a starting or ending diagonal
 
640
          with a higher-scoring HSP. */
 
641
       Blast_HSPListPurgeHSPsWithCommonEndpoints(program_number, hsp_list);
 
642
 
 
643
       /* Sort HSPs by score again, as the scores might have changed. */
 
644
       Blast_HSPListSortByScore(hsp_list);
 
645
 
 
646
       /* Remove any HSPs that are contained within other HSPs.
 
647
          Since the list is sorted by score already, any HSP
 
648
          contained by a previous HSP is guaranteed to have a
 
649
          lower score, and may be purged. */
 
650
       Blast_IntervalTreeReset(tree);
 
651
       for (index = 0; index < hsp_list->hspcnt; index++) {
 
652
           hsp = hsp_array[index];
629
653
       
630
 
       if (BlastIntervalTreeContainsHSP(tree, hsp, query_info, 0)) {
631
 
           hsp_array[index] = Blast_HSPFree(hsp);
632
 
       }
633
 
       else {
634
 
           BlastIntervalTreeAddHSP(hsp, tree, query_info, 
635
 
                                   eQueryAndSubject);
 
654
           if (BlastIntervalTreeContainsHSP(tree, hsp, query_info,
 
655
                                     hit_options->min_diag_separation)) {
 
656
               hsp_array[index] = Blast_HSPFree(hsp);
 
657
           }
 
658
           else {
 
659
               BlastIntervalTreeAddHSP(hsp, tree, query_info, 
 
660
                                       eQueryAndSubject);
 
661
           }
636
662
       }
637
663
   }
 
664
   
638
665
   tree = Blast_IntervalTreeFree(tree);
639
 
 
640
 
   Blast_HSPListPurgeNullHSPs(hsp_list);
641
 
 
 
666
   
642
667
   /* Free the local query_info structure, if necessary (RPS tblastn only) */
643
668
   if (query_info != query_info_in)
644
669
      sfree(query_info);
645
670
   
646
 
   s_HSPListPostTracebackUpdate(program_number, hsp_list, query_info_in, 
647
 
                                score_params, hit_params, sbp, 
648
 
                                subject_blk->length);
 
671
   if (fence_error) {
 
672
       /* Roll back this function by restoring the input HSP list. */
 
673
       
 
674
       Blast_HSPListSwap(hsp_list, orig_hsplist);
 
675
       Blast_HSPListFree(orig_hsplist);
 
676
       
 
677
       if (gap_align->edit_script) {
 
678
           gap_align->edit_script =
 
679
               GapEditScriptDelete(gap_align->edit_script);
 
680
       }
 
681
   } else {
 
682
       Blast_HSPListPurgeNullHSPs(hsp_list);
 
683
       
 
684
       if (orig_hsplist) {
 
685
           Blast_HSPListFree(orig_hsplist);
 
686
       }
 
687
       s_HSPListPostTracebackUpdate(program_number, hsp_list, query_info_in, 
 
688
                                    score_params, hit_params, sbp, 
 
689
                                    subject_blk->length);
 
690
   }
649
691
   
650
692
   return 0;
651
693
}
746
788
 
747
789
EBlastEncoding Blast_TracebackGetEncoding(EBlastProgramType program_number) 
748
790
{
749
 
   EBlastEncoding retval = eBlastEncodingError;
750
 
 
751
 
   switch (program_number) {
752
 
   case eBlastTypeBlastn:
753
 
   case eBlastTypePhiBlastn:
754
 
      retval = eBlastEncodingNucleotide;
755
 
      break;
756
 
   case eBlastTypeBlastp:
757
 
   case eBlastTypeRpsBlast:
758
 
   case eBlastTypeBlastx:
759
 
   case eBlastTypeRpsTblastn:
760
 
   case eBlastTypePsiBlast:
761
 
   case eBlastTypePhiBlastp:
762
 
      retval = eBlastEncodingProtein;
763
 
      break;
764
 
   case eBlastTypeTblastn:
765
 
   case eBlastTypeTblastx:
766
 
      retval = eBlastEncodingNcbi4na;
767
 
      break;
768
 
   default:
769
 
      retval = eBlastEncodingError;
770
 
      break;
771
 
   }
772
 
   return retval;
 
791
    if (Blast_SubjectIsProtein(program_number)) {
 
792
        return eBlastEncodingProtein;
 
793
    } else if (Blast_SubjectIsTranslated(program_number)) {
 
794
        return eBlastEncodingNcbi4na;
 
795
    } else {
 
796
        return eBlastEncodingNucleotide;
 
797
    }
773
798
}
774
799
 
 
800
 
775
801
/** Delete extra subject sequences hits, if after-traceback hit list size is
776
802
 * smaller than preliminary hit list size.
777
803
 * @param results All results after traceback, assumed already sorted by best
940
966
   BlastQueryInfo* one_query_info = NULL;
941
967
   BLAST_SequenceBlk* one_query = NULL;
942
968
   BlastQueryInfo* concat_db_info = NULL;
 
969
   Boolean make_up_kbp = FALSE;
943
970
 
944
971
   if (!hsp_stream || !seq_src || !results) {
945
972
      return -1;
957
984
   encoding = Blast_TracebackGetEncoding(program_number);
958
985
   memset((void*) &seq_arg, 0, sizeof(seq_arg));
959
986
 
 
987
   /* the first Karlin block must be valid for traceback to
 
988
      be performed; if it is not valid (i.e. if the first query
 
989
      was completely masked), make up a valid Karlin block.
 
990
      This is possible because all gapped Karlin blocks currently
 
991
      look the same */
 
992
 
 
993
   if (sbp->kbp_gap[0] == NULL) {
 
994
       Int4 index;
 
995
       for (index = query_info->first_context; 
 
996
                        index <= query_info->last_context; index++) {
 
997
           if (sbp->kbp_gap[index] != NULL) {
 
998
               sbp->kbp_gap[0] = sbp->kbp_gap[index];
 
999
               break;
 
1000
           }
 
1001
       }
 
1002
       make_up_kbp = TRUE;
 
1003
   }
 
1004
 
960
1005
   while (BlastHSPStreamRead(hsp_stream, &hsp_list) 
961
1006
          != kBlastHSPStream_Eof) {
962
1007
 
1026
1071
      
1027
1072
      Blast_TracebackFromHSPList(program_number, hsp_list, seq_arg.seq, 
1028
1073
         one_query, one_query_info, gap_align, sbp, score_params, 
1029
 
         ext_params->options, hit_params, NULL);
 
1074
         ext_params->options, hit_params, NULL, NULL);
1030
1075
 
1031
1076
      BlastSeqSrcReleaseSequence(seq_src, (void*)&seq_arg);
1032
1077
 
1045
1090
                                    hit_params->options->hitlist_size);
1046
1091
   }
1047
1092
 
 
1093
   if (make_up_kbp)
 
1094
       sbp->kbp_gap[0] = NULL;
 
1095
 
1048
1096
   BlastQueryInfoFree(concat_db_info);
1049
1097
 
1050
1098
   /* Free the sequence block allocated inside the loop */
1088
1136
   BlastHSPResults* results = NULL;
1089
1137
   BlastHSPList* hsp_list = NULL;
1090
1138
   BlastScoreBlk* sbp;
1091
 
   Uint1* gen_code_string = NULL;
 
1139
   Int4 default_db_genetic_code = db_options->genetic_code;
1092
1140
 
1093
1141
   if (!query_info || !seq_src || !hsp_stream || !results_out) {
1094
1142
      return -1;
1100
1148
 
1101
1149
   sbp = gap_align->sbp;
1102
1150
  
1103
 
   if (db_options)
1104
 
      gen_code_string = db_options->gen_code_string;
1105
 
 
1106
1151
   /* signal the traceback stage has started */
1107
1152
   if (progress_info)
1108
1153
       progress_info->stage = eTracebackSearch;
1115
1160
                                 query_info, gap_align, score_params,
1116
1161
                                 ext_params, hit_params, rps_info, results,
1117
1162
                                 interrupt_search, progress_info);
1118
 
   } else if ((program_number == eBlastTypeBlastp ||
1119
 
               program_number == eBlastTypeTblastn ||
1120
 
               program_number == eBlastTypePhiBlastp ||
1121
 
               program_number == eBlastTypePsiBlast) &&
1122
 
              (ext_params->options->compositionBasedStats > 0 ||
1123
 
               ext_params->options->eTbackExt == eSmithWatermanTbck)) {
 
1163
   } else if (ext_params->options->compositionBasedStats > 0 ||
 
1164
              ext_params->options->eTbackExt == eSmithWatermanTbck) {
1124
1165
      status =
1125
1166
          Blast_RedoAlignmentCore(program_number, query, query_info, sbp,
1126
 
                                  hsp_stream, seq_src, gen_code_string,
1127
 
                                  score_params, ext_params, hit_params,
 
1167
                                  hsp_stream, seq_src, default_db_genetic_code,
 
1168
                                  score_params, ext_params, hit_params, 
1128
1169
                                  psi_options, results);
1129
1170
   } else {
 
1171
      Int4 i;
1130
1172
      BlastSeqSrcGetSeqArg seq_arg;
1131
1173
      EBlastEncoding encoding = Blast_TracebackGetEncoding(program_number);
1132
 
      Boolean perform_traceback = 
1133
 
         (score_params->options->gapped_calculation && 
1134
 
          (ext_params->options->ePrelimGapExt != eGreedyWithTracebackExt));
 
1174
      Boolean perform_traceback = score_params->options->gapped_calculation;
1135
1175
      const Boolean kPhiBlast = Blast_ProgramIsPhiBlast(program_number);
 
1176
      BlastHSPStreamResultBatch *batch = 
 
1177
                      Blast_HSPStreamResultBatchInit(query_info->num_queries);
 
1178
      const Boolean kSubjectRanges = !(hit_params->restricted_align ||
 
1179
                                     score_params->options->is_ooframe ||
 
1180
                                     ext_params->options->eTbackExt == 
 
1181
                                                     eSmithWatermanTbck);
1136
1182
 
1137
1183
      memset((void*) &seq_arg, 0, sizeof(seq_arg));
1138
1184
 
1139
 
      /* Retrieve all HSP lists from the HSPStream. */
1140
 
      while (BlastHSPStreamRead(hsp_stream, &hsp_list) 
 
1185
      /* Retrieve all HSP lists from the HSPStream that contain
 
1186
         hits to the next subject OID. */
 
1187
      while (BlastHSPStreamBatchRead(hsp_stream, batch) 
1141
1188
             != kBlastHSPStream_Eof) {
1142
1189
 
1143
1190
         /* check for interrupt */
1144
1191
         if (interrupt_search && (*interrupt_search)(progress_info) == TRUE) {
1145
 
             hsp_list = Blast_HSPListFree(hsp_list);
 
1192
             Blast_HSPStreamResultBatchReset(batch);
1146
1193
             status = BLASTERR_INTERRUPTED;
1147
1194
             break;
1148
1195
         }
1149
1196
 
1150
 
         /* Perform traceback here, if necessary. */
 
1197
         /* traceback will require fetching the subject sequence */
 
1198
 
1151
1199
         if (perform_traceback) {
1152
 
            seq_arg.oid = hsp_list->oid;
 
1200
            seq_arg.oid = batch->hsplist_array[0]->oid;
1153
1201
            seq_arg.encoding = encoding;
 
1202
            seq_arg.enable_ranges = kSubjectRanges;
 
1203
            seq_arg.check_oid_exclusion = TRUE;
 
1204
            
1154
1205
            BlastSequenceBlkClean(seq_arg.seq);
1155
 
            if (BlastSeqSrcGetSequence(seq_src, (void*) &seq_arg) < 0)
 
1206
            if (BlastSeqSrcGetSequence(seq_src, (void*) &seq_arg) < 0) {
 
1207
               Blast_HSPStreamResultBatchReset(batch);
1156
1208
               continue;
 
1209
            }
 
1210
 
 
1211
            /* If the subject is translated and the BlastSeqSrc implementation
 
1212
             * doesn't provide a genetic code string, use the default genetic
 
1213
             * code for all subjects (as in the C toolkit) */
 
1214
            if (Blast_SubjectIsTranslated(program_number) && 
 
1215
                seq_arg.seq->gen_code_string == NULL) {
 
1216
                seq_arg.seq->gen_code_string = 
 
1217
                    GenCodeSingletonFind(default_db_genetic_code);
 
1218
                ASSERT(seq_arg.seq->gen_code_string);
 
1219
            }
1157
1220
            
1158
1221
            if (BlastSeqSrcGetTotLen(seq_src) == 0) {
1159
1222
               /* This is not a database search, so effective search spaces
1169
1232
               if ((status = BLAST_OneSubjectUpdateParameters(program_number, 
1170
1233
                                seq_arg.seq->length, score_params->options, 
1171
1234
                                query_info, sbp, hit_params, 
1172
 
                                NULL, eff_len_params)) != 0)
1173
 
                  return status;
 
1235
                                NULL, eff_len_params)) != 0) {
 
1236
                  Blast_HSPStreamResultBatchReset(batch);
 
1237
                  break;
 
1238
               }
1174
1239
            }
1175
 
 
1176
 
            if (kPhiBlast) {
1177
 
                s_PHITracebackFromHSPList(program_number, hsp_list, query, 
1178
 
                                          seq_arg.seq, gap_align, sbp, 
1179
 
                                          score_params, hit_params, 
1180
 
                                          query_info, pattern_blk);
 
1240
         }
 
1241
 
 
1242
         /* process all the hits to this subject sequence, one
 
1243
            list at a time */
 
1244
 
 
1245
         for (i = 0; i < batch->num_hsplists; i++) {
 
1246
 
 
1247
            hsp_list = batch->hsplist_array[i];
 
1248
 
 
1249
            if (perform_traceback) {
 
1250
               if (kPhiBlast) {
 
1251
                  s_PHITracebackFromHSPList(program_number, hsp_list, query, 
 
1252
                                            seq_arg.seq, gap_align, sbp, 
 
1253
                                            score_params, hit_params, 
 
1254
                                            query_info, pattern_blk);
 
1255
               } else {
 
1256
                  Boolean fence_hit = FALSE;
 
1257
                  Boolean * fence_hit_ptr = NULL;
 
1258
                    
 
1259
                  /* prepare to deal with partial subject sequence
 
1260
                     ranges, if these are configured and a previous
 
1261
                     HSP list has not turned them off */
 
1262
                  if (seq_arg.enable_ranges == TRUE)
 
1263
                     fence_hit_ptr = &fence_hit;
 
1264
                    
 
1265
                  Blast_TracebackFromHSPList(program_number, hsp_list, query,
 
1266
                                             seq_arg.seq, query_info, 
 
1267
                                             gap_align, sbp, score_params,
 
1268
                                             ext_params->options, hit_params,
 
1269
                                             seq_arg.seq->gen_code_string,
 
1270
                                             fence_hit_ptr);
 
1271
                    
 
1272
                  if (fence_hit) {
 
1273
                     /* Disable range support and refetch the 
 
1274
                        (whole) subject sequence */
 
1275
                        
 
1276
                     seq_arg.enable_ranges = FALSE;
 
1277
                     BlastSeqSrcReleaseSequence(seq_src, (void*)&seq_arg);
 
1278
                     BlastSeqSrcGetSequence(seq_src, (void*) &seq_arg);
 
1279
                        
 
1280
                     /* Retry the alignment */
 
1281
                       
 
1282
                     Blast_TracebackFromHSPList(program_number, hsp_list, 
 
1283
                                                query, seq_arg.seq, 
 
1284
                                                query_info, gap_align,
 
1285
                                                sbp, score_params, 
 
1286
                                                ext_params->options, 
 
1287
                                                hit_params, 
 
1288
                                                seq_arg.seq->gen_code_string,
 
1289
                                                NULL);
 
1290
                  } /* fence_hit */
 
1291
               }    /* !phi_blast */
 
1292
 
1181
1293
            } else {
1182
 
                Blast_TracebackFromHSPList(program_number, hsp_list, query, 
1183
 
                                           seq_arg.seq, query_info, gap_align,
1184
 
                                           sbp, score_params, 
1185
 
                                           ext_params->options, hit_params, 
1186
 
                                           gen_code_string);
1187
 
            }
1188
 
            
1189
 
            BlastSeqSrcReleaseSequence(seq_src, (void*)&seq_arg);
1190
 
         } else if (! score_params->options->gapped_calculation) {
1191
 
             /* Compute bit scores for searches where the traceback
1192
 
                phase is seperated from the preliminary search. */
 
1294
               /* traceback skipped; compute bit scores for searches 
 
1295
                  where the traceback phase is seperated from the 
 
1296
                  preliminary search. */
1193
1297
             
1194
 
             Blast_HSPListGetBitScores(hsp_list, FALSE, sbp);
1195
 
         }
 
1298
               Blast_HSPListGetBitScores(hsp_list, FALSE, sbp);
 
1299
            }
1196
1300
         
1197
 
         /* Free HSP list structure if all HSPs have been deleted. */
1198
 
         if (hsp_list->hspcnt == 0) {
1199
 
             hsp_list = Blast_HSPListFree(hsp_list);
1200
 
             continue;
 
1301
            /* Free HSP list if all HSPs have been deleted. */
 
1302
 
 
1303
            batch->hsplist_array[i] = NULL;
 
1304
            if (hsp_list->hspcnt == 0) {
 
1305
               hsp_list = Blast_HSPListFree(hsp_list);
 
1306
            }
 
1307
            else {
 
1308
               Blast_HSPResultsInsertHSPList(results, hsp_list, 
 
1309
                                          hit_params->options->hitlist_size);
 
1310
            }
 
1311
         }      /* loop over one HSPList batch */
 
1312
 
 
1313
         if (perform_traceback) {
 
1314
            BlastSeqSrcReleaseSequence(seq_src, (void*)&seq_arg);
1201
1315
         }
1202
1316
 
1203
 
         Blast_HSPResultsInsertHSPList(results, hsp_list, 
1204
 
                                       hit_params->options->hitlist_size);
1205
 
      }
 
1317
      }         /* loop over all batches */
 
1318
 
 
1319
      batch = Blast_HSPStreamResultBatchFree(batch);
1206
1320
      BlastSequenceBlkFree(seq_arg.seq);
1207
1321
   }
1208
1322