~ubuntu-branches/ubuntu/oneiric/ncbi-tools6/oneiric

« back to all changes in this revision

Viewing changes to algo/blast/api/blast_seq.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
1
#ifndef SKIP_DOXYGEN_PROCESSING
2
 
static char const rcsid[] = "$Id: blast_seq.c,v 1.85 2006/07/05 15:52:35 papadopo Exp $";
 
2
static char const rcsid[] = "$Id: blast_seq.c,v 1.88 2007/03/14 19:50:30 papadopo Exp $";
3
3
#endif /* SKIP_DOXYGEN_PROCESSING */
4
4
/*
5
5
* ===========================================================================
40
40
#include <algo/blast/core/blast_util.h>
41
41
#include <algo/blast/core/blast_encoding.h>
42
42
#include <algo/blast/core/blast_setup.h> /* For BlastSeqLoc_RestrictToInterval */
43
 
#include <algo/blast/core/blast_inline.h>
44
43
 
45
44
/** @addtogroup CToolkitAlgoBlast
46
45
 *
70
69
      return FALSE;
71
70
 
72
71
   /* allocate hashtable */
73
 
   hashtable = (Uint4 *)calloc(1 << kLog2HashSize, sizeof(Uint4));
 
72
   hashtable = (Uint4 *)calloc((size_t)1 << kLog2HashSize, sizeof(Uint4));
74
73
   id_entries = (SeqIdHash *)malloc((kNumSeqs + 1) * sizeof(SeqIdHash));
75
74
 
76
75
   for (slp = query_seqlocs, curr_id_num = 1; slp; slp = slp->next) {
81
80
 
82
81
       /* hash the ID of the next query sequence */
83
82
       SeqIdLabel(id, buffer, sizeof(buffer), OM_LABEL_CONTENT);
84
 
       hashval = readdb_sequence_hash(buffer, strlen(buffer));
 
83
       hashval = readdb_sequence_hash(buffer, (int)strlen(buffer));
85
84
       hashval = hashval >> (32 - kLog2HashSize);
86
85
       if (hashtable[hashval] != 0) {
87
86
          Int4 offset = hashtable[hashval];
156
155
    retval = BlastMaskLocNew(kNumSeqs*kNumContexts);
157
156
 
158
157
    /* create hashtable for query IDs */
159
 
    hashtable = (Uint4 *)calloc(1 << kLog2HashSize, sizeof(Uint4));
 
158
    hashtable = (Uint4 *)calloc((size_t)1 << kLog2HashSize, sizeof(Uint4));
160
159
    id_entries = (SeqIdHash *)malloc((kNumSeqs + 1) * sizeof(SeqIdHash));
161
160
 
162
161
    /* add the ID of each query sequence to the hashtable */
166
165
        Char buffer[64];
167
166
 
168
167
        SeqIdLabel(seq_id, buffer, sizeof(buffer), OM_LABEL_CONTENT);
169
 
        hashval = readdb_sequence_hash(buffer, strlen(buffer));
 
168
        hashval = readdb_sequence_hash(buffer, (int)strlen(buffer));
170
169
        hashval = hashval >> (32 - kLog2HashSize);
171
170
 
172
171
        id_entries[curr_id_num].id = seq_id;
191
190
 
192
191
       mask_id = SeqLocId(current_mask);
193
192
       SeqIdLabel(mask_id, buffer, sizeof(buffer), OM_LABEL_CONTENT);
194
 
       hashval = readdb_sequence_hash(buffer, strlen(buffer));
 
193
       hashval = readdb_sequence_hash(buffer, (int)strlen(buffer));
195
194
       hashval = hashval >> (32 - kLog2HashSize);
196
195
 
197
196
       /* examine only the query IDs that hash to the same value */
588
587
   if (!gen_code_eaa)
589
588
      return -1;
590
589
   smtp = SeqMapTableFind(Seq_code_ncbistdaa, Seq_code_ncbieaa);
591
 
   gen_code_length = StrLen(gen_code_eaa);
 
590
   gen_code_length = (Int4)StrLen(gen_code_eaa);
592
591
   *genetic_code = gen_code_stdaa = (Uint1*) calloc(gen_code_length+1, 1);
593
592
 
594
593
   if (!gen_code_stdaa)
740
739
       program_number == eBlastTypePhiBlastn) {
741
740
      encoding = eBlastEncodingNucleotide;
742
741
      num_frames = 2;
743
 
   } else if (program_number == eBlastTypeBlastp ||
744
 
              program_number == eBlastTypeRpsBlast ||
745
 
              program_number == eBlastTypeTblastn ||
746
 
              program_number == eBlastTypePhiBlastp) {
 
742
   } else if (Blast_QueryIsProtein(program_number)) {
747
743
      encoding = eBlastEncodingProtein;
748
744
      num_frames = 1;
749
745
   } else { /* blastx or rpstblastn, which is also essentially blastx */
785
781
   EBlastEncoding encoding;
786
782
   const Boolean kNucleotide = (program_number == eBlastTypeBlastn || 
787
783
                                program_number == eBlastTypePhiBlastn);
788
 
   const Boolean kTranslated = (program_number == eBlastTypeTblastn ||
789
 
                                program_number == eBlastTypeTblastx);
 
784
   const Boolean kTranslated = Blast_SubjectIsTranslated(program_number);
790
785
 
791
786
   if (kNucleotide)
792
787
      encoding = eBlastEncodingNucleotide;