Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

FastaIterator.h (Maintainer: Chris Bauer)

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // --------------------------------------------------------------------------
00005 //                   OpenMS Mass Spectrometry Framework
00006 // --------------------------------------------------------------------------
00007 //  Copyright (C) 2003-2008 -- Oliver Kohlbacher, Knut Reinert
00008 //
00009 //  This library is free software; you can redistribute it and/or
00010 //  modify it under the terms of the GNU Lesser General Public
00011 //  License as published by the Free Software Foundation; either
00012 //  version 2.1 of the License, or (at your option) any later version.
00013 //
00014 //  This library is distributed in the hope that it will be useful,
00015 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 //  Lesser General Public License for more details.
00018 //
00019 //  You should have received a copy of the GNU Lesser General Public
00020 //  License along with this library; if not, write to the Free Software
00021 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //
00023 // --------------------------------------------------------------------------
00024 // $Maintainer: Chris Bauer$
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

Generated Tue Apr 1 15:36:34 2008 -- using doxygen 1.5.4 OpenMS / TOPP 1.1