diff options
author | Aaron M. Ucko <ucko@debian.org> | 2005-03-24 18:32:05 +0000 |
---|---|---|
committer | Aaron M. Ucko <ucko@debian.org> | 2005-03-24 18:32:05 +0000 |
commit | f06fc23cbc179836f402001f24176fc9d5725482 (patch) | |
tree | 39e97ad8f13a33296b32a3907f3409b056cf851b /demo | |
parent | ccba467ae4f393d7acce357a9847bfe1fb77ccc7 (diff) |
Load ncbi (6.1.20040616) into ncbi-tools6/branches/upstream/current.
Diffstat (limited to 'demo')
-rw-r--r-- | demo/asn2fsa.c | 80 | ||||
-rw-r--r-- | demo/asn2gb.c | 54 | ||||
-rw-r--r-- | demo/blast_driver.c | 193 | ||||
-rw-r--r-- | demo/blastall.c | 9 | ||||
-rw-r--r-- | demo/fastacmd.c | 13 | ||||
-rw-r--r-- | demo/fmerge.c | 445 | ||||
-rw-r--r-- | demo/makemat.c | 8 | ||||
-rw-r--r-- | demo/megablast.c | 9 | ||||
-rw-r--r-- | demo/tbl2asn.c | 29 |
9 files changed, 271 insertions, 569 deletions
diff --git a/demo/asn2fsa.c b/demo/asn2fsa.c index a385ffb3..2cc68fdd 100644 --- a/demo/asn2fsa.c +++ b/demo/asn2fsa.c @@ -29,7 +29,7 @@ * * Version Creation Date: 3/4/04 * -* $Revision: 1.13 $ +* $Revision: 1.16 $ * * File Description: * @@ -61,6 +61,10 @@ #include <accpubseq.h> #endif +#define ASN2FSA_APP_VER "1.0" + +CharPtr ASN2FSA_APPLICATION = ASN2FSA_APP_VER; + static ValNodePtr requested_uid_list = NULL; static TNlmMutex requested_uid_mutex = NULL; @@ -265,6 +269,7 @@ typedef struct fastaflags { FILE *aa; FILE *ql; FILE *fr; + FILE *logfp; } FastaFlagData, PNTR FastaFlagPtr; static VoidPtr DoAsyncLookup ( @@ -405,6 +410,9 @@ static ValNodePtr DoLockFarComponents ( if (NlmThreadsAvailable () && ffp->useThreads) { rsult = AsyncLockFarComponents (sep, ffp); + } else if (ffp->useThreads) { + Message (MSG_POST, "Threads not available in this executable"); + rsult = LockFarComponents (sep); } else { rsult = LockFarComponents (sep); } @@ -673,13 +681,16 @@ static void ProcessMultipleRecord ( AsnIoPtr aip; AsnModulePtr amp; AsnTypePtr atp, atp_bss, atp_desc, atp_se; + BioseqPtr bsp; ValNodePtr bsplist; - Char cmmd [256], file [FILENAME_MAX], path [PATH_MAX]; + Char buf [64], cmmd [256], file [FILENAME_MAX], path [PATH_MAX], longest [64]; Char path1 [PATH_MAX], path2 [PATH_MAX], path3 [PATH_MAX]; StreamFlgType flags = 0; FILE *fp, *tfp; + Int4 numrecords = 0; + SeqEntryPtr fsep, sep; ObjMgrPtr omp; - SeqEntryPtr sep; + time_t starttime, stoptime, worsttime; #ifdef OS_UNIX CharPtr gzcatprog; int ret; @@ -796,10 +807,28 @@ static void ProcessMultipleRecord ( flags = STREAM_EXPAND_GAPS; } + longest [0] = '\0'; + worsttime = 0; + while ((atp = AsnReadId (aip, amp, atp)) != NULL) { if (atp == atp_se) { sep = SeqEntryAsnRead (aip, atp); + starttime = GetSecs (); + buf [0] = '\0'; + + if (ffp->logfp != NULL) { + fsep = FindNthBioseq (sep, 1); + if (fsep != NULL && fsep->choice == 1) { + bsp = (BioseqPtr) fsep->data.ptrvalue; + if (bsp != NULL) { + SeqIdWrite (bsp->id, buf, PRINTID_FASTA_LONG, sizeof (buf)); + fprintf (ffp->logfp, "%s\n", buf); + fflush (ffp->logfp); + } + } + } + bsplist = NULL; if (ffp->lock) { bsplist = DoLockFarComponents (sep, ffp); @@ -820,6 +849,13 @@ static void ProcessMultipleRecord ( bsplist = UnlockFarComponents (bsplist); + stoptime = GetSecs (); + if (stoptime - starttime > worsttime && StringDoesHaveText (buf)) { + worsttime = stoptime - starttime; + StringCpy (longest, buf); + } + numrecords++; + SeqEntryFree (sep); omp = ObjMgrGet (); ObjMgrReapOne (omp); @@ -841,6 +877,13 @@ static void ProcessMultipleRecord ( FileClose (fp); #endif + if (ffp->logfp != NULL && (! StringHasNoText (longest))) { + fprintf (ffp->logfp, "Longest processing time %ld seconds on %s\n", + (long) worsttime, longest); + fprintf (ffp->logfp, "Total number of records %ld\n", (long) numrecords); + fflush (ffp->logfp); + } + sprintf (cmmd, "rm %s; rm %s; rm %s", path1, path2, path3); system (cmmd); } @@ -939,6 +982,7 @@ static void FileRecurse ( #define h_argFarOutFile 20 #define e_argLineLength 21 #define T_argThreads 22 +#define L_argLogFile 23 Args myargs [] = { {"Path to ASN.1 Files", NULL, NULL, NULL, @@ -987,21 +1031,22 @@ Args myargs [] = { TRUE, 'e', ARG_INT, 0.0, 0, NULL}, {"Use Threads", "F", NULL, NULL, TRUE, 'T', ARG_BOOLEAN, 0.0, 0, NULL}, + {"Log File", NULL, NULL, NULL, + TRUE, 'L', ARG_FILE_OUT, 0.0, 0, NULL}, }; Int2 Main (void) { + Char app [64], sfx [32]; CharPtr base, blastdb, directory, fastaidx, ntout, - aaout, qlout, frout, ptr, str, suffix; + aaout, qlout, frout, logfile, ptr, str, suffix; Boolean batch, binary, blast, compressed, dorecurse, expandgaps, fargenomicqual, fasta, local, lock, masterstyle, qualgapzero, remote, usethreads; FastaFlagData ffd; - FILE *fp = NULL; Int2 linelen, type = 0; time_t run_time, start_time, stop_time; - Char sfx [32]; /* standard setup */ @@ -1034,7 +1079,8 @@ Int2 Main (void) /* process command line arguments */ - if (! GetArgs ("asn2fsa", sizeof (myargs) / sizeof (Args), myargs)) { + sprintf (app, "asn2fsa %s", ASN2FSA_APPLICATION); + if (! GetArgs (app, sizeof (myargs) / sizeof (Args), myargs)) { return 0; } @@ -1054,7 +1100,7 @@ Int2 Main (void) local = (Boolean) myargs [k_argLocalFetch].intvalue; lock = (Boolean) myargs [l_argLockFar].intvalue; linelen = (Int2) myargs [e_argLineLength].intvalue; - usethreads = (Int2) myargs [T_argThreads].intvalue; + usethreads = (Boolean) myargs [T_argThreads].intvalue; expandgaps = (Boolean) myargs [g_argExpandGaps].intvalue; masterstyle = (Boolean) myargs [m_argMaster].intvalue; @@ -1091,6 +1137,8 @@ Int2 Main (void) qlout = (CharPtr) myargs [q_argQlOutFile].strvalue; frout = (CharPtr) myargs [h_argFarOutFile].strvalue; + logfile = (CharPtr) myargs [L_argLogFile].strvalue; + /* default to stdout for nucleotide output if nothing specified */ if (StringHasNoText (ntout) && @@ -1118,6 +1166,7 @@ Int2 Main (void) ffd.aa = NULL; ffd.ql = NULL; ffd.fr = NULL; + ffd.logfp = NULL; if (! StringHasNoText (ntout)) { ffd.nt = FileOpen (ntout, "w"); @@ -1152,6 +1201,14 @@ Int2 Main (void) ffd.lock = TRUE; } + if (! StringHasNoText (logfile)) { + ffd.logfp = FileOpen (logfile, "w"); + if (ffd.logfp == NULL) { + Message (MSG_FATAL, "Unable to open log file"); + return 1; + } + } + /* register fetch functions */ if (remote) { @@ -1161,6 +1218,7 @@ Int2 Main (void) return 1; } ffd.usePUBSEQ = TRUE; + ffd.useThreads = FALSE; #else PubSeqFetchEnable (); #endif @@ -1227,6 +1285,12 @@ Int2 Main (void) stop_time = GetSecs (); run_time = stop_time - start_time; + + if (ffd.logfp != NULL) { + fprintf (ffd.logfp, "Finished in %ld seconds\n", (long) run_time); + FileClose (ffd.logfp); + } + Message (MSG_POST, "Ran in %ld seconds", (long) run_time); /* close fetch functions */ diff --git a/demo/asn2gb.c b/demo/asn2gb.c index 0598a4bd..14411743 100644 --- a/demo/asn2gb.c +++ b/demo/asn2gb.c @@ -29,7 +29,7 @@ * * Version Creation Date: 10/21/98 * -* $Revision: 6.61 $ +* $Revision: 6.64 $ * * File Description: New GenBank flatfile generator application * @@ -50,6 +50,10 @@ #include <explore.h> #include <asn2gnbp.h> +#define ASN2GB_APP_VER "2.0" + +CharPtr ASN2GB_APPLICATION = ASN2GB_APP_VER; + static void SaveSeqEntry ( SeqEntryPtr sep, CharPtr filename @@ -145,6 +149,7 @@ static Int2 HandleSingleRecord ( CharPtr inputFile, CharPtr outputFile, FmtType format, + FmtType altformat, ModType mode, StlType style, FlgType flags, @@ -323,6 +328,9 @@ static Int2 HandleSingleRecord ( AsnIoFree (aip, FALSE); } else { SeqEntryToGnbk (sep, slp, format, mode, style, flags, locks, custom, extra, ofp); + if (altformat != 0) { + SeqEntryToGnbk (sep, slp, altformat, mode, style, flags, locks, custom, extra, ofp); + } } if (ofp != NULL) { FileClose (ofp); @@ -469,6 +477,7 @@ static void CompareFlatFiles ( SeqEntryPtr sep, FILE* fp, FmtType format, + FmtType altformat, ModType mode, StlType style, FlgType flags, @@ -496,6 +505,9 @@ static void CompareFlatFiles ( if (batch == 1) { SeqEntryToGnbk (sep, NULL, format, mode, style, flags, locks, custom, extra, fp); + if (altformat != 0) { + SeqEntryToGnbk (sep, NULL, altformat, mode, style, flags, locks, custom, extra, fp); + } return; /* just make report, nothing to diff */ } else if (batch == 2) { @@ -591,6 +603,9 @@ static void CompareFlatFiles ( #else SeqEntryToGnbk (sep, NULL, format, mode, style, flags, locks, custom, extra, fp); + if (altformat != 0) { + SeqEntryToGnbk (sep, NULL, altformat, mode, style, flags, locks, custom, extra, fp); + } #endif } @@ -648,6 +663,7 @@ static Int2 HandleMultipleRecords ( CharPtr inputFile, CharPtr outputFile, FmtType format, + FmtType altformat, ModType mode, StlType style, FlgType flags, @@ -883,8 +899,8 @@ static Int2 HandleMultipleRecords ( starttime = GetSecs (); useGbdjoin = (Boolean) (format == GENBANK_FMT && (! hasRefSeq)); CompareFlatFiles (path1, path2, path3, sep, ofp, - format, mode, style, flags, locks, custom, - extra, batch, gbdjoin, useGbdjoin); + format, altformat, mode, style, flags, locks, + custom, extra, batch, gbdjoin, useGbdjoin); stoptime = GetSecs (); if (stoptime - starttime > worsttime) { worsttime = stoptime - starttime; @@ -968,7 +984,7 @@ Args myargs [] = { FALSE, 'i', ARG_FILE_IN, 0.0, 0, NULL}, {"Output File Name", "stdout", NULL, NULL, FALSE, 'o', ARG_FILE_OUT, 0.0, 0, NULL}, - {"Format (b GenBank, e EMBL, p GenPept, t Feature Table, x GBSet)", "b", NULL, NULL, + {"Format (b GenBank, e EMBL, p GenPept, t Feature Table, x INSDSet)", "b", NULL, NULL, FALSE, 'f', ARG_STRING, 0.0, 0, NULL}, {"Mode (r Release, e Entrez, s Sequin, d Dump)", "s", NULL, NULL, FALSE, 'm', ARG_STRING, 0.0, 0, NULL}, @@ -1033,6 +1049,8 @@ Int2 Main ( { CharPtr accn = NULL; AsnIoPtr aip = NULL; + FmtType altformat = (FmtType) 0; + Char app [64]; AsnTypePtr atp = NULL; Int2 batch = 0; Boolean binary = FALSE; @@ -1054,8 +1072,6 @@ Int2 Main ( CharPtr logfile = NULL; FILE *logfp = NULL; ModType mode = SEQUIN_MODE; - Char path [PATH_MAX]; - CharPtr progname; Boolean propOK = FALSE; Int2 rsult = 0; time_t runtime, starttime, stoptime; @@ -1096,17 +1112,10 @@ Int2 Main ( return 1; } - ProgramPath (path, sizeof (path)); - progname = StringRChr (path, DIRDELIMCHR); - if (progname != NULL) { - progname++; - } else { - progname = "asn2gb"; - } - /* process command line arguments */ - if (! GetArgs (progname, sizeof (myargs) / sizeof (Args), myargs)) { + sprintf (app, "asn2gb %s", ASN2GB_APPLICATION); + if (! GetArgs (app, sizeof (myargs) / sizeof (Args), myargs)) { return 0; } @@ -1131,7 +1140,11 @@ Int2 Main ( } str = myargs [f_argFormat].strvalue; - if (StringICmp (str, "b") == 0) { + if (StringICmp (str, "bp") == 0 || StringICmp (str, "pb") == 0) { + format = GENBANK_FMT; + altformat = GENPEPT_FMT; + + } else if (StringICmp (str, "b") == 0) { format = GENBANK_FMT; } else if (StringICmp (str, "e") == 0) { format = EMBL_FMT; @@ -1304,13 +1317,13 @@ Int2 Main ( if (batch != 0 || accn != NULL) { rsult = HandleMultipleRecords (myargs [i_argInputFile].strvalue, myargs [o_argOutputFile].strvalue, - format, mode, style, flags, locks, + format, altformat, mode, style, flags, locks, custom, extra, batch, binary, compressed, propOK, gbdjoin, accn, logfp); } else { rsult = HandleSingleRecord (myargs [i_argInputFile].strvalue, myargs [o_argOutputFile].strvalue, - format, mode, style, flags, locks, + format, altformat, mode, style, flags, locks, custom, extra, type, binary, compressed, from, to, strand, itemID, do_tiny_seq, do_fasta_stream); } @@ -1322,12 +1335,11 @@ Int2 Main ( } stoptime = GetSecs (); + runtime = stoptime - starttime; if (logfp != NULL) { - fprintf (logfp, "Finished in %ld seconds\n", - (long) (stoptime - starttime)); + fprintf (logfp, "Finished in %ld seconds\n", (long) runtime); FileClose (logfp); } - runtime = stoptime - starttime; Message (MSG_POST, "Ran in %ld seconds", (long) runtime); if (myargs [r_argRemote].intvalue) { diff --git a/demo/blast_driver.c b/demo/blast_driver.c index f568f993..16a4bb01 100644 --- a/demo/blast_driver.c +++ b/demo/blast_driver.c @@ -1,4 +1,4 @@ -/* $Id: blast_driver.c,v 1.40 2004/05/05 15:30:33 dondosha Exp $ +/* $Id: blast_driver.c,v 1.46 2004/06/08 17:47:43 dondosha Exp $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -32,10 +32,10 @@ Author: Ilya Dondoshansky Contents: Main function for running BLAST ****************************************************************************** - * $Revision: 1.40 $ + * $Revision: 1.46 $ * */ -static char const rcsid[] = "$Id: blast_driver.c,v 1.40 2004/05/05 15:30:33 dondosha Exp $"; +static char const rcsid[] = "$Id: blast_driver.c,v 1.46 2004/06/08 17:47:43 dondosha Exp $"; #include <ncbi.h> #include <sqnutils.h> @@ -46,6 +46,8 @@ static char const rcsid[] = "$Id: blast_driver.c,v 1.40 2004/05/05 15:30:33 dond #include <algo/blast/core/blast_filter.h> #include <algo/blast/core/blast_util.h> #include <algo/blast/core/blast_engine.h> +#include <algo/blast/core/hspstream_collector.h> +#include <algo/blast/api/hspstream_queue.h> #include <algo/blast/api/blast_seq.h> #include <algo/blast/api/blast_input.h> #include <algo/blast/api/blast_format.h> @@ -53,6 +55,7 @@ static char const rcsid[] = "$Id: blast_driver.c,v 1.40 2004/05/05 15:30:33 dond #include <algo/blast/api/blast_format.h> #include <algo/blast/api/seqsrc_readdb.h> #include <algo/blast/api/multiseq_src.h> +#include <algo/blast/api/blast_tabular.h> #define NUMARG (sizeof(myargs)/sizeof(myargs[0])) @@ -97,7 +100,8 @@ typedef enum { ARG_FORMAT, ARG_HTML, ARG_ASNOUT, - ARG_OIDRANGE + ARG_OIDRANGE, + ARG_TABULAR } BlastArguments; static Args myargs[] = { @@ -199,7 +203,9 @@ static Args myargs[] = { { "Range of ordinal ids in the BLAST database to search.\n" "Format: \"oid1 oid2\"; ',', ':' or ';' can also be used as delimiters\n" "Full database is searched if range not provided.", /* ARG_OIDRANGE */ - NULL, NULL, NULL, TRUE, 'R', ARG_STRING, 0.0, 0, NULL} + NULL, NULL, NULL, TRUE, 'R', ARG_STRING, 0.0, 0, NULL}, + { "Produce on-the-fly tabular output", + "0", NULL, NULL, FALSE, 'B', ARG_INT, 0.0, 0, NULL} /* ARG_TABULAR */ }; static Int2 BLAST_FillRPSInfo( RPSInfo **ppinfo, Nlm_MemMap **rps_mmap, @@ -314,10 +320,9 @@ BLAST_FillOptions(LookupTableOptions* lookup_options, { char* blast_program; Boolean ag_blast = TRUE, variable_wordsize = FALSE, mb_lookup = FALSE; - Boolean greedy_extension = FALSE; + Int4 greedy_extension = 0; + Boolean greedy_with_ungapped = FALSE; Boolean is_gapped = FALSE; - Int8 totlen = 0; - Int4 numseqs = 0; Uint1 program_number; Int2 status; Boolean use_pssm = FALSE; @@ -340,7 +345,8 @@ BLAST_FillOptions(LookupTableOptions* lookup_options, mb_lookup = TRUE; variable_wordsize = FALSE; } - greedy_extension = (Boolean) myargs[ARG_GREEDY].intvalue; + greedy_extension = MIN(myargs[ARG_GREEDY].intvalue, 2); + greedy_with_ungapped = (myargs[ARG_GREEDY].intvalue == 3); } BLAST_FillLookupTableOptions(lookup_options, program_number, mb_lookup, @@ -372,42 +378,26 @@ BLAST_FillOptions(LookupTableOptions* lookup_options, query_setup_options->genetic_code = myargs[ARG_GENCODE].intvalue; BLAST_FillInitialWordOptions(word_options, program_number, - greedy_extension, myargs[ARG_WINDOW].intvalue, variable_wordsize, - ag_blast, mb_lookup, myargs[ARG_XDROP_UNGAPPED].intvalue); + (greedy_extension && !greedy_with_ungapped), + myargs[ARG_WINDOW].intvalue, variable_wordsize, ag_blast, mb_lookup, + myargs[ARG_XDROP_UNGAPPED].intvalue); BLAST_FillExtensionOptions(ext_options, program_number, greedy_extension, myargs[ARG_XDROP].intvalue, myargs[ARG_XDROP_FINAL].intvalue); - if (greedy_extension) { - switch (myargs[ARG_GREEDY].intvalue) { - case 1: - ext_options->algorithm_type = EXTEND_GREEDY; - word_options->ungapped_extension = FALSE; - break; - case 2: - ext_options->algorithm_type = EXTEND_GREEDY_NO_TRACEBACK; - word_options->ungapped_extension = FALSE; - break; - case 3: - ext_options->algorithm_type = EXTEND_GREEDY_NO_TRACEBACK; - word_options->ungapped_extension = TRUE; - break; - default: - break; - } - } - if (program_number == blast_type_rpsblast || - program_number == blast_type_rpstblastn) - BLAST_FillScoringOptions(score_options, program_number, greedy_extension, + program_number == blast_type_rpstblastn) { + BLAST_FillScoringOptions(score_options, program_number, FALSE, myargs[ARG_MISMATCH].intvalue, myargs[ARG_MATCH].intvalue, "BLOSUM62", rps_info->aux_info.gap_open_penalty, rps_info->aux_info.gap_extend_penalty); - else - BLAST_FillScoringOptions(score_options, program_number, greedy_extension, + } else { + BLAST_FillScoringOptions(score_options, program_number, + (Boolean)greedy_extension, myargs[ARG_MISMATCH].intvalue, myargs[ARG_MATCH].intvalue, myargs[ARG_MATRIX].strvalue, myargs[ARG_GAPOPEN].intvalue, myargs[ARG_GAPEXT].intvalue); + } if (program_number != blast_type_tblastx) is_gapped = !myargs[ARG_UNGAPPED].intvalue; @@ -426,8 +416,9 @@ BLAST_FillOptions(LookupTableOptions* lookup_options, hit_options->percent_identity = myargs[ARG_PERC_IDENT].floatvalue; hit_options->longest_intron = myargs[ARG_INTRON].intvalue; - BLAST_FillEffectiveLengthsOptions(eff_len_options, - numseqs, totlen, (Int8) myargs[ARG_SEARCHSP].floatvalue); + if (myargs[ARG_SEARCHSP].floatvalue != 0) { + eff_len_options->searchsp_eff = (Int8) myargs[ARG_SEARCHSP].floatvalue; + } if (db_options && (program_number == blast_type_tblastn || program_number == blast_type_rpstblastn || @@ -458,7 +449,7 @@ Int2 Nlm_Main(void) BlastHitSavingOptions* hit_options; char* dbname = NULL; LookupTableWrap* lookup_wrap; - Int2 status; + Int2 status = 0; QuerySetUpOptions* query_options=NULL; BlastEffectiveLengthsOptions* eff_len_options=NULL; BlastMaskLoc* lcase_mask = NULL; @@ -472,7 +463,7 @@ Int2 Nlm_Main(void) SeqAlign* seqalign; BlastFormattingOptions* format_options; Boolean done; - BlastReturnStat* return_stats; + BlastDiagnostics* diagnostics; Int4 ctr = 0; PSIBlastOptions* psi_options = NULL; BlastDatabaseOptions* db_options = NULL; @@ -485,6 +476,11 @@ Int2 Nlm_Main(void) Nlm_MemMapPtr rps_mmap = NULL; Nlm_MemMapPtr rps_pssm_mmap = NULL; RPSInfo *rps_info = NULL; + double scale_factor; + BlastHSPStream* hsp_stream = NULL; + Boolean tabular_output; + TNlmThread format_thread; + BlastTabularFormatData* tf_data = NULL; if (! GetArgs (buf, NUMARG, myargs)) return (1); @@ -496,11 +492,13 @@ Int2 Nlm_Main(void) ErrSetMessageLevel(SEV_WARNING); - if ((outfp = fopen(myargs[ARG_OUT].strvalue, "w")) == NULL) { + if ((outfp = FileOpen(myargs[ARG_OUT].strvalue, "w")) == NULL) { ErrPostEx(SEV_FATAL, 1, 0, "blast: Unable to open output file %s\n", myargs[ARG_OUT].strvalue); return (1); } + + tabular_output = (Boolean)myargs[ARG_TABULAR].intvalue; blast_program = strdup(myargs[ARG_PROGRAM].strvalue); BlastProgram2Number(myargs[ARG_PROGRAM].strvalue, &program_number); @@ -525,7 +523,7 @@ Int2 Nlm_Main(void) if (!myargs[ARG_DB].strvalue) { FILE *infp2; char *subject_file = strdup(myargs[ARG_SUBJECT].strvalue); - if ((infp2 = fopen(subject_file, "r")) == NULL) { + if ((infp2 = FileOpen(subject_file, "r")) == NULL) { ErrPostEx(SEV_FATAL, 1, 0, "blast: Unable to open second input file %s\n", subject_file); @@ -535,7 +533,7 @@ Int2 Nlm_Main(void) BLAST_GetQuerySeqLoc(infp2, db_is_na, 0, 0, 0, NULL, &subject_slp, 0, NULL); - fclose(infp2); + FileClose(infp2); seq_src = MultiSeqSrcInit(subject_slp, program_number); @@ -558,34 +556,39 @@ Int2 Nlm_Main(void) if (BLAST_FillRPSInfo(&rps_info, &rps_mmap, &rps_pssm_mmap, myargs[ARG_DB].strvalue) != 0) ErrPostEx(SEV_FATAL, 1, 0, "RPS Blast setup failed"); + scale_factor = rps_info->aux_info.scale_factor; + } + else { + scale_factor = 1.0; } BLAST_FillOptions(lookup_options, query_options, word_options, ext_options, hit_options, score_options, eff_len_options, psi_options, db_options, seq_src, rps_info); + if (!tabular_output) { + if ((status = BlastFormattingOptionsNew(program_number, + myargs[ARG_OUT].strvalue, + myargs[ARG_DESCRIPTIONS].intvalue, + myargs[ARG_ALIGNMENTS].intvalue, + myargs[ARG_FORMAT].intvalue, &format_options)) != 0) + return status; + format_options->html = (Boolean) myargs[ARG_HTML].intvalue; - if ((status = BlastFormattingOptionsNew(program_number, - myargs[ARG_OUT].strvalue, - myargs[ARG_DESCRIPTIONS].intvalue, - myargs[ARG_ALIGNMENTS].intvalue, - myargs[ARG_FORMAT].intvalue, &format_options)) != 0) - return status; - format_options->html = (Boolean) myargs[ARG_HTML].intvalue; - - if (seq_src) { - dbname = BLASTSeqSrcGetName(seq_src); + if (seq_src) { + dbname = BLASTSeqSrcGetName(seq_src); - BLAST_PrintOutputHeader(format_options, - myargs[ARG_GREEDY].intvalue, dbname, !db_is_na); + BLAST_PrintOutputHeader(format_options, + myargs[ARG_GREEDY].intvalue, dbname, !db_is_na); + } } - if ((infp = fopen(myargs[ARG_QUERY].strvalue, "r")) == NULL) { + if ((infp = FileOpen(myargs[ARG_QUERY].strvalue, "r")) == NULL) { ErrPostEx(SEV_FATAL, 1, 0, "blast: Unable to open input file %s\n", myargs[ARG_QUERY].strvalue); return (1); } - return_stats = (BlastReturnStat*) calloc(1, sizeof(BlastReturnStat)); + diagnostics = Blast_DiagnosticsInit(); translated_query = (program_number == blast_type_blastx || program_number == blast_type_tblastx); @@ -622,7 +625,7 @@ Int2 Nlm_Main(void) status = BLAST_MainSetUp(program_number, query_options, score_options, - hit_options, query, query_info, &lookup_segments, + hit_options, query, query_info, scale_factor, &lookup_segments, &filter_loc, &sbp, &blast_message); if (translated_query) { @@ -638,42 +641,75 @@ Int2 Nlm_Main(void) return status; } - Blast_HSPResultsInit(query_info->num_queries, &results); LookupTableWrapInit(query, lookup_options, lookup_segments, sbp, &lookup_wrap, rps_info); - if (rps_blast) + if (!tabular_output) { + Int4 num_results = (rps_blast ? BLASTSeqSrcGetNumSeqs(seq_src) : + query_info->num_queries); + /* Results in the collector stream should be sorted only for a + database search. The latter is true if and only if the sequence + source has non-zero database length. */ + Boolean sort_on_read = (BLASTSeqSrcGetTotLen(seq_src) != 0); + hsp_stream = + Blast_HSPListCollectorInit(program_number, hit_options, + num_results, sort_on_read); + } else { + hsp_stream = Blast_HSPListQueueInit(); + tf_data = Blast_TabularFormatDataInit(program_number, hsp_stream, + seq_src, query, query_info, score_options, sbp, + eff_len_options, ext_options, hit_options, db_options, + query_slp, outfp); + /* Start the formatting thread */ + if((format_thread = + NlmThreadCreate(Blast_TabularFormatThread, (void*) tf_data)) + == NULL_thread) { + fprintf(stderr, + "Cannot create thread for formatting tabular output\n"); + return 1; + } + } + + if (rps_blast) { BLAST_RPSSearchEngine(program_number, query, query_info, seq_src, sbp, score_options, lookup_wrap, word_options, ext_options, hit_options, eff_len_options, - psi_options, db_options, results, return_stats); - else + psi_options, db_options, hsp_stream, diagnostics, + (tabular_output ? NULL : &results)); + } else { BLAST_SearchEngine(program_number, query, query_info, seq_src, sbp, score_options, lookup_wrap, word_options, ext_options, hit_options, eff_len_options, - psi_options, db_options, results, return_stats); + psi_options, db_options, hsp_stream, diagnostics, + (tabular_output ? NULL : &results)); + } + if (tabular_output) { + void* join_status = NULL; + NlmThreadJoin(format_thread, &join_status); + } + + hsp_stream = BlastHSPStreamFree(hsp_stream); lookup_wrap = LookupTableWrapFree(lookup_wrap); if (rps_blast) { - Nlm_MemMapFini(rps_mmap); - Nlm_MemMapFini(rps_pssm_mmap); + Nlm_MemMapFini(rps_mmap); + Nlm_MemMapFini(rps_pssm_mmap); sfree(rps_info->aux_info.karlin_k); sfree(rps_info->aux_info.orig_score_matrix); - sfree(rps_info); + sfree(rps_info); } /* The following works because the ListNodes' data point to simple double-integer structures */ lookup_segments = ListNodeFreeData(lookup_segments); - + if (!tabular_output) { /* Convert results to the SeqAlign form */ BLAST_ResultsToSeqAlign(program_number, results, query_slp, seq_src, - subject_slp, score_options, sbp, score_options->gapped_calculation, + score_options->gapped_calculation, score_options->is_ooframe, &seqalign); results = Blast_HSPResultsFree(results); - seq_src = BlastSeqSrcFree(seq_src); if (myargs[ARG_ASNOUT].strvalue) { AsnIoPtr asnout = AsnIoOpen(myargs[ARG_ASNOUT].strvalue, (char*)"w"); @@ -686,21 +722,21 @@ Int2 Nlm_Main(void) status = BLAST_FormatResults(seqalign, dbname, blast_program, query_info->num_queries, query_slp, filter_loc, format_options, score_options->is_ooframe); - - BlastMaskLocFree(filter_loc); - PrintOutputFooter(program_number, format_options, score_options, sbp, - lookup_options, word_options, ext_options, hit_options, query_info, - dbname, return_stats, db_is_na); - + lookup_options, word_options, ext_options, + hit_options, eff_len_options, query_info, + seq_src, diagnostics); + } /* if not tabular output */ query = BlastSequenceBlkFree(query); + BlastMaskLocFree(filter_loc); query_info = BlastQueryInfoFree(query_info); BlastScoreBlkFree(sbp); query_slp = SeqLocSetFree(query_slp); } /* End loop on sets of queries */ + seq_src = BlastSeqSrcFree(seq_src); subject_slp = SeqLocSetFree(subject_slp); - sfree(return_stats); + Blast_DiagnosticsFree(diagnostics); LookupTableOptionsFree(lookup_options); BlastQuerySetUpOptionsFree(query_options); BlastExtensionOptionsFree(ext_options); @@ -710,11 +746,14 @@ Int2 Nlm_Main(void) BlastEffectiveLengthsOptionsFree(eff_len_options); PSIBlastOptionsFree(psi_options); BlastDatabaseOptionsFree(db_options); - - BlastFormattingOptionsFree(format_options); + if (!tabular_output) { + BlastFormattingOptionsFree(format_options); + } else { + FileClose(outfp); + } if (infp) - fclose(infp); + FileClose(infp); sfree(dbname); sfree(blast_program); diff --git a/demo/blastall.c b/demo/blastall.c index 0b712792..0ead6d9d 100644 --- a/demo/blastall.c +++ b/demo/blastall.c @@ -1,6 +1,6 @@ -static char const rcsid[] = "$Id: blastall.c,v 6.142 2004/04/29 19:56:00 dondosha Exp $"; +static char const rcsid[] = "$Id: blastall.c,v 6.143 2004/05/13 18:42:44 coulouri Exp $"; -/* $Id: blastall.c,v 6.142 2004/04/29 19:56:00 dondosha Exp $ +/* $Id: blastall.c,v 6.143 2004/05/13 18:42:44 coulouri Exp $ ************************************************************************** * * * COPYRIGHT NOTICE * @@ -28,6 +28,9 @@ static char const rcsid[] = "$Id: blastall.c,v 6.142 2004/04/29 19:56:00 dondosh ************************************************************************** * * $Log: blastall.c,v $ + * Revision 6.143 2004/05/13 18:42:44 coulouri + * disable -B for blastcl3 + * * Revision 6.142 2004/04/29 19:56:00 dondosha * Mask filtered locations in query sequence lines in XML output * @@ -762,8 +765,10 @@ static Args myargs[] = { sizeof(myargs) itself made optional=TRUE but this may change? */ +#ifndef BLAST_CS_API { "Number of concatenated queries, for blastn and tblastn", /* 40 */ "0", NULL, NULL, TRUE, 'B', ARG_INT, 0.0, 0, NULL} +#endif }; #ifdef BLAST_CS_API diff --git a/demo/fastacmd.c b/demo/fastacmd.c index 010bae9d..ff0521cc 100644 --- a/demo/fastacmd.c +++ b/demo/fastacmd.c @@ -1,6 +1,6 @@ -static char const rcsid[] = "$Id: fastacmd.c,v 6.29 2003/05/30 17:31:09 coulouri Exp $"; +static char const rcsid[] = "$Id: fastacmd.c,v 6.30 2004/05/13 20:54:45 coulouri Exp $"; -/* $Id: fastacmd.c,v 6.29 2003/05/30 17:31:09 coulouri Exp $ +/* $Id: fastacmd.c,v 6.30 2004/05/13 20:54:45 coulouri Exp $ * =========================================================================== * * PUBLIC DOMAIN NOTICE @@ -31,12 +31,15 @@ static char const rcsid[] = "$Id: fastacmd.c,v 6.29 2003/05/30 17:31:09 coulouri * * Initial Version Creation Date: 05/20/1997 * -* $Revision: 6.29 $ +* $Revision: 6.30 $ * * File Description: * FASTA retrievel system using ISAM indexes * * $Log: fastacmd.c,v $ +* Revision 6.30 2004/05/13 20:54:45 coulouri +* spell 'loci' correctly +* * Revision 6.29 2003/05/30 17:31:09 coulouri * add rcsid * @@ -157,10 +160,10 @@ static Args myargs [] = { " T - protein \n" " F - nucleotide", "G", NULL,NULL,TRUE,'p',ARG_STRING,0.0,0,NULL}, - { "Search string: GIs, accessions and locuses may be used delimited\n" + { "Search string: GIs, accessions and loci may be used delimited\n" " by comma.", /* 2 */ NULL, NULL, NULL, TRUE, 's', ARG_STRING, 0.0, 0, NULL}, - { "Input file wilth GIs/accessions/locuses for batch\n" + { "Input file wilth GIs/accessions/loci for batch\n" " retrieval",/* 3 */ NULL, NULL, NULL, TRUE, 'i', ARG_STRING, 0.0, 0, NULL}, { "Retrieve duplicate accessions", /* 4 */ diff --git a/demo/fmerge.c b/demo/fmerge.c deleted file mode 100644 index 1aaae442..00000000 --- a/demo/fmerge.c +++ /dev/null @@ -1,445 +0,0 @@ -/***************************************************************************** - - Name: fmerge.c - - Description: Program for merging FASTA databases. - - Author: Sergei Shavirin - - *************************************************************************** - - PUBLIC DOMAIN NOTICE - National Center for Biotechnology Information - - This software/database is a "United States Government Work" under the - terms of the United States Copyright Act. It was written as part of - the author's official duties as a United States Government employee - and thus cannot be copyrighted. This software/database is freely - available to the public for use. The National Library of Medicine and - the U.S. Government have not placed any restriction on its use or - reproduction. - - Although all reasonable efforts have been taken to ensure the accuracy - and reliability of the software and data, the NLM and the U.S. - Government do not and cannot warrant the performance or results that - may be obtained by using this software or data. The NLM and the U.S. - Government disclaim all warranties, express or implied, including - warranties of performance, merchantability or fitness for any - particular purpose. - - Please cite the author in any work or product based on this material. - - *************************************************************************** - - Modification History: - 20 August of 1996 - Shavirin - originaly written - - Bugs and restriction on use: - - Notes: - -*****************************************************************************/ -#include <ncbi.h> - -#define INCLENGTH 256 -#define STRLENGTH 128 - -typedef struct MDeflineID { - Uint4 gi; - CharPtr defline; - struct MDeflineID *next; -} MDeflineID, PNTR MDeflineIDPtr; - -typedef struct FMergeID { - MDeflineIDPtr id; - CharPtr sequence; -} FMergeID, PNTR FMergeIDPtr; - -Uint4Ptr GetIndexFromFasta(FILE *fd, Uint4Ptr MaxIndexCount); -Uint4Ptr GetIndexFromIndex(FILE *fd, Uint4Ptr MaxIndexCount); - -static FMergeIDPtr NextFastaFromFasta(FILE *fd); -Boolean IfGiInIndex(Uint4Ptr index, Uint4 MaxIndexCount, Uint4 gi); -Int4 MergeFMergeID(FMergeIDPtr fasta, - FILE *fd, FILE *fd_ind, - Uint4Ptr index, - Uint4 MaxIndexCount); -void FMergeIDFree(FMergeIDPtr fasta); - -#define NUMARG 5 - -Args dump_args[NUMARG] = { - {"Job mode (this value must be set):\n" - " 1 - create index only\n" - " 2 - update database from existing index\n" - " 3 - create index and update database\n" - " ", - - NULL, NULL,NULL,FALSE,'t',ARG_STRING, 0.0,0,NULL}, - {"Logfile name:","fmerge.log", - NULL,NULL,TRUE,'l',ARG_FILE_OUT, 0.0,0,NULL}, - {"Input file for indexing\n" - " Name of FASTA file, that you are going to update\n" - " ", - "nr", NULL,NULL,TRUE,'n',ARG_FILE_IN,0.0,0,NULL}, - - {"Input file for new gis:\n" - " Name of FASTA file with new sequences\n" - " ", - "month.aa", NULL,NULL,TRUE,'m',ARG_FILE_IN,0.0,0,NULL}, - {"Index file name\n" - " Name of file for index storage\n" - " ", - "index.nr", NULL,NULL,TRUE,'i',ARG_FILE_IN,0.0,0,NULL}, -}; - -#define JobModeStr (const char *) dump_args[0].strvalue -#define LogFileName (const char *) dump_args[1].strvalue -#define NRFile (const char *) dump_args[2].strvalue -#define MonthFile (const char *) dump_args[3].strvalue -#define IndexFile (const char *) dump_args[4].strvalue - -#define INDEX_MODE 1 -#define UPDATE_MODE 2 -#define FULL_MODE 3 - -/* ------------------------------------------------------------------ - This is handler for HeapSort function - ------------------------------------------------------------------*/ -static int LIBCALLBACK intcompare(VoidPtr i, VoidPtr j) -{ - if (*(int *)i > *(int *)j) - return (1); - if (*(int *)i < *(int *)j) - return (-1); - return (0); -} - -Int2 Main(void) -{ - Uint4Ptr index = NULL; - FILE *fd, *fd_ind, *fdout; - Uint4 i, MaxIndexCount; - FMergeIDPtr fasta; - Int4 Added =0, TotalAdded =0, SequenceAdded =0; - Int4 JobMode; - - if ( !GetArgs ("fmerge",NUMARG,dump_args) ) { - return 1; - } - if ( !ErrSetLog (LogFileName) ) { - ErrShow(); - } else { - ErrSetOpts (ERR_CONTINUE, ERR_LOG_ON); - } - - JobMode = atoi(JobModeStr); - - switch(JobMode) { - case INDEX_MODE: - ErrLogPrintf("fmerge started in \"Create index\" mode\n"); - break; - case UPDATE_MODE: - ErrLogPrintf("fmerge started in \"Update database\" mode\n"); - break; - case FULL_MODE: - ErrLogPrintf("fmerge started in \"Full mode\" mode\n"); - break; - default: - printf("fmerge mode \"%s\" invalid, exiting...\n", - JobModeStr); - exit(1); - } - - /* First creating index if necessary */ - - if(JobMode == INDEX_MODE || JobMode == FULL_MODE) { - - if((fd = FileOpen(NRFile, "r")) == NULL) { - ErrLogPrintf("Cannot open input file. Indexing failed...\n"); - exit(1); - } - ErrLogPrintf("Using file \"%s\" to create index\n", NRFile); - - if((index = GetIndexFromFasta(fd, &MaxIndexCount)) == NULL) { - ErrLogPrintf("Error in creating gi index from FASTA file\n"); - } - FileClose(fd); - ErrLogPrintf("Created index of %d gis\n", MaxIndexCount); - - fd_ind = FileOpen(IndexFile, "w"); - for(i = 0; i < MaxIndexCount; i++) - fprintf(fd_ind, "%ld\n", index[i]); - FileClose(fd_ind); - - if(JobMode == INDEX_MODE) { - MemFree(index); - exit(0); - } - } - - if(JobMode == UPDATE_MODE) { - - if((fd_ind = FileOpen(IndexFile, "r")) == NULL) { - ErrLogPrintf("Cannot open file with index. Exiting...\n"); - exit(1); - } - if((index = GetIndexFromIndex(fd_ind, &MaxIndexCount)) == NULL) { - ErrLogPrintf("Error in creating gi index from FASTA file\n"); - } - FileClose(fd_ind); - ErrLogPrintf("Created index of %d gis\n", MaxIndexCount); - } - - /* Now searching FASTA file with new gis*/ - - if((fd = FileOpen(MonthFile, "r")) == NULL) { - ErrLogPrintf("Cannot open input file. Indexing failed...\n"); - exit(1); - } - ErrLogPrintf("Using file \"%s\" as FASTA database with new gis\n", - MonthFile); - - if((fdout = FileOpen(NRFile, "a+")) == NULL) { - ErrLogPrintf("Error opening %s file\n", NRFile); - exit(1); - } - - if((fd_ind = FileOpen(IndexFile, "a+")) == NULL) { - ErrLogPrintf("Error opening %s file\n", IndexFile); - exit(1); - } - - while((fasta = NextFastaFromFasta(fd)) != NULL) { - if((Added = MergeFMergeID(fasta, fdout, fd_ind, - index, MaxIndexCount)) != 0) { - TotalAdded += Added; - SequenceAdded++; - } - } - MemFree(index); - FileClose(fd); - FileClose(fd_ind); - ErrLogPrintf("Total gis added: %d\n", TotalAdded); - ErrLogPrintf("Total sequences added: %d\n", SequenceAdded); - return 0; -} -Uint4Ptr GetIndexFromIndex(FILE *fd, Uint4Ptr MaxIndexCount) -{ - Uint4Ptr index; - Uint4 IndexSize = INCLENGTH; - Uint4 i =0, gi; - - index = MemNew(IndexSize*4); - - while (fscanf(fd, "%ld", &gi) > 0) { - - if(i == IndexSize) { - IndexSize += INCLENGTH; - index = Realloc(index, IndexSize*4); - } - index[i] = gi; - i++; - } - *MaxIndexCount = i; - HeapSort(index, *MaxIndexCount, sizeof(Uint4), intcompare); - return index; -} - -Uint4Ptr GetIndexFromFasta(FILE *fd, Uint4Ptr MaxIndexCount) -{ - Char str[20000]; - CharPtr pos; - CharPtr start; - Uint4Ptr index; - Uint4 i =0, gi; - Uint4 IndexSize = INCLENGTH; - - index = MemNew(IndexSize*4); - - while(fgets (str, sizeof (str), fd) != NULL) { - start = str; - while((pos = StringStr(start, "\1gi|")) != NULL || - (pos = StringStr(start, ">gi|")) != NULL) { - if(!sscanf(pos+4, "%ld", &gi)) { - ErrLogPrintf("Error parsing gi number. Indexing failed...\n"); - exit(1); - } - /* Here we got next gi nnumber and will add it to the index */ - - if(i == IndexSize) { - IndexSize += INCLENGTH; - index = Realloc(index, IndexSize*4); - } - index[i] = gi; - i++; - start = pos+4; - } - } - *MaxIndexCount = i; - HeapSort(index, *MaxIndexCount, sizeof(Uint4), intcompare); - return index; -} - -Boolean IfGiInIndex(Uint4Ptr index, Uint4 MaxIndexCount, Uint4 gi) -{ - Uint4 high_index, low_index, new_index; - - if(MaxIndexCount == 0 || index == NULL || gi == 0) - return FALSE; - - low_index = 0; - high_index = MaxIndexCount; - new_index = (low_index+high_index)/2; - - while(new_index != low_index && new_index != high_index){ - if (gi > index[new_index]) { - low_index = new_index; - } else if (gi < index[new_index]) { - high_index = new_index; - } else { /* scores are equal. */ - return TRUE; - } - new_index = (low_index+high_index)/2; - } - if (gi == index[new_index]) - return TRUE; - else - return FALSE; -} - -static FMergeIDPtr NextFastaFromFasta(FILE *fd) -{ - CharPtr str, start; - Int4 i=0,j=0; - Char ch; - Int4 gi; - CharPtr pos; - Int4 f_pos; - Char tmpbuff[2048]; - FMergeIDPtr fasta; - MDeflineIDPtr id, last_id; - CharPtr TmpSequence; - Int4 SeqSize = STRLENGTH; - - if((fasta = MemNew(sizeof(FMergeID))) == NULL) { - ErrLogPrintf("Cannot allocate memory for Fasta ID\n"); - exit(1); - } - fasta->id = NULL; - - str = MemNew(SeqSize + 5); - str[0] = NULLB; - for(i=0; (FileRead(&ch, sizeof(ch), 1, fd) == 1); i++) { - if((str[i] = ch) == '\n' || ch == '\r') - break; - if (i > SeqSize) { - SeqSize = i + STRLENGTH; - str = Realloc(str, SeqSize + 5); - } - } - str[i+1] = NULLB; - start = str; - while((pos = StringStr(str, "\1gi|")) != NULL || - (pos = StringStr(str, ">gi|")) != NULL) { - if(!sscanf(pos+4, "%ld", &gi)) { - ErrLogPrintf("Error parsing gi number. Indexing failed...\n"); - exit(1); - } - pos++; - for(j = 0;pos[j] != '\1' && - pos[j] != '\n' && - pos[j] != '\r'; j++) { - tmpbuff[j] = pos[j]; - } - tmpbuff[j] = '\0'; - - id = MemNew(sizeof(MDeflineID)); - id->defline = StringSave(tmpbuff); - id->gi = gi; - id->next = NULL; - - if(fasta->id == NULL) { - fasta->id = id; - last_id = fasta->id; - } else { - last_id->next = id; - last_id = last_id->next; - } - str = pos+4; - } - - MemFree(start); - - if(fasta->id == NULL) { - MemFree(fasta); - return NULL; - } - - TmpSequence = MemNew(SeqSize + 5); - TmpSequence[0] = NULLB; - - - while(TRUE) { - f_pos = ftell(fd); - if(fgets(tmpbuff, sizeof (tmpbuff), fd) == NULL) - break; - if(StringStr(tmpbuff, ">gi|") != NULL) { /* new fasta entry started */ - fseek(fd, (long) f_pos, SEEK_SET); - break; - } - StringCat(TmpSequence, tmpbuff); - SeqSize += STRLENGTH + 5; - TmpSequence = Realloc(TmpSequence, SeqSize); - } - fasta->sequence = TmpSequence; - return fasta; -} - -Int4 MergeFMergeID(FMergeIDPtr fasta, FILE *fd, FILE *fd_ind, - Uint4Ptr index, Uint4 MaxIndexCount) -{ - Boolean SomeNew = FALSE; - MDeflineIDPtr id; - Int4 TotalNot =0; - - id = fasta->id; - while(id != NULL) { - if(IfGiInIndex(index, MaxIndexCount, id->gi)) { - id = id->next; - continue; - } - TotalNot++; - - fprintf(fd_ind, "%ld\n", id->gi); - - if(SomeNew) - fprintf(fd, "\1%s", id->defline); - else { - fprintf(fd, ">%s", id->defline); - SomeNew = TRUE; - } - id = id->next; - } - - if(SomeNew) - fprintf(fd, "\n%s", fasta->sequence); - - FMergeIDFree(fasta); - return TotalNot; -} -void FMergeIDFree(FMergeIDPtr fasta) -{ - MDeflineIDPtr id, id1; - - MemFree(fasta->sequence); - id = fasta->id; - while(id != NULL) { - MemFree(id->defline); - id1 = id; - id = id->next; - MemFree(id1); - } - MemFree(fasta); -} - diff --git a/demo/makemat.c b/demo/makemat.c index dba93c25..49939238 100644 --- a/demo/makemat.c +++ b/demo/makemat.c @@ -1,4 +1,4 @@ -static char const rcsid[] = "$Id: makemat.c,v 6.13 2003/05/30 17:31:09 coulouri Exp $"; +static char const rcsid[] = "$Id: makemat.c,v 6.14 2004/05/14 12:10:06 camacho Exp $"; /* * =========================================================================== @@ -180,6 +180,10 @@ static Boolean takeMatrixCheckpoint(compactSearchItems * compactSearch, localChar = getRes(compactSearch->query[i]); fprintf(checkFile,"%c",localChar); + + /* The following 2 lines are needed to preserve compatibility with the + * checkpoint file libraries distributed with IMPALA (from personal + * communication with IMPALA's author) */ posSearch->posMatrix[i][Xchar] = Xscore; posSearch->posPrivateMatrix[i][Xchar] = Xscore * scalingFactor; } @@ -322,6 +326,8 @@ Nlm_FloatHi scalingFactor, Char *directoryPrefix) BlastScoreBlkMatFill(sbp, underlyingMatrixName); compactSearch->matrix = sbp->matrix; compactSearch->gapped_calculation = TRUE; + /* Note that these two assignments are not really needed for + * makemat's operation and thus their values are irrelevant */ compactSearch->pseudoCountConst = 10; compactSearch->ethresh = 0.001; BlastScoreBlkFill(sbp, (CharPtr) query, queryLength, 0); diff --git a/demo/megablast.c b/demo/megablast.c index 06778dcc..d141a337 100644 --- a/demo/megablast.c +++ b/demo/megablast.c @@ -1,6 +1,6 @@ -static char const rcsid[] = "$Id: megablast.c,v 6.113 2004/04/29 19:56:00 dondosha Exp $"; +static char const rcsid[] = "$Id: megablast.c,v 6.114 2004/05/27 17:37:30 dondosha Exp $"; -/* $Id: megablast.c,v 6.113 2004/04/29 19:56:00 dondosha Exp $ +/* $Id: megablast.c,v 6.114 2004/05/27 17:37:30 dondosha Exp $ ************************************************************************** * * * COPYRIGHT NOTICE * @@ -28,6 +28,9 @@ static char const rcsid[] = "$Id: megablast.c,v 6.113 2004/04/29 19:56:00 dondos ************************************************************************** * $Revision 6.13$ * * $Log: megablast.c,v $ + * Revision 6.114 2004/05/27 17:37:30 dondosha + * Do not call GapXEditBlockDelete in formatting callback - this is now done when HSPs are freed + * * Revision 6.113 2004/04/29 19:56:00 dondosha * Mask filtered locations in query sequence lines in XML output * @@ -653,7 +656,6 @@ MegaBlastPrintSegments(VoidPtr ptr) hsp = search->current_hitlist->hsp_array[hsp_index]; if (hsp==NULL || (search->pbp->cutoff_e > 0 && hsp->evalue > search->pbp->cutoff_e)) { - GapXEditBlockDelete(hsp->gap_info); /* Don't need it anymore */ continue; } context = hsp->context; @@ -748,7 +750,6 @@ MegaBlastPrintSegments(VoidPtr ptr) GXECollectDataForSeqalign(hsp->gap_info, hsp->gap_info->esp, numseg, &start, &length, &strands, &q_off, &hsp->subject.offset); - GapXEditBlockDelete(hsp->gap_info); /* Don't need it anymore */ if (start[0] < 0) { length[0] += start[0]; diff --git a/demo/tbl2asn.c b/demo/tbl2asn.c index b95dc25c..3ea959d5 100644 --- a/demo/tbl2asn.c +++ b/demo/tbl2asn.c @@ -29,7 +29,7 @@ * * Version Creation Date: 5/5/00 * -* $Revision: 6.85 $ +* $Revision: 6.88 $ * * File Description: * @@ -1428,12 +1428,14 @@ static Uint2 ProcessDeltaSet ( Uint2 entityID; SeqEntryPtr firstsep, lastsep, nextsep, sep, topsep; IntFuzzPtr ifp; + Boolean is_unk100; + ObjectIdPtr oip; ObjMgrDataPtr omdptop; ObjMgrData omdata; Uint2 parenttype; Pointer parentptr; CharPtr seqbuf; - SeqIdPtr sip; + SeqIdPtr sip, virtid; SeqLitPtr slp; ValNodePtr vnp; @@ -1491,7 +1493,7 @@ static Uint2 ProcessDeltaSet ( bsp = FindNucBioseq (firstsep); if (bsp == NULL) return 0; - sip = SeqIdDup (bsp->id); + sip = SeqIdSetDup (bsp->id); vnp = ValNodeExtract (&(bsp->descr), Seq_descr_title); deltabsp = BioseqNew (); @@ -1554,8 +1556,21 @@ static Uint2 ProcessDeltaSet ( slp->length = bsp->length; ValNodeAddPointer ((ValNodePtr PNTR) &(deltabsp->seq_ext), (Int2) 2, (Pointer) slp); - if (slp->length < 1) { - slp->length = 0; + + is_unk100 = FALSE; + virtid = bsp->id; + if (virtid != NULL && virtid->choice == SEQID_LOCAL) { + oip = (ObjectIdPtr) virtid->data.ptrvalue; + if (oip != NULL) { + if (StringCmp (oip->str, "unk100") == 0) { + is_unk100 = TRUE; + } + } + } + if (slp->length < 1 || is_unk100) { + if (slp->length < 1) { + slp->length = 0; + } ifp = IntFuzzNew (); ifp->choice = 4; slp->fuzz = ifp; @@ -3126,6 +3141,7 @@ Int2 Main (void) { AsnIoPtr aip = NULL; + Char app [64]; CharPtr base; AsnTypePtr bssp_atp = NULL; CitSubPtr csp; @@ -3185,7 +3201,8 @@ Int2 Main (void) /* process command line arguments */ - if (! GetArgs ("tbl2asn", sizeof (myargs) / sizeof (Args), myargs)) { + sprintf (app, "tbl2asn %s", TBL2ASN_APPLICATION); + if (! GetArgs (app, sizeof (myargs) / sizeof (Args), myargs)) { return 0; } |