ToPS
SequenceEntry.hpp
00001 /*
00002  *       SequenceEntry.hpp
00003  *
00004  *       Copyright 2011 Andre Yoshiaki Kashiwabara <akashiwabara@usp.br>
00005  *                      Ígor Bonádio <ibonadio@ime.usp.br>
00006  *                      Vitor Onuchic <vitoronuchic@gmail.com>
00007  *                      Alan Mitchell Durham <aland@usp.br>
00008  *
00009  *       This program is free software; you can redistribute it and/or modify
00010  *       it under the terms of the GNU  General Public License as published by
00011  *       the Free Software Foundation; either version 3 of the License, or
00012  *       (at your option) any later version.
00013  *
00014  *       This program 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
00017  *       GNU General Public License for more details.
00018  *
00019  *       You should have received a copy of the GNU General Public License
00020  *       along with this program; if not, write to the Free Software
00021  *       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00022  *       MA 02110-1301, USA.
00023  */
00024 
00025 #ifndef Sequence_ENTRY_HPP
00026 #define Sequence_ENTRY_HPP
00027 
00028 #include "crossplatform.hpp"
00029 
00030 #include <istream>
00031 #include <ostream>
00032 #include <string>
00033 #include <boost/shared_ptr.hpp>
00034 
00035 #include "SequenceFactory.hpp"
00036 #include "SequenceFormat.hpp"
00037 #include "Sequence.hpp"
00038 
00039 namespace tops {
00041   class DLLEXPORT SequenceEntry {
00042   private:
00043     DLLEXPORT friend std::ostream & operator << (std::ostream & stream, SequenceEntry & out);
00044     DLLEXPORT friend std::istream & operator >> (std::istream & stream, SequenceEntry & in);
00045     std::string _name;
00046     std::string _description;
00047     Sequence _sequence;
00048     AlphabetPtr _alphabet;
00049     std::string _sep;
00050     SequenceFormatPtr _format;
00051       std::vector <int>_invalidPositions;
00052   public:
00053     SequenceEntry(){
00054       _format = (SequenceFormatManager::instance())->getFormat();
00055     };
00056     SequenceEntry ( AlphabetPtr alphabet) : _alphabet(alphabet), _sep(" ")
00057     {
00058       _format = (SequenceFormatManager::instance())->getFormat();
00059     }
00060     AlphabetPtr getAlphabet() {
00061       return _alphabet;
00062     }
00063       void addInvalidPosition(int i) {
00064           _invalidPositions.push_back(i);
00065       }
00066       void setInvalidPositions (std::vector <int> v) {
00067           _invalidPositions = v;
00068       }
00069       std::vector <int> & invalidPositions(){
00070           return _invalidPositions;
00071       }
00072     void setSeparator(std::string sep) {
00073       _sep = sep;
00074     }
00075     std::string getSeparator() {
00076       return _sep;
00077     }
00078     Sequence &  getSequence()  {
00079       return _sequence;
00080     }
00081     void setSequence(Sequence  s) {
00082       _sequence = s;
00083     }
00084 
00085     std::string  getName() {
00086       return _name;
00087     }
00088 
00089     void setName(std::string name) {
00090       _name = name;
00091     }
00092 
00093     void setDescription(std::string description) {
00094       _description = description;
00095     }
00096 
00097     std::string  getDescription() {
00098       return _description;
00099     }
00100 
00101     void setSequenceFormat(SequenceFormatPtr format) {
00102       _format = format;
00103     }
00104   };
00105   typedef boost::shared_ptr <SequenceEntry> SequenceEntryPtr;
00106   typedef std::vector <Sequence> SequenceList;
00107   typedef std::vector <SequenceEntryPtr> SequenceEntryList;
00108 
00109 
00110 }
00111 #endif