Mercurial > repos > dawe > srf2fastq
comparison srf2fastq/io_lib-1.12.2/io_lib/expFileIO.h @ 0:d901c9f41a6a default tip
Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
author | dawe |
---|---|
date | Tue, 07 Jun 2011 17:48:05 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d901c9f41a6a |
---|---|
1 /* | |
2 * Copyright (c) Medical Research Council 1994. All rights reserved. | |
3 * | |
4 * Permission to use, copy, modify and distribute this software and its | |
5 * documentation for any purpose is hereby granted without fee, provided that | |
6 * this copyright and notice appears in all copies. | |
7 * | |
8 * This file was written by James Bonfield, Simon Dear, Rodger Staden, | |
9 * as part of the Staden Package at the MRC Laboratory of Molecular | |
10 * Biology, Hills Road, Cambridge, CB2 2QH, United Kingdom. | |
11 * | |
12 * MRC disclaims all warranties with regard to this software. | |
13 */ | |
14 | |
15 /* | |
16 * File: expFileIO.h | |
17 * Version: | |
18 * | |
19 * Description: | |
20 * | |
21 * Created: | |
22 * Updated: | |
23 * | |
24 */ | |
25 | |
26 #ifndef _EXPFILEIO_H_ | |
27 #define _EXPFILEIO_H_ | |
28 | |
29 #include <stdio.h> | |
30 | |
31 #include "io_lib/mFILE.h" | |
32 #include "io_lib/array.h" | |
33 #include "io_lib/os.h" | |
34 | |
35 #ifdef __cplusplus | |
36 extern "C" { | |
37 #endif | |
38 | |
39 /* | |
40 * Definitions | |
41 */ | |
42 #define MAXIMUM_EFLT_LENGTH 4 | |
43 #define MAXIMUM_EFLTS 60 | |
44 #define EFLT_FILE_LINE_LENGTH 128 | |
45 #define EXP_FILE_LINE_LENGTH 128 | |
46 | |
47 typedef Array Exp_entries; | |
48 | |
49 typedef struct { | |
50 Array entries[MAXIMUM_EFLTS]; /* array of array of entries */ | |
51 int Nentries[MAXIMUM_EFLTS]; | |
52 mFILE *fp; | |
53 } Exp_info; | |
54 | |
55 #define NULL_Exp_info ( (Exp_info *) NULL ) | |
56 | |
57 | |
58 | |
59 #define exp_Nentries(E,I) ((E)->Nentries[I]) /* get last entry for line I */ | |
60 | |
61 #define exp_get_entry(E,I) (arr(char *,(E)->entries[I],(E)->Nentries[I] - 1)) /* get last entry for line I */ | |
62 | |
63 /* | |
64 * Allocate an set a new experiment file entry | |
65 */ | |
66 extern char *exp_set_entry(Exp_info *e, int eflt, char *str); | |
67 | |
68 | |
69 | |
70 /************************************************************* | |
71 * Experiment file line types | |
72 *************************************************************/ | |
73 | |
74 extern char eflt_feature_ids[MAXIMUM_EFLTS][MAXIMUM_EFLT_LENGTH+1]; | |
75 | |
76 #define EFLT_CF 0 | |
77 #define EFLT_CN 1 | |
78 #define EFLT_CS 2 | |
79 #define EFLT_CV 3 | |
80 #define EFLT_DR 4 | |
81 #define EFLT_DT 5 | |
82 #define EFLT_EN 6 | |
83 #define EFLT_EX 7 | |
84 #define EFLT_FM 8 | |
85 #define EFLT_LN 9 | |
86 #define EFLT_LT 10 | |
87 #define EFLT_MC 11 | |
88 #define EFLT_MN 12 | |
89 #define EFLT_MT 13 | |
90 #define EFLT_OP 14 | |
91 #define EFLT_PN 15 | |
92 #define EFLT_QR 16 | |
93 #define EFLT_SC 17 | |
94 #define EFLT_SF 18 | |
95 #define EFLT_SI 19 | |
96 #define EFLT_SL 20 | |
97 #define EFLT_SP 21 | |
98 #define EFLT_SQ 22 | |
99 #define EFLT_SR 23 | |
100 #define EFLT_ST 24 | |
101 #define EFLT_SV 25 | |
102 #define EFLT_TN 26 | |
103 #define EFLT_QL 27 | |
104 #define EFLT_PS 28 | |
105 #define EFLT_CC 29 | |
106 #define EFLT_SS 30 | |
107 #define EFLT_TG 31 | |
108 #define EFLT_ID 32 | |
109 #define EFLT_AQ 33 | |
110 #define EFLT_PR 34 | |
111 #define EFLT_LI 35 | |
112 #define EFLT_LE 36 | |
113 #define EFLT_TC 37 | |
114 #define EFLT_AC 38 | |
115 #define EFLT_BC 39 | |
116 #define EFLT_ON 40 | |
117 #define EFLT_AV 41 | |
118 #define EFLT_PC 42 | |
119 #define EFLT_SE 43 | |
120 #define EFLT_CL 44 | |
121 #define EFLT_CR 45 | |
122 #define EFLT_AP 46 | |
123 #define EFLT_CH 47 | |
124 #define EFLT_PD 48 | |
125 #define EFLT_WT 49 | |
126 #define EFLT_NT 50 | |
127 #define EFLT_GD 51 | |
128 #define EFLT_WL 52 | |
129 #define EFLT_WR 53 | |
130 #define EFLT_FT 54 | |
131 #define EFLT_LG 55 | |
132 | |
133 | |
134 /*************************************************************************************/ | |
135 | |
136 | |
137 /* | |
138 * Creates a string of 'range format' from the start and end points. | |
139 * The string (of form start..end) is also returned. | |
140 */ | |
141 extern char *exp_create_range(char *str, int start, int end); | |
142 | |
143 /* | |
144 * Extracts the start and end points from a range string. | |
145 * Returns 0 for success and -1 for failure. | |
146 */ | |
147 extern int exp_extract_range(char *str, int *start, int *end); | |
148 | |
149 /* | |
150 * Output an experiment file line | |
151 */ | |
152 extern int exp_print_line(mFILE *fp, Exp_info *e, int eflt, int i); | |
153 | |
154 /* | |
155 * Output an experiment file multi-line | |
156 */ | |
157 extern int exp_print_mline(mFILE *fp, Exp_info *e, int eflt, int i); | |
158 | |
159 extern int exp_print_seq(mFILE *fp, Exp_info *e, int eflt, int i); | |
160 /* | |
161 * Output an experiment file multi line | |
162 */ | |
163 | |
164 | |
165 | |
166 extern int exp_get_feature_index(char *e); | |
167 | |
168 extern void exp_destroy_info(Exp_info *e); | |
169 /* | |
170 * Destroy experiment file information | |
171 */ | |
172 | |
173 | |
174 | |
175 extern Exp_info *exp_create_info(void); | |
176 /* | |
177 * Allocate space for new experiment file information | |
178 */ | |
179 | |
180 | |
181 | |
182 | |
183 | |
184 | |
185 | |
186 extern Exp_info *exp_fread_info(FILE *fp); | |
187 extern Exp_info *exp_mfread_info(mFILE *fp); | |
188 extern Exp_info *exp_read_info(char *file); | |
189 /* | |
190 * Read in an experiment file and return handle | |
191 */ | |
192 | |
193 | |
194 char *opos2str(int2 *opos, int len, char *buf); | |
195 int str2opos(int2 *opos, int len, char *buf); | |
196 char *conf2str(int1 *conf, int len, char *buf); | |
197 int str2conf(int1 *conf, int len, char *buf); | |
198 | |
199 extern int exp_get_int(Exp_info *e, int id, int *val); | |
200 /* | |
201 * Get the integer for entry id | |
202 * returns: | |
203 * 0 - success | |
204 * 1 - no entry | |
205 */ | |
206 | |
207 | |
208 extern int exp_get_rng(Exp_info *e, int id, int *from, int *to); | |
209 /* | |
210 * Get the integer pair for entry id | |
211 * returns: | |
212 * 0 - success | |
213 * 1 - no entry | |
214 */ | |
215 | |
216 | |
217 extern int exp_get_str(Exp_info *e, int id, char *s, f_implicit s_l); | |
218 /* | |
219 * Get the string for entry id | |
220 * returns: | |
221 * 0 - success | |
222 * 1 - no entry | |
223 */ | |
224 | |
225 | |
226 extern int exp_put_int(Exp_info *e, int id, int *val); | |
227 /* | |
228 * Append the integer for entry id to the experiment file | |
229 * returns: | |
230 * 0 - success | |
231 * 1 - no update | |
232 */ | |
233 | |
234 | |
235 extern int exp_put_rng(Exp_info *e, int id, int *from, int *to); | |
236 /* | |
237 * Append the integer pair for entry id to the experiment file | |
238 * returns: | |
239 * 0 - success | |
240 * 1 - no update | |
241 */ | |
242 | |
243 | |
244 | |
245 extern int exp_put_str(Exp_info *e, int id, char *s, f_implicit s_l); | |
246 /* | |
247 * Append the string for entry id to the experiment file | |
248 * returns: | |
249 * 0 - success | |
250 * 1 - no update | |
251 */ | |
252 | |
253 | |
254 extern void exp_close(Exp_info *e); | |
255 /* | |
256 * Closes an experiment file (if open), but does not free it. | |
257 */ | |
258 | |
259 /* | |
260 * FORTRAN INTERFACE | |
261 */ | |
262 | |
263 | |
264 | |
265 extern f_int expopn_(char *fn, f_implicit fn_l); | |
266 /* | |
267 * FORTRAN interface to exp_open_file() | |
268 */ | |
269 | |
270 extern f_proc_ret expkil_(f_int *le); | |
271 /* | |
272 * FORTRAN interface to exp_destroy_info | |
273 */ | |
274 | |
275 extern f_int expri_(f_int *le, f_int *id, f_int *val); | |
276 /* | |
277 * FORTRAN interface to exp_get_int | |
278 */ | |
279 | |
280 | |
281 extern f_int exprr_(f_int *le, f_int *id, f_int *from, f_int *to); | |
282 /* | |
283 * FORTRAN interface to exp_get_rng | |
284 */ | |
285 | |
286 | |
287 extern f_int exprsa_(f_int *le, f_int *id, char *s, f_int *max_len, f_implicit s_l); | |
288 /* | |
289 * FORTRAN interface to exp_get_str workalike | |
290 * NOTE: for use with FORTRAN CHARACTER arrays instead CHARACTER strings | |
291 */ | |
292 | |
293 extern f_int exprs_(f_int *le, f_int *id, char *s, f_implicit s_l); | |
294 /* | |
295 * FORTRAN interface to exp_get_str workalike | |
296 * NOTE: for use with FORTRAN CHARACTER strings instead CHARACTER arrays | |
297 */ | |
298 | |
299 extern f_int expwi_(f_int *le, f_int *id, f_int *val); | |
300 /* | |
301 * FORTRAN interface to exp_put_int | |
302 */ | |
303 | |
304 | |
305 extern f_int expwr_(f_int *le, f_int *id, f_int *from, f_int *to); | |
306 /* | |
307 * FORTRAN interface to exp_put_rng | |
308 */ | |
309 | |
310 | |
311 | |
312 extern f_int expwsa_(f_int *le, f_int *id, char *s, f_int *max_len, f_implicit s_l); | |
313 /* | |
314 * FORTRAN interface to exp_put_str workalike | |
315 * NOTE: for use with FORTRAN CHARACTER arrays instead CHARACTER strings | |
316 */ | |
317 | |
318 | |
319 | |
320 extern f_int expws_(f_int *le, f_int *id, char *s, f_implicit s_l); | |
321 /* | |
322 * FORTRAN interface to exp_put_str workalike | |
323 * NOTE: for use with FORTRAN CHARACTER strings instead CHARACTER arrays | |
324 */ | |
325 | |
326 | |
327 extern void exp_print_file(FILE *fp, Exp_info *e); | |
328 extern void exp_print_mfile(mFILE *fp, Exp_info *e); | |
329 | |
330 /* | |
331 * FORTRAN interface to exp_create_range() | |
332 */ | |
333 extern void expcr_(char *str, f_int *start, f_int *end, f_implicit str_l); | |
334 | |
335 /* | |
336 * FORTRAN interface to exp_extract_range() | |
337 */ | |
338 extern f_int exper_(char *str, f_int *start, f_int *end, f_implicit str_l); | |
339 | |
340 #ifdef __cplusplus | |
341 } | |
342 #endif | |
343 | |
344 #endif /* _EXPFILEIO_H_ */ | |
345 |