~ubuntu-branches/ubuntu/edgy/ncbi-tools6/edgy

« back to all changes in this revision

Viewing changes to demo/formatdb.c

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2006-07-19 23:28:07 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060719232807-et3cdmcjgmnyleyx
Tags: 6.1.20060507-3ubuntu1
Re-merge with Debian

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
static char const rcsid[] = "$Id: formatdb.c,v 6.97 2005/09/30 14:54:32 camacho Exp $";
 
1
static char const rcsid[] = "$Id: formatdb.c,v 6.100 2006/05/04 20:07:27 camacho Exp $";
2
2
 
3
3
/*****************************************************************************
4
4
 
32
32
   
33
33
   Version Creation Date: 10/01/96
34
34
 
35
 
   $Revision: 6.97 $
 
35
   $Revision: 6.100 $
36
36
 
37
37
   File Description:  formats FASTA databases for use by BLAST
38
38
 
39
39
   $Log: formatdb.c,v $
 
40
   Revision 6.100  2006/05/04 20:07:27  camacho
 
41
   Report fatal error in case of failure to add sequence to BLAST database because
 
42
   of zero-length sequence and clean up the datababase that was being created.
 
43
 
 
44
   Revision 6.99  2006/03/14 14:36:46  camacho
 
45
   Logging changes
 
46
 
 
47
   Revision 6.98  2006/03/08 19:06:12  camacho
 
48
   Moved definition for maximum number of volumes to readdb.[ch], fixes rt ticket 15147600
 
49
 
40
50
   Revision 6.97  2005/09/30 14:54:32  camacho
41
51
   Enable recognition of the formatdb configuration file to allow users to set the
42
52
   membership and link bits in the ASN.1 deflines.
483
493
 
484
494
/* Fasta file delimiters */
485
495
#define DELIM " "
486
 
#define MAX_VOLUMES 99
487
496
 
488
497
Boolean FDBCheckFastaInputs(CharPtr fasta_files, Int4 is_prot, Int8
489
498
        bases_per_vol, Int4Ptr num_inputs)
506
515
    if (!is_prot)
507
516
        predicted_dblength /= READDB_COMPRESSION_RATIO;
508
517
 
509
 
    if ((predicted_dblength/bases_per_vol) > (MAX_VOLUMES - 10)) {
 
518
    if ((predicted_dblength/bases_per_vol) > (kFDBMaxNumVolumes - 10)) {
510
519
        ErrPostEx(SEV_ERROR, 0, 0, "Using %s bases per volume will exceed "
511
520
                "the maximum number\nof volumes formatdb can create.\n"
512
521
                "Please increase this value or do not set it at all.\n",
561
570
        return 1;
562
571
 
563
572
    if (!SeqEntryLoad())
564
 
        return 0;
 
573
        return 1;
565
574
    
566
575
    if (!ErrSetLog(dump_args[logfile_arg].strvalue))
567
576
        ErrShow();
719
728
            sprintf(tmpbuf2, "%s.%cal", options->alias_file_name,
720
729
                    options->is_protein ? 'p' : 'n');
721
730
            FileRename(tmpbuf1, tmpbuf2);
722
 
            ErrLogPrintf("Renamed %s to %s\n", tmpbuf1, tmpbuf2);
 
731
            ErrLogPrintf("SUCCESS: Renamed %s to %s\n", tmpbuf1, tmpbuf2);
723
732
        } else { /* multi-volume database */
724
733
            Char *p = FD_ConstructMultivolumeDBList(options->alias_file_name,
725
734
                    rdfp_ctr);
730
739
             */
731
740
            FD_CreateAliasFileEx(options->db_title, options->alias_file_name,
732
741
                    0, options->is_protein, p, 0, 0, 0, 0, NULL, NULL);
733
 
            ErrLogPrintf("Created wrapper alias file %s for %s\n",
 
742
            ErrLogPrintf("SUCCESS: Created wrapper alias file %s for %s\n",
734
743
                    options->alias_file_name, p);
735
744
            p = MemFree(p);
736
745
        }
743
752
        /*** Convert text gi list to binary format ***/
744
753
        Int4 ngis;
745
754
        ngis = readdb_MakeGiFileBinary(options->gi_file, options->gi_file_bin);
746
 
        ErrLogPrintf("Converted %ld gi(s) to binary format on %s\n",
 
755
        ErrLogPrintf("SUCCESS: Converted %ld gi(s) to binary format on %s\n",
747
756
                ngis, options->gi_file_bin);
748
757
        FDBOptionsFree(options);
749
758
        return 0;
835
844
             }
836
845
             
837
846
             bdp = FDBGetDefAsnFromBioseq(bsp, taxid_tbl);
838
 
             FDBAddBioseq(fdbp, bsp, bdp);             
 
847
             if ( FDBAddBioseq(fdbp, bsp, bdp) ) {
 
848
                 options->clean_opt = eCleanAlways;
 
849
                 FDBCleanUp(options);
 
850
                 ErrPostEx(SEV_FATAL, 1, 0, 
 
851
                   "Fatal error when adding sequence to BLAST database.");
 
852
                 return 1;
 
853
             }
839
854
             bdp = BlastDefLineSetFree(bdp);
840
855
             SeqEntryFree(sep);
841
856
          }
1031
1046
        options->linkbit_listp = FDBDestroyLinksTable(options->linkbit_listp);
1032
1047
        options->memb_tblp = FDBDestroyMembershipsTable(options->memb_tblp);
1033
1048
    }
1034
 
    FDBOptionsFree(options);
 
1049
 
 
1050
    ErrLogPrintf("SUCCESS: formatted database %s\n",
 
1051
            options->alias_file_name ? 
 
1052
            options->alias_file_name : options->base_name);
 
1053
 
 
1054
    options = FDBOptionsFree(options);
1035
1055
 
1036
1056
    return 0;
1037
1057