Debian Codegraph @

debian/patches/dpkg-1.22.6.patch

raw symbols SCIP
1 Description: Fix FTBFS with GCC 14.
2 https://gcc.gnu.org/gcc-14/porting_to.html#implicit-function-declaration
3 Author: Bas Couwenberg <[email protected]>
4 Bug-Debian: https://bugs.debian.org/1066716
5
6 --- a/Ext/lib/pwm_searchPFF.c
7 +++ b/Ext/lib/pwm_searchPFF.c
8 @@ -33,81 +33,6 @@
9 *------------------------------------------------------------------*/
10 #include "pwm_search.h"
11
12 -int do_search(char* matrixfile,
13 - char* seqfile,
14 - float threshold,
15 - char* tfname,
16 - char* tfclass,
17 - char* outfile)
18 - /*was: main
19 - int argc;
20 - char **argv;*/
21 -{
22 - double pwm[2*MAXCOUNTS]; /* for pwm matrix */
23 - /* do own indexing; 5*pos + nt */
24 - int exitval = -1; /* exit value from main */
25 - struct arguments args; /* command line args */
26 - FILE *fp; /* for sequence input file */
27 - FILE *outfp;
28 - NUM_ERRS = 0;
29 - if (__DEBUG__) fprintf(stderr, "%s %s %f %s %s %s\n", matrixfile, seqfile, threshold, tfname, tfclass, outfile);
30 - if ( __DEBUG__ )
31 - announce("+++\nEntering main.\n+++\n");
32 -
33 - /* Parse command line arguments */
34 - /*if ( get_cmd_args(argc,argv,&args) )
35 - {
36 - err_log(
37 - "Usage: pwm_searchPFF pwm_file seq_file threshold [-a][-b]|[-m mask_file] [-n TFname] [-c TFclass]\n"
38 - );
39 - }*/
40 -
41 - strcpy(args.counts_file, matrixfile);
42 - strcpy(args.seq_file, seqfile);
43 - args.threshold = threshold;
44 - strcpy(args.name, tfname);
45 - strcpy(args.class, tfclass);
46 - args.print_all = 0;
47 - args.best_only= 0;
48 - /* Read in the pwm; calculate max/min score */
49 - //else
50 - if ( get_matrix(&args,pwm) )
51 - {
52 - err_log("MAIN: get_matrix failed.");
53 - }
54 -
55 - /* Open the sequence file */
56 - else if ( (fp=fopen(args.seq_file,"r")) == NULL )
57 - {
58 - err_log("MAIN: open_seq_file failed.");
59 - }
60 - else if ( (outfp=fopen(outfile,"w")) == NULL )
61 - {
62 - err_log("MAIN: open_outfile failed.");
63 - }
64 -
65 - /* Loop on sequences */
66 - else if ( loop_on_seqs(&args,pwm,fp,outfp) )
67 - {
68 - err_log("MAIN: loop_on_seqs failed.");
69 - }
70 -
71 - /* Normal completion */
72 - else
73 - {
74 - exitval = 0;
75 - }
76 -
77 - /* Clean up and close out */
78 - err_show();
79 - fclose(fp);
80 - fclose(outfp);
81 - if ( __DEBUG__ )
82 - announce("+++\nLeaving main.\n+++\n");
83 -
84 - return(exitval);
85 -}
86 -
87 /*--------------------------------------------------------------------
88 * Announce
89 *
90 @@ -126,185 +51,6 @@ char *msg;
91 return(retval);
92 }
93
94 -/*--------------------------------------------------------------------
95 - * BEST_SAVE - Save the best score so far
96 - *
97 - * Called by do_seq
98 - *
99 - * Returns: 0
100 - *------------------------------------------------------------------*/
101 -int best_save(struct arguments* pargs, long base, int strand, double score)
102 - //struct arguments *pargs; /* args from command line */
103 - //long base; /* base where score occurs */
104 - //int strand; /* strand where score occurs */
105 - //double score; /* score of hit to save */
106 -{
107 - if ( pargs->best_base < 0 || score > pargs->best_score )
108 - {
109 - pargs->best_base = base;
110 - pargs->best_score = score;
111 - pargs->best_strand = strand;
112 - }
113 -
114 - return(0);
115 -}
116 -
117 -/*--------------------------------------------------------------------
118 - * BEST_PULL - Copy back the best score saved
119 - *
120 - * Called by do_seq
121 - *
122 - * Returns: 0
123 - *------------------------------------------------------------------*/
124 -best_pull(pargs,pbase,pstrand,pscore)
125 -struct arguments *pargs; /* args from command line */
126 -long *pbase; /* base where score occurs */
127 -int *pstrand; /* strand where score occurs */
128 -double *pscore; /* score of hit to pull back */
129 -{
130 - *pbase = pargs->best_base;
131 - if ( pargs->best_base >= 0 )
132 - {
133 - *pscore = pargs->best_score;
134 - *pstrand = pargs->best_strand;
135 - }
136 - return(0);
137 -}
138 -
139 -/*--------------------------------------------------------------------
140 - * DO_SEQ - Search through the given sequence with the given matrix
141 - *
142 - * Called by loop_on_seqs
143 - *
144 - * Returns: 0 for success, -1 for failure.
145 - *------------------------------------------------------------------*/
146 -int
147 -do_seq(pargs,pwm,seqid,seq,outfp)
148 -struct arguments *pargs; /* args from command line */
149 -double *pwm; /* pwm from get_matrix */
150 -char *seqid; /* id of sequence to work on */
151 -char *seq; /* the sequence to work on */
152 -FILE *outfp;
153 -{
154 - double backward_score;
155 - double forward_score;
156 - double score;
157 - long base;
158 - int done = 0;
159 - int nt;
160 - int pos;
161 - int retval = 0;
162 - int strand;
163 - long l;
164 - long nhit=0L;
165 - struct HIT hits[MAXHITS];
166 -
167 - if ( __DEBUG__ )
168 - announce("+++\nEntering do_seq.\n+++\n");
169 -
170 - /* first make sure sequence is long enough */
171 - for ( base=0; base < pargs->width; ++base )
172 - {
173 - if ( seq[base] == '\0' )
174 - done = 1;
175 - }
176 -
177 - /* loop on windows */
178 - pargs->best_base = -1;
179 - for ( base=0; !retval && !done && seq[base+pargs->width-1]; ++base )
180 - {
181 - forward_score = 0.0;
182 - backward_score = 0.0;
183 - for ( pos=0; pos<pargs->width; ++pos )
184 - {
185 - nt = TRANS[seq[base+pos]];
186 - forward_score += pwm[5*pos + nt];
187 - nt = ( nt==4 ) ? 4 : 3-nt;
188 - backward_score += pwm[5*(pargs->width - pos -1) + nt];
189 - }
190 - if ( forward_score > pargs->threshold )
191 - {
192 - if ( pargs->print_all )
193 - {
194 - if ( save_hit(base,0,forward_score,hits,&nhit) )
195 - {
196 - err_log("DO_SEQ: save_hit failed");
197 - retval = -1;
198 - }
199 - }
200 - else if ( pargs->best_only )
201 - {
202 - best_save(pargs,base,0,forward_score);
203 - }
204 - else if ( output(pargs,seqid,base,seq,0,forward_score,outfp) )
205 - {
206 - err_log("DO_SEQ: output failed");
207 - retval = -1;
208 - }
209 - }
210 - if ( backward_score > pargs->threshold )
211 - {
212 - if ( pargs->print_all )
213 - {
214 - if ( save_hit(base,1,backward_score,hits,&nhit) )
215 - {
216 - err_log("DO_SEQ: save_hit failed");
217 - retval = -1;
218 - }
219 - }
220 - else if ( pargs->best_only )
221 - {
222 - best_save(pargs,base,1,backward_score);
223 - }
224 - else if ( output(pargs,seqid,base,seq,1,backward_score, outfp) )
225 - {
226 - err_log("DO_SEQ: output failed");
227 - retval = -1;
228 - }
229 - }
230 -
231 - }
232 -
233 - if ( pargs->print_all )
234 - {
235 - for ( l=0; l<nhit; ++l )
236 - printf("%ld %.3f\n",1+hits[l].base,hits[l].score);
237 -/*
238 - printf("# forward strand hits\n\n");
239 - for ( l=0; l<nhit; ++l )
240 - {
241 - if ( hits[l].strand == 0 )
242 - printf("%ld %.3f\n",1+hits[l].base,hits[l].score);
243 - }
244 - printf("\n# comp strand hits\n\n");
245 - for ( l=0; l<nhit; ++l )
246 - {
247 - if ( hits[l].strand == 1 )
248 - printf("%ld %.3f\n",1+hits[l].base,hits[l].score);
249 - }
250 -*/
251 - }
252 -
253 - else
254 - {
255 - best_pull(pargs,&base,&strand,&score);
256 - if ( base>=0 )
257 - {
258 - if ( output(pargs,seqid,base,seq,strand,score,outfp) )
259 - {
260 - err_log("DO_SEQ: output failed");
261 - retval = -1;
262 - }
263 - }
264 - }
265 -
266 - if ( __DEBUG__ )
267 - announce("+++\nLeaving do_seq.\n+++\n");
268 -
269 - return(retval);
270 -
271 -}
272 -
273 /***********************************************************************
274 * ERR_LOG and ERR_SHOW
275 *
276 @@ -341,85 +87,37 @@ err_show()
277 return;
278 }
279
280 +
281 /*--------------------------------------------------------------------
282 - * GET_CMD_ARGS - Parse execute line, fill arg structure.
283 + * SAVE_HIT - save location, strand and score of a hit in an array of such
284 *
285 - * Called by main.
286 + * Called by do_seq.
287 *
288 * Returns: 0 for success, -1 for failure.
289 *------------------------------------------------------------------*/
290 -int get_cmd_args(argc,argv,pargs)
291 -int argc; /* argc as passed to main */
292 -char **argv; /* argv as passed to main */
293 -struct arguments *pargs; /* args from command line */
294 +int
295 +save_hit(base,strand,score,hits,pnhit)
296 +long base;
297 +int strand;
298 +double score;
299 +struct HIT *hits;
300 +long *pnhit;
301 {
302 int retval = 0;
303 - int arg_count = 4;
304 -
305 - if ( __DEBUG__ )
306 - announce("+++\nEntering get_cmd_args\n+++\n");
307
308 - /* See if we got at least three arguments */
309 - if ( argc < 4 )
310 - { retval = -1;
311 - err_log("GET_CMD_ARGS: Too few arguments.");
312 + if ( *pnhit == MAXHITS )
313 + {
314 + err_log("SAVE_HIT: MAXHITS limit reached.");
315 + retval = -1;
316 }
317
318 - /* Get the arguments */
319 - else
320 - { strcpy(pargs->counts_file,argv[1]);
321 - strcpy(pargs->seq_file,argv[2]);
322 - pargs->threshold = atof(argv[3]);
323 - pargs->best_only = 0;
324 - pargs->print_all = 0;
325 - pargs->mask_file[0] = '\0';
326 - while (arg_count < argc)
327 - {
328 - if ( argv[arg_count][0]=='-' && argv[arg_count][1]=='b' )
329 - {
330 - pargs->best_only = 1;
331 - arg_count++;
332 - }
333 - else if ( argv[arg_count][0]=='-' && argv[arg_count][1]=='a' )
334 - {
335 - pargs->print_all = 1;
336 - arg_count++;
337 - }
338 - else if ( arg_count<argc-1 &&
339 - argv[arg_count][0]=='-' && argv[arg_count][1]=='m' &&
340 - argv[arg_count+1][0]!='\0'
341 - )
342 - {
343 - strcpy(pargs->mask_file,argv[arg_count+1]);
344 - arg_count = arg_count+2;
345 - }
346 - else if ( arg_count<argc-1 &&
347 - argv[arg_count][0]=='-' && argv[arg_count][1]=='n' &&
348 - argv[arg_count+1][0]!='\0'
349 - )
350 - {
351 - strcpy(pargs->name,argv[arg_count+1]);
352 - arg_count = arg_count+2;
353 - }
354 - else if ( arg_count<argc-1 &&
355 - argv[arg_count][0]=='-' && argv[arg_count][1]=='c' &&
356 - argv[arg_count+1][0]!='\0'
357 - )
358 - {
359 - strcpy(pargs->class,argv[arg_count+1]);
360 - arg_count = arg_count+2;
361 - }
362 - else
363 - {
364 - arg_count++;
365 - }
366 - }
367 - }
368 - if ( __DEBUG__ )
369 - announce("+++\nLeaving get_cmd_args\n+++\n");
370 - return( retval );
371 + hits[*pnhit].base = base;
372 + hits[*pnhit].strand = strand;
373 + hits[*pnhit].score = score;
374 + *pnhit = *pnhit + 1;
375 +
376 + return(retval);
377 }
378 -
379 /*--------------------------------------------------------------------
380 * GET_MATRIX - Read in pwm.
381 *
382 @@ -515,6 +213,85 @@ get_matrix(struct arguments* pargs, doub
383 }
384
385 /*--------------------------------------------------------------------
386 + * GET_CMD_ARGS - Parse execute line, fill arg structure.
387 + *
388 + * Called by main.
389 + *
390 + * Returns: 0 for success, -1 for failure.
391 + *------------------------------------------------------------------*/
392 +int get_cmd_args(argc,argv,pargs)
393 +int argc; /* argc as passed to main */
394 +char **argv; /* argv as passed to main */
395 +struct arguments *pargs; /* args from command line */
396 +{
397 + int retval = 0;
398 + int arg_count = 4;
399 +
400 + if ( __DEBUG__ )
401 + announce("+++\nEntering get_cmd_args\n+++\n");
402 +
403 + /* See if we got at least three arguments */
404 + if ( argc < 4 )
405 + { retval = -1;
406 + err_log("GET_CMD_ARGS: Too few arguments.");
407 + }
408 +
409 + /* Get the arguments */
410 + else
411 + { strcpy(pargs->counts_file,argv[1]);
412 + strcpy(pargs->seq_file,argv[2]);
413 + pargs->threshold = atof(argv[3]);
414 + pargs->best_only = 0;
415 + pargs->print_all = 0;
416 + pargs->mask_file[0] = '\0';
417 + while (arg_count < argc)
418 + {
419 + if ( argv[arg_count][0]=='-' && argv[arg_count][1]=='b' )
420 + {
421 + pargs->best_only = 1;
422 + arg_count++;
423 + }
424 + else if ( argv[arg_count][0]=='-' && argv[arg_count][1]=='a' )
425 + {
426 + pargs->print_all = 1;
427 + arg_count++;
428 + }
429 + else if ( arg_count<argc-1 &&
430 + argv[arg_count][0]=='-' && argv[arg_count][1]=='m' &&
431 + argv[arg_count+1][0]!='\0'
432 + )
433 + {
434 + strcpy(pargs->mask_file,argv[arg_count+1]);
435 + arg_count = arg_count+2;
436 + }
437 + else if ( arg_count<argc-1 &&
438 + argv[arg_count][0]=='-' && argv[arg_count][1]=='n' &&
439 + argv[arg_count+1][0]!='\0'
440 + )
441 + {
442 + strcpy(pargs->name,argv[arg_count+1]);
443 + arg_count = arg_count+2;
444 + }
445 + else if ( arg_count<argc-1 &&
446 + argv[arg_count][0]=='-' && argv[arg_count][1]=='c' &&
447 + argv[arg_count+1][0]!='\0'
448 + )
449 + {
450 + strcpy(pargs->class,argv[arg_count+1]);
451 + arg_count = arg_count+2;
452 + }
453 + else
454 + {
455 + arg_count++;
456 + }
457 + }
458 + }
459 + if ( __DEBUG__ )
460 + announce("+++\nLeaving get_cmd_args\n+++\n");
461 + return( retval );
462 +}
463 +
464 +/*--------------------------------------------------------------------
465 * GET_SEQUENCE
466 *
467 * Get the next sequence from the input file (fasta format)
468 @@ -628,50 +405,48 @@ char *sequence; /* text of sequence
469 }
470
471 /*--------------------------------------------------------------------
472 - * LOOP_ON_SEQS - Loop through the sequences of the input file,
473 - * doing the search and output.
474 + * BEST_PULL - Copy back the best score saved
475 *
476 - * Called by main.
477 + * Called by do_seq
478 *
479 - * Returns: 0 for success, -1 for failure.
480 + * Returns: 0
481 *------------------------------------------------------------------*/
482 -int
483 -loop_on_seqs(pargs,pwm,fp, outfp)
484 +best_pull(pargs,pbase,pstrand,pscore)
485 struct arguments *pargs; /* args from command line */
486 -double *pwm; /* pwm, from get_matrix */
487 -FILE *fp; /* sequence file pointer */
488 -FILE *outfp; /* output file pointer */
489 +long *pbase; /* base where score occurs */
490 +int *pstrand; /* strand where score occurs */
491 +double *pscore; /* score of hit to pull back */
492 {
493 - char seq[SEQLEN+1];
494 - char seqid[SEQNAMELEN+1];
495 - int done = 0;
496 - int retval=0;
497 - if ( __DEBUG__ )
498 - announce("+++\nEntering loop_on_seqs\n+++\n");
499 -
500 - /* Main loop */
501 - while ( !retval && !done )
502 + *pbase = pargs->best_base;
503 + if ( pargs->best_base >= 0 )
504 {
505 - done = get_sequence(fp,seqid,seq);
506 - if ( done == -1 )
507 - {
508 - err_log("LOOP_ON_SEQS: get_sequence failed.");
509 - retval = -1;
510 - }
511 - else if ( done == 0 )
512 - {
513 - if ( do_seq(pargs,pwm,seqid,seq,outfp) )
514 - {
515 - err_log("LOOP_ON_SEQS: do_seq failed.");
516 - retval = -1;
517 - }
518 - }
519 + *pscore = pargs->best_score;
520 + *pstrand = pargs->best_strand;
521 }
522 + return(0);
523 +}
524
525 - if ( __DEBUG__ )
526 - announce("+++\nLeaving loop_on_seqs\n+++\n");
527 +/*--------------------------------------------------------------------
528 + * BEST_SAVE - Save the best score so far
529 + *
530 + * Called by do_seq
531 + *
532 + * Returns: 0
533 + *------------------------------------------------------------------*/
534 +int best_save(struct arguments* pargs, long base, int strand, double score)
535 + //struct arguments *pargs; /* args from command line */
536 + //long base; /* base where score occurs */
537 + //int strand; /* strand where score occurs */
538 + //double score; /* score of hit to save */
539 +{
540 + if ( pargs->best_base < 0 || score > pargs->best_score )
541 + {
542 + pargs->best_base = base;
543 + pargs->best_score = score;
544 + pargs->best_strand = strand;
545 + }
546
547 - return (retval);
548 + return(0);
549 }
550
551 /*--------------------------------------------------------------------
552 @@ -754,32 +529,257 @@ FILE *outfp;
553 }
554
555 /*--------------------------------------------------------------------
556 - * SAVE_HIT - save location, strand and score of a hit in an array of such
557 + * DO_SEQ - Search through the given sequence with the given matrix
558 *
559 - * Called by do_seq.
560 + * Called by loop_on_seqs
561 *
562 * Returns: 0 for success, -1 for failure.
563 *------------------------------------------------------------------*/
564 int
565 -save_hit(base,strand,score,hits,pnhit)
566 -long base;
567 -int strand;
568 -double score;
569 -struct HIT *hits;
570 -long *pnhit;
571 +do_seq(pargs,pwm,seqid,seq,outfp)
572 +struct arguments *pargs; /* args from command line */
573 +double *pwm; /* pwm from get_matrix */
574 +char *seqid; /* id of sequence to work on */
575 +char *seq; /* the sequence to work on */
576 +FILE *outfp;
577 {
578 + double backward_score;
579 + double forward_score;
580 + double score;
581 + long base;
582 + int done = 0;
583 + int nt;
584 + int pos;
585 int retval = 0;
586 + int strand;
587 + long l;
588 + long nhit=0L;
589 + struct HIT hits[MAXHITS];
590
591 - if ( *pnhit == MAXHITS )
592 + if ( __DEBUG__ )
593 + announce("+++\nEntering do_seq.\n+++\n");
594 +
595 + /* first make sure sequence is long enough */
596 + for ( base=0; base < pargs->width; ++base )
597 {
598 - err_log("SAVE_HIT: MAXHITS limit reached.");
599 - retval = -1;
600 + if ( seq[base] == '\0' )
601 + done = 1;
602 }
603
604 - hits[*pnhit].base = base;
605 - hits[*pnhit].strand = strand;
606 - hits[*pnhit].score = score;
607 - *pnhit = *pnhit + 1;
608 + /* loop on windows */
609 + pargs->best_base = -1;
610 + for ( base=0; !retval && !done && seq[base+pargs->width-1]; ++base )
611 + {
612 + forward_score = 0.0;
613 + backward_score = 0.0;
614 + for ( pos=0; pos<pargs->width; ++pos )
615 + {
616 + nt = TRANS[seq[base+pos]];
617 + forward_score += pwm[5*pos + nt];
618 + nt = ( nt==4 ) ? 4 : 3-nt;
619 + backward_score += pwm[5*(pargs->width - pos -1) + nt];
620 + }
621 + if ( forward_score > pargs->threshold )
622 + {
623 + if ( pargs->print_all )
624 + {
625 + if ( save_hit(base,0,forward_score,hits,&nhit) )
626 + {
627 + err_log("DO_SEQ: save_hit failed");
628 + retval = -1;
629 + }
630 + }
631 + else if ( pargs->best_only )
632 + {
633 + best_save(pargs,base,0,forward_score);
634 + }
635 + else if ( output(pargs,seqid,base,seq,0,forward_score,outfp) )
636 + {
637 + err_log("DO_SEQ: output failed");
638 + retval = -1;
639 + }
640 + }
641 + if ( backward_score > pargs->threshold )
642 + {
643 + if ( pargs->print_all )
644 + {
645 + if ( save_hit(base,1,backward_score,hits,&nhit) )
646 + {
647 + err_log("DO_SEQ: save_hit failed");
648 + retval = -1;
649 + }
650 + }
651 + else if ( pargs->best_only )
652 + {
653 + best_save(pargs,base,1,backward_score);
654 + }
655 + else if ( output(pargs,seqid,base,seq,1,backward_score, outfp) )
656 + {
657 + err_log("DO_SEQ: output failed");
658 + retval = -1;
659 + }
660 + }
661 +
662 + }
663 +
664 + if ( pargs->print_all )
665 + {
666 + for ( l=0; l<nhit; ++l )
667 + printf("%ld %.3f\n",1+hits[l].base,hits[l].score);
668 +/*
669 + printf("# forward strand hits\n\n");
670 + for ( l=0; l<nhit; ++l )
671 + {
672 + if ( hits[l].strand == 0 )
673 + printf("%ld %.3f\n",1+hits[l].base,hits[l].score);
674 + }
675 + printf("\n# comp strand hits\n\n");
676 + for ( l=0; l<nhit; ++l )
677 + {
678 + if ( hits[l].strand == 1 )
679 + printf("%ld %.3f\n",1+hits[l].base,hits[l].score);
680 + }
681 +*/
682 + }
683 +
684 + else
685 + {
686 + best_pull(pargs,&base,&strand,&score);
687 + if ( base>=0 )
688 + {
689 + if ( output(pargs,seqid,base,seq,strand,score,outfp) )
690 + {
691 + err_log("DO_SEQ: output failed");
692 + retval = -1;
693 + }
694 + }
695 + }
696 +
697 + if ( __DEBUG__ )
698 + announce("+++\nLeaving do_seq.\n+++\n");
699
700 return(retval);
701 +
702 +}
703 +
704 +/*--------------------------------------------------------------------
705 + * LOOP_ON_SEQS - Loop through the sequences of the input file,
706 + * doing the search and output.
707 + *
708 + * Called by main.
709 + *
710 + * Returns: 0 for success, -1 for failure.
711 + *------------------------------------------------------------------*/
712 +int
713 +loop_on_seqs(pargs,pwm,fp, outfp)
714 +struct arguments *pargs; /* args from command line */
715 +double *pwm; /* pwm, from get_matrix */
716 +FILE *fp; /* sequence file pointer */
717 +FILE *outfp; /* output file pointer */
718 +{
719 + char seq[SEQLEN+1];
720 + char seqid[SEQNAMELEN+1];
721 + int done = 0;
722 + int retval=0;
723 + if ( __DEBUG__ )
724 + announce("+++\nEntering loop_on_seqs\n+++\n");
725 +
726 + /* Main loop */
727 + while ( !retval && !done )
728 + {
729 + done = get_sequence(fp,seqid,seq);
730 + if ( done == -1 )
731 + {
732 + err_log("LOOP_ON_SEQS: get_sequence failed.");
733 + retval = -1;
734 + }
735 + else if ( done == 0 )
736 + {
737 + if ( do_seq(pargs,pwm,seqid,seq,outfp) )
738 + {
739 + err_log("LOOP_ON_SEQS: do_seq failed.");
740 + retval = -1;
741 + }
742 + }
743 + }
744 +
745 + if ( __DEBUG__ )
746 + announce("+++\nLeaving loop_on_seqs\n+++\n");
747 +
748 + return (retval);
749 +}
750 +
751 +int do_search(char* matrixfile,
752 + char* seqfile,
753 + float threshold,
754 + char* tfname,
755 + char* tfclass,
756 + char* outfile)
757 + /*was: main
758 + int argc;
759 + char **argv;*/
760 +{
761 + double pwm[2*MAXCOUNTS]; /* for pwm matrix */
762 + /* do own indexing; 5*pos + nt */
763 + int exitval = -1; /* exit value from main */
764 + struct arguments args; /* command line args */
765 + FILE *fp; /* for sequence input file */
766 + FILE *outfp;
767 + NUM_ERRS = 0;
768 + if (__DEBUG__) fprintf(stderr, "%s %s %f %s %s %s\n", matrixfile, seqfile, threshold, tfname, tfclass, outfile);
769 + if ( __DEBUG__ )
770 + announce("+++\nEntering main.\n+++\n");
771 +
772 + /* Parse command line arguments */
773 + /*if ( get_cmd_args(argc,argv,&args) )
774 + {
775 + err_log(
776 + "Usage: pwm_searchPFF pwm_file seq_file threshold [-a][-b]|[-m mask_file] [-n TFname] [-c TFclass]\n"
777 + );
778 + }*/
779 +
780 + strcpy(args.counts_file, matrixfile);
781 + strcpy(args.seq_file, seqfile);
782 + args.threshold = threshold;
783 + strcpy(args.name, tfname);
784 + strcpy(args.class, tfclass);
785 + args.print_all = 0;
786 + args.best_only= 0;
787 + /* Read in the pwm; calculate max/min score */
788 + //else
789 + if ( get_matrix(&args,pwm) )
790 + {
791 + err_log("MAIN: get_matrix failed.");
792 + }
793 +
794 + /* Open the sequence file */
795 + else if ( (fp=fopen(args.seq_file,"r")) == NULL )
796 + {
797 + err_log("MAIN: open_seq_file failed.");
798 + }
799 + else if ( (outfp=fopen(outfile,"w")) == NULL )
800 + {
801 + err_log("MAIN: open_outfile failed.");
802 + }
803 +
804 + /* Loop on sequences */
805 + else if ( loop_on_seqs(&args,pwm,fp,outfp) )
806 + {
807 + err_log("MAIN: loop_on_seqs failed.");
808 + }
809 +
810 + /* Normal completion */
811 + else
812 + {
813 + exitval = 0;
814 + }
815 +
816 + /* Clean up and close out */
817 + err_show();
818 + fclose(fp);
819 + fclose(outfp);
820 + if ( __DEBUG__ )
821 + announce("+++\nLeaving main.\n+++\n");
822 +
823 + return(exitval);
824 }