| 1 |
|
| 2 |
#include <stdlib.h> |
| 3 |
#include <stdio.h> |
| 4 |
#include <string.h> |
| 5 |
#include <ctype.h> |
| 6 |
#if defined(_WIN32) |
| 7 |
#include <Windows.h> |
| 8 |
#elif defined(unix) || defined(FLTK_COCOA_PLATFORM) |
| 9 |
#define unixlike |
| 10 |
#include <termios.h> |
| 11 |
#endif |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
int trim_key(char *name); |
| 17 |
void padtosize(char *pname, char *name, int length); |
| 18 |
char *get_code_descr(int code); |
| 19 |
int calc_codon_number(char *codon); |
| 20 |
char codaa(char *codon, int code); |
| 21 |
int get_ncbi_gc_number(int gc); |
| 22 |
int get_acnuc_gc_number(int ncbi_gc); |
| 23 |
int strcmptrail(char *s1, int l1, char *s2, int l2); |
| 24 |
void majuscules(char *name); |
| 25 |
void compact(char *chaine); |
| 26 |
void *mycalloc(int nbr, size_t taille); |
| 27 |
char complementer_base(char nucl); |
| 28 |
void complementer_seq(char *deb_ch, int l); |
| 29 |
char init_codon_to_aa(char *codon, int gc); |
| 30 |
char stop_codon_to_aa(char *codon, int gc); |
| 31 |
int notrail2(char *chaine, int len); |
| 32 |
int prepch(char *chaine, char **posmot); |
| 33 |
int compch(char *cible, int lcible, char **posmot, int nbrmots); |
| 34 |
int chg_acnuc(char *acnucvar, char *gcgacnucvar); |
| 35 |
void gets_no_echo(char *password, size_t lpw); |
| 36 |
|
| 37 |
|
| 38 |
int trim_key(char *name) |
| 39 |
{ |
| 40 |
char *p; |
| 41 |
int l = (int)strlen(name); |
| 42 |
p = name + l - 1; |
| 43 |
while( p >= name && *p == ' ' ) *(p--) = 0; |
| 44 |
return (int)((p + 1) - name); |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
void padtosize(char *pname, char *name, int length) |
| 49 |
{ |
| 50 |
int i; |
| 51 |
strncpy(pname,name,length); |
| 52 |
pname[length]=0; |
| 53 |
for(i=(int)strlen(pname);i<length;i++) pname[i]=' '; |
| 54 |
} |
| 55 |
|
| 56 |
|
| 57 |
#define TOTCODES 27 |
| 58 |
int totcodes=TOTCODES; |
| 59 |
|
| 60 |
char aminoacids[]="RLSTPAGVKNQHEDYCFIMW*X"; |
| 61 |
|
| 62 |
struct genetic_code_libel { |
| 63 |
char libel[61]; |
| 64 |
char* target; |
| 65 |
int code[65]; |
| 66 |
int ncbi_gc; |
| 67 |
int codon_init[64]; |
| 68 |
}; |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
struct genetic_code_libel genetic_code[TOTCODES] = |
| 82 |
{ |
| 83 |
|
| 84 |
{ |
| 85 |
{"Standard genetic code"}, |
| 86 |
"Standard", |
| 87 |
{9,10,9,10,4,4,4,4,1,3,1,3,18,18,19,18, |
| 88 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,2,2, |
| 89 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 90 |
21,15,21,15,3,3,3,3,21,16,20,16,2,17,2,17,22}, |
| 91 |
1, |
| 92 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 93 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 94 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 95 |
21,0,21,0,0,0,0,0,21,0,0,0,0,0,19,0} |
| 96 |
} |
| 97 |
, |
| 98 |
{ |
| 99 |
{"CUN=T AUA=M UGA=W"}, |
| 100 |
"Yeast Mitochondrial", |
| 101 |
{9,10,9,10,4,4,4,4,1,3,1,3,19,18,19,18, |
| 102 |
11,12,11,12,5,5,5,5,1,1,1,1,4,4,4,4, |
| 103 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 104 |
21,15,21,15,3,3,3,3,20,16,20,16,2,17,2,17,22}, |
| 105 |
3, |
| 106 |
{0,0,0,0,0,0,0,0,0,0,0,0,19,0,19,0, |
| 107 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 108 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 109 |
21,0,21,0,0,0,0,0,0,0,0,0,0,0,0,0} |
| 110 |
} |
| 111 |
, |
| 112 |
{ |
| 113 |
{"AGR=* AUA=M UGA=W"}, |
| 114 |
"Vertebrate Mitochondrial", |
| 115 |
{9,10,9,10,4,4,4,4,21,3,21,3,19,18,19,18,11,12,11,12, |
| 116 |
5,5,5,5,1,1,1,1,2,2,2,2,13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8,21,15, |
| 117 |
21,15,3,3,3,3,20,16,20,16,2,17,2,17,22}, |
| 118 |
2, |
| 119 |
{0,0,0,0,0,0,0,0,21,0,21,0,19,19,19,19, |
| 120 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 121 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 122 |
21,0,21,0,0,0,0,0,0,0,0,0,0,0,0,0} |
| 123 |
} |
| 124 |
, |
| 125 |
{ |
| 126 |
{"UGA=W"}, |
| 127 |
"Mold Mitochondrial; Protozoan Mitochondrial; Coelenterate Mitochondrial; Mycoplasma; Spiroplasma", |
| 128 |
{9,10,9,10,4,4,4,4,1,3,1,3,18,18,19,18,11,12,11,12,5,5,5, |
| 129 |
5,1,1,1,1,2,2,2,2,13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8,21,15,21, |
| 130 |
15,3,3,3,3,20,16,20,16,2,17,2,17,22}, |
| 131 |
4, |
| 132 |
{0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19, |
| 133 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 134 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 135 |
21,0,21,0,0,0,0,0,0,0,0,0,19,0,19,0} |
| 136 |
} |
| 137 |
, |
| 138 |
{ |
| 139 |
{"AUA=M UGA=W AGR=S"}, |
| 140 |
"Invertebrate Mitochondrial", |
| 141 |
{9,10,9,10,4,4,4,4,3,3,3,3,19,18,19,18,11,12,11,12,5,5,5, |
| 142 |
5,1,1,1,1,2,2,2,2,13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8,21,15,21, |
| 143 |
15,3,3,3,3,20,16,20,16,2,17,2,17,22}, |
| 144 |
5, |
| 145 |
{0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19, |
| 146 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 147 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 148 |
21,0,21,0,0,0,0,0,0,0,0,0,0,0,19,0} |
| 149 |
} |
| 150 |
, |
| 151 |
{ |
| 152 |
{"CUG=S"}, |
| 153 |
"Alternative Yeast Nuclear", |
| 154 |
{9,10,9,10,4,4,4,4,1,3,1,3,18,18,19,18, |
| 155 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,3,2, |
| 156 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 157 |
21,15,21,15,3,3,3,3,21,16,20,16,2,17,2,17,22}, |
| 158 |
12, |
| 159 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 160 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 161 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 162 |
21,0,21,0,0,0,0,0,21,0,0,0,0,0,0,0} |
| 163 |
} |
| 164 |
, |
| 165 |
{ |
| 166 |
{"UAR=Q"}, |
| 167 |
"Ciliate Nuclear; Dasycladacean Nuclear; Hexamita Nuclear", |
| 168 |
{9,10,9,10,4,4,4,4,1,3,1,3,18,18,19,18,11,12,11,12,5,5,5, |
| 169 |
5,1,1,1,1,2,2,2,2,13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8,11,15,11, |
| 170 |
15,3,3,3,3,21,16,20,16,2,17,2,17,22}, |
| 171 |
6, |
| 172 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 173 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 174 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 175 |
0,0,0,0,0,0,0,0,21,0,0,0,0,0,0,0} |
| 176 |
} |
| 177 |
, |
| 178 |
{ |
| 179 |
{"UGA=C"}, |
| 180 |
"Euplotid Nuclear", |
| 181 |
{9,10,9,10,4,4,4,4,1,3,1,3,18,18,19,18,11,12,11,12,5,5,5, |
| 182 |
5,1,1,1,1,2,2,2,2,13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8,21,15,21, |
| 183 |
15,3,3,3,3,16,16,20,16,2,17,2,17,22}, |
| 184 |
10, |
| 185 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 186 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 187 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 188 |
21,0,21,0,0,0,0,0,0,0,0,0,0,0,0,0} |
| 189 |
} |
| 190 |
, |
| 191 |
{ |
| 192 |
{"UGA=W AGR=S AAA=N"}, |
| 193 |
"Echinoderm Mitochondrial; Flatworm Mitochondrial", |
| 194 |
{10,10,9,10,4,4,4,4,3,3,3,3,18,18,19,18, |
| 195 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,2,2, |
| 196 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 197 |
21,15,21,15,3,3,3,3,20,16,20,16,2,17,2,17,22}, |
| 198 |
9, |
| 199 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 200 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 201 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 202 |
21,0,21,0,0,0,0,0,0,0,0,0,0,0,0,0} |
| 203 |
} |
| 204 |
, |
| 205 |
{ |
| 206 |
{"UGA=W AGR=G AUA=M"}, |
| 207 |
"Ascidian Mitochondrial", |
| 208 |
{9,10,9,10,4,4,4,4,7,3,7,3,19,18,19,18, |
| 209 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,2,2, |
| 210 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 211 |
21,15,21,15,3,3,3,3,20,16,20,16,2,17,2,17,22}, |
| 212 |
13, |
| 213 |
{0,0,0,0,0,0,0,0,0,0,0,0,19,0,19,0, |
| 214 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 215 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 216 |
21,0,21,0,0,0,0,0,0,0,0,0,0,0,19,0} |
| 217 |
} |
| 218 |
, |
| 219 |
{ |
| 220 |
{"UGA=W AGR=S UAA=Y AAA=N"}, |
| 221 |
"Alternative Flatworm Mitochondrial", |
| 222 |
{10,10,9,10,4,4,4,4,3,3,3,3,18,18,19,18, |
| 223 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,2,2, |
| 224 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 225 |
15,15,21,15,3,3,3,3,20,16,20,16,2,17,2,17,22}, |
| 226 |
14, |
| 227 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 228 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 229 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 230 |
0,0,21,0,0,0,0,0,0,0,0,0,0,0,0,0} |
| 231 |
} |
| 232 |
, |
| 233 |
{ |
| 234 |
{"UAG=Q"}, |
| 235 |
"Blepharisma Macronuclear", |
| 236 |
{9,10,9,10,4,4,4,4,1,3,1,3,18,18,19,18, |
| 237 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,2,2, |
| 238 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 239 |
21,15,11,15,3,3,3,3,21,16,20,16,2,17,2,17,22}, |
| 240 |
15, |
| 241 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 242 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 243 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 244 |
21,0,0,0,0,0,0,0,21,0,0,0,0,0,0,0} |
| 245 |
} |
| 246 |
, |
| 247 |
{ |
| 248 |
{"NUG=AUN=M when initiation codon"}, |
| 249 |
"Bacterial, Archaeal and Plant Plastid", |
| 250 |
{9,10,9,10,4,4,4,4,1,3,1,3,18,18,19,18, |
| 251 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,2,2, |
| 252 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 253 |
21,15,21,15,3,3,3,3,21,16,20,16,2,17,2,17,22}, |
| 254 |
11, |
| 255 |
{0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19, |
| 256 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 257 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 258 |
21,0,21,0,0,0,0,0,21,0,0,0,0,0,19,0} |
| 259 |
} |
| 260 |
, |
| 261 |
{ |
| 262 |
{"UAG=Leu"}, |
| 263 |
"Chlorophycean Mitochondrial", |
| 264 |
{9,10,9,10,4,4,4,4,1,3,1,3,18,18,19,18, |
| 265 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,2,2, |
| 266 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 267 |
21,15,2,15,3,3,3,3,21,16,20,16,2,17,2,17,22}, |
| 268 |
16, |
| 269 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 270 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 271 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 272 |
21,0,0,0,0,0,0,0,21,0,0,0,0,0,0,0} |
| 273 |
} |
| 274 |
, |
| 275 |
{ |
| 276 |
{"AUA=M UGA=W AGR=S AAA=N"}, |
| 277 |
"Trematode Mitochondrial", |
| 278 |
{10,10,9,10,4,4,4,4,3,3,3,3,19,18,19,18,11,12,11,12,5,5,5, |
| 279 |
5,1,1,1,1,2,2,2,2,13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8,21,15,21, |
| 280 |
15,3,3,3,3,20,16,20,16,2,17,2,17,22}, |
| 281 |
21, |
| 282 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 283 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 284 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 285 |
21,0,21,0,0,0,0,0,0,0,0,0,0,0,0,0} |
| 286 |
} |
| 287 |
, |
| 288 |
{ |
| 289 |
{"UAG=L UCA=*"}, |
| 290 |
"Scenedesmus obliquus mitochondrial", |
| 291 |
{9,10,9,10,4,4,4,4,1,3,1,3,18,18,19,18, |
| 292 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,2,2, |
| 293 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 294 |
21,15,2,15,21,3,3,3,21,16,20,16,2,17,2,17,22}, |
| 295 |
22, |
| 296 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 297 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 298 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 299 |
21,0,0,0,21,0,0,0,21,0,0,0,0,0,0,0} |
| 300 |
} |
| 301 |
, |
| 302 |
{ |
| 303 |
{"UUA=*"}, |
| 304 |
"Thraustochytrium mitochondrial", |
| 305 |
{9,10,9,10,4,4,4,4,1,3,1,3,18,18,19,18, |
| 306 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,2,2, |
| 307 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 308 |
21,15,21,15,3,3,3,3,21,16,20,16,21,17,2,17,22}, |
| 309 |
23, |
| 310 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,19, |
| 311 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 312 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 313 |
21,0,21,0,0,0,0,0,21,0,0,0,21,0,0,0} |
| 314 |
} |
| 315 |
, |
| 316 |
{ |
| 317 |
{"UGA=W AGA=S AGG=K"}, |
| 318 |
"Pterobranchia Mitochondrial", |
| 319 |
{9,10,9,10,4,4,4,4,3,3,9,3,18,18,19,18, |
| 320 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,2,2, |
| 321 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 322 |
21,15,21,15,3,3,3,3,20,16,20,16,2,17,2,17,22}, |
| 323 |
24, |
| 324 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 325 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 326 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 327 |
21,0,21,0,0,0,0,0,0,0,0,0,0,0,19,0} |
| 328 |
} |
| 329 |
, |
| 330 |
{ |
| 331 |
{"UGA=G"}, |
| 332 |
"Candidate Division SR1 and Gracilibacteria", |
| 333 |
{9,10,9,10,4,4,4,4,1,3,1,3,18,18,19,18, |
| 334 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,2,2, |
| 335 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 336 |
21,15,21,15,3,3,3,3,7,16,20,16,2,17,2,17,22}, |
| 337 |
25, |
| 338 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 339 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 340 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 341 |
21,0,21,0,0,0,0,0,0,0,0,0,0,0,19,0} |
| 342 |
} |
| 343 |
, |
| 344 |
{ |
| 345 |
{"CUG=A"}, |
| 346 |
"Pachysolen tannophilus Nuclear", |
| 347 |
{9,10,9,10,4,4,4,4,1,3,1,3,18,18,19,18, |
| 348 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,6,2, |
| 349 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 350 |
21,15,21,15,3,3,3,3,21,16,20,16,2,17,2,17,22}, |
| 351 |
26, |
| 352 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 353 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 354 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 355 |
21,0,21,0,0,0,0,0,21,0,0,0,0,0,0,0} |
| 356 |
} |
| 357 |
, |
| 358 |
{ |
| 359 |
{"UAR=Q, UGA=W, CUG=A"}, |
| 360 |
"Karyorelict Nuclear", |
| 361 |
{9,10,9,10,4,4,4,4,1,3,1,3,18,18,19,18, |
| 362 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,6,2, |
| 363 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 364 |
11,15,11,15,3,3,3,3,20,16,20,16,2,17,2,17,22}, |
| 365 |
27, |
| 366 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 367 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 368 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 369 |
0,0,0,0,0,0,0,0,21,0,0,0,0,0,0,0} |
| 370 |
} |
| 371 |
, |
| 372 |
{ |
| 373 |
{"UAR=Q, UGA=W, CUG=A"}, |
| 374 |
"Condylostoma Nuclear", |
| 375 |
{9,10,9,10,4,4,4,4,1,3,1,3,18,18,19,18, |
| 376 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,6,2, |
| 377 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 378 |
11,15,11,15,3,3,3,3,20,16,20,16,2,17,2,17,22}, |
| 379 |
28, |
| 380 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 381 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 382 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 383 |
21,0,21,0,0,0,0,0,21,0,0,0,0,0,0,0} |
| 384 |
} |
| 385 |
, |
| 386 |
{ |
| 387 |
{"UAR=Y, CUG=A"}, |
| 388 |
"Mesodinium Nuclear", |
| 389 |
{9,10,9,10,4,4,4,4,1,3,1,3,18,18,19,18, |
| 390 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,6,2, |
| 391 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 392 |
15,15,15,15,3,3,3,3,21,16,20,16,2,17,2,17,22}, |
| 393 |
29, |
| 394 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 395 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 396 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 397 |
0,0,0,0,0,0,0,0,21,0,0,0,0,0,0,0} |
| 398 |
} |
| 399 |
, |
| 400 |
{ |
| 401 |
{"UAR=E, CUG=A"}, |
| 402 |
"Peritrich Nuclear", |
| 403 |
{9,10,9,10,4,4,4,4,1,3,1,3,18,18,19,18, |
| 404 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,6,2, |
| 405 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 406 |
13,15,13,15,3,3,3,3,21,16,20,16,2,17,2,17,22}, |
| 407 |
30, |
| 408 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 409 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 410 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 411 |
0,0,0,0,0,0,0,0,21,0,0,0,0,0,0,0} |
| 412 |
} |
| 413 |
, |
| 414 |
{ |
| 415 |
{"UAR=E, UGA=W"}, |
| 416 |
"Blastocrithidia Nuclear", |
| 417 |
{9,10,9,10,4,4,4,4,1,3,1,3,18,18,19,18, |
| 418 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,2,2, |
| 419 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 420 |
13,15,13,15,3,3,3,3,20,16,20,16,2,17,2,17,22}, |
| 421 |
31, |
| 422 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 423 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 424 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
| 425 |
21,0,21,0,0,0,0,0,0,0,0,0,0,0,0,0} |
| 426 |
} |
| 427 |
, |
| 428 |
{ |
| 429 |
{"UAG=W"}, |
| 430 |
"Balanophoraceae Plastid", |
| 431 |
{9,10,9,10,4,4,4,4,1,3,1,3,18,18,19,18, |
| 432 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,2,2, |
| 433 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 434 |
21,15,20,15,3,3,3,3,21,16,20,16,2,17,2,17,22}, |
| 435 |
32, |
| 436 |
{0,0,0,0,0,0,0,0,0,0,0,0,19,19,19,19, |
| 437 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 438 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 439 |
21,0,0,0,0,0,0,0,21,0,0,0,0,0,19,0} |
| 440 |
} |
| 441 |
, |
| 442 |
{ |
| 443 |
{"UAA=Y, UGA=W, AGA=S, AGG=K"}, |
| 444 |
"Cephalodiscidae Mitochondrial", |
| 445 |
{9,10,9,10,4,4,4,4,3,3,9,3,18,18,19,18, |
| 446 |
11,12,11,12,5,5,5,5,1,1,1,1,2,2,2,2, |
| 447 |
13,14,13,14,6,6,6,6,7,7,7,7,8,8,8,8, |
| 448 |
15,15,21,15,3,3,3,3,20,16,20,16,2,17,2,17,22}, |
| 449 |
33, |
| 450 |
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 451 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 452 |
0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0, |
| 453 |
0,0,21,0,0,0,0,0,0,0,0,0,0,0,19,0} |
| 454 |
} |
| 455 |
|
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
}; |
| 462 |
|
| 463 |
|
| 464 |
char *get_code_descr(int code) |
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
{ |
| 470 |
if(code>=0 && code<totcodes) |
| 471 |
return genetic_code[code].libel ; |
| 472 |
else |
| 473 |
return "Unknown genetic code. Standard code is used."; |
| 474 |
} |
| 475 |
|
| 476 |
|
| 477 |
char *get_code_target(int code) |
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
{ |
| 483 |
if(code >= 0 && code < totcodes) |
| 484 |
return genetic_code[code].target ; |
| 485 |
else |
| 486 |
return "Unknown genetic code. Standard code is used."; |
| 487 |
} |
| 488 |
|
| 489 |
|
| 490 |
int calc_codon_number(char *codon) |
| 491 |
{ |
| 492 |
static char nucleotides[] = "AaCcGgTtUu"; |
| 493 |
static int nucnum[5] = {0,1,2,3,3}; |
| 494 |
int num, i, base; |
| 495 |
char *p; |
| 496 |
|
| 497 |
num = 0; |
| 498 |
for(i = 1; i <= 3; i++) { |
| 499 |
p = strchr(nucleotides, *codon); |
| 500 |
if(p == NULL) { |
| 501 |
num = 64; |
| 502 |
break; |
| 503 |
} |
| 504 |
else |
| 505 |
base = (int)(p-nucleotides)/2; |
| 506 |
num = num * 4 + nucnum[base]; |
| 507 |
codon++; |
| 508 |
} |
| 509 |
return num; |
| 510 |
} |
| 511 |
|
| 512 |
|
| 513 |
char codaa(char *codon, int code) |
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
|
| 519 |
|
| 520 |
{ |
| 521 |
struct genetic_code_libel *pdata; |
| 522 |
int num; |
| 523 |
|
| 524 |
num = calc_codon_number(codon); |
| 525 |
if(code < 0 || code >= totcodes)code = 0; |
| 526 |
pdata = &genetic_code[code]; |
| 527 |
return aminoacids[ pdata->code[num] - 1 ]; |
| 528 |
} |
| 529 |
|
| 530 |
|
| 531 |
int get_ncbi_gc_number(int gc) |
| 532 |
{ |
| 533 |
return genetic_code[gc].ncbi_gc; |
| 534 |
} |
| 535 |
|
| 536 |
|
| 537 |
int get_acnuc_gc_number(int ncbi_gc) |
| 538 |
{ |
| 539 |
int num; |
| 540 |
|
| 541 |
for( num = 0; num < totcodes; num++ ) |
| 542 |
if(genetic_code[num].ncbi_gc == ncbi_gc) return num; |
| 543 |
return 0; |
| 544 |
} |
| 545 |
|
| 546 |
|
| 547 |
int strcmptrail(char *s1, int l1, char *s2, int l2) |
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
{ |
| 553 |
char *fin; |
| 554 |
int l, flag=1; |
| 555 |
|
| 556 |
if(l1 > 0) { |
| 557 |
if( (fin = (char *)memchr(s1, 0, l1) ) != NULL) l1 = (int)(fin - s1); |
| 558 |
} |
| 559 |
if(l2 > 0) { |
| 560 |
if( (fin = (char *)memchr(s2, 0, l2) ) != NULL) l2 = (int)(fin - s2); |
| 561 |
} |
| 562 |
|
| 563 |
if(l2 > l1) { |
| 564 |
flag = -1; |
| 565 |
fin=s1; s1=s2; s2=fin; |
| 566 |
l=l1; l1=l2; l2=l; |
| 567 |
} |
| 568 |
l = l2; |
| 569 |
fin = s2 + l; |
| 570 |
while(s2 < fin) { |
| 571 |
if( *s1 != *s2 ) return (*s1 - *s2)*flag; |
| 572 |
s1++; s2++; |
| 573 |
} |
| 574 |
fin= s1+l1-l2; |
| 575 |
while(s1 < fin) { |
| 576 |
if( *s1 != ' ') return flag; |
| 577 |
s1++; |
| 578 |
} |
| 579 |
return 0; |
| 580 |
} |
| 581 |
|
| 582 |
|
| 583 |
void majuscules(char *name) |
| 584 |
{ |
| 585 |
name--; |
| 586 |
while(*(++name) != 0) *name = toupper(*name); |
| 587 |
} |
| 588 |
|
| 589 |
|
| 590 |
void compact(char *chaine) |
| 591 |
{ |
| 592 |
int l; |
| 593 |
char *p, *q; |
| 594 |
|
| 595 |
l= (int)strlen(chaine); p=chaine+l; |
| 596 |
while( *(--p) == ' ' && p>=chaine) *p=0; |
| 597 |
while((p=strchr(chaine,' '))!=NULL) { |
| 598 |
q=p+1; |
| 599 |
while(*q==' ') q++; |
| 600 |
l= (int)(q-p); |
| 601 |
while(*q!=0) {*(q-l) = *q; q++; } |
| 602 |
*(q-l)=0; |
| 603 |
} |
| 604 |
} |
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
void *mycalloc(int nbre, size_t size) |
| 609 |
{ |
| 610 |
void *point; |
| 611 |
|
| 612 |
point = calloc((unsigned)nbre, size); |
| 613 |
if(point == NULL) { |
| 614 |
fprintf(stderr,"Error: problem allocating memory.\n"); |
| 615 |
exit(1); |
| 616 |
} |
| 617 |
return point; |
| 618 |
} |
| 619 |
|
| 620 |
|
| 621 |
char complementer_base(char nucl) |
| 622 |
{ |
| 623 |
switch (nucl) { |
| 624 |
case 'a': |
| 625 |
case 'A': return('t'); |
| 626 |
|
| 627 |
case 'c': |
| 628 |
case 'C': return('g'); |
| 629 |
|
| 630 |
case 'g': |
| 631 |
case 'G': return('c'); |
| 632 |
|
| 633 |
case 'u': |
| 634 |
case 'U': |
| 635 |
case 't': |
| 636 |
case 'T': return('a'); |
| 637 |
|
| 638 |
case 'r': |
| 639 |
case 'R': return('y'); |
| 640 |
|
| 641 |
case 'y': |
| 642 |
case 'Y': return('r'); |
| 643 |
|
| 644 |
default : return('n'); |
| 645 |
|
| 646 |
} |
| 647 |
} |
| 648 |
|
| 649 |
|
| 650 |
|
| 651 |
|
| 652 |
|
| 653 |
|
| 654 |
|
| 655 |
|
| 656 |
void complementer_seq(char *deb_ch, int l) |
| 657 |
{ |
| 658 |
int ii = 0; |
| 659 |
char compl1,compl2; |
| 660 |
|
| 661 |
for(ii = 0; ii <= (l-1)/2; ii++) |
| 662 |
{ |
| 663 |
compl1 = complementer_base(*(deb_ch+ii)); |
| 664 |
|
| 665 |
compl2 = complementer_base(*(deb_ch+l-ii-1)); |
| 666 |
|
| 667 |
*(deb_ch+ii) = compl2; |
| 668 |
*(deb_ch+l-ii-1) = compl1; |
| 669 |
} |
| 670 |
|
| 671 |
|
| 672 |
} |
| 673 |
|
| 674 |
|
| 675 |
char init_codon_to_aa(char *codon, int gc) |
| 676 |
{ |
| 677 |
int num, aa; |
| 678 |
struct genetic_code_libel *pdata; |
| 679 |
|
| 680 |
num = calc_codon_number(codon); |
| 681 |
if(num >= 64) return 'X'; |
| 682 |
|
| 683 |
if(gc < 0 || gc >= totcodes) gc = 0; |
| 684 |
pdata = &genetic_code[gc]; |
| 685 |
aa = pdata->codon_init[num]; |
| 686 |
|
| 687 |
if(aa == 0 || aa == 21) aa = pdata->code[num]; |
| 688 |
return aminoacids[aa - 1]; |
| 689 |
} |
| 690 |
|
| 691 |
|
| 692 |
char stop_codon_to_aa(char *codon, int gc) |
| 693 |
{ |
| 694 |
int num, aa; |
| 695 |
struct genetic_code_libel *pdata; |
| 696 |
|
| 697 |
num = calc_codon_number(codon); |
| 698 |
if(num >= 64) return 'X'; |
| 699 |
|
| 700 |
if(gc < 0 || gc >= totcodes) gc = 0; |
| 701 |
pdata = &genetic_code[gc]; |
| 702 |
aa = pdata->code[num]; |
| 703 |
if (aa != 21) { |
| 704 |
aa = pdata->codon_init[num]; |
| 705 |
|
| 706 |
if (aa != 21) aa = pdata->code[num]; |
| 707 |
} |
| 708 |
return aminoacids[aa - 1]; |
| 709 |
} |
| 710 |
|
| 711 |
|
| 712 |
int notrail2(char *chaine, int len) |
| 713 |
{ |
| 714 |
len--; |
| 715 |
while(len>=0 && chaine[len]==' ') len--; |
| 716 |
return len+1; |
| 717 |
} |
| 718 |
|
| 719 |
|
| 720 |
int prepch(char *chaine, char **posmot) |
| 721 |
{ |
| 722 |
|
| 723 |
|
| 724 |
|
| 725 |
|
| 726 |
|
| 727 |
char *pos; |
| 728 |
int nbrmots; |
| 729 |
static char wildcard='@'; |
| 730 |
|
| 731 |
if(strchr(chaine,'@')==NULL) return 0; |
| 732 |
nbrmots= -1; |
| 733 |
pos=chaine+strlen(chaine)-1; |
| 734 |
while( pos>=chaine && *pos==' ' ) pos--; |
| 735 |
*(pos+1)=0; |
| 736 |
|
| 737 |
pos=chaine; |
| 738 |
while(*pos!=0) { |
| 739 |
if(*pos==wildcard) { |
| 740 |
posmot[++nbrmots]=NULL; |
| 741 |
*pos=0; |
| 742 |
while(*(pos+1)==wildcard) pos++; |
| 743 |
} |
| 744 |
else { |
| 745 |
posmot[++nbrmots]=pos; |
| 746 |
while( *(pos+1)!=wildcard && *(pos+1) !=0 ) pos++; |
| 747 |
} |
| 748 |
pos++; |
| 749 |
} |
| 750 |
return nbrmots+1; |
| 751 |
} |
| 752 |
|
| 753 |
|
| 754 |
int compch(char *cible, int lcible, char **posmot, int nbrmots) |
| 755 |
{ |
| 756 |
|
| 757 |
|
| 758 |
|
| 759 |
|
| 760 |
|
| 761 |
|
| 762 |
|
| 763 |
|
| 764 |
int num= 0, l, total; |
| 765 |
char *pos; |
| 766 |
static char vcible[151]; |
| 767 |
|
| 768 |
pos=cible+lcible-1; |
| 769 |
while( pos>=cible && *pos==' ' ) pos--; |
| 770 |
lcible= (int)(pos-cible+1); |
| 771 |
memcpy(vcible,cible,lcible); |
| 772 |
vcible[lcible]=0; |
| 773 |
cible=vcible; |
| 774 |
if(posmot[nbrmots-1]==NULL) |
| 775 |
total=nbrmots-1; |
| 776 |
else |
| 777 |
total=nbrmots-2; |
| 778 |
|
| 779 |
if(posmot[0]!=NULL) { |
| 780 |
l= (int)strlen(posmot[0]); |
| 781 |
if(strncmp(cible,posmot[0],l)!=0) return 0; |
| 782 |
cible += l; |
| 783 |
num++; |
| 784 |
} |
| 785 |
while(num<total) { |
| 786 |
num++; |
| 787 |
pos=strstr(cible,posmot[num]); |
| 788 |
if(pos==NULL) return 0; |
| 789 |
l= (int)strlen(posmot[num]); |
| 790 |
cible = pos+l; |
| 791 |
num++; |
| 792 |
} |
| 793 |
if( total==nbrmots-1 ) return 1; |
| 794 |
|
| 795 |
l= (int)strlen(posmot[nbrmots-1]); |
| 796 |
if( strcmp(vcible+lcible-l,posmot[nbrmots-1]) == 0 ) return 1; |
| 797 |
return 0; |
| 798 |
} |
| 799 |
|
| 800 |
|
| 801 |
int chg_acnuc(char *acnucvar, char *gcgacnucvar) |
| 802 |
|
| 803 |
|
| 804 |
|
| 805 |
|
| 806 |
|
| 807 |
|
| 808 |
|
| 809 |
{ |
| 810 |
static char newacnuc[200], newgcgacnuc[200]; |
| 811 |
char *point; |
| 812 |
|
| 813 |
if( strcmp(acnucvar,"acnuc") != 0 ) { |
| 814 |
point=getenv(acnucvar); |
| 815 |
if(point!=NULL) acnucvar=point; |
| 816 |
strcpy(newacnuc,"acnuc="); |
| 817 |
strcat(newacnuc,acnucvar); |
| 818 |
if( putenv(newacnuc) ) return 1; |
| 819 |
} |
| 820 |
|
| 821 |
if( strcmp(gcgacnucvar,"gcgacnuc") != 0 ) { |
| 822 |
point=getenv(gcgacnucvar); |
| 823 |
if(point!=NULL) gcgacnucvar=point; |
| 824 |
strcpy(newgcgacnuc,"gcgacnuc="); |
| 825 |
strcat(newgcgacnuc,gcgacnucvar); |
| 826 |
if( putenv(newgcgacnuc) ) return 1; |
| 827 |
} |
| 828 |
return 0; |
| 829 |
} |
| 830 |
|
| 831 |
|
| 832 |
void gets_no_echo(char *password, size_t lpw) |
| 833 |
{ |
| 834 |
char *p, c; |
| 835 |
#ifdef unixlike |
| 836 |
struct termios initialrsettings, newrsettings; |
| 837 |
int err; |
| 838 |
#elif defined(_WIN32) |
| 839 |
DWORD mode, savemode, lu; |
| 840 |
HANDLE hconsole; |
| 841 |
int err; |
| 842 |
#endif |
| 843 |
|
| 844 |
#ifdef unixlike |
| 845 |
err = tcgetattr( fileno(stdin), &initialrsettings ); |
| 846 |
if(err == 0) { |
| 847 |
newrsettings = initialrsettings; |
| 848 |
newrsettings.c_lflag &= ~ECHO; |
| 849 |
newrsettings.c_lflag &= ~ICANON; |
| 850 |
tcsetattr( fileno(stdin), TCSAFLUSH, &newrsettings ); |
| 851 |
} |
| 852 |
#elif defined(_WIN32) |
| 853 |
hconsole = GetStdHandle(STD_INPUT_HANDLE); |
| 854 |
err = GetConsoleMode(hconsole, &savemode); |
| 855 |
if(err != 0) { |
| 856 |
mode = savemode; |
| 857 |
mode &= ~ENABLE_ECHO_INPUT; |
| 858 |
mode &= ~ENABLE_LINE_INPUT; |
| 859 |
SetConsoleMode(hconsole, mode); |
| 860 |
FlushConsoleInputBuffer(hconsole); |
| 861 |
} |
| 862 |
#endif |
| 863 |
p = password; |
| 864 |
do { |
| 865 |
#ifdef _WIN32 |
| 866 |
ReadConsole(hconsole, &c, 1, &lu, NULL); |
| 867 |
#else |
| 868 |
c = getchar(); |
| 869 |
#endif |
| 870 |
if(c == EOF || c == '\n' || c == '\r') break; |
| 871 |
if(c != '\b' && c != '\x7F' ) { |
| 872 |
*(p++) = c; |
| 873 |
putchar('*'); |
| 874 |
} |
| 875 |
else { |
| 876 |
if(p > password) { |
| 877 |
p--; |
| 878 |
putchar('\b');putchar(' ');putchar('\b'); |
| 879 |
} |
| 880 |
} |
| 881 |
} |
| 882 |
while(p - password < lpw); |
| 883 |
*p = 0; |
| 884 |
#ifdef unixlike |
| 885 |
if(err == 0) { |
| 886 |
tcsetattr( fileno(stdin), TCSANOW, &initialrsettings ); |
| 887 |
putchar('\n'); |
| 888 |
} |
| 889 |
#elif defined(_WIN32) |
| 890 |
if(err != 0) { |
| 891 |
SetConsoleMode(hconsole, savemode); |
| 892 |
putchar('\n'); |
| 893 |
} |
| 894 |
#endif |
| 895 |
return; |
| 896 |
} |
| 897 |
|
| 898 |
|