Next version of JABA
[jabaws.git] / binaries / src / fasta34 / showrss.c
1
2 /* copyright (c) 1996, 1997, 1998, 1999 William R. Pearson and the
3    U. of Virginia */
4
5 /* $Name: fa_34_26_5 $ - $Id: showrss.c,v 1.12 2006/04/12 18:00:02 wrp Exp $ */
6
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <string.h>
10
11 #include "defs.h"
12 #ifndef PCOMPLIB
13 #include "mw.h"
14 #else
15 #include "p_mw.h"
16 #endif
17
18 #include "structs.h"
19 #include "param.h"
20
21 extern double
22 zs_to_E(double zs, int n1, int isdna, long entries,struct db_str db);
23 extern double zs_to_bit(double zs, int n0, int n1);
24 extern double zs_to_p(double zs);
25
26 extern double (*find_zp)(int score, double escore, int length, double comp, void *);
27
28 extern char *prog_func;
29
30 void showbest (FILE *fp, unsigned char **aa0, unsigned char *aa1, int maxn,
31                struct beststr **bptr, int nbest, int qlib, struct mngmsg *m_msg,
32                struct pstruct pst, struct db_str db,
33                char *gstring2, void **f_str)
34 {
35   double zs;
36   int score;
37   char *rlabel;
38   struct beststr *bbp;
39
40   if ((rlabel=strrchr(m_msg->label,' '))==NULL) rlabel = m_msg->label;
41
42   fprintf(fp,"\n %s - %d shuffles; ",prog_func,m_msg->shuff_max);
43   if (m_msg->shuff_wid > 0)
44     fprintf(fp," window shuffle, window size: %d\n",m_msg->shuff_wid);
45   else
46     fprintf(fp," uniform shuffle\n");
47
48   bbp = bptr[0];
49
50   fprintf(fp," unshuffled %s score: %d;  bits(s=%d|n_l=%d): %4.1f p(%d) < %g\n",
51           rlabel,bbp->score[0],bbp->score[0], bbp->n1,
52           zs_to_bit(bbp->zscore,m_msg->n0,bbp->n1),bbp->score[0],zs_to_p(bbp->zscore));
53
54   fprintf(fp,"For %ld sequences, a score >= %d is expected %4.4g times\n\n", 
55           pst.zdb_size,bbp->score[0],zs_to_E(bbp->zscore,bbp->n1,0l,pst.zdb_size,db)); 
56 }
57
58 void showalign (FILE *fp, unsigned char *aa0, unsigned char *aa1, int maxn,
59                 struct beststr **bptr, int nbest,int qlib, struct mngmsg m_msg,
60                 struct pstruct pst, void *f_str, char *gstring2)
61 {
62 }
63
64 void
65 aancpy(char *to, char *from, int count,
66        struct pstruct pst)
67 {
68   char *tp;
69
70   tp=to;
71   while (count-- && *from) {
72     if (*from <= pst.nsq) *tp++ = pst.sq[*(from++)];
73     else *tp++ = *from++;
74   }
75   *tp='\0';
76 }