|
bpp-seq
2.1.0
|
The clustal sequence file format. More...
#include <Bpp/Seq/Io/Clustal.h>
Inheritance diagram for bpp::Clustal:
Collaboration diagram for bpp::Clustal:Public Member Functions | |
| Clustal (bool checkSequenceNames=true, unsigned int nbExtraSpacesBeforeSeq=5, unsigned int charsByLine=100) throw (Exception) | |
| Build a new Clustal object. | |
| virtual | ~Clustal () |
| bool | checkNames () const |
| void | checkNames (bool yn) |
| Tell whether the sequence names should be checked when reading from files. | |
| const std::string | getDataType () const |
The AbstractIAlignment interface. | |
| void | appendAlignmentFromStream (std::istream &input, SiteContainer &sc) const throw (Exception) |
| Append sequences to a container from a stream. | |
The ISequence interface. | |
As a SiteContainer is a subclass of SequenceContainer, we hereby implement the ISequence interface by downcasting the interface. | |
| virtual SequenceContainer * | readSequences (std::istream &input, const Alphabet *alpha) const throw (Exception) |
| Create a new container from a stream. | |
| virtual SequenceContainer * | readSequences (const std::string &path, const Alphabet *alpha) const throw (Exception) |
| Create a new container from a file. | |
The AbstractOAlignment interface. | |
| void | writeAlignment (std::ostream &output, const SiteContainer &sc) const throw (Exception) |
| Write a container to a stream. | |
| void | writeAlignment (const std::string &path, const SiteContainer &sc, bool overwrite=true) const throw (Exception) |
| Write a container to a file. | |
The IOSequence interface. | |
| const std::string | getFormatName () const |
| const std::string | getFormatDescription () const |
IAlignment methods: | |
| virtual void | readAlignment (std::istream &input, SiteContainer &sc) const throw (Exception) |
| Add sequences to a container from a stream. | |
| virtual void | readAlignment (const std::string &path, SiteContainer &sc) const throw (Exception) |
| Add sequences to a container from a file. | |
| virtual AlignedSequenceContainer * | readAlignment (const std::string &path, const Alphabet *alpha) const throw (Exception) |
| Create a new container from a file. | |
| virtual AlignedSequenceContainer * | readAlignment (std::istream &input, const Alphabet *alpha) const throw (Exception) |
| Create a new container from a stream. | |
Protected Member Functions | |
| virtual void | appendAlignmentFromFile (const std::string &path, SiteContainer &sc) const throw (Exception) |
| Append sequences to a container from a file. | |
| virtual AlignedSequenceContainer * | readAlignmentFromStream (std::istream &input, const Alphabet *alpha) const throw (Exception) |
| Read sequences from a stream. | |
| virtual AlignedSequenceContainer * | readAlignmentFromFile (const std::string &path, const Alphabet *alpha) const throw (Exception) |
| Read sequences from a file. | |
Private Attributes | |
| bool | checkNames_ |
| unsigned int | nbSpacesBeforeSeq_ |
| unsigned int | charsByLine_ |
The clustal sequence file format.
An AlignedSequenceContainer object is used instead of a VectorSequenceContainer.
| bpp::Clustal::Clustal | ( | bool | checkSequenceNames = true, |
| unsigned int | nbExtraSpacesBeforeSeq = 5, |
||
| unsigned int | charsByLine = 100 |
||
| ) | throw (Exception) [inline] |
Build a new Clustal object.
| checkSequenceNames | Tell if the names in the file should be checked for unicity (slower, in o(n*n) where n is the number of sequences). |
| nbExtraSpacesBeforeSeq | Specify the number of extra space characters separating the sequence name form content. The default is 5 (hence 6 spaces in total) for backward compatibility, using 0 will not allow for any space in the sequence names. |
| charsByLine | Number of character per line when writing file. |
| virtual bpp::Clustal::~Clustal | ( | ) | [inline, virtual] |
| virtual void bpp::AbstractIAlignment::appendAlignmentFromFile | ( | const std::string & | path, |
| SiteContainer & | sc | ||
| ) | const throw (Exception) [inline, protected, virtual, inherited] |
Append sequences to a container from a file.
| path | The path to the file to read. |
| sc | The sequence container to update. |
| Exception | If the file is not in the specified format. |
Definition at line 143 of file AbstractIAlignment.h.
References bpp::AbstractIAlignment::appendAlignmentFromStream().
Referenced by bpp::AbstractIAlignment::readAlignment(), and bpp::AbstractIAlignment::readAlignmentFromFile().
| void Clustal::appendAlignmentFromStream | ( | std::istream & | input, |
| SiteContainer & | sc | ||
| ) | const throw (Exception) [virtual] |
Append sequences to a container from a stream.
This is the unique method to implement!
| input | The input stream to read. |
| sc | The sequence container to update. |
| Exception | If the file is not in the specified format. |
Implements bpp::AbstractIAlignment.
Definition at line 52 of file Clustal.cpp.
References bpp::FileTools::getNextLine(), bpp::TextTools::isEmpty(), and bpp::TextTools::removeSurroundingWhiteSpaces().
| bool bpp::Clustal::checkNames | ( | ) | const [inline] |
Definition at line 134 of file Clustal.h.
References checkNames_.
| void bpp::Clustal::checkNames | ( | bool | yn | ) | [inline] |
Tell whether the sequence names should be checked when reading from files.
| yn | whether the sequence names should be checked when reading from files. |
Definition at line 141 of file Clustal.h.
References checkNames_.
| const std::string bpp::IOSequence::getDataType | ( | ) | const [inline, virtual, inherited] |
Implements bpp::IOFormat.
Definition at line 65 of file IoSequence.h.
| const std::string bpp::Clustal::getFormatDescription | ( | ) | const [inline, virtual] |
Implements bpp::IOFormat.
| const std::string bpp::Clustal::getFormatName | ( | ) | const [inline, virtual] |
Implements bpp::IOFormat.
| virtual void bpp::AbstractIAlignment::readAlignment | ( | std::istream & | input, |
| SiteContainer & | sc | ||
| ) | const throw (Exception) [inline, virtual, inherited] |
Add sequences to a container from a stream.
| input | The input stream to read. |
| sc | The sequence container to update. |
| Exception | If the file is not in the specified format. |
Definition at line 81 of file AbstractIAlignment.h.
References bpp::AbstractIAlignment::appendAlignmentFromStream().
Referenced by bpp::DCSE::readSequences(), readSequences(), bpp::NexusIOSequence::readSequences(), and bpp::Phylip::readSequences().
| virtual void bpp::AbstractIAlignment::readAlignment | ( | const std::string & | path, |
| SiteContainer & | sc | ||
| ) | const throw (Exception) [inline, virtual, inherited] |
Add sequences to a container from a file.
| path | The path to the file to read. |
| sc | The sequence container to update. |
| Exception | If the file is not in the specified format. |
Definition at line 93 of file AbstractIAlignment.h.
References bpp::AbstractIAlignment::appendAlignmentFromFile().
| virtual AlignedSequenceContainer* bpp::AbstractIAlignment::readAlignment | ( | const std::string & | path, |
| const Alphabet * | alpha | ||
| ) | const throw (Exception) [inline, virtual, inherited] |
Create a new container from a file.
| path | The path to the file to read. |
| alpha | The alphabet to be associated to the container. |
| Exception | If the file is not in the specified format. |
Implements bpp::IAlignment.
Definition at line 104 of file AbstractIAlignment.h.
References bpp::AbstractIAlignment::readAlignmentFromFile().
| virtual AlignedSequenceContainer* bpp::AbstractIAlignment::readAlignment | ( | std::istream & | input, |
| const Alphabet * | alpha | ||
| ) | const throw (Exception) [inline, virtual, inherited] |
Create a new container from a stream.
| input | The input stream to read. |
| alpha | The alphabet to be associated to the container. |
| Exception | If the file is not in the specified format. |
Implements bpp::IAlignment.
Definition at line 115 of file AbstractIAlignment.h.
References bpp::AbstractIAlignment::readAlignmentFromStream().
| virtual AlignedSequenceContainer* bpp::AbstractIAlignment::readAlignmentFromFile | ( | const std::string & | path, |
| const Alphabet * | alpha | ||
| ) | const throw (Exception) [inline, protected, virtual, inherited] |
Read sequences from a file.
| path | The path to the file to read. |
| alpha | The alphabet to use. |
| Exception | If the file is not in the specified format. |
Definition at line 173 of file AbstractIAlignment.h.
References bpp::AbstractIAlignment::appendAlignmentFromFile().
Referenced by bpp::AbstractIAlignment::readAlignment().
| virtual AlignedSequenceContainer* bpp::AbstractIAlignment::readAlignmentFromStream | ( | std::istream & | input, |
| const Alphabet * | alpha | ||
| ) | const throw (Exception) [inline, protected, virtual, inherited] |
Read sequences from a stream.
| input | The input stream to read. |
| alpha | The alphabet to use. |
| Exception | If the file is not in the specified format. |
Definition at line 158 of file AbstractIAlignment.h.
References bpp::AbstractIAlignment::appendAlignmentFromStream().
Referenced by bpp::AbstractIAlignment::readAlignment().
| virtual SequenceContainer* bpp::Clustal::readSequences | ( | std::istream & | input, |
| const Alphabet * | alpha | ||
| ) | const throw (Exception) [inline, virtual] |
Create a new container from a stream.
| input | The input stream to read. |
| alpha | The alphabet to be associated to the container. |
| Exception | If the file is not in the specified format. |
Implements bpp::ISequence.
Definition at line 100 of file Clustal.h.
References bpp::AbstractIAlignment::readAlignment().
| virtual SequenceContainer* bpp::Clustal::readSequences | ( | const std::string & | path, |
| const Alphabet * | alpha | ||
| ) | const throw (Exception) [inline, virtual] |
Create a new container from a file.
| path | The path to the file to read. |
| alpha | The alphabet to be associated to the container. |
| Exception | If the file is not in the specified format. |
Implements bpp::ISequence.
Definition at line 103 of file Clustal.h.
References bpp::AbstractIAlignment::readAlignment().
| void Clustal::writeAlignment | ( | std::ostream & | output, |
| const SiteContainer & | sc | ||
| ) | const throw (Exception) [virtual] |
Write a container to a stream.
| output | The output stream where to write. |
| sc | The container to write. |
| Exception | If the file is not in the specified format. |
Implements bpp::AbstractOAlignment.
Definition at line 114 of file Clustal.cpp.
References bpp::Sequence::getName(), and bpp::TextTools::resizeRight().
Referenced by writeAlignment().
| void bpp::Clustal::writeAlignment | ( | const std::string & | path, |
| const SiteContainer & | sc, | ||
| bool | overwrite = true |
||
| ) | const throw (Exception) [inline, virtual] |
Write a container to a file.
| path | The path to the file to write. |
| sc | The container to write. |
| overwrite | If true the sequences are written at the beginning of the file instead of being appended. Any previous content will be lost. |
| Exception | If the file is not in the specified format. |
Reimplemented from bpp::AbstractOAlignment.
Definition at line 114 of file Clustal.h.
References writeAlignment().
unsigned int bpp::Clustal::charsByLine_ [private] |
bool bpp::Clustal::checkNames_ [private] |
Definition at line 63 of file Clustal.h.
Referenced by checkNames().
unsigned int bpp::Clustal::nbSpacesBeforeSeq_ [private] |