75 getline(input_, nextLine_);
81 if (!hasMoreFeature())
82 throw Exception(
"GffFeatureReader::nextFeature(). No more feature in file.");
87 throw Exception(
"GffFeatureReader::nextFeature(). Wrong GFF3 file format: should have 9 tab delimited columns.");
93 unsigned int start = TextTools::to<unsigned int>(st.
nextToken()) - 1;
94 unsigned int end = TextTools::to<unsigned int>(st.
nextToken());
95 double score = TextTools::to<double>(st.
nextToken());
99 map<string, string> attributes;
101 string id = attributes[
"ID"];
105 if (phase !=
".") feature.
setAttribute(GFF_PHASE, phase);
108 for (map<string, string>::iterator it = attributes.begin(); it != attributes.end(); ++it) {
109 if (it->first !=
"ID")
120 std::vector< std::string > v;
121 std::vector< std::string > attr;
144 if (f.
getId() !=
"") {
145 attr.push_back(
"ID=" + f.
getId());
147 for (std::set< std::string >::iterator it = attrNames.begin() ; it != attrNames.end() ; it++) {
A very simple implementation of the SequenceFeature class.
void setAttribute(const std::string &attribute, const std::string &value)
Set the value of an attribute.
static const std::string GFF_DBXREF
static const std::string GFF_ALIAS
static std::string toString(const bpp::SequenceFeature &f)
static const std::string GFF_NOTE
static const std::string GFF_PHASE
static const std::string GFF_DERIVES_FROM
static const std::string GFF_TARGET
static const std::string GFF_ONTOLOGY_TERM
static const std::string GFF_IS_CIRCULAR
static const std::string GFF_GAP
static const std::string GFF_PARENT
static const std::string GFF_NAME
const BasicSequenceFeature nextFeature()
The base interface for sequence features.
virtual std::set< std::string > getAttributeList() const =0
virtual const std::string & getType() const =0
virtual const std::string & getSource() const =0
virtual const size_t getEnd() const =0
virtual bool isStranded() const =0
virtual const std::string & getAttribute(const std::string &attribute) const =0
virtual const std::string & getId() const =0
virtual const size_t getStart() const =0
virtual const std::string & getSequenceId() const =0
virtual const double & getScore() const =0
virtual bool isNegativeStrand() const =0
size_t numberOfRemainingTokens() const
const std::string & nextToken()
bool isEmpty(const std::string &s)
std::string toString(T t)