3 * Header for module UReadSeq
15 #define min(a,b) (a<b)?a:b
16 #define max(a,b) (a>b)?a:b
17 #define skipwhitespace(string) {while (*string <= ' ' && *string != 0) string++;}
20 #define is_upper(c) ('A'<=(c) && (c)<='Z')
21 #define is_lower(c) ('a'<=(c) && (c)<='z')
22 #define to_lower(c) ((char)(is_upper(c) ? (c)+' ' : (c)))
23 #define to_upper(c) ((char)(is_lower(c) ? (c)-' ' : (c)))
27 #define eFileNotFound -1
30 #define eItemNotFound -4
32 #define eUnequalSize -6
33 #define eFileCreate -7
34 #define eUnknownFormat -8
38 /* magic number for readSeq(whichEntry) to give seq list */
39 #define kListSequences -1
41 /* sequence types parsed by getseqtype */
48 /* formats known to readSeq */
61 #define kPhylip3 kPhylip4
62 #define kPhylip kPhylip4
63 #define kPlain 13 /* keep this at #13 */
72 #define kNoformat -1 /* format not tested */
73 #define kUnknown 0 /* format not determinable */
75 /* subsidiary types */
76 #define kASNseqentry 51
79 #define kPhylipInterleave 61
80 #define kPhylipSequential 62
84 boolean isactive, baseonlynum;
85 boolean numright, numleft, numtop, numbot;
86 boolean nameright, nameleft, nametop;
87 boolean noleaves, domatch, degap;
88 char matchchar, gapchar;
90 short namewidth, numwidth;
91 short interline, spacer, seqwidth, tab;
94 #define gPrettyInit(p) { \
97 p.numline= p.atseq= 0;\
98 p.numright= p.numleft= p.numtop= p.numbot= false;\
99 p.nameright= p.nameleft= p.nametop= false;\
100 p.noleaves= p.domatch= p.degap= false;\
113 extern prettyopts gPretty;
121 extern short seqFileFormat(const char *filename, long *skiplines, short *error );
122 extern short seqFileFormatFp(FILE *fseq, long *skiplines, short *error );
124 extern char *listSeqs(const char *filename, const long skiplines,
125 const short format, short *nseq, short *error );
127 extern char *readSeq(const short whichEntry, const char *filename,
128 const long skiplines, const short format,
129 long *seqlen, short *nseq, short *error, char *seqid );
131 extern char *readSeqFp(const short whichEntry_, FILE *fp_,
132 const long skiplines_, const short format_,
133 long *seqlen_, short *nseq_, short *error_, char *seqid_ );
135 extern short writeSeq(FILE *outf, const char *seq, const long seqlen,
136 const short outform, const char *seqid );
138 extern unsigned long CRC32checksum(const char *seq, const long seqlen, unsigned long *checktotal);
139 extern unsigned long GCGchecksum(const char *seq, const long seqlen, unsigned long *checktotal);
141 #define seqchecksum GCGchecksum
143 #define seqchecksum CRC32checksum
146 extern short getseqtype(const char *seq, const long seqlen );
147 extern char *compressSeq( const char gapc, const char *seq, const long seqlen, long *newlen);
151 extern char *listASNSeqs(const char *filename, const long skiplines,
152 const short format, short *nseq, short *error );
154 extern char *readASNSeq(const short whichEntry, const char *filename,
155 const long skiplines, const short format,
156 long *seqlen, short *nseq, short *error, char **seqid );
160 /* patches for some missing string.h stuff */
161 extern int Strcasecmp(const char *a, const char *b);
162 extern int Strncasecmp(const char *a, const char *b, long maxn);
168 #endif /*UREADSEQ_H*/