source: trunk/yat/omic/GFF.h @ 2576

Last change on this file since 2576 was 2576, checked in by Peter, 10 years ago

avoid warning with doxygen 1.7.5.1

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