Debian Codegraph @

src/parse_gff.h

raw symbols SCIP
1 #include <cstdint>
2 #include <fstream>
3 #include <iostream>
4 #include <iterator>
5 #include <map>
6 #include <regex>
7 #include <sstream>
8
9 #ifndef parse_gff
10 #define parse_gff
11
12 /*
13 GFF3 file format:
14 Defined at
15 https://github.com/The-Sequence-Ontology/Specifications/blob/master/gff3.md
16
17 | Col | Desc |
18 | seqid | ID of ref |
19 | source | algorithm/operating procedure |
20 | type | type of feature |
21 | start | 1-based start |
22 | end | start <= end |
23 | score | score of feature |
24 | strand | +/- |
25 | phase | Number of bases to be removed with reference to reading frame |
26 | attributes | list of attributes in the format tag=value;tag-value.. |
27 */
28
29 /*
30 Custom GFF3 attributes for RNA editing
31
32 EditPosition: Position to make insertion
33 EditSequence: Sequence to be inserted
34
35 */
36
37 const std::string EDIT_POSITION = "EditPosition";
38 const std::string EDIT_SEQUENCE = "EditSequence";
39
40 class gff3_feature {
41 public:
42 gff3_feature(std::string line);
43 int print();
44
45 std::string get_seqid();
46 std::string get_source();
47 std::string get_type();
48 uint64_t get_start();
49 uint64_t get_end();
50 char get_strand();
51 int get_phase();
52 std::map<std::string, std::string> get_attributes();
53 std::string get_attribute(std::string key);
54
55 int set_seqid();
56 int set_source();
57 int set_type();
58 int set_start();
59 int set_end();
60 int set_strand();
61 int set_phase();
62 int set_attributes(std::string attr);
63 int64_t get_edit_position();
64 std::string get_edit_sequence();
65
66 private:
67 std::string seqid, source, type;
68 std::map<std::string, std::string> attributes;
69 uint64_t start, end;
70 float score;
71 char strand;
72 int phase;
73 };
74
75 class gff3 {
76 public:
77 gff3();
78 gff3(std::string path);
79 std::vector<gff3_feature> get_features();
80 int print();
81 int read_file(std::string path);
82 std::vector<gff3_feature> query_features(uint64_t pos, std::string type);
83 int get_count();
84 bool empty();
85
86 private:
87 std::vector<gff3_feature> features;
88 // Flag to see if file has been populated
89 bool is_empty;
90 };
91
92 #endif