1 /* thr_bufs.h - structures for passing buffers of sequences to threads */
2 
3 /* $Id: thr_buf_structs.h 793 2011-07-03 00:03:55Z wrp $ */
4 
5 /* copyright (c) 2007, 2014 by William R. Pearson and The Rector &
6    Vistors of the University of Virginia */
7 
8 /* Licensed under the Apache License, Version 2.0 (the "License");
9    you may not use this file except in compliance with the License.
10    You may obtain a copy of the License at
11 
12    http://www.apache.org/licenses/LICENSE-2.0
13 
14    Unless required by applicable law or agreed to in writing,
15    software distributed under this License is distributed on an "AS
16    IS" BASIS, WITHOUT WRRANTIES OR CONDITIONS OF ANY KIND, either
17    express or implied.  See the License for the specific language
18    governing permissions and limitations under the License.
19 */
20 
21 #include <sys/types.h>
22 
23 struct thr_str {
24   int worker;
25   void *status;
26   int max_work_buf;
27   int qframe;
28   struct pstruct *ppst;
29   const struct mngmsg *m_msp;
30   int qshuffle;
31   int nrshuffle;
32   unsigned char *aa0;	/* query sequence */
33   int n0;		/* query sequence length */
34   int nm0;
35   int max_tot;
36   char info_lib_range[MAX_SSTR];
37   void **f_str_ap;
38 };
39 
40 
41 /* this structure passes library sequences to the worker threads
42    and returns scores */
43 
44 struct buf2_hdr_s {
45   int buf2_cnt;		/* number of buf2 records */
46   /*  int buf2_stats_cnt; */	/* number of stats scores */
47   int buf2_type;	/* search, shuffle, etc */
48   int stop_work;
49   int have_data;
50   int have_results;
51   int have_best_save;
52   int shuff_cnt;
53   int worker_idx;
54   struct seq_record *seq_b;	/* pointer to contig. actual sequence data */
55   struct mseq_record *mseq_b;	/* pointer to contig. seq. meta-info */
56   struct seqr_chain *my_chain;	/* pointer to the seqr_chain providing data for this buffer */
57   int seqr_cnt;		/* count of seq_records, which can be less than buf2_cnt */
58   int seq_record_continuous;	/* contiguous seq_record/aa1b */
59   unsigned char *aa1b_start;	/* pointer to contiguous aa1b buffer */
60   int aa1b_size;	/* allocated size of aab buffer -- needed for PCOMPLIB */
61   int aa1b_used;	/* used size of aab buffer -- needed for PCOMPLIB */
62   int my_id;
63   int my_worker;
64 };
65 
66 
67 /* this structure contains a single sequence record, with all the
68    information necessary to calculate a score */
69 
70 struct buf2_data_s {
71   struct seq_record *seq;	/* pointer to sequence */
72   struct mseq_record *mseq;	/* pointer to sequence meta data */
73   int frame;			/* query frame used for returning results, indexes into aa0[], f_str[]
74 				   also used in best_stats.h bbp->frame */
75   int repeat_thresh;		/* threshold for sub-alignment */
76   int stats_idx;		/* where to save for statistics */
77   int seq_dup;			/* duplicate entry for alternate frame */
78   struct beststr *best_save;	/* if beststr is pointing to this record, where is it saved? */
79 };
80 
81 struct buf2_res_s {
82   struct rstruct rst;
83   int is_valid_stat;
84   int qr_score;
85   struct rstruct r_rst;
86   double qr_escore;
87 };
88 
89 /*
90 struct buf2_stats_s {
91   int stats_idx;
92   int valid_stat;
93   int iscore;
94   int n1;
95   double escore;
96   double comp;
97   double H;
98 };
99 */
100 
101 struct buf2_ares_s {
102   int have_ares;
103   struct a_res_str *a_res;
104   int best_idx;
105 };
106 
107 #define BUF2_DOWORK 0x1
108 #define BUF2_DOSHUF 0x2
109 #define BUF2_DOOPT 0x4
110 #define BUF2_DOALIGN 0x8
111 
112 struct buf_head {
113   struct buf2_hdr_s hdr;		/* meta-information */
114   struct buf2_data_s *buf2_data;	/* input (sequence) datat */
115   struct buf2_res_s *buf2_res; 		/* score type results */
116   /*  struct buf2_stats_s *buf2_stats; */	/* statistics values */
117   struct buf2_ares_s *buf2_ares;	/* alignment results */
118   struct score_count_s s_cnt_info;	/* statitics info */
119 };
120