00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef OPENMS_FORMAT_FASTAITERATOR_H
00029 #define OPENMS_FORMAT_FASTAITERATOR_H
00030
00031 #include <OpenMS/CHEMISTRY/PepIterator.h>
00032 #include <OpenMS/CONCEPT/Exception.h>
00033 #include <fstream>
00034 #include <vector>
00035
00036 namespace OpenMS{
00043 class FastaIterator : public PepIterator
00044 {
00045
00046 public:
00047
00048 typedef std::pair <String, String> FASTAEntry;
00052 FastaIterator();
00053
00057 FastaIterator(const FastaIterator &);
00058
00062 virtual ~FastaIterator ();
00063
00069 virtual FASTAEntry operator*() throw (Exception::InvalidIterator);
00070
00076 virtual PepIterator & operator++() throw (Exception::InvalidIterator);
00077
00083 virtual PepIterator * operator++(int i) throw (Exception::InvalidIterator);
00084
00089 virtual void setFastaFile (const String & f) throw (Exception::FileNotFound, Exception::ParseError);
00090
00095 virtual String getFastaFile();
00096
00102 virtual void setSpectrum (const std::vector<float> &) throw (Exception::InvalidValue, Exception::NotImplemented)
00103 {
00104 throw Exception::NotImplemented(__FILE__, __LINE__, __PRETTY_FUNCTION__);
00105 };
00106
00112 virtual const std::vector<float> & getSpectrum () throw (Exception::NotImplemented)
00113 {
00114 throw Exception::NotImplemented(__FILE__, __LINE__, __PRETTY_FUNCTION__);
00115 };
00116
00123 virtual void setTolerance (float) throw (Exception::InvalidValue, Exception::NotImplemented)
00124 {
00125 throw Exception::NotImplemented(__FILE__, __LINE__, __PRETTY_FUNCTION__);
00126 };
00127
00134 virtual float getTolerance() throw (Exception::NotImplemented)
00135 {
00136 throw Exception::NotImplemented(__FILE__, __LINE__, __PRETTY_FUNCTION__);
00137 };
00138
00144 virtual bool begin () throw (Exception::InvalidIterator);
00145
00150 virtual bool isAtEnd ();
00151
00156 static const std::string getName()
00157 {
00158 return "FastaIterator";
00159 }
00160
00165 static PepIterator * create()
00166 {
00167 return new FastaIterator;
00168 }
00169
00170
00171
00172 protected:
00177 virtual std::string next_ ();
00178
00179 bool is_at_end_;
00180
00181 std::ifstream * input_file_;
00182
00183 String fasta_file_;
00184
00185 std::string actual_seq_;
00186
00187 std::string header_;
00188
00189 std::string last_header_;
00190
00191 };
00192 }
00193 #endif // OPENMS_FORMAT_FASTAITERATOR_H