ARB
embl.h
Go to the documentation of this file.
1 #ifndef EMBL_H
2 #define EMBL_H
3 
4 #ifndef REFS_H
5 #include "refs.h"
6 #endif
7 #ifndef PARSER_H
8 #include "parser.h"
9 #endif
10 #ifndef ARB_STRING_H
11 #include <arb_string.h>
12 #endif
13 
14 struct Emblref {
15  char *author;
16  char *title;
17  char *journal;
18  char *processing;
19 
21  : author(ARB_strdup("")),
22  title(ARB_strdup("")),
23  journal(ARB_strdup("")),
24  processing(ARB_strdup(""))
25  {}
26  Emblref(const Emblref& other)
27  : author(ARB_strdup(other.author)),
28  title(ARB_strdup(other.title)),
29  journal(ARB_strdup(other.journal)),
30  processing(ARB_strdup(other.processing))
31  {}
33  free(processing);
34  free(journal);
35  free(title);
36  free(author);
37  }
39 };
40 
41 class Embl FINAL_TYPE : public InputFormat, public RefContainer<Emblref> { // derived from a Noncopyable
42  char *create_id() const OVERRIDE {
43  char buf[TOKENSIZE];
44  embl_key_word(ID, 0, buf);
45  return ARB_strdup(buf);
46  }
47 
48 public:
49  char *ID; // entry name
50  char *dateu; // date of last updated
51  char *datec; // date of created
52  char *description; // description line (DE)
53  char *os; // Organism species
54  char *accession; // accession number(s)
55  char *keywords; // keyword
56  char *dr; // database cross-reference
57 
58  RDP_comments comments; // comments
59 
60  Embl() {
61  ID = no_content();
62  dateu = no_content();
63  datec = no_content();
64  description = no_content();
65  os = no_content();
66  accession = no_content();
67  keywords = no_content();
68  dr = no_content();
69  }
71  freenull(ID);
72  freenull(dateu);
73  freenull(datec);
74  freenull(description);
75  freenull(os);
76  freenull(accession);
77  freenull(keywords);
78  freenull(dr);
79  }
80 
81  // InputFormat interface
82  void reinit() OVERRIDE { INPLACE_RECONSTRUCT(Embl, this); }
83  Format format() const OVERRIDE { return EMBL; }
84 };
85 
87  Embl data;
88 public:
89  EmblSwissprotReader(const char *inf) : SimpleFormatReader(inf) {}
90 
91  const char *get_key_word(int offset) {
92  char key[TOKENSIZE];
93  embl_key_word(line() + offset, 0, key);
94  return shorttimecopy(key);
95  }
97  InputFormat& get_data() OVERRIDE { return data; }
98 };
99 
100 class EmblParser: public Parser {
101  Embl& embl;
102 
103  void parse_keyed_section(const char *key);
104 public:
105  EmblParser(Embl& embl_, Seq& seq_, Reader& reader_) : Parser(seq_, reader_), embl(embl_) {}
106  void parse_section() OVERRIDE;
107 
108  const Embl& get_data() const OVERRIDE { return embl; }
109 };
110 
111 #else
112 #error embl.h included twice
113 #endif // EMBL_H
Definition: reader.h:21
Format
Definition: fun.h:10
char * title
Definition: embl.h:16
DECLARE_ASSIGNMENT_OPERATOR(Emblref)
char * ARB_strdup(const char *str)
Definition: arb_string.h:27
EmblSwissprotReader(const char *inf)
Definition: embl.h:89
Format format() const OVERRIDE
Definition: embl.h:83
#define INPLACE_RECONSTRUCT(type, this)
Definition: arbtools.h:49
bool read_one_entry(Seq &seq) OVERRIDE __ATTR__USERESULT
Definition: embl.cxx:777
char * author
Definition: embl.h:15
Emblref()
Definition: embl.h:20
~Emblref()
Definition: embl.h:32
FILE * seq
Definition: rns.c:46
EmblParser(Embl &embl_, Seq &seq_, Reader &reader_)
Definition: embl.h:105
void reinit() OVERRIDE
Definition: embl.h:82
char * datec
Definition: embl.h:51
~Embl() OVERRIDE
Definition: embl.h:70
RDP_comments comments
Definition: embl.h:58
char * dateu
Definition: embl.h:50
Definition: fun.h:12
Definition: seq.h:43
int32_t ID
Definition: embl.h:14
const char * get_key_word(int offset)
Definition: embl.h:91
char * keywords
Definition: embl.h:55
void embl_key_word(const char *line, int index, char *key)
Definition: embl.cxx:236
char * dr
Definition: embl.h:56
char * ID
Definition: embl.h:49
char * journal
Definition: embl.h:17
char * os
Definition: embl.h:53
xml element
void parse_section() OVERRIDE
Definition: embl.cxx:149
#define OVERRIDE
Definition: cxxforward.h:93
Emblref(const Emblref &other)
Definition: embl.h:26
Embl()
Definition: embl.h:60
#define __ATTR__USERESULT
Definition: attributes.h:58
InputFormat & get_data() OVERRIDE
Definition: embl.h:97
char * processing
Definition: embl.h:18
const char * shorttimecopy(const char *nocopy)
Definition: reader.h:67
#define TOKENSIZE
Definition: defs.h:18
const char * line() const
Definition: reader.h:43
char * accession
Definition: embl.h:54
char * no_content()
Definition: global.h:129
#define offset(field)
Definition: GLwDrawA.c:73
char * description
Definition: embl.h:52
const Embl & get_data() const OVERRIDE
Definition: embl.h:108