File: ureadseq.h

package info (click to toggle)
gentle 1.9+cvs20100605+dfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 12,224 kB
  • ctags: 6,214
  • sloc: cpp: 41,569; ansic: 3,978; sh: 1,420; makefile: 243
file content (175 lines) | stat: -rw-r--r-- 4,754 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/* File: ureadseq.h
 *
 * Header for module UReadSeq
 */

#ifndef UREADSEQ_H
#define UREADSEQ_H


#ifndef __WXMSW__
typedef char  boolean;
#endif

#define NEWLINE         '\n'
#ifndef false
	#define false 0
	#define true  1
#endif
#define min(a,b)      (a<b)?a:b
#define max(a,b)      (a>b)?a:b
#define skipwhitespace(string)  {while (*string <= ' ' && *string != 0) string++;}

  /* NLM strings */
#define is_upper(c) ('A'<=(c) && (c)<='Z')
#define is_lower(c) ('a'<=(c) && (c)<='z')
#define to_lower(c) ((char)(is_upper(c) ? (c)+' ' : (c)))
#define to_upper(c) ((char)(is_lower(c) ? (c)-' ' : (c)))


  /* readSeq errors */
#define eFileNotFound   -1
#define eNoData         -2
#define eMemFull        -3
#define eItemNotFound   -4
#define eOneFormat      -5
#define eUnequalSize    -6
#define eFileCreate     -7
#define eUnknownFormat  -8
#define eOptionBad      -9
#define eASNerr         -10

  /* magic number for readSeq(whichEntry) to give seq list */
#define kListSequences  -1

  /* sequence types parsed by getseqtype */
#define kOtherSeq   0
#define kDNA        1
#define kRNA        2
#define kNucleic    3
#define kAmino      4

  /* formats known to readSeq */
#define kIG             1
#define kGenBank        2
#define kNBRF           3
#define kEMBL           4
#define kGCG            5
#define kStrider        6
#define kFitch          7
#define kPearson        8
#define kZuker          9
#define kOlsen          10
#define kPhylip2        11
#define kPhylip4        12
#define kPhylip3        kPhylip4
#define kPhylip         kPhylip4
#define kPlain          13  /* keep this at #13 */
#define kPIR            14
#define kMSF            15
#define kASN1           16
#define kPAUP           17
#define kPretty         18

#define kMaxFormat      18
#define kMinFormat      1
#define kNoformat       -1    /* format not tested */
#define kUnknown        0     /* format not determinable */

  /* subsidiary types */
#define kASNseqentry    51
#define kASNseqset      52

#define kPhylipInterleave 61
#define kPhylipSequential 62


/// Part of the ClustalW package
typedef struct  {
  boolean isactive, baseonlynum;
  boolean numright, numleft, numtop, numbot;
  boolean nameright, nameleft, nametop;
  boolean noleaves, domatch, degap;
  char  matchchar, gapchar;
  short numline, atseq;
  short namewidth, numwidth;
  short interline, spacer, seqwidth, tab;
  } prettyopts;

#define gPrettyInit(p) { \
  p.isactive=false;\
  p.baseonlynum=true;\
  p.numline= p.atseq= 0;\
  p.numright= p.numleft= p.numtop= p.numbot= false;\
  p.nameright= p.nameleft= p.nametop= false;\
  p.noleaves= p.domatch= p.degap= false;\
  p.matchchar='.';\
  p.gapchar='-';\
  p.namewidth=8;\
  p.numwidth=5;\
  p.interline=1;\
  p.spacer=10;\
  p.seqwidth=50;\
  p.tab=0; }

#ifdef UREADSEQ_G
prettyopts  gPretty;
#else
extern  prettyopts  gPretty;
#endif


#ifdef __cplusplus
extern "C" {
#endif

extern short seqFileFormat(const char *filename, long *skiplines, short *error );
extern short seqFileFormatFp(FILE *fseq, long  *skiplines, short *error );

extern char *listSeqs(const char *filename, const long skiplines,
                       const short format, short *nseq, short *error );

extern char *readSeq(const short whichEntry, const char *filename,
                      const long skiplines, const short format,
                      long *seqlen, short *nseq, short *error, char *seqid );

extern char *readSeqFp(const short whichEntry_, FILE  *fp_,
  const long  skiplines_, const short format_,
        long  *seqlen_,  short *nseq_, short *error_, char *seqid_ );

extern short writeSeq(FILE *outf, const char *seq, const long seqlen,
                       const short outform, const char *seqid );

extern unsigned long CRC32checksum(const char *seq, const long seqlen, unsigned long *checktotal);
extern unsigned long GCGchecksum(const char *seq, const long seqlen, unsigned long *checktotal);
#ifdef SMALLCHECKSUM
#define seqchecksum  GCGchecksum
#else
#define seqchecksum  CRC32checksum
#endif

extern short getseqtype(const char *seq, const long seqlen );
extern char *compressSeq( const char gapc, const char *seq, const long seqlen, long *newlen);

#ifdef NCBI

extern char *listASNSeqs(const char *filename, const long skiplines,
                  const short format, short *nseq, short *error );

extern char *readASNSeq(const short whichEntry, const char *filename,
                const long skiplines, const short format,
                long *seqlen, short *nseq, short *error, char **seqid );
#endif


  /* patches for some missing string.h stuff */
extern int Strcasecmp(const char *a, const char *b);
extern int Strncasecmp(const char *a, const char *b, long maxn);

#ifdef __cplusplus
}
#endif

#endif /*UREADSEQ_H*/