4
|
1 #ifndef SICKLE_H
|
|
2 #define SICKLE_H
|
|
3
|
|
4 #include <limits.h>
|
|
5 #include <zlib.h>
|
|
6 #include "kseq.h"
|
|
7
|
|
8
|
|
9 /* KSEQ_INIT() cannot be called here, because we only need the types
|
|
10 defined. Calling KSEQ_INIT() would also define functions, leading
|
|
11 to an unused function warning with GCC. So, the basic typedefs
|
|
12 kseq.h has are included here, and each file that reads needs:
|
|
13
|
|
14 __KS_GETC(gzread, BUFFER_SIZE)
|
|
15 __KS_GETUNTIL(gzread, BUFFER_SIZE)
|
|
16 __KSEQ_READ
|
|
17
|
|
18 */
|
|
19
|
|
20 #define BUFFER_SIZE 4096
|
|
21 __KS_TYPE(gzFile)
|
|
22 __KS_BASIC(gzFile, BUFFER_SIZE)
|
|
23 __KSEQ_TYPE(gzFile)
|
|
24 __KSEQ_BASIC(gzFile)
|
|
25
|
|
26 #ifndef PROGRAM_NAME
|
|
27 #define PROGRAM_NAME "sickle"
|
|
28 #endif
|
|
29
|
|
30 #ifndef AUTHORS
|
|
31 #define AUTHORS "Nikhil Joshi, UC Davis Bioinformatics Core\n"
|
|
32 #endif
|
|
33
|
|
34 #ifndef VERSION
|
|
35 #define VERSION 0.0
|
|
36 #endif
|
|
37
|
|
38 /* Options drawn from GNU's coreutils/src/system.h */
|
|
39 /* These options are defined so as to avoid conflicting with option
|
|
40 values used by commands */
|
|
41 enum {
|
|
42 GETOPT_HELP_CHAR = (CHAR_MIN - 2),
|
|
43 GETOPT_VERSION_CHAR = (CHAR_MIN - 3)
|
|
44 };
|
|
45 #define GETOPT_HELP_OPTION_DECL \
|
|
46 "help", no_argument, NULL, GETOPT_HELP_CHAR
|
|
47 #define GETOPT_VERSION_OPTION_DECL \
|
|
48 "version", no_argument, NULL, GETOPT_VERSION_CHAR
|
|
49 #define case_GETOPT_HELP_CHAR(Usage_call) \
|
|
50 case GETOPT_HELP_CHAR: \
|
|
51 Usage_call(EXIT_SUCCESS, NULL); \
|
|
52 break;
|
|
53 #define case_GETOPT_VERSION_CHAR(Program_name, Version, Authors) \
|
|
54 case GETOPT_VERSION_CHAR: \
|
|
55 fprintf(stdout, "%s version %0.3f\nCopyright (c) 2011 The Regents " \
|
|
56 "of University of California, Davis Campus.\n" \
|
|
57 "%s is free software and comes with ABSOLUTELY NO WARRANTY.\n"\
|
|
58 "Distributed under the MIT License.\n\nWritten by %s\n", \
|
|
59 Program_name, Version, Program_name, Authors); \
|
|
60 exit(EXIT_SUCCESS); \
|
|
61 break;
|
|
62 /* end code drawn from system.h */
|
|
63
|
|
64 typedef enum {
|
|
65 PHRED,
|
|
66 SANGER,
|
|
67 SOLEXA,
|
|
68 ILLUMINA
|
|
69 } quality_type;
|
|
70
|
|
71 static const char typenames[4][10] = {
|
|
72 {"Phred"},
|
|
73 {"Sanger"},
|
|
74 {"Solexa"},
|
|
75 {"Illumina"}
|
|
76 };
|
|
77
|
|
78 #define Q_OFFSET 0
|
|
79 #define Q_MIN 1
|
|
80 #define Q_MAX 2
|
|
81
|
|
82 static const int quality_constants[4][3] = {
|
|
83 /* offset, min, max */
|
|
84 {0, 4, 60}, /* PHRED */
|
|
85 {33, 33, 126}, /* SANGER */
|
|
86 {64, 58, 112}, /* SOLEXA; this is an approx; the transform is non-linear */
|
|
87 {64, 64, 110} /* ILLUMINA */
|
|
88 };
|
|
89
|
|
90 typedef struct __cutsites_ {
|
|
91 int five_prime_cut;
|
|
92 int three_prime_cut;
|
|
93 } cutsites;
|
|
94
|
|
95
|
|
96 /* Function Prototypes */
|
|
97 int single_main (int argc, char *argv[]);
|
|
98 int paired_main (int argc, char *argv[]);
|
|
99 cutsites* sliding_window (kseq_t *fqrec, int qualtype, int length_threshold, int qual_threshold, int no_fiveprime, int trunc_n, int debug);
|
|
100
|
|
101 #endif /*SICKLE_H*/
|