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

« back to all changes in this revision

Viewing changes to demo/copymat.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
 
static char const rcsid[] = "$Id: copymat.c,v 6.45 2006/09/15 15:45:35 madden Exp $";
 
1
static char const rcsid[] = "$Id: copymat.c,v 6.48 2008/02/01 14:04:25 madden Exp $";
2
2
 
3
3
/*
4
4
* ===========================================================================
36
36
score matrices output by makematrices into a single byte-encoded file.
37
37
   
38
38
$Log: copymat.c,v $
 
39
Revision 6.48  2008/02/01 14:04:25  madden
 
40
LookupTableWrapInit prototype change
 
41
 
 
42
Revision 6.47  2006/11/24 19:06:15  kans
 
43
added include of blast_filter.h
 
44
 
 
45
Revision 6.46  2006/11/21 17:24:20  papadopo
 
46
1. rearrange headers
 
47
2. change lookup table type
 
48
 
39
49
Revision 6.45  2006/09/15 15:45:35  madden
40
50
Change to LookupTableWrapInit
41
51
 
169
179
#include <sequtil.h>
170
180
#include <seqport.h>
171
181
#include <tofasta.h>
 
182
#include <algo/blast/core/blast_aalookup.h>
 
183
#include <algo/blast/core/blast_stat.h>
172
184
#include <algo/blast/core/blast_encoding.h>
 
185
#include <algo/blast/core/lookup_wrap.h>
173
186
#include <algo/blast/core/blast_filter.h>
174
187
 
175
188
#ifndef MAXLINELEN
429
442
    return(totalLength);
430
443
}
431
444
 
432
 
static Boolean RPSUpdateOffsets(BlastLookupTable *lookup)
 
445
static Boolean RPSUpdateOffsets(BlastAaLookupTable *lookup)
433
446
{
434
447
    Uint4 len;
435
448
    Int4 index;
471
484
   pointers relative to the start of "mod_lookup_table_memory" chunk 
472
485
   RPS Blast will calculate real pointers in run time using these values
473
486
*/
474
 
Boolean RPSUpdatePointers(BlastLookupTable *lookup, Uint4 *new_overflow, Uint4 *new_overflow_size)
 
487
Boolean RPSUpdatePointers(BlastAaLookupTable *lookup, Uint4 *new_overflow, Uint4 *new_overflow_size)
475
488
{
476
489
    Uint4 len;
477
490
    Int4 index;
516
529
   Write lookup table to the disk into file "*.loo", which will be
517
530
   used memory-mapped during RPS Blast search 
518
531
*/
519
 
Boolean RPSDumpLookupTable(BlastLookupTable *lookup, FILE *fd)
 
532
Boolean RPSDumpLookupTable(BlastAaLookupTable *lookup, FILE *fd)
520
533
{
521
534
    Uint4 *new_overflow;
522
535
    Uint4 new_overflow_size;
523
 
    LookupBackboneCell empty_cell;
 
536
    AaLookupBackboneCell empty_cell;
524
537
    Int4 index;
525
538
 
526
539
    RPSUpdateOffsets(lookup);
528
541
    new_overflow = malloc(lookup->overflow_size*sizeof(Uint4)); 
529
542
    RPSUpdatePointers(lookup, new_overflow, &new_overflow_size);
530
543
 
531
 
    FileWrite(lookup->thick_backbone, sizeof(LookupBackboneCell), lookup->backbone_size, fd);
 
544
    FileWrite(lookup->thick_backbone, sizeof(AaLookupBackboneCell), lookup->backbone_size, fd);
532
545
    
533
546
    /* write empty cells out to the thick backbone size that
534
547
       RPS blast expects */
593
606
    Int4Ptr offsets;
594
607
    Int4 num_lookups;
595
608
    BlastSeqLoc *lookup_segment=NULL;
596
 
    BlastLookupTable *lookup;
 
609
    BlastAaLookupTable *lookup;
597
610
    LookupTableWrap* lookup_wrap_ptr=NULL;
598
611
    LookupTableOptions* lookup_options;
599
612
   
627
640
    BlastSeqLocNew(&lookup_segment, 0, all_length);
628
641
 
629
642
    /* Need query for psi-blast??  where to put the PSSM? */
630
 
    LookupTableWrapInit(NULL, lookup_options, lookup_segment, sbp, &lookup_wrap_ptr, NULL, NULL);
 
643
    LookupTableWrapInit(NULL, lookup_options, NULL, lookup_segment, sbp, &lookup_wrap_ptr, NULL, NULL);
631
644
   
632
645
    RPSPsiMatrixDetach(sbp);
633
646
    sbp = BlastScoreBlkFree(sbp);
634
647
    lookup_options = LookupTableOptionsFree(lookup_options);
635
648
    lookup_segment = BlastSeqLocFree(lookup_segment);
636
649
 
637
 
    lookup = (BlastLookupTable*) lookup_wrap_ptr->lut;
 
650
    lookup = (BlastAaLookupTable*) lookup_wrap_ptr->lut;
638
651
 
639
652
    /* Only Uint4 maximum length for lookup file allowed in current
640
653
       implementation */