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
|
/* gde.c - GDE sequence functions */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include "sequence.h"
#include "sequence/gde.h"
/* Functions prototypes */
extern sequence_t *gdey_parse(FILE *);
extern int gdey_check(FILE *);
/* Parse GDE sequence */
sequence_t *gde_parse(FILE *f) {
sequence_t *seq;
seq = gdey_parse(f);
return seq; }
/* Checks GDE sequence */
int gde_check(FILE *f) {
int i;
i = gdey_check(f);
return i; }
/* Print GDE sequence */
void gde_print(FILE *f, sequence_t *seq) {
char *p, c;
const char *q;
int max;
long l;
seqtyp_t typ;
if (seq == NULL) { return; }
typ = sequence_type(seq->str);
c = (typ == SEQTYP_PRO) ? '%' : '#';
/* Header */
q = (seq->nam != NULL) ? seq->nam : "unknown";
(void)fprintf(f, "%c%s\n", c, q);
/* Sequence */
p = seq->str; max = 80;
while (*p) {
l = p - seq->str;
if (l % max == 0 && l > 0) { (void)fputc('\n', f); }
if (*p == '*') { p++; continue; }
(void)fputc(*p, f);
p++; }
l = p - seq->str;
if (l % max != 0) { (void)fputc('\n', f); }
return; }
|