1read_reading(3) Staden Package read_reading(3)
2
3
4
6 read_reading, fread_reading - Read a trace file into a Read structure.
7
8
10 #include <Read.h>
11
12 Read *read_reading(
13 char *filename,
14 int format);
15
16 Read *fread_reading(
17 FILE *fp,
18 char *filename,
19 int format);
20
21
23 These functions read trace files into a Read structure. A variety of
24 formats are supported including ABI, ALF and SCF. (Note that the first
25 two are only supported when the library is used as part of the Staden
26 Package.) Additionally, support for reading the plain (old) staden
27 format files and Experiment files is included. Compressed trace files
28 may also be read. Decompression is performed using either gzip -d or
29 uncompress and is written to a temporary file for further processing.
30 The temporary file is then read and removed.
31
32 When reading an experiment file the trace file referenced by the LN and
33 LT line types is read. The QL, QR (left and right quality clips), SL
34 and SR (left and right vector clips) are taken from the Experiment file
35 to produce the cutoff information held within the Read structure. The
36 orig_trace field of the Read structure will then contain the pointer to
37 the experiment file structure and the orig_trace_format field will be
38 set to TT_EXP.
39
40 The functions allocate a Read structure which is returned. To deallo‐
41 cate this structure use the read_deallocate() function.
42
43 read_reading() reads a trace from the specified filename and format.
44 Formats available are TT_SCF, TT_ABI, TT_ALF, TT_PLN, TT_EXPand TT_ANY.
45 Specifying format TT_ANY will attempt to automatically detect the cor‐
46 ret format type by analysing the trace file for magic numbers and com‐
47 position. The format field of the structure can then be used to deter‐
48 mine the real trace type.
49
50 fread_reading() reads a trace from the specified file pointer. The
51 filename argument is used for setting the trace_name field of the
52 resulting structure, and for error messages. Otherwise the function is
53 identical to the read_reading() function.
54
55 The Read structure itself is as follows.
56 typedef uint_2 TRACE; /* for trace heights */
57
58 typedef struct
59 {
60 int format; /* Trace file format */
61 char *trace_name; /* Trace file name */
62
63 int NPoints; /* No. of points of data */
64 int NBases; /* No. of bases */
65
66 /* Traces */
67 TRACE *traceA; /* Array of length `NPoints' */
68 TRACE *traceC; /* Array of length `NPoints' */
69 TRACE *traceG; /* Array of length `NPoints' */
70 TRACE *traceT; /* Array of length `NPoints' */
71 TRACE maxTraceVal; /* The maximal value in any trace */
72
73 /* Bases */
74 char *base; /* Array of length `NBases' */
75 uint_2 *basePos; /* Array of length `NBases' */
76
77 /* Cutoffs */
78 int leftCutoff; /* Number of unwanted bases */
79 int rightCutoff; /* Number of unwanted bases */
80
81 /* Miscellaneous Sequence Information */
82 char *info; /* misc seq info, eg comments */
83
84 /* Probability information */
85 char *prob_A; /* Array of length 'NBases' */
86 char *prob_C; /* Array of length 'NBases' */
87 char *prob_G; /* Array of length 'NBases' */
88 char *prob_T; /* Array of length 'NBases' */
89
90 /* The original input format data, or NULL if inapplicable */
91 int orig_trace_format;
92 void *orig_trace;
93
94 } Read;
95
97 On successful completion, the read_reading() and fread_reading() func‐
98 tions return a pointer to a Read structure. Otherwise these functions
99 return NULLRead (which is a null pointer).
100
101
103 write_reading(3), fwrite_reading(3), deallocate_reading(3), scf(4),
104 ExperimentFile(4)
105
106
107
108 read_reading(3)