|
bpp-seq
2.1.0
|
00001 // 00002 // File: Clustal.h 00003 // Created by: Julien Dutheil 00004 // Created on: ? 00005 // 00006 00007 /* 00008 Copyright or © or Copr. Bio++ Development Team, (November 17, 2004) 00009 00010 This software is a computer program whose purpose is to provide classes 00011 for sequences analysis. 00012 00013 This software is governed by the CeCILL license under French law and 00014 abiding by the rules of distribution of free software. You can use, 00015 modify and/ or redistribute the software under the terms of the CeCILL 00016 license as circulated by CEA, CNRS and INRIA at the following URL 00017 "http://www.cecill.info". 00018 00019 As a counterpart to the access to the source code and rights to copy, 00020 modify and redistribute granted by the license, users are provided only 00021 with a limited warranty and the software's author, the holder of the 00022 economic rights, and the successive licensors have only limited 00023 liability. 00024 00025 In this respect, the user's attention is drawn to the risks associated 00026 with loading, using, modifying and/or developing or reproducing the 00027 software by the user in light of its specific status of free software, 00028 that may mean that it is complicated to manipulate, and that also 00029 therefore means that it is reserved for developers and experienced 00030 professionals having in-depth computer knowledge. Users are therefore 00031 encouraged to load and test the software's suitability as regards their 00032 requirements in conditions enabling the security of their systems and/or 00033 data to be ensured and, more generally, to use and operate it in the 00034 same conditions as regards security. 00035 00036 The fact that you are presently reading this means that you have had 00037 knowledge of the CeCILL license and that you accept its terms. 00038 */ 00039 00040 #ifndef _CLUSTAL_H_ 00041 #define _CLUSTAL_H_ 00042 00043 #include "AbstractIAlignment.h" 00044 #include "AbstractOAlignment.h" 00045 #include "../Container/SiteContainer.h" 00046 00047 // From the STL: 00048 #include <iostream> 00049 00050 namespace bpp 00051 { 00057 class Clustal : 00058 public AbstractIAlignment, 00059 public AbstractOAlignment, 00060 public virtual ISequence 00061 { 00062 private: 00063 bool checkNames_; 00064 unsigned int nbSpacesBeforeSeq_; 00065 unsigned int charsByLine_; 00066 00067 public: 00075 Clustal(bool checkSequenceNames = true, unsigned int nbExtraSpacesBeforeSeq = 5, unsigned int charsByLine = 100) throw (Exception) : 00076 checkNames_(checkSequenceNames), 00077 nbSpacesBeforeSeq_(nbExtraSpacesBeforeSeq + 1), 00078 charsByLine_(charsByLine) 00079 {} 00080 00081 virtual ~Clustal() {} 00082 00083 public: 00089 void appendAlignmentFromStream(std::istream& input, SiteContainer& sc) const throw (Exception); 00100 virtual SequenceContainer* readSequences(std::istream& input, const Alphabet* alpha) const throw (Exception) { 00101 return readAlignment(input, alpha); 00102 } 00103 virtual SequenceContainer* readSequences(const std::string& path, const Alphabet* alpha) const throw (Exception) { 00104 return readAlignment(path, alpha); 00105 } 00113 void writeAlignment(std::ostream& output, const SiteContainer& sc) const throw (Exception); 00114 void writeAlignment(const std::string& path, const SiteContainer& sc, bool overwrite = true) const throw (Exception) 00115 { 00116 AbstractOAlignment::writeAlignment(path, sc, overwrite); 00117 } 00125 const std::string getFormatName() const { return "Clustal"; } 00126 00127 const std::string getFormatDescription() const { return "The Clustal alignment tool output format."; } 00128 00134 bool checkNames() const { return checkNames_; } 00135 00141 void checkNames(bool yn) { checkNames_ = yn; } 00142 }; 00143 } // end of namespace bpp. 00144 00145 #endif // _CLUSTAL_H_ 00146