]> git.donarmstrong.com Git - biopieces.git/blob - code_c/Maasha/src/inc/seq.h
finished c fasta parser
[biopieces.git] / code_c / Maasha / src / inc / seq.h
1 /* Macro to test if a given char is sequence (DNA, RNA, Protein, indels. brackets, etc ). */
2 #define isseq( x ) ( x > 32 && x < 127 ) ? 1 : 0
3
4 /* Macro to test if a given char is DNA. */
5 #define isDNA( c ) ( c == 'A' || c == 'a' || c == 'T' || c == 't' ||  c == 'C' || c == 'c' ||  c == 'G' || c == 'g' || c == 'N' || c == 'n' ) ? 1 : 0
6
7 /* Macro to test if a given char is RNA. */
8 #define isRNA( c ) ( c == 'A' || c == 'a' || c == 'U' || c == 'u' ||  c == 'C' || c == 'c' ||  c == 'G' || c == 'g' || c == 'N' || c == 'n' ) ? 1 : 0
9
10 #define MAX_SEQ_NAME      1024
11 #define MAX_SEQ      250000000
12
13 /* Definition of a sequence entry */
14 struct _seq_entry
15 {
16     char   *seq_name;
17     char   *seq;
18     size_t  seq_len;
19 };
20
21 typedef struct _seq_entry seq_entry;
22
23 /* Initialize a new sequence entry. */
24 void seq_new( seq_entry **entry_ppt, size_t max_seq_name, size_t max_seq );
25
26 /* Destroy a sequence entry. */
27 void seq_destroy( seq_entry *entry );
28
29 /* Uppercase sequence. */
30 void uppercase_seq( char *seq );
31
32 /* Lowercase sequence. */
33 void lowercase_seq( char *seq );
34
35 /* Reverse compliments DNA sequence. */
36 void revcomp_dna( char *seq );
37
38 /* Reverse compliments RNA sequence. */
39 void revcomp_rna( char *seq );
40
41 /* Reverse compliment nucleotide sequnce after guessing the sequence type. */
42 void revcomp_nuc( char *seq );
43
44 /* Complement DNA sequence. (NB it is not reversed!). */
45 void complement_dna( char *seq );
46
47 /* Complement RNA sequence. (NB it is not reversed!). */
48 void complement_rna( char *seq );
49
50 /* Complement nucleotide sequence after guessing the sequence type. */
51 void complement_nuc( char *seq );
52
53 /* Reverse sequence. */
54 void reverse( char *seq );
55
56 /* Convert all non-nucleotide letters to Ns. */
57 void seq2nuc_simple( char *seq );
58
59 /* Convert DNA into RNA by change t and T to u and U, respectively. */
60 void dna2rna( char *seq );
61
62 /* Convert RNA into DNA by change u and U to t and T, respectively. */
63 void rna2dna( char *seq );
64
65 /* Check if a sequence is DNA by inspecting the first 100 residues. */
66 bool is_dna( char *seq );
67
68 /* Check if a sequence is RNA by inspecting the first 100 residues. */
69 bool is_rna( char *seq );
70
71 /* Check if a sequence is protein by inspecting the first 100 residues. */
72 bool is_protein( char *seq );
73
74 /* Guess if a sequence is DNA, RNA, or protein by inspecting the first 100 residues. */
75 char *seq_guess_type( char *seq );
76
77 /* Check if a sequence contain N or n. */
78 bool contain_N( char *seq );
79
80 /* Pack a nucleotide oligo (max length 15) into a binary/integer (good for hash keys). */
81 int  oligo2bin( char *oligo );
82