JPRED-2 Add sources of all binaries (except alscript) to Git
[jpred.git] / sources / pairwise / docs / html / pairwise_8h.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3 <title>pairwise: pairwise.h File Reference</title>
4 <link href="doxygen.css" rel="stylesheet" type="text/css">
5 </head><body>
6 <!-- Generated by Doxygen 1.3.2 -->
7 <div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
8 <h1>pairwise.h File Reference</h1><code>#include &lt;stdlib.h&gt;</code><br>
9
10 <p>
11 Include dependency graph for pairwise.h:<p><center><img src="pairwise_8h__incl.png" border="0" usemap="#pairwise.h_map" alt="Include dependency graph"></center>
12
13 <p>
14 This graph shows which files directly or indirectly include this file:<p><center><img src="pairwise_8h__dep__incl.png" border="0" usemap="#pairwise.hdep_map" alt="Included by dependency graph"></center>
15 <map name="pairwise.hdep_map">
16 <area href="pairwise_8c.html" shape="rect" coords="7,17,79,36" alt="">
17 </map>
18
19 <p>
20 <a href="pairwise_8h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0>
21 <tr><td></td></tr>
22 <tr><td colspan=2><br><h2>Data Structures</h2></td></tr>
23 <tr><td class="memItemLeft" nowrap align=right valign=top>struct &nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="structfasta.html">fasta</a></td></tr>
24
25 <tr><td colspan=2><br><h2>Functions</h2></td></tr>
26 <tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="pairwise_8h.html#a0">fatal_error</a> (char *message)</td></tr>
27
28 <tr><td class="memItemLeft" nowrap align=right valign=top>FILE *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="pairwise_8h.html#a1">xfopen</a> (const char *path, const char *mode)</td></tr>
29
30 <tr><td class="memItemLeft" nowrap align=right valign=top>void *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="pairwise_8h.html#a2">xmalloc</a> (size_t size)</td></tr>
31
32 <tr><td class="memItemLeft" nowrap align=right valign=top>void *&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="pairwise_8h.html#a3">xrealloc</a> (void *ptr, size_t size)</td></tr>
33
34 <tr><td class="memItemLeft" nowrap align=right valign=top>int&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="pairwise_8h.html#a4">diff</a> (char a, char b)</td></tr>
35
36 <tr><td class="memItemLeft" nowrap align=right valign=top>float&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="pairwise_8h.html#a5">pairwise</a> (struct <a class="el" href="structfasta.html">fasta</a> *a, struct <a class="el" href="structfasta.html">fasta</a> *b)</td></tr>
37
38 <tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="pairwise_8h.html#a6">populate</a> (struct <a class="el" href="structfasta.html">fasta</a> *a)</td></tr>
39
40 <tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="pairwise_8h.html#a7">check_length</a> (struct <a class="el" href="structfasta.html">fasta</a> **array)</td></tr>
41
42 <tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="structfasta.html">fasta</a> **&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="pairwise_8h.html#a8">read_fasta</a> (FILE *fh)</td></tr>
43
44 </table>
45 <hr><h2>Function Documentation</h2>
46 <a name="a7" doxytag="pairwise.h::check_length"></a><p>
47 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
48   <tr>
49     <td class="mdRow">
50       <table cellpadding="0" cellspacing="0" border="0">
51         <tr>
52           <td class="md" nowrap valign="top"> void check_length </td>
53           <td class="md" valign="top">(&nbsp;</td>
54           <td class="md" nowrap valign="top">struct <a class="el" href="structfasta.html">fasta</a> **&nbsp;</td>
55           <td class="mdname1" valign="top" nowrap> <em>array</em>          </td>
56           <td class="md" valign="top">&nbsp;)&nbsp;</td>
57           <td class="md" nowrap></td>
58         </tr>
59
60       </table>
61     </td>
62   </tr>
63 </table>
64 <table cellspacing=5 cellpadding=0 border=0>
65   <tr>
66     <td>
67       &nbsp;
68     </td>
69     <td>
70
71 <p>
72
73 <p>
74 Definition at line <a class="el" href="pairwise_8c-source.html#l00160">160</a> of file <a class="el" href="pairwise_8c-source.html">pairwise.c</a>.
75 <p>
76 References <a class="el" href="pairwise_8c-source.html#l00053">fatal_error()</a>.
77 <p>
78 Referenced by <a class="el" href="pairwise_8c-source.html#l00253">main()</a>.
79 <p>
80 <div class="fragment"><pre>00160                                     {
81 00161         <span class="keywordtype">int</span> i, length;
82 00162 
83 00163         <span class="keywordflow">if</span> (array[0] != NULL)
84 00164                 length = strlen(array[0]-&gt;seq);
85 00165         <span class="keywordflow">else</span> {
86 00166                 fprintf(stderr, <span class="stringliteral">"check_length() not passed an array of fasta structs\n"</span>);
87 00167                 <span class="keywordflow">return</span>;
88 00168         }
89 00169 
90 00170         <span class="keywordflow">for</span> (i = 0; array[i] != NULL; i++) {
91 00171                 <span class="keywordflow">if</span> (length != strlen(array[i]-&gt;seq)) {
92 00172                         <a class="code" href="pairwise_8c.html#a6">fatal_error</a>(<span class="stringliteral">"Not all of the sequences are the same length\n"</span>);
93 00173                 }
94 00174         }
95 00175 }
96 </pre></div>    </td>
97   </tr>
98 </table>
99
100 <p>
101 Here is the call graph for this function:<p><center><img src="pairwise_8h_a7_cgraph.png" border="0" usemap="#pairwise_8h_a7_cgraph_map" alt=""></center>
102 <map name="pairwise_8h_a7_cgraph_map">
103 <area href="pairwise_8h.html#a0" shape="rect" coords="160,5,235,23" alt="">
104 </map>
105 <a name="a4" doxytag="pairwise.h::diff"></a><p>
106 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
107   <tr>
108     <td class="mdRow">
109       <table cellpadding="0" cellspacing="0" border="0">
110         <tr>
111           <td class="md" nowrap valign="top"> int diff </td>
112           <td class="md" valign="top">(&nbsp;</td>
113           <td class="md" nowrap valign="top">char&nbsp;</td>
114           <td class="mdname" nowrap> <em>a</em>, </td>
115         </tr>
116         <tr>
117           <td></td>
118           <td></td>
119           <td class="md" nowrap>char&nbsp;</td>
120           <td class="mdname" nowrap> <em>b</em></td>
121         </tr>
122         <tr>
123           <td></td>
124           <td class="md">)&nbsp;</td>
125           <td class="md" colspan="2"></td>
126         </tr>
127
128       </table>
129     </td>
130   </tr>
131 </table>
132 <table cellspacing=5 cellpadding=0 border=0>
133   <tr>
134     <td>
135       &nbsp;
136     </td>
137     <td>
138
139 <p>
140
141 <p>
142 Definition at line <a class="el" href="pairwise_8c-source.html#l00092">92</a> of file <a class="el" href="pairwise_8c-source.html">pairwise.c</a>.
143 <p>
144 Referenced by <a class="el" href="pairwise_8c-source.html#l00106">pairwise()</a>.
145 <p>
146 <div class="fragment"><pre>00092                       {
147 00093         <span class="keywordflow">if</span> (a == b &amp;&amp; a == <span class="charliteral">'-'</span>)
148 00094                 <span class="keywordflow">return</span> 0;
149 00095         <span class="keywordflow">if</span> (a == b)
150 00096                 <span class="keywordflow">return</span> 1;
151 00097         <span class="keywordflow">return</span> 0;
152 00098 }
153 </pre></div>    </td>
154   </tr>
155 </table>
156 <a name="a0" doxytag="pairwise.h::fatal_error"></a><p>
157 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
158   <tr>
159     <td class="mdRow">
160       <table cellpadding="0" cellspacing="0" border="0">
161         <tr>
162           <td class="md" nowrap valign="top"> void fatal_error </td>
163           <td class="md" valign="top">(&nbsp;</td>
164           <td class="md" nowrap valign="top">char *&nbsp;</td>
165           <td class="mdname1" valign="top" nowrap> <em>message</em>          </td>
166           <td class="md" valign="top">&nbsp;)&nbsp;</td>
167           <td class="md" nowrap></td>
168         </tr>
169
170       </table>
171     </td>
172   </tr>
173 </table>
174 <table cellspacing=5 cellpadding=0 border=0>
175   <tr>
176     <td>
177       &nbsp;
178     </td>
179     <td>
180
181 <p>
182
183 <p>
184 Definition at line <a class="el" href="pairwise_8c-source.html#l00053">53</a> of file <a class="el" href="pairwise_8c-source.html">pairwise.c</a>.
185 <p>
186 Referenced by <a class="el" href="pairwise_8c-source.html#l00160">check_length()</a>.
187 <p>
188 <div class="fragment"><pre>00053                             {
189 00054         printf(message);
190 00055         exit(EXIT_FAILURE);
191 00056 }
192 </pre></div>    </td>
193   </tr>
194 </table>
195 <a name="a5" doxytag="pairwise.h::pairwise"></a><p>
196 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
197   <tr>
198     <td class="mdRow">
199       <table cellpadding="0" cellspacing="0" border="0">
200         <tr>
201           <td class="md" nowrap valign="top"> float pairwise </td>
202           <td class="md" valign="top">(&nbsp;</td>
203           <td class="md" nowrap valign="top">struct <a class="el" href="structfasta.html">fasta</a> *&nbsp;</td>
204           <td class="mdname" nowrap> <em>a</em>, </td>
205         </tr>
206         <tr>
207           <td></td>
208           <td></td>
209           <td class="md" nowrap>struct <a class="el" href="structfasta.html">fasta</a> *&nbsp;</td>
210           <td class="mdname" nowrap> <em>b</em></td>
211         </tr>
212         <tr>
213           <td></td>
214           <td class="md">)&nbsp;</td>
215           <td class="md" colspan="2"></td>
216         </tr>
217
218       </table>
219     </td>
220   </tr>
221 </table>
222 <table cellspacing=5 cellpadding=0 border=0>
223   <tr>
224     <td>
225       &nbsp;
226     </td>
227     <td>
228
229 <p>
230
231 <p>
232 Definition at line <a class="el" href="pairwise_8c-source.html#l00106">106</a> of file <a class="el" href="pairwise_8c-source.html">pairwise.c</a>.
233 <p>
234 References <a class="el" href="pairwise_8c-source.html#l00092">diff()</a>, <a class="el" href="pairwise_8h-source.html#l00007">fasta::end</a>, <a class="el" href="pairwise_8c-source.html#l00035">MAX</a>, <a class="el" href="pairwise_8c-source.html#l00039">MIN</a>, <a class="el" href="pairwise_8h-source.html#l00008">fasta::numres</a>, <a class="el" href="pairwise_8h-source.html#l00005">fasta::seq</a>, and <a class="el" href="pairwise_8h-source.html#l00006">fasta::start</a>.
235 <p>
236 Referenced by <a class="el" href="pairwise_8c-source.html#l00253">main()</a>.
237 <p>
238 <div class="fragment"><pre>00106                                             {
239 00107         <span class="keywordtype">float</span> result;
240 00108         <span class="keywordtype">int</span> start, end, numres, i, id = 0;
241 00109         
242 00110         <span class="comment">/* If the sequences don't overlap then the seq ID is 0 */</span>
243 00111         <span class="keywordflow">if</span> (a-&gt;<a class="code" href="structfasta.html#o3">end</a> &lt; b-&gt;<a class="code" href="structfasta.html#o2">start</a> || a-&gt;<a class="code" href="structfasta.html#o2">start</a> &gt; b-&gt;<a class="code" href="structfasta.html#o3">end</a>)
244 00112                 <span class="keywordflow">return</span> 0;
245 00113 
246 00114         start = <a class="code" href="pairwise_8c.html#a3">MIN</a>( a-&gt;<a class="code" href="structfasta.html#o2">start</a>, b-&gt;<a class="code" href="structfasta.html#o2">start</a> );
247 00115         end = <a class="code" href="pairwise_8c.html#a2">MAX</a>( a-&gt;<a class="code" href="structfasta.html#o3">end</a>, b-&gt;<a class="code" href="structfasta.html#o3">end</a> );
248 00116         numres = <a class="code" href="pairwise_8c.html#a2">MAX</a>( a-&gt;<a class="code" href="structfasta.html#o4">numres</a>, b-&gt;<a class="code" href="structfasta.html#o4">numres</a> );
249 00117 
250 00118         <span class="keywordflow">for</span> (i = start; i &lt; end; i++)
251 00119                 id += <a class="code" href="pairwise_8c.html#a11">diff</a>(a-&gt;<a class="code" href="structfasta.html#o1">seq</a>[i], b-&gt;<a class="code" href="structfasta.html#o1">seq</a>[i]);
252 00120 
253 00121         result = 100 * (<span class="keywordtype">float</span>) id / (<span class="keywordtype">float</span>) numres;
254 00122 
255 00123         <span class="keywordflow">return</span> result;
256 00124 }
257 </pre></div>    </td>
258   </tr>
259 </table>
260
261 <p>
262 Here is the call graph for this function:<p><center><img src="pairwise_8h_a5_cgraph.png" border="0" usemap="#pairwise_8h_a5_cgraph_map" alt=""></center>
263 <map name="pairwise_8h_a5_cgraph_map">
264 <area href="pairwise_8h.html#a4" shape="rect" coords="131,5,168,23" alt="">
265 </map>
266 <a name="a6" doxytag="pairwise.h::populate"></a><p>
267 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
268   <tr>
269     <td class="mdRow">
270       <table cellpadding="0" cellspacing="0" border="0">
271         <tr>
272           <td class="md" nowrap valign="top"> void populate </td>
273           <td class="md" valign="top">(&nbsp;</td>
274           <td class="md" nowrap valign="top">struct <a class="el" href="structfasta.html">fasta</a> *&nbsp;</td>
275           <td class="mdname1" valign="top" nowrap> <em>a</em>          </td>
276           <td class="md" valign="top">&nbsp;)&nbsp;</td>
277           <td class="md" nowrap></td>
278         </tr>
279
280       </table>
281     </td>
282   </tr>
283 </table>
284 <table cellspacing=5 cellpadding=0 border=0>
285   <tr>
286     <td>
287       &nbsp;
288     </td>
289     <td>
290
291 <p>
292
293 <p>
294 Definition at line <a class="el" href="pairwise_8c-source.html#l00133">133</a> of file <a class="el" href="pairwise_8c-source.html">pairwise.c</a>.
295 <p>
296 References <a class="el" href="pairwise_8h-source.html#l00007">fasta::end</a>, <a class="el" href="pairwise_8h-source.html#l00008">fasta::numres</a>, <a class="el" href="pairwise_8h-source.html#l00005">fasta::seq</a>, and <a class="el" href="pairwise_8h-source.html#l00006">fasta::start</a>.
297 <p>
298 Referenced by <a class="el" href="pairwise_8c-source.html#l00179">read_fasta()</a>.
299 <p>
300 <div class="fragment"><pre>00133                            {
301 00134         <span class="keywordtype">int</span> i;
302 00135         <span class="keywordtype">int</span> len = strlen(a-&gt;<a class="code" href="structfasta.html#o1">seq</a>);
303 00136 
304 00137         a-&gt;<a class="code" href="structfasta.html#o4">numres</a> = 0;
305 00138         
306 00139         <span class="keywordflow">for</span> (i = 0; i &lt;= len; i++) {
307 00140                 <span class="keywordflow">if</span> (a-&gt;<a class="code" href="structfasta.html#o1">seq</a>[i] != <span class="charliteral">'-'</span>) {
308 00141                         a-&gt;<a class="code" href="structfasta.html#o2">start</a> = i;
309 00142                         <span class="keywordflow">break</span>;
310 00143                 }
311 00144         }
312 00145         <span class="keywordflow">for</span> (i = len; i &gt; 0; i--) {
313 00146                 <span class="keywordflow">if</span> (a-&gt;<a class="code" href="structfasta.html#o1">seq</a>[i] != <span class="charliteral">'-'</span>) {
314 00147                         a-&gt;<a class="code" href="structfasta.html#o3">end</a> = i;
315 00148                         <span class="keywordflow">break</span>;
316 00149                 }
317 00150         }
318 00151         <span class="keywordflow">for</span> (i = a-&gt;<a class="code" href="structfasta.html#o2">start</a>; i &lt; a-&gt;<a class="code" href="structfasta.html#o3">end</a>; i++) {
319 00152                 <span class="keywordflow">if</span> (a-&gt;<a class="code" href="structfasta.html#o1">seq</a>[i] != <span class="charliteral">'-'</span>) {
320 00153                         a-&gt;<a class="code" href="structfasta.html#o4">numres</a>++;
321 00154                 }
322 00155         }
323 00156 }
324 </pre></div>    </td>
325   </tr>
326 </table>
327 <a name="a8" doxytag="pairwise.h::read_fasta"></a><p>
328 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
329   <tr>
330     <td class="mdRow">
331       <table cellpadding="0" cellspacing="0" border="0">
332         <tr>
333           <td class="md" nowrap valign="top"> struct <a class="el" href="structfasta.html">fasta</a>** read_fasta </td>
334           <td class="md" valign="top">(&nbsp;</td>
335           <td class="md" nowrap valign="top">FILE *&nbsp;</td>
336           <td class="mdname1" valign="top" nowrap> <em>fh</em>          </td>
337           <td class="md" valign="top">&nbsp;)&nbsp;</td>
338           <td class="md" nowrap></td>
339         </tr>
340
341       </table>
342     </td>
343   </tr>
344 </table>
345 <table cellspacing=5 cellpadding=0 border=0>
346   <tr>
347     <td>
348       &nbsp;
349     </td>
350     <td>
351
352 <p>
353
354 <p>
355 Definition at line <a class="el" href="pairwise_8c-source.html#l00179">179</a> of file <a class="el" href="pairwise_8c-source.html">pairwise.c</a>.
356 <p>
357 References <a class="el" href="pairwise_8c-source.html#l00029">ARRAY</a>, <a class="el" href="pairwise_8c-source.html#l00030">FILEBUF</a>, <a class="el" href="pairwise_8h-source.html#l00004">fasta::id</a>, <a class="el" href="pairwise_8h-source.html#l00008">fasta::numres</a>, <a class="el" href="pairwise_8c-source.html#l00133">populate()</a>, <a class="el" href="pairwise_8c-source.html#l00179">read_fasta()</a>, <a class="el" href="pairwise_8h-source.html#l00005">fasta::seq</a>, <a class="el" href="pairwise_8c-source.html#l00074">xmalloc()</a>, and <a class="el" href="pairwise_8c-source.html#l00083">xrealloc()</a>.
358 <p>
359 Referenced by <a class="el" href="pairwise_8c-source.html#l00253">main()</a>, and <a class="el" href="pairwise_8c-source.html#l00179">read_fasta()</a>.
360 <p>
361 <div class="fragment"><pre>00179                       {
362 00180         <span class="keywordtype">int</span> i, j, k, c, filesize = 1;
363 00181         <span class="keywordtype">char</span> *file;
364 00182         <span class="keyword">struct </span><a class="code" href="structfasta.html">fasta</a> **array;
365 00183 
366 00184         array = (<span class="keyword">struct </span><a class="code" href="structfasta.html">fasta</a> **) <a class="code" href="pairwise_8c.html#a9">xmalloc</a>(<a class="code" href="pairwise_8c.html#a0">ARRAY</a> * sizeof(struct fasta *));
367 00185         file = (<span class="keywordtype">char</span> *) <a class="code" href="pairwise_8c.html#a9">xmalloc</a>(<span class="keyword">sizeof</span>(<span class="keywordtype">char</span>));
368 00186 
369 00187         <span class="comment">/* Allocate initial space for the file */</span>
370 00188         file = <a class="code" href="pairwise_8c.html#a10">xrealloc</a>(file, <span class="keyword">sizeof</span>(<span class="keywordtype">char</span>) * filesize);
371 00189         file[filesize] = <span class="charliteral">'\0'</span>;
372 00190 
373 00191         <span class="comment">/* Read in the file */</span>
374 00192         <span class="keywordflow">while</span> ((c = getc(fh)) != EOF) {
375 00193                 <span class="keywordflow">if</span> (filesize % <a class="code" href="pairwise_8c.html#a1">FILEBUF</a>)
376 00194                         file = <a class="code" href="pairwise_8c.html#a10">xrealloc</a>(file, <span class="keyword">sizeof</span>(<span class="keywordtype">char</span>) * (FILEBUF + filesize));
377 00195 
378 00196                 file[filesize] = c;
379 00197                 filesize++;
380 00198         }
381 00199 
382 00200         <span class="comment">/* Parse the FASTA file into an array of structures */</span>
383 00201         <span class="keywordflow">for</span> (i = 0, j = 0, k = 0; i &lt; filesize; i++) {
384 00202                 <span class="keywordflow">if</span> (file[i] == <span class="charliteral">'&gt;'</span>) {
385 00203                         <span class="keywordflow">if</span> (j % <a class="code" href="pairwise_8c.html#a0">ARRAY</a> == 0)
386 00204                                 array = (<span class="keyword">struct </span>fasta **) <a class="code" href="pairwise_8c.html#a10">xrealloc</a>(array, sizeof(struct fasta *) * (j + <a class="code" href="pairwise_8c.html#a0">ARRAY</a>));
387 00205 
388 00206                         array[j] = (<span class="keyword">struct </span>fasta *) <a class="code" href="pairwise_8c.html#a9">xmalloc</a>(sizeof(struct fasta));
389 00207                         array[j]-&gt;<a class="code" href="structfasta.html#o0">id</a> = (<span class="keywordtype">char</span> *) <a class="code" href="pairwise_8c.html#a9">xmalloc</a>(<span class="keyword">sizeof</span>(<span class="keywordtype">char</span>));
390 00208                         array[j]-&gt;<a class="code" href="structfasta.html#o1">seq</a> = (<span class="keywordtype">char</span> *) <a class="code" href="pairwise_8c.html#a9">xmalloc</a>(<span class="keyword">sizeof</span>(<span class="keywordtype">char</span>));
391 00209                         array[j]-&gt;<a class="code" href="structfasta.html#o4">numres</a> = 0;
392 00210 
393 00211                         i++;
394 00212                         <span class="keywordflow">while</span> (file[i] != <span class="charliteral">'\0'</span> &amp;&amp; file[i] != <span class="charliteral">'\n'</span>) {
395 00213                                 <span class="keywordflow">if</span> (k % <a class="code" href="pairwise_8c.html#a0">ARRAY</a> == 0)
396 00214                                         array[j]-&gt;<a class="code" href="structfasta.html#o0">id</a> = (<span class="keywordtype">char</span> *) <a class="code" href="pairwise_8c.html#a10">xrealloc</a>(array[j]-&gt;id, <span class="keyword">sizeof</span>(<span class="keywordtype">char</span>) * (ARRAY + k));
397 00215                                 array[j]-&gt;<a class="code" href="structfasta.html#o0">id</a>[k] = file[i];
398 00216                                 k++; i++;
399 00217                         }
400 00218                         array[j]-&gt;<a class="code" href="structfasta.html#o0">id</a> = (<span class="keywordtype">char</span> *) <a class="code" href="pairwise_8c.html#a10">xrealloc</a>(array[j]-&gt;id, <span class="keyword">sizeof</span>(<span class="keywordtype">char</span>) * (ARRAY + k));
401 00219                         array[j]-&gt;<a class="code" href="structfasta.html#o0">id</a>[k] = <span class="charliteral">'\0'</span>;
402 00220                         k = 0;
403 00221 
404 00222                         <span class="keywordflow">while</span> (file[i] != <span class="charliteral">'\0'</span> &amp;&amp; file[i] != <span class="charliteral">'&gt;'</span>) {
405 00223                                 <span class="keywordflow">if</span> (file[i] == <span class="charliteral">'\n'</span>) {
406 00224                                         i++;
407 00225                                         <span class="keywordflow">continue</span>;
408 00226                                 }
409 00227                                 <span class="keywordflow">if</span> (k % <a class="code" href="pairwise_8c.html#a0">ARRAY</a> == 0)
410 00228                                         array[j]-&gt;<a class="code" href="structfasta.html#o1">seq</a> = (<span class="keywordtype">char</span> *) <a class="code" href="pairwise_8c.html#a10">xrealloc</a>(array[j]-&gt;seq, <span class="keyword">sizeof</span>(<span class="keywordtype">char</span>) * (ARRAY + k));
411 00229                                 array[j]-&gt;<a class="code" href="structfasta.html#o1">seq</a>[k] = file[i];
412 00230                                 k++; i++;
413 00231                         }
414 00232                         array[j]-&gt;<a class="code" href="structfasta.html#o1">seq</a> = (<span class="keywordtype">char</span> *) <a class="code" href="pairwise_8c.html#a10">xrealloc</a>(array[j]-&gt;seq, <span class="keyword">sizeof</span>(<span class="keywordtype">char</span>) * (ARRAY + k));
415 00233                         array[j]-&gt;<a class="code" href="structfasta.html#o1">seq</a>[k] = <span class="charliteral">'\0'</span>;
416 00234                         k = 0;
417 00235                         i--;
418 00236                         j++;
419 00237                 }
420 00238         }
421 00239 
422 00240         free(file);
423 00241         array = (<span class="keyword">struct </span>fasta **) <a class="code" href="pairwise_8c.html#a10">xrealloc</a>(array, sizeof(struct fasta *) * j);
424 00242         array[j] = NULL;
425 00243 
426 00244         <span class="comment">/* find the start and end points for the alignments */</span>
427 00245         <span class="keywordflow">for</span> (i = 0; array[i] != NULL; i++) {
428 00246                 <a class="code" href="pairwise_8c.html#a13">populate</a>(array[i]);
429 00247         }
430 00248 
431 00249         <span class="keywordflow">return</span> array;
432 00250 }
433 </pre></div>    </td>
434   </tr>
435 </table>
436
437 <p>
438 Here is the call graph for this function:<p><center><img src="pairwise_8h_a8_cgraph.png" border="0" usemap="#pairwise_8h_a8_cgraph_map" alt=""></center>
439 <map name="pairwise_8h_a8_cgraph_map">
440 <area href="pairwise_8h.html#a6" shape="rect" coords="273,45,340,63" alt="">
441 <area href="pairwise_8c.html#a15" shape="rect" coords="147,79,224,98" alt="">
442 <area href="pairwise_8c.html#a9" shape="rect" coords="277,150,336,169" alt="">
443 <area href="pairwise_8h.html#a3" shape="rect" coords="276,107,337,126" alt="">
444 <area href="pairwise_8c.html#a7" shape="rect" coords="388,129,492,147" alt="">
445 </map>
446 <a name="a1" doxytag="pairwise.h::xfopen"></a><p>
447 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
448   <tr>
449     <td class="mdRow">
450       <table cellpadding="0" cellspacing="0" border="0">
451         <tr>
452           <td class="md" nowrap valign="top"> FILE* xfopen </td>
453           <td class="md" valign="top">(&nbsp;</td>
454           <td class="md" nowrap valign="top">const char *&nbsp;</td>
455           <td class="mdname" nowrap> <em>path</em>, </td>
456         </tr>
457         <tr>
458           <td></td>
459           <td></td>
460           <td class="md" nowrap>const char *&nbsp;</td>
461           <td class="mdname" nowrap> <em>mode</em></td>
462         </tr>
463         <tr>
464           <td></td>
465           <td class="md">)&nbsp;</td>
466           <td class="md" colspan="2"></td>
467         </tr>
468
469       </table>
470     </td>
471   </tr>
472 </table>
473 <table cellspacing=5 cellpadding=0 border=0>
474   <tr>
475     <td>
476       &nbsp;
477     </td>
478     <td>
479
480 <p>
481
482 <p>
483 Definition at line <a class="el" href="pairwise_8c-source.html#l00065">65</a> of file <a class="el" href="pairwise_8c-source.html">pairwise.c</a>.
484 <p>
485 References <a class="el" href="pairwise_8c-source.html#l00059">fatal_sys_error()</a>.
486 <p>
487 Referenced by <a class="el" href="pairwise_8c-source.html#l00253">main()</a>.
488 <p>
489 <div class="fragment"><pre>00065                                             {
490 00066         FILE *fh;
491 00067         fh = fopen(path, mode);
492 00068         <span class="keywordflow">if</span> (fh == NULL)
493 00069                 <a class="code" href="pairwise_8c.html#a7">fatal_sys_error</a>(<span class="stringliteral">"fopen returned NULL"</span>);
494 00070         <span class="keywordflow">return</span> fh;
495 00071 }
496 </pre></div>    </td>
497   </tr>
498 </table>
499
500 <p>
501 Here is the call graph for this function:<p><center><img src="pairwise_8h_a1_cgraph.png" border="0" usemap="#pairwise_8h_a1_cgraph_map" alt=""></center>
502 <map name="pairwise_8h_a1_cgraph_map">
503 <area href="pairwise_8c.html#a7" shape="rect" coords="121,5,225,23" alt="">
504 </map>
505 <a name="a2" doxytag="pairwise.h::xmalloc"></a><p>
506 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
507   <tr>
508     <td class="mdRow">
509       <table cellpadding="0" cellspacing="0" border="0">
510         <tr>
511           <td class="md" nowrap valign="top"> void* xmalloc </td>
512           <td class="md" valign="top">(&nbsp;</td>
513           <td class="md" nowrap valign="top">size_t&nbsp;</td>
514           <td class="mdname1" valign="top" nowrap> <em>size</em>          </td>
515           <td class="md" valign="top">&nbsp;)&nbsp;</td>
516           <td class="md" nowrap></td>
517         </tr>
518
519       </table>
520     </td>
521   </tr>
522 </table>
523 <table cellspacing=5 cellpadding=0 border=0>
524   <tr>
525     <td>
526       &nbsp;
527     </td>
528     <td>
529
530 <p>
531
532 <p>
533 Definition at line <a class="el" href="pairwise_8c-source.html#l00074">74</a> of file <a class="el" href="pairwise_8c-source.html">pairwise.c</a>.
534 <p>
535 References <a class="el" href="pairwise_8c-source.html#l00059">fatal_sys_error()</a>.
536 <p>
537 Referenced by <a class="el" href="pairwise_8c-source.html#l00179">read_fasta()</a>.
538 <p>
539 <div class="fragment"><pre>00074                       {
540 00075         <span class="keywordtype">void</span> *ptr;
541 00076         ptr = (<span class="keywordtype">void</span> *) malloc(size);
542 00077         <span class="keywordflow">if</span> (ptr == NULL)
543 00078                 <a class="code" href="pairwise_8c.html#a7">fatal_sys_error</a>(<span class="stringliteral">"malloc returned NULL"</span>);
544 00079         <span class="keywordflow">return</span> ptr;
545 00080 }
546 </pre></div>    </td>
547   </tr>
548 </table>
549
550 <p>
551 Here is the call graph for this function:<p><center><img src="pairwise_8h_a2_cgraph.png" border="0" usemap="#pairwise_8h_a2_cgraph_map" alt=""></center>
552 <map name="pairwise_8h_a2_cgraph_map">
553 <area href="pairwise_8c.html#a7" shape="rect" coords="127,5,231,23" alt="">
554 </map>
555 <a name="a3" doxytag="pairwise.h::xrealloc"></a><p>
556 <table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
557   <tr>
558     <td class="mdRow">
559       <table cellpadding="0" cellspacing="0" border="0">
560         <tr>
561           <td class="md" nowrap valign="top"> void* xrealloc </td>
562           <td class="md" valign="top">(&nbsp;</td>
563           <td class="md" nowrap valign="top">void *&nbsp;</td>
564           <td class="mdname" nowrap> <em>ptr</em>, </td>
565         </tr>
566         <tr>
567           <td></td>
568           <td></td>
569           <td class="md" nowrap>size_t&nbsp;</td>
570           <td class="mdname" nowrap> <em>size</em></td>
571         </tr>
572         <tr>
573           <td></td>
574           <td class="md">)&nbsp;</td>
575           <td class="md" colspan="2"></td>
576         </tr>
577
578       </table>
579     </td>
580   </tr>
581 </table>
582 <table cellspacing=5 cellpadding=0 border=0>
583   <tr>
584     <td>
585       &nbsp;
586     </td>
587     <td>
588
589 <p>
590
591 <p>
592 Definition at line <a class="el" href="pairwise_8c-source.html#l00083">83</a> of file <a class="el" href="pairwise_8c-source.html">pairwise.c</a>.
593 <p>
594 References <a class="el" href="pairwise_8c-source.html#l00059">fatal_sys_error()</a>.
595 <p>
596 Referenced by <a class="el" href="pairwise_8c-source.html#l00179">read_fasta()</a>.
597 <p>
598 <div class="fragment"><pre>00083                                   {
599 00084         ptr = (<span class="keywordtype">void</span> *) realloc(ptr, size);
600 00085         <span class="keywordflow">if</span> (ptr == NULL &amp;&amp; size != 0)
601 00086                 <a class="code" href="pairwise_8c.html#a7">fatal_sys_error</a>(<span class="stringliteral">"realloc returned NULL"</span>);
602 00087         <span class="keywordflow">return</span> ptr;
603 00088 }
604 </pre></div>    </td>
605   </tr>
606 </table>
607
608 <p>
609 Here is the call graph for this function:<p><center><img src="pairwise_8h_a3_cgraph.png" border="0" usemap="#pairwise_8h_a3_cgraph_map" alt=""></center>
610 <map name="pairwise_8h_a3_cgraph_map">
611 <area href="pairwise_8c.html#a7" shape="rect" coords="127,5,231,23" alt="">
612 </map>
613 <hr size="1"><address style="align: right;"><small>Generated on Thu Jul 24 12:17:51 2003 for pairwise by
614 <a href="http://www.doxygen.org/index.html">
615 <img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
616 </a>1.3.2 </small></address>
617 </body>
618 </html>