~ubuntu-branches/ubuntu/precise/ncbi-tools6/precise

« back to all changes in this revision

Viewing changes to tools/mbalign.c

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2005-03-27 12:00:15 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050327120015-embhesp32nj73p9r
Tags: 6.1.20041020-3
* Fix FTBFS under GCC 4.0 caused by inconsistent use of "static" on
  functions.  (Closes: #295110.)
* Add a watch file, now that we can.  (Upstream's layout needs version=3.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: mbalign.c,v 6.35 2001/12/28 20:38:41 dondosha Exp $
 
1
static char const rcsid[] = "$Id: mbalign.c,v 6.41 2003/10/29 17:46:59 dondosha Exp $";
 
2
 
 
3
/* $Id: mbalign.c,v 6.41 2003/10/29 17:46:59 dondosha Exp $
2
4
* ===========================================================================
3
5
*
4
6
*                            PUBLIC DOMAIN NOTICE
30
32
*
31
33
* Initial Creation Date: 10/27/1999
32
34
*
33
 
* $Revision: 6.35 $
 
35
* $Revision: 6.41 $
34
36
*
35
37
* File Description:
36
38
*        Alignment functions for Mega Blast program
37
39
*
38
40
* $Log: mbalign.c,v $
 
41
* Revision 6.41  2003/10/29 17:46:59  dondosha
 
42
* Allow 2-stage greedy extension in megablast
 
43
*
 
44
* Revision 6.40  2003/05/30 17:25:36  coulouri
 
45
* add rcsid
 
46
*
 
47
* Revision 6.39  2003/05/13 16:02:53  coulouri
 
48
* make ErrPostEx(SEV_FATAL, ...) exit with nonzero status
 
49
*
 
50
* Revision 6.38  2003/01/30 19:40:13  dondosha
 
51
* No need to add gap extension penalty to gap open in greedy alignment functions
 
52
*
 
53
* Revision 6.37  2002/08/01 21:02:12  dondosha
 
54
* Added a sanity check in GreedyAlignMemFree
 
55
*
 
56
* Revision 6.36  2002/03/20 19:56:34  dondosha
 
57
* Check entire list of readdb structures for maximal length when allocating memory for greedy algorithm
 
58
*
39
59
* Revision 6.35  2001/12/28 20:38:41  dondosha
40
60
* Moved Mega BLAST related parameters into a separate structure
41
61
*
241
261
static Int4 edit_script_more(edit_script_t *data, Uint4 op, Uint4 k)
242
262
{
243
263
    if (op == EDIT_OP_ERR) {
244
 
        ErrPostEx(SEV_FATAL, 0, 0, 
 
264
        ErrPostEx(SEV_FATAL, 1, 0, 
245
265
                  "edit_script_more: bad opcode %d:%d", op, k);
246
266
        return -1;
247
267
    }
502
522
 
503
523
   if (gap_open == 0 && gap_extend == 0)
504
524
      gap_extend = reward / 2 + penalty;
505
 
   else
506
 
      gap_open += gap_extend;
507
525
 
508
 
   if (search->rdfp)
509
 
      max_len = readdb_get_maxlen(search->rdfp);
510
 
   else
 
526
   if (search->rdfp) {
 
527
      ReadDBFILEPtr rdfp;
 
528
      for (rdfp = search->rdfp, max_len = 0; rdfp; rdfp = rdfp->next)
 
529
         max_len = MAX(max_len, readdb_get_maxlen(rdfp));
 
530
   } else
511
531
      max_len = search->subject->length;
512
532
 
513
533
   max_len = MIN(max_len, MAX_DBSEQ_LEN);
575
595
      MemFree(abmp->flast_d[0]);
576
596
      MemFree(abmp->flast_d);
577
597
   } else {
578
 
      MemFree(abmp->flast_d_affine[0]);
579
 
      MemFree(abmp->flast_d_affine);
 
598
      if (abmp->flast_d_affine) {
 
599
         MemFree(abmp->flast_d_affine[0]);
 
600
         MemFree(abmp->flast_d_affine);
 
601
      }
580
602
      MemFree(abmp->uplow_free);
581
603
   }
582
604
   MemFree(abmp->max_row_free);
672
694
    }
673
695
    if (S==NULL) 
674
696
       space = 0;
 
697
    else if (!space)
 
698
       abmp->space = space = new_mb_space();
675
699
    else 
676
700
       refresh_mb_space(space);
677
701
    
867
891
                                   mismatch_score, e1, e2, abmp, S, rem);
868
892
    }
869
893
    
870
 
    gap_open += gap_extend;
871
 
    
872
894
    Mis_cost = mismatch_score + match_score;
873
895
    GO_cost = gap_open;
874
896
    GE_cost = gap_extend+M_half;
918
940
    flast_d = abmp->flast_d_affine;
919
941
    if (S==NULL) {
920
942
        space = 0;
921
 
    } else { 
 
943
    } else if (!space) {
 
944
       abmp->space = space = new_mb_space();
 
945
    } else {
922
946
        refresh_mb_space(space);
923
947
    }
924
948
    max_row = max_row_free + D_diff;