1 /* @include embmat ************************************************************
2 **
3 ** General match routines
4 **
5 ** @author Copyright (c) 1999 Alan Bleasby
6 ** @version $Revision: 1.17 $
7 ** @modified $Date: 2013/03/05 23:08:59 $ by $Author: rice $
8 ** @@
9 **
10 ** This library is free software; you can redistribute it and/or
11 ** modify it under the terms of the GNU Lesser General Public
12 ** License as published by the Free Software Foundation; either
13 ** version 2.1 of the License, or (at your option) any later version.
14 **
15 ** This library is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 ** Lesser General Public License for more details.
19 **
20 ** You should have received a copy of the GNU Lesser General Public
21 ** License along with this library; if not, write to the Free Software
22 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
23 ** MA  02110-1301,  USA.
24 **
25 ******************************************************************************/
26 
27 #ifndef EMBMAT_H
28 #define EMBMAT_H
29 
30 /* ========================================================================= */
31 /* ============================= include files ============================= */
32 /* ========================================================================= */
33 
34 #include "ajdefine.h"
35 #include "ajmem.h"
36 #include "ajmess.h"
37 #include "ajstr.h"
38 #include "ajsys.h"
39 #include "ajbase.h"
40 #include "ajfileio.h"
41 
42 AJ_BEGIN_DECLS
43 
44 
45 
46 
47 /* ========================================================================= */
48 /* =============================== constants =============================== */
49 /* ========================================================================= */
50 
51 
52 
53 
54 #define PRINTS_MAT "PRINTS/prints.mat"
55 
56 typedef ajuint *PMAT_INT[26];
57 
58 
59 
60 
61 /* ========================================================================= */
62 /* ============================== public data ============================== */
63 /* ========================================================================= */
64 
65 
66 
67 
68 /* @data EmbPMatPrints ********************************************************
69 **
70 ** NUCLEUS data structure for PRINTS protein fingerprints
71 **
72 ** @attr cod [AjPStr] gc line
73 ** @attr acc [AjPStr] gx line
74 ** @attr tit [AjPStr] gt line
75 ** @attr len [ajuint*] Lengths of motifs
76 ** @attr thresh [ajuint*] % of maximum score for matrix
77 ** @attr max [ajuint*] Maximum score for matrix
78 ** @attr matrix [PMAT_INT*] Matrices
79 ** @attr n [ajuint] Number of motifs in fingerprint
80 ** @attr Padding [char[4]] Padding to alignment boundary
81 ** @@
82 ******************************************************************************/
83 
84 typedef struct EmbSMatPrints
85 {
86     AjPStr cod;
87     AjPStr acc;
88     AjPStr tit;
89     ajuint    *len;
90     ajuint    *thresh;
91     ajuint    *max;
92     PMAT_INT  *matrix;
93     ajuint    n;
94     char      Padding[4];
95 } EmbOMatPrint;
96 #define EmbPMatPrints EmbOMatPrint*
97 
98 
99 
100 
101 /* @data EmbPMatMatch *********************************************************
102 **
103 ** NUCLEUS data structure for sequence matrix matches
104 **
105 ** @attr seqname [AjPStr] Sequence name
106 ** @attr cod [AjPStr] Matrix name
107 ** @attr acc [AjPStr] Matrix accession number
108 ** @attr tit [AjPStr] Matrix title
109 ** @attr pat [AjPStr] Pattern
110 ** @attr n [ajuint] Number of motifs in fingerprint
111 ** @attr len [ajuint] Lengths of motifs
112 ** @attr thresh [ajuint] % of maximum score for matrix
113 ** @attr max [ajuint] Maximum score for matrix
114 ** @attr element [ajuint] Number of matching element
115 ** @attr start [ajuint] Start of match
116 ** @attr end [ajuint] End of match
117 ** @attr score [ajuint] Score of match
118 ** @attr hpe [ajuint] Hits per element (so far)
119 ** @attr hpm [ajuint] Hits per motif (so far)
120 ** @attr all [AjBool] Can be set if all elements match
121 ** @attr ordered [AjBool] Can be set if "all" and in order
122 ** @attr forward [AjBool] on forward strand
123 ** @attr mm [ajuint] Number of mismatches
124 ** @attr cut1 [ajint] First 5' cut
125 ** @attr cut2 [ajint] First 3' cut
126 ** @attr cut3 [ajint] Reverse 5' cut
127 ** @attr cut4 [ajint] Reverse 3' cut
128 ** @attr len1 [ajuint] Fragment length 5'
129 ** @attr len2 [ajuint] Fragment length 3'
130 ** @attr len3 [ajuint] Fragment length reverse 5'
131 ** @attr len4 [ajuint] Fragment length reverse 3'
132 ** @attr circ12 [AjBool] Circular for cut1 and/or cut2
133 ** @attr circ34 [AjBool] Circular for cut3 and/or cut4
134 ** @attr iso [AjPStr] Holds names of isoschizomers
135 ** @@
136 ******************************************************************************/
137 
138 typedef struct EmbSMatMatch
139 {
140     AjPStr seqname;
141     AjPStr cod;
142     AjPStr acc;
143     AjPStr tit;
144     AjPStr pat;
145     ajuint  n;
146     ajuint  len;
147     ajuint  thresh;
148     ajuint  max;
149     ajuint  element;
150     ajuint  start;
151     ajuint  end;
152     ajuint  score;
153     ajuint  hpe;
154     ajuint  hpm;
155     AjBool all;
156     AjBool ordered;
157     AjBool forward;
158     ajuint  mm;
159     ajint  cut1;
160     ajint  cut2;
161     ajint  cut3;
162     ajint  cut4;
163     ajuint len1;
164     ajuint len2;
165     ajuint len3;
166     ajuint len4;
167     AjBool circ12;
168     AjBool circ34;
169     AjPStr iso;
170 } EmbOMatMatch;
171 #define EmbPMatMatch EmbOMatMatch*
172 
173 
174 
175 
176 /* ========================================================================= */
177 /* =========================== public functions ============================ */
178 /* ========================================================================= */
179 
180 
181 
182 /*
183 ** Prototype definitions
184 */
185 
186 void   embMatMatchDel (EmbPMatMatch *s);
187 void   embMatPrintsInit (AjPFile *fp);
188 void   embMatProtDelInt (EmbPMatPrints *s);
189 EmbPMatPrints embMatProtReadInt (AjPFile fp);
190 ajuint    embMatProtScanInt (const AjPStr s, const AjPStr n,
191 			    const EmbPMatPrints m, AjPList *l,
192 			    AjBool *all, AjBool *ordered, AjBool overlap);
193 
194 /*
195 ** End of prototype definitions
196 */
197 
198 
199 AJ_END_DECLS
200 
201 #endif  /* !EMBMAT_H */
202