~ubuntu-branches/ubuntu/hardy/ncbi-tools6/hardy

« back to all changes in this revision

Viewing changes to api/lsqfetch.c

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2005-09-27 15:38:20 UTC
  • mfrom: (1.1.3 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050927153820-1t1sta0qirjpxaar
Tags: 6.1.20050429-1ubuntu1
GL/GLU Transition

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
* Date     Name        Description of modification
38
38
*
39
39
* $Log: lsqfetch.c,v $
 
40
* Revision 6.30  2004/10/27 20:07:14  kans
 
41
* LsqFetch_AsnIoOpen to suppress missing file warning, similar to LsqFetch_FileOpen
 
42
*
 
43
* Revision 6.29  2004/10/26 14:45:30  kans
 
44
* LsqFetch_FileOpen suppresses FileOpen failure INFO message
 
45
*
40
46
* Revision 6.28  2004/10/05 19:11:23  kans
41
47
* separate internal CreateBinaryAsnIndex and CreateTextAsnIndex functions
42
48
*
177
183
        static CharPtr seqinfo_file = ".seqinfo";
178
184
#endif
179
185
 
 
186
/********************************************************************
 
187
*
 
188
*       Local versions of FileOpen and AsnIoOpen suppress missing file error report
 
189
*
 
190
*********************************************************************/
 
191
 
 
192
static FILE* LIBCALL LsqFetch_FileOpen (const char *filename, const char *mode)
 
193
 
 
194
{
 
195
  FILE    *fp;
 
196
  ErrSev  sev;
 
197
 
 
198
  sev = ErrSetMessageLevel (SEV_ERROR);
 
199
  fp = FileOpen (filename, mode);
 
200
  ErrSetMessageLevel (sev);
 
201
  return fp;
 
202
}
 
203
 
 
204
static AsnIoPtr LIBCALL  LsqFetch_AsnIoOpen (CharPtr file_name, CharPtr mode)
 
205
 
 
206
{
 
207
  AsnIoPtr  aip;
 
208
  ErrSev    sev;
 
209
 
 
210
  sev = ErrSetMessageLevel (SEV_ERROR);
 
211
  aip = AsnIoOpen (file_name, mode);
 
212
  ErrSetMessageLevel (sev);
 
213
  return aip;
 
214
}
 
215
 
 
216
 
180
217
/***********************************************************************
181
218
***
182
219
*
489
526
        {
490
527
                if(flp->state == FASTALIB_CLOSE)
491
528
                {
492
 
                        flp->fp = FileOpen(flp->file_name, "r");
 
529
                        flp->fp = LsqFetch_FileOpen(flp->file_name, "r");
493
530
                        if(flp->fp == NULL)
494
531
                                flp->state = FASTALIB_ERROR;
495
532
                        else
528
565
                file_name = libs->data.ptrvalue;
529
566
                if(now)
530
567
                {
531
 
                        if((fp = FileOpen(file_name, "r")) == NULL)
 
568
                        if((fp = LsqFetch_FileOpen(file_name, "r")) == NULL)
532
569
                                ok = FALSE;
533
570
                }
534
571
                if(ok)
734
771
                switch(sbfp->choice)
735
772
                {
736
773
                        case FASTA_FILE:
737
 
                                if((fp = FileOpen(c_name, "r")) != NULL)
 
774
                                if((fp = LsqFetch_FileOpen(c_name, "r")) != NULL)
738
775
                                {
739
776
                                        sep = fasta_lib_sep(fp, NULL, sip);
740
777
                                        FileClose(fp);
744
781
                        case TEXT_ASN:  
745
782
                        case BIN_ASN:
746
783
                                bin = (sbfp->choice == BIN_ASN);
747
 
                                if((aip = AsnIoOpen(c_name, bin?"rb":"r")) != NULL) 
 
784
                                if((aip = LsqFetch_AsnIoOpen(c_name, bin?"rb":"r")) != NULL) 
748
785
                                {
749
786
                                        sep = SeqEntryAsnRead(aip, NULL);
750
787
                                        AsnIoClose(aip);
1008
1045
        }
1009
1046
 
1010
1047
        seq_file = seqinfo_file;        /*check the current search path*/
1011
 
        if((fp = FileOpen(seq_file, "r")) != NULL)
 
1048
        if((fp = LsqFetch_FileOpen(seq_file, "r")) != NULL)
1012
1049
        {
1013
1050
                while(FileGets(str, 100, fp) != NULL)   /*find the right seq*/
1014
1051
                {
1162
1199
  fip = (FastaIndexPtr) MemNew (sizeof (FastaIndex));
1163
1200
  if (fip == NULL) return NULL;
1164
1201
  
1165
 
  fp = FileOpen (file, "r");
 
1202
  fp = LsqFetch_FileOpen (file, "r");
1166
1203
  if (fp == NULL) {
1167
1204
    MemFree (fip);
1168
1205
    return NULL;
1316
1353
          sprintf (file, "chr%s.fa", tmp);
1317
1354
          StringNCpy_0 (path, flfp->path, sizeof (path));
1318
1355
          FileBuildPath (path, NULL, file);
1319
 
          fp = FileOpen (path, "r");
 
1356
          fp = LsqFetch_FileOpen (path, "r");
1320
1357
          if (fp == NULL) return OM_MSG_RET_ERROR;
1321
1358
          fseek (fp, offset, SEEK_SET);
1322
1359
          dataptr = ReadAsnFastaOrFlatFile (fp, &datatype, &entityID,
1483
1520
      StringCat (file, ".fa");
1484
1521
      StringNCpy_0 (path, fip->path, sizeof (path));
1485
1522
      FileBuildPath (path, NULL, file);
1486
 
      fp = FileOpen (path, "r");
 
1523
      fp = LsqFetch_FileOpen (path, "r");
1487
1524
      if (fp == NULL) {
1488
1525
        tmp = StringStr (file, ".fa");
1489
1526
        if (tmp != NULL) {
1491
1528
          StringCat (file, ".fsa");
1492
1529
          StringNCpy_0 (path, fip->path, sizeof (path));
1493
1530
          FileBuildPath (path, NULL, file);
1494
 
          fp = FileOpen (path, "r");
 
1531
          fp = LsqFetch_FileOpen (path, "r");
1495
1532
        }
1496
1533
      }
1497
1534
      if (fp == NULL) return OM_MSG_RET_ERROR;
1659
1696
  }
1660
1697
  StringCat (path, ".idx");
1661
1698
 
1662
 
  ifp = FileOpen (file, "r");
 
1699
  ifp = LsqFetch_FileOpen (file, "r");
1663
1700
  if (ifp == NULL) return;
1664
1701
 
1665
 
  ofp = FileOpen (path, "w");
 
1702
  ofp = LsqFetch_FileOpen (path, "w");
1666
1703
  if (ofp != NULL) {
1667
1704
 
1668
1705
    /* get initial file offset */
1805
1842
    StringCat (file, ".aso");
1806
1843
    StringNCpy_0 (path, fip->path, sizeof (path));
1807
1844
    FileBuildPath (path, NULL, file);
1808
 
    aip = AsnIoOpen (path, alfp->binary? "rb" : "r");
 
1845
    aip = LsqFetch_AsnIoOpen (path, alfp->binary? "rb" : "r");
1809
1846
    if (aip == NULL) {
1810
1847
      tmp = StringStr (file, ".aso");
1811
1848
      if (tmp != NULL) {
1813
1850
        StringCat (file, ".asn");
1814
1851
        StringNCpy_0 (path, fip->path, sizeof (path));
1815
1852
        FileBuildPath (path, NULL, file);
1816
 
        aip = AsnIoOpen (path, alfp->binary? "rb" : "r");
 
1853
        aip = LsqFetch_AsnIoOpen (path, alfp->binary? "rb" : "r");
1817
1854
      }
1818
1855
    }
1819
1856
    if (aip == NULL) return OM_MSG_RET_ERROR;
2008
2045
  }
2009
2046
  StringCat (path, ".idx");
2010
2047
 
2011
 
  aip = AsnIoOpen (file, "rb");
 
2048
  aip = LsqFetch_AsnIoOpen (file, "rb");
2012
2049
  if (aip == NULL) return;
2013
2050
 
2014
 
  ofp = FileOpen (path, "w");
 
2051
  ofp = LsqFetch_FileOpen (path, "w");
2015
2052
  if (ofp != NULL) {
2016
2053
 
2017
2054
    MemSet ((Pointer) &aid, 0, sizeof (AsnIdxData));
2097
2134
  }
2098
2135
  StringCat (path, ".idx");
2099
2136
 
2100
 
  ifp = FileOpen (file, "r");
 
2137
  ifp = LsqFetch_FileOpen (file, "r");
2101
2138
  if (ifp == NULL) return;
2102
2139
 
2103
 
  ofp = FileOpen (path, "w");
 
2140
  ofp = LsqFetch_FileOpen (path, "w");
2104
2141
  if (ofp != NULL) {
2105
2142
 
2106
2143
    MemSet ((Pointer) &aid, 0, sizeof (AsnIdxData));