1 /* @include embdmx ************************************************************
2 **
3 ** Algorithms for some of the DOMAINATRIX EMBASSY applications.
4 ** For use with the Scophit and Scopalign objects.
5 ** The functionality will eventually be subsumed by other AJAX and NUCLEUS
6 ** libraries.
7 **
8 ** @author Copyright (C) 2004 Ranjeeva Ranasinghe (rranasin@hgmp.mrc.ac.uk)
9 ** @author Copyright (C) 2004 Jon Ison (jison@hgmp.mrc.ac.uk)
10 ** @version $Revision: 1.20 $
11 ** @modified $Date: 2011/10/18 14:24:24 $ by $Author: rice $
12 ** @@
13 **
14 ** This library is free software; you can redistribute it and/or
15 ** modify it under the terms of the GNU Lesser General Public
16 ** License as published by the Free Software Foundation; either
17 ** version 2.1 of the License, or (at your option) any later version.
18 **
19 ** This library is distributed in the hope that it will be useful,
20 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22 ** Lesser General Public License for more details.
23 **
24 ** You should have received a copy of the GNU Lesser General Public
25 ** License along with this library; if not, write to the Free Software
26 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
27 ** MA  02110-1301,  USA.
28 ****************************************************************************/
29 
30 #ifndef EMBDMX_H
31 #define EMBDMX_H
32 
33 
34 
35 
36 /* ========================================================================= */
37 /* ============================= include files ============================= */
38 /* ========================================================================= */
39 
40 #include "ajdefine.h"
41 #include "ajlist.h"
42 #include "ajfile.h"
43 #include "ajseqdata.h"
44 #include "ajdmx.h"
45 #include "ajarr.h"
46 #include "ajmatrices.h"
47 #include "embsig.h"
48 
49 AJ_BEGIN_DECLS
50 
51 
52 
53 
54 /* ========================================================================= */
55 /* =============================== constants =============================== */
56 /* ========================================================================= */
57 
58 
59 
60 
61 /* ========================================================================= */
62 /* ============================== public data ============================== */
63 /* ========================================================================= */
64 
65 
66 
67 
68 /* @data EmbPDmxNrseq *********************************************************
69 **
70 ** NUCLEUS data structure for non-redundant sequence testing
71 **
72 
73 ** @attr Seq [AjPSeq] Sequence to be tested for redundancy
74 ** @attr Garbage [AjBool] True if sequence is to be ignored
75 ** @attr Padding [char[4]] Padding to alignment boundary
76 ** @@
77 ******************************************************************************/
78 
79 typedef struct EmbSDmxNrseq {
80   AjPSeq Seq;
81   AjBool Garbage;
82   char Padding[4];
83 } EmbODmxNrseq;
84 #define EmbPDmxNrseq EmbODmxNrseq*
85 
86 
87 
88 
89 
90 /* ========================================================================= */
91 /* =========================== public functions ============================ */
92 /* ========================================================================= */
93 
94 
95 
96 /*
97 ** Prototype definitions
98 */
99 
100 void          embDmxNrseqDel(EmbPDmxNrseq* Pnrseq);
101 
102 EmbPDmxNrseq  embDmxNrseqNew(const AjPSeq seq);
103 
104 AjPList       embDmxScophitReadAllFasta(AjPFile in);
105 
106 AjBool        embDmxHitlistToScophits(const AjPList in,
107 				      AjPList out);
108 
109 AjBool        embDmxScophitsToHitlist(const AjPList in,
110 				      EmbPHitlist *out,
111 				      AjIList *iter);
112 
113 AjBool        embDmxScophitToHit(EmbPHit *to,
114 				 const AjPScophit from);
115 
116 AjBool        embDmxScophitsAccToHitlist(const AjPList in,
117 					 EmbPHitlist *out,
118 					 AjIList *iter);
119 
120 AjBool        embDmxHitsWrite(AjPFile outf,
121 			      EmbPHitlist hits,
122 			      ajint maxhits);
123 
124 AjBool        embDmxScopToScophit(const AjPScop source,
125 				  AjPScophit* target);
126 
127 AjBool        embDmxScopalgToScop(const AjPScopalg align,
128 				  AjPScop const *scop_arr,
129 				  ajint scop_dim,
130 				  AjPList* list);
131 
132 AjBool        embDmxScophitsOverlap(const AjPScophit h1,
133 				    const AjPScophit h2,
134 				    ajuint n);
135 
136 AjBool        embDmxScophitsOverlapAcc(const AjPScophit h1,
137 				       const AjPScophit h2,
138 				       ajuint n);
139 
140 AjPScophit    embDmxScophitMerge(const AjPScophit hit1,
141 				 const AjPScophit hit2);
142 
143 AjBool        embDmxScophitMergeInsertThis(const AjPList list,
144 					   AjPScophit hit1,
145 					   AjPScophit hit2,
146 					   AjIList iter);
147 
148 AjBool        embDmxScophitMergeInsertThisTarget(const AjPList list,
149 						 AjPScophit hit1,
150 						 AjPScophit hit2,
151 						 AjIList iter);
152 
153 AjBool        embDmxScophitMergeInsertThisTargetBoth(const AjPList list,
154 						     AjPScophit hit1,
155 						     AjPScophit hit2,
156 						     AjIList iter);
157 
158 AjBool        embDmxScophitMergeInsertOther(AjPList list,
159 					    AjPScophit hit1,
160 					    AjPScophit hit2);
161 
162 AjBool        embDmxScophitMergeInsertOtherTargetBoth(AjPList list,
163 						      AjPScophit hit1,
164 						      AjPScophit hit2);
165 
166 AjBool        embDmxScophitMergeInsertOtherTarget(AjPList list,
167 						  AjPScophit hit1,
168 						  AjPScophit hit2);
169 
170 AjBool        embDmxSeqNR(const AjPList input,
171 			  AjPUint *keep,
172 			  ajint *nset,
173 			  const AjPMatrixf matrix,
174 			  float gapopen,
175 			  float gapextend,
176 			  float thresh,
177 			  AjBool CheckGarbage);
178 
179 AjBool        embDmxSeqNRRange(const AjPList input,
180 			       AjPUint *keep,
181 			       ajint *nset,
182 			       const AjPMatrixf matrix,
183 			       float gapopen,
184 			       float gapextend,
185 			       float thresh1,
186 			       float thresh2,
187 			       AjBool CheckGarbage);
188 
189 AjBool        embDmxSeqCompall(const AjPList input,
190 			       AjPFloat2d *scores,
191 			       const AjPMatrixf matrix,
192 			       float gapopen,
193 			       float gapextend);
194 
195 /*
196 ** End of prototype definitions
197 */
198 
199 AJ_END_DECLS
200 
201 #endif  /* !EMBDMX_H */
202