Mercurial > repos > dawe > srf2fastq
comparison srf2fastq/io_lib-1.12.2/io_lib/seqIOCTF.c @ 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 * Title: seqIOCTF | |
3 * | |
4 * File: seqIOCTF.c | |
5 * Purpose: Reading/writing of CTF sequences | |
6 * Last update: March 2000 | |
7 * | |
8 * Change log: | |
9 * Created mieg, march 2000, importing code from wabi/ctftrace.c | |
10 */ | |
11 | |
12 | |
13 /* ---- Imports ---- */ | |
14 | |
15 #include <stdio.h> | |
16 #include <stdlib.h> | |
17 #include <ctype.h> | |
18 #include <string.h> | |
19 | |
20 #include "io_lib/Read.h" | |
21 #include "io_lib/seqIOCTF.h" | |
22 #include "io_lib/abi.h" | |
23 #include "io_lib/mach-io.h" | |
24 #include "io_lib/xalloc.h" | |
25 #include "io_lib/stdio_hack.h" | |
26 | |
27 /* ---- Constants ---- */ | |
28 | |
29 /* | |
30 * Read the CTF format sequence from FILE *fp into a Read structure. | |
31 | |
32 * Returns: | |
33 * Read * - Success, the Read structure read. | |
34 * NULLRead - Failure. | |
35 */ | |
36 Read *fread_ctf (FILE *fp) { | |
37 Read *read = ctfFRead (fp) ; | |
38 | |
39 return read ; | |
40 } | |
41 | |
42 /* | |
43 * Read the CTF format sequence from file 'fn' into a Read structure. | |
44 */ | |
45 | |
46 Read *read_ctf (char *fn) { | |
47 Read *read; | |
48 FILE *fp; | |
49 | |
50 /* Open file */ | |
51 if ((fp = fopen(fn, "rb")) == NULL) | |
52 return NULLRead; | |
53 | |
54 read = fread_ctf(fp); | |
55 fclose(fp); | |
56 | |
57 if (read && (read->trace_name = (char *)xmalloc(strlen(fn)+1))) | |
58 strcpy(read->trace_name, fn); | |
59 | |
60 return read; | |
61 } | |
62 | |
63 | |
64 /* | |
65 * Write to an CTF file - unsupported. | |
66 */ | |
67 /* ARGSUSED */ | |
68 int fwrite_ctf (FILE *fp, Read *read) { | |
69 return ctfFWrite (fp, read) ; | |
70 } | |
71 | |
72 /* | |
73 * Write to an CTF file | |
74 */ | |
75 /* ARGSUSED */ | |
76 int write_ctf(char *fn, Read *read) { | |
77 FILE *fp; | |
78 | |
79 /* Open file */ | |
80 if ((fp = fopen(fn, "wb")) == NULL) | |
81 return -1 ; | |
82 | |
83 fwrite_ctf (fp, read) ; | |
84 fclose(fp); | |
85 | |
86 return 0 ; | |
87 } | |
88 |