2482 |
24 Apr 11 |
peter |
1 |
#ifndef theplu_yat_omic_gff |
2482 |
24 Apr 11 |
peter |
2 |
#define theplu_yat_omic_gff |
2482 |
24 Apr 11 |
peter |
3 |
|
2993 |
03 Mar 13 |
peter |
// $Id$ |
2993 |
03 Mar 13 |
peter |
5 |
|
2482 |
24 Apr 11 |
peter |
6 |
/* |
3114 |
10 Nov 13 |
peter |
Copyright (C) 2011, 2013 Peter Johansson |
2482 |
24 Apr 11 |
peter |
8 |
|
2482 |
24 Apr 11 |
peter |
This file is part of the yat library, http://dev.thep.lu.se/yat |
2482 |
24 Apr 11 |
peter |
10 |
|
2482 |
24 Apr 11 |
peter |
The yat library is free software; you can redistribute it and/or |
2482 |
24 Apr 11 |
peter |
modify it under the terms of the GNU General Public License as |
2482 |
24 Apr 11 |
peter |
published by the Free Software Foundation; either version 3 of the |
2482 |
24 Apr 11 |
peter |
License, or (at your option) any later version. |
2482 |
24 Apr 11 |
peter |
15 |
|
2482 |
24 Apr 11 |
peter |
The yat library is distributed in the hope that it will be useful, |
2482 |
24 Apr 11 |
peter |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
2482 |
24 Apr 11 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2482 |
24 Apr 11 |
peter |
General Public License for more details. |
2482 |
24 Apr 11 |
peter |
20 |
|
2482 |
24 Apr 11 |
peter |
You should have received a copy of the GNU General Public License |
2482 |
24 Apr 11 |
peter |
along with yat. If not, see <http://www.gnu.org/licenses/>. |
2482 |
24 Apr 11 |
peter |
23 |
*/ |
2482 |
24 Apr 11 |
peter |
24 |
|
2482 |
24 Apr 11 |
peter |
25 |
#include <iosfwd> |
2482 |
24 Apr 11 |
peter |
26 |
#include <map> |
2482 |
24 Apr 11 |
peter |
27 |
#include <string> |
2482 |
24 Apr 11 |
peter |
28 |
#include <vector> |
2482 |
24 Apr 11 |
peter |
29 |
|
2482 |
24 Apr 11 |
peter |
30 |
namespace theplu { |
2482 |
24 Apr 11 |
peter |
31 |
namespace yat { |
2482 |
24 Apr 11 |
peter |
32 |
namespace omic { |
2482 |
24 Apr 11 |
peter |
33 |
|
2482 |
24 Apr 11 |
peter |
34 |
/** |
2482 |
24 Apr 11 |
peter |
Abstract class for GFF2 and GFF3 |
2482 |
24 Apr 11 |
peter |
36 |
|
2482 |
24 Apr 11 |
peter |
\since New in yat 0.8 |
2482 |
24 Apr 11 |
peter |
38 |
*/ |
2482 |
24 Apr 11 |
peter |
39 |
class GFF |
2482 |
24 Apr 11 |
peter |
40 |
{ |
2482 |
24 Apr 11 |
peter |
41 |
public: |
2482 |
24 Apr 11 |
peter |
42 |
/** |
2482 |
24 Apr 11 |
peter |
\brief Default Constructor |
2482 |
24 Apr 11 |
peter |
44 |
|
2482 |
24 Apr 11 |
peter |
Constructs an empty GFF. Class need to be loaded with function |
2482 |
24 Apr 11 |
peter |
getline before calling any other functions. |
2482 |
24 Apr 11 |
peter |
47 |
|
2482 |
24 Apr 11 |
peter |
\see getline(std::istream& is, GFF& gff); |
2482 |
24 Apr 11 |
peter |
49 |
*/ |
2482 |
24 Apr 11 |
peter |
50 |
GFF(void); |
2482 |
24 Apr 11 |
peter |
51 |
|
2482 |
24 Apr 11 |
peter |
52 |
/** |
2482 |
24 Apr 11 |
peter |
\brief Destructor |
2482 |
24 Apr 11 |
peter |
54 |
*/ |
2482 |
24 Apr 11 |
peter |
55 |
virtual ~GFF(void); |
2482 |
24 Apr 11 |
peter |
56 |
|
2482 |
24 Apr 11 |
peter |
57 |
/** |
2482 |
24 Apr 11 |
peter |
\return attribute value for attribute \a key |
2482 |
24 Apr 11 |
peter |
59 |
|
2482 |
24 Apr 11 |
peter |
If attribute with key \a key has several values, the values are |
2482 |
24 Apr 11 |
peter |
given appended together comma-separated as it appears in file. |
2482 |
24 Apr 11 |
peter |
62 |
*/ |
2482 |
24 Apr 11 |
peter |
63 |
const std::string& attribute(const std::string& key) const; |
2482 |
24 Apr 11 |
peter |
64 |
|
2482 |
24 Apr 11 |
peter |
65 |
/** |
2482 |
24 Apr 11 |
peter |
\return map containing all attributes |
2482 |
24 Apr 11 |
peter |
67 |
|
2482 |
24 Apr 11 |
peter |
\see attribute(const std::string& key) const |
2482 |
24 Apr 11 |
peter |
69 |
*/ |
2482 |
24 Apr 11 |
peter |
70 |
const std::map<std::string, std::string>& attributes(void) const; |
2482 |
24 Apr 11 |
peter |
71 |
|
2482 |
24 Apr 11 |
peter |
72 |
/** |
2482 |
24 Apr 11 |
peter |
\return end string |
2482 |
24 Apr 11 |
peter |
74 |
*/ |
2482 |
24 Apr 11 |
peter |
75 |
const std::string& end(void) const; |
2482 |
24 Apr 11 |
peter |
76 |
|
2482 |
24 Apr 11 |
peter |
77 |
/** |
2482 |
24 Apr 11 |
peter |
\return phase string |
2482 |
24 Apr 11 |
peter |
79 |
*/ |
2482 |
24 Apr 11 |
peter |
80 |
const std::string& phase(void) const; |
2482 |
24 Apr 11 |
peter |
81 |
|
2482 |
24 Apr 11 |
peter |
82 |
/** |
2482 |
24 Apr 11 |
peter |
\return score string |
2482 |
24 Apr 11 |
peter |
84 |
*/ |
2482 |
24 Apr 11 |
peter |
85 |
const std::string& score(void) const; |
2482 |
24 Apr 11 |
peter |
86 |
|
2482 |
24 Apr 11 |
peter |
87 |
/** |
2482 |
24 Apr 11 |
peter |
\return seqid string |
2482 |
24 Apr 11 |
peter |
89 |
*/ |
2482 |
24 Apr 11 |
peter |
90 |
const std::string& seqid(void) const; |
2482 |
24 Apr 11 |
peter |
91 |
|
2482 |
24 Apr 11 |
peter |
92 |
/** |
2482 |
24 Apr 11 |
peter |
\return source string |
2482 |
24 Apr 11 |
peter |
94 |
*/ |
2482 |
24 Apr 11 |
peter |
95 |
const std::string& source(void) const; |
2482 |
24 Apr 11 |
peter |
96 |
|
2482 |
24 Apr 11 |
peter |
97 |
/** |
2482 |
24 Apr 11 |
peter |
\return start string |
2482 |
24 Apr 11 |
peter |
99 |
*/ |
2482 |
24 Apr 11 |
peter |
100 |
const std::string& start(void) const; |
2482 |
24 Apr 11 |
peter |
101 |
|
2482 |
24 Apr 11 |
peter |
102 |
/** |
2482 |
24 Apr 11 |
peter |
\return strand string |
2482 |
24 Apr 11 |
peter |
104 |
*/ |
2482 |
24 Apr 11 |
peter |
105 |
const std::string& strand(void) const; |
2482 |
24 Apr 11 |
peter |
106 |
|
2482 |
24 Apr 11 |
peter |
107 |
/** |
2482 |
24 Apr 11 |
peter |
\return type string |
2482 |
24 Apr 11 |
peter |
109 |
*/ |
2482 |
24 Apr 11 |
peter |
110 |
const std::string& type(void) const; |
2482 |
24 Apr 11 |
peter |
111 |
protected: |
2482 |
24 Apr 11 |
peter |
112 |
/** |
2482 |
24 Apr 11 |
peter |
\return vector with the 9 elements |
2482 |
24 Apr 11 |
peter |
114 |
*/ |
2482 |
24 Apr 11 |
peter |
115 |
const std::vector<std::string>& vec(void) const; |
2576 |
03 Oct 11 |
peter |
116 |
|
2576 |
03 Oct 11 |
peter |
117 |
/** |
2576 |
03 Oct 11 |
peter |
\brief protected friend |
2576 |
03 Oct 11 |
peter |
119 |
*/ |
2482 |
24 Apr 11 |
peter |
120 |
friend std::ostream& operator<<(std::ostream&, const GFF&); |
2482 |
24 Apr 11 |
peter |
// user compiler generated copy |
2482 |
24 Apr 11 |
peter |
//GFF(const GFF& other) {}; |
2482 |
24 Apr 11 |
peter |
//GFFBase& operator=(const GFF&); |
2482 |
24 Apr 11 |
peter |
124 |
private: |
2482 |
24 Apr 11 |
peter |
125 |
friend bool getline(std::istream&, GFF&); |
2482 |
24 Apr 11 |
peter |
126 |
virtual void add_attribute(std::map<std::string, std::string>& m, |
2482 |
24 Apr 11 |
peter |
127 |
const std::string&) const=0; |
2482 |
24 Apr 11 |
peter |
128 |
|
2482 |
24 Apr 11 |
peter |
129 |
void create_attributes(std::map<std::string, std::string>& m) const; |
2482 |
24 Apr 11 |
peter |
130 |
std::vector<std::string> vec_; |
2482 |
24 Apr 11 |
peter |
131 |
std::map<std::string, std::string> attributes_; |
2482 |
24 Apr 11 |
peter |
132 |
}; |
2482 |
24 Apr 11 |
peter |
133 |
|
2482 |
24 Apr 11 |
peter |
134 |
/** |
2482 |
24 Apr 11 |
peter |
\return true iff a GFF object was loaded successfully |
2482 |
24 Apr 11 |
peter |
136 |
|
2482 |
24 Apr 11 |
peter |
Empty lines and lines starting with '#' are ignored. |
2482 |
24 Apr 11 |
peter |
138 |
|
2482 |
24 Apr 11 |
peter |
\relates GFF |
2482 |
24 Apr 11 |
peter |
\since New in yat 0.8 |
2482 |
24 Apr 11 |
peter |
141 |
*/ |
2482 |
24 Apr 11 |
peter |
142 |
bool getline(std::istream& is, GFF& gff); |
2482 |
24 Apr 11 |
peter |
143 |
|
2482 |
24 Apr 11 |
peter |
144 |
/** |
2482 |
24 Apr 11 |
peter |
\brief output operator for GFF |
2482 |
24 Apr 11 |
peter |
146 |
|
2482 |
24 Apr 11 |
peter |
\relates GFF |
2482 |
24 Apr 11 |
peter |
\since New in yat 0.8 |
2482 |
24 Apr 11 |
peter |
149 |
*/ |
2482 |
24 Apr 11 |
peter |
150 |
std::ostream& operator<<(std::ostream& os, const GFF& gff); |
2482 |
24 Apr 11 |
peter |
151 |
|
2482 |
24 Apr 11 |
peter |
152 |
}}} |
2482 |
24 Apr 11 |
peter |
153 |
#endif |