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

« back to all changes in this revision

Viewing changes to tools/suggslp.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: suggslp.c,v 6.2 2003/05/30 17:25:38 coulouri Exp $";
 
1
static char const rcsid[] = "$Id: suggslp.c,v 6.3 2007/02/22 22:26:08 kans Exp $";
2
2
 
3
3
/* suggslp.c
4
4
* ===========================================================================
31
31
*
32
32
* Version Creation Date:   11/22/95
33
33
*
34
 
* $Revision: 6.2 $
 
34
* $Revision: 6.3 $
35
35
*
36
36
* File Description: 
37
37
*       Implementation of Suggest standalone prediction function. Here it
216
216
    Int4        i4Len;
217
217
    Uint1       u1Residue;
218
218
    BioseqPtr   pBSP;
219
 
    SeqPortPtr  pSeqPort;
 
219
    StreamCache  sc;
220
220
    Int2  j;
221
221
    Char  buf [BUFSIZE + 5];
222
222
 
223
223
    if (pSeqEntry == NULL || pSeqRec == NULL)
224
224
        return;
225
225
 
226
 
    /* Find out first Bioseq from SeqEntry.
227
 
     * It's necessary to create SeqPort
228
 
     */
 
226
    /* Find out first Bioseq from SeqEntry. */
229
227
    pBSP = FindFirstBioseq(pSeqEntry);
230
228
    if (pBSP == NULL)
231
229
        return; /* There is no data to get, return; */
232
230
 
233
 
    pSeqPort = SeqPortNew(pBSP, 0, -1, 0, Seq_code_iupacna);
234
 
    if (pSeqPort == NULL)
235
 
        return;
 
231
    if (! StreamCacheSetup (pBSP, NULL, STREAM_EXPAND_GAPS, &sc)) {
 
232
      return;
 
233
    }
236
234
 
237
235
    /* Allocate memory for storing bioseq's data
238
236
     */
268
266
     */
269
267
    j = 0;
270
268
    buf [0] = '\0';
271
 
    while((u1Residue = SeqPortGetResidue(pSeqPort)) != SEQPORT_EOF) {
272
 
        if (IS_residue(u1Residue)) {
 
269
    while((u1Residue = StreamCacheGetResidue(&sc)) != '\0') {
 
270
          if (IS_residue(u1Residue)) {
273
271
            u1Residue = TO_UPPER(u1Residue);
274
272
            if (u1Residue == 'U')
275
273
                u1Residue = 'T';
282
280
              BSWrite (pSeqRec->rawSeq, buf, j * sizeof (Char));
283
281
              j = 0;
284
282
            }
285
 
        }
 
283
          }
286
284
    }
287
285
        
288
 
    SeqPortFree(pSeqPort);
289
 
    
290
286
    /*
291
287
    BSPutByte(pSeqRec->rawSeq, 'N');
292
288
    BSPutByte(pSeqRec->rawSeq, 'N');
342
338
    Int4        i4TotalLen = 0;
343
339
    IdRecPtr    pIdRec;
344
340
    BioseqPtr PNTR      ppSeqList;
345
 
    SeqPortPtr  pSeqPort;
 
341
    StreamCache  sc;
346
342
    Int2  j;
347
343
    Char  buf [BUFSIZE + 5];
348
344
 
389
385
        /* Store data of each bioseq into internal suggest's data structure
390
386
         */
391
387
        i4Len = 0;
392
 
    pSeqPort = SeqPortNew(ppSeqList[i], 0, -1, 0, Seq_code_ncbieaa);
393
 
    if (pSeqPort != NULL) {
394
 
    j = 0;
395
 
    buf [0] = '\0';
396
 
        while ((iChar = SeqPortGetResidue(pSeqPort)) != SEQPORT_EOF) {
 
388
    if (StreamCacheSetup (ppSeqList[i], NULL, STREAM_EXPAND_GAPS, &sc)) {
 
389
      j = 0;
 
390
      buf [0] = '\0';
 
391
          while ((iChar = StreamCacheGetResidue(&sc)) != '\0') {
397
392
                if (IS_residue(iChar)) {
398
393
            iChar = TO_UPPER(iChar);
399
394
            if (((iChar >= 'A' && iChar <= 'Z') || iChar == '*' || iChar == '-')
415
410
            }
416
411
        }
417
412
        
418
 
    SeqPortFree(pSeqPort);
419
 
    
420
413
        if (i4Len > 0) {
421
414
            if (pSeqRec->lookForStop) {
422
415
            /*