bpp-seq3
3.0.0
|
The mase sequence file format. More...
#include <Bpp/Seq/Io/Mase.h>
Public Member Functions | |
Mase (unsigned int charsByLine=100, bool checkSequenceNames=true) | |
Build a new Mase object. More... | |
virtual | ~Mase () |
bool | checkNames () const |
void | checkNames (bool yn) |
Tell whether the sequence names should be checked when reading from files. More... | |
const std::string | getDataType () const |
Reading method including header: | |
std::unique_ptr< SequenceContainerInterface > | readMeta (std::istream &input, std::shared_ptr< const Alphabet > &alpha, MaseHeader &header) const |
std::unique_ptr< SequenceContainerInterface > | readMeta (std::string &path, std::shared_ptr< const Alphabet > &alpha, MaseHeader &header) const |
The AbstractISequence interface. | |
void | appendSequencesFromStream (std::istream &input, SequenceContainerInterface &sc) const override |
Append sequences to a container from a stream. More... | |
The AbstractIAlignment interface. | |
void | appendAlignmentFromStream (std::istream &input, SequenceContainerInterface &sc) const override |
Append sequences to a container from a stream. More... | |
The OSequence interface. | |
void | writeSequences (std::ostream &output, const SequenceContainerInterface &sc) const override |
Write a container to a stream. More... | |
void | writeSequences (const std::string &path, const SequenceContainerInterface &sc, bool overwrite=true) const override |
Write a container to a file. More... | |
Writing methods including header: | |
void | writeMeta (std::ostream &output, const SequenceContainerInterface &sc, const MaseHeader &header) const |
void | writeMeta (const std::string &path, const SequenceContainerInterface &sc, const MaseHeader &header, bool overwrite=true) const |
The IOSequence interface. | |
const std::string | getFormatName () const override |
const std::string | getFormatDescription () const override |
ISequence methods: | |
void | readSequences (std::istream &input, SequenceContainerInterface &sc) const override |
Add sequences to a container from a stream. More... | |
void | readSequences (const std::string &path, SequenceContainerInterface &sc) const override |
Add sequences to a container from a file. More... | |
std::unique_ptr< SequenceContainerInterface > | readSequences (std::istream &input, std::shared_ptr< const Alphabet > alpha) const override |
Create a new container from a stream. More... | |
std::unique_ptr< SequenceContainerInterface > | readSequences (const std::string &path, std::shared_ptr< const Alphabet > alpha) const override |
Create a new container from a file. More... | |
IAlignment methods: | |
virtual void | readAlignment (std::istream &input, SequenceContainerInterface &sc) const override |
Add sequences to a container from a stream. More... | |
virtual void | readAlignment (const std::string &path, SequenceContainerInterface &sc) const override |
Add sequences to a container from a file. More... | |
std::unique_ptr< SiteContainerInterface > | readAlignment (const std::string &path, std::shared_ptr< const Alphabet > alpha) const override |
Create a new container from a file. More... | |
std::unique_ptr< SiteContainerInterface > | readAlignment (std::istream &input, std::shared_ptr< const Alphabet > alpha) const override |
Create a new container from a stream. More... | |
OAlignment methods: | |
As a SiteContainer is a specialization of SequenceContainer, it is assumed that a OSequence object can write aligned sequence just like a OAlignment object. Therefore it implements the OAlignment interface by down-casting the SiteContainer to a SequenceContainer. | |
void | writeAlignment (std::ostream &output, const SiteContainerInterface &sc) const override |
Write a container to a stream. More... | |
void | writeAlignment (const std::string &path, const SiteContainerInterface &sc, bool overwrite=true) const override |
Write a container to a file. More... | |
Protected Member Functions | |
virtual void | appendSequencesFromFile (const std::string &path, SequenceContainerInterface &sc) const |
Append sequences to a container from a file. More... | |
std::unique_ptr< SequenceContainerInterface > | readSequencesFromStream (std::istream &input, std::shared_ptr< const Alphabet > &alpha) const |
Read sequences from a stream. More... | |
std::unique_ptr< SequenceContainerInterface > | readSequencesFromFile (const std::string &path, std::shared_ptr< const Alphabet > &alpha) const |
Append sequences to a container from a file. More... | |
virtual void | appendAlignmentFromFile (const std::string &path, SequenceContainerInterface &sc) const |
Append sequences to a container from a file. More... | |
virtual std::unique_ptr< SiteContainerInterface > | readAlignmentFromStream (std::istream &input, std::shared_ptr< const Alphabet > alpha) const |
Read sequences from a stream. More... | |
virtual std::unique_ptr< SiteContainerInterface > | readAlignmentFromFile (const std::string &path, std::shared_ptr< const Alphabet > alpha) const |
Read sequences from a file. More... | |
Private Member Functions | |
void | readHeader_ (std::istream &input, MaseHeader &header) const |
void | writeHeader_ (std::ostream &output, const MaseHeader &header) const |
Private Attributes | |
unsigned int | charsByLine_ |
The maximum number of chars to be written on a line. More... | |
bool | checkNames_ |
The mase sequence file format.
In addition to traditional read and write method, this class offers overloaded method with MaseHeader objects, dedicated to header information storage. If used, then the header of the mase file will be parsed accordingly. Otherwise, the header lines will be stored as general comments.
|
inline |
|
inlineprotectedvirtualinherited |
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 93 of file AbstractIAlignment.h.
References bpp::AbstractIAlignment::appendAlignmentFromStream().
Referenced by bpp::AbstractIAlignment::readAlignment(), bpp::AbstractIAlignment::readAlignmentFromFile(), and bpp::AbstractIAlignment2::readSequences().
|
inlineoverridevirtual |
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 161 of file Mase.h.
References appendSequencesFromStream().
|
inlineprotectedvirtualinherited |
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 92 of file AbstractISequence.h.
References bpp::AbstractISequence::appendSequencesFromStream().
Referenced by bpp::AbstractISequence::readSequences(), and bpp::AbstractISequence::readSequencesFromFile().
|
overridevirtual |
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::AbstractISequence.
Definition at line 13 of file Mase.cpp.
References bpp::TemplateSequenceContainerInterface< SequenceType, HashType >::addSequence(), bpp::TemplateSequenceDataInterface< HashType >::getAlphabet(), bpp::Commentable::getComments(), and bpp::Commentable::setComments().
Referenced by appendAlignmentFromStream().
|
inline |
Definition at line 217 of file Mase.h.
References checkNames_.
|
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 224 of file Mase.h.
References checkNames_.
|
inlinevirtualinherited |
|
inlineoverridevirtual |
Implements bpp::IOFormat.
|
inlineoverridevirtual |
Implements bpp::IOFormat.
|
inlineoverridevirtualinherited |
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. |
Implements bpp::IAlignment.
Definition at line 57 of file AbstractIAlignment.h.
References bpp::AbstractIAlignment::appendAlignmentFromFile().
|
inlineoverridevirtualinherited |
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 62 of file AbstractIAlignment.h.
References bpp::AbstractIAlignment::readAlignmentFromFile().
|
inlineoverridevirtualinherited |
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. |
Implements bpp::IAlignment.
Definition at line 45 of file AbstractIAlignment.h.
References bpp::AbstractIAlignment::appendAlignmentFromStream().
Referenced by bpp::AbstractIAlignment2::readSequences(), bpp::Clustal::readSequences(), bpp::DCSE::readSequences(), and bpp::Phylip::readSequences().
|
inlineoverridevirtualinherited |
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 67 of file AbstractIAlignment.h.
References bpp::AbstractIAlignment::readAlignmentFromStream().
|
inlineprotectedvirtualinherited |
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 125 of file AbstractIAlignment.h.
References bpp::AbstractIAlignment::appendAlignmentFromFile().
Referenced by bpp::AbstractIAlignment::readAlignment().
|
inlineprotectedvirtualinherited |
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 110 of file AbstractIAlignment.h.
References bpp::AbstractIAlignment::appendAlignmentFromStream().
Referenced by bpp::AbstractIAlignment::readAlignment().
|
private |
Definition at line 159 of file Mase.cpp.
References bpp::MultiRange< class >::addRange(), bpp::TextTools::endsWith(), bpp::FileTools::getNextLine(), bpp::StringTokenizer::hasMoreToken(), bpp::StringTokenizer::nextToken(), bpp::TextTools::removeSurroundingWhiteSpaces(), bpp::MaseHeader::setSequenceSelection(), bpp::MaseHeader::setSiteSelection(), bpp::MaseHeader::setTree(), bpp::MultiRange< class >::size(), bpp::TextTools::toString(), and bpp::StringTokenizer::unparseRemainingTokens().
Referenced by readMeta().
|
inline |
Definition at line 133 of file Mase.h.
References readHeader_(), and bpp::AbstractISequence::readSequences().
Referenced by readMeta().
|
inline |
Definition at line 139 of file Mase.h.
References readMeta().
|
inlineoverridevirtualinherited |
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. |
Implements bpp::ISequence.
Definition at line 57 of file AbstractISequence.h.
References bpp::AbstractISequence::appendSequencesFromFile().
|
inlineoverridevirtualinherited |
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 67 of file AbstractISequence.h.
References bpp::AbstractISequence::readSequencesFromFile().
|
inlineoverridevirtualinherited |
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. |
Implements bpp::ISequence.
Definition at line 45 of file AbstractISequence.h.
References bpp::AbstractISequence::appendSequencesFromStream().
Referenced by readMeta().
|
inlineoverridevirtualinherited |
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 62 of file AbstractISequence.h.
References bpp::AbstractISequence::readSequencesFromStream().
|
inlineprotectedinherited |
Append sequences to a container 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 123 of file AbstractISequence.h.
References bpp::AbstractISequence::appendSequencesFromFile().
Referenced by bpp::AbstractISequence::readSequences().
|
inlineprotectedinherited |
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 109 of file AbstractISequence.h.
References bpp::AbstractISequence::appendSequencesFromStream().
Referenced by bpp::AbstractISequence::readSequences().
|
inlineoverridevirtualinherited |
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. |
Implements bpp::OAlignment.
Definition at line 78 of file AbstractOSequence.h.
References bpp::AbstractOSequence::writeSequences().
|
inlineoverridevirtualinherited |
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::OAlignment.
Definition at line 73 of file AbstractOSequence.h.
References bpp::AbstractOSequence::writeSequences().
|
private |
Definition at line 270 of file Mase.cpp.
References bpp::Range< class >::begin(), bpp::Range< class >::end(), bpp::MultiRange< class >::getRange(), bpp::MaseHeader::getSequenceSelection(), bpp::MaseHeader::getSequenceSelectionNames(), bpp::MaseHeader::getSiteSelection(), bpp::MaseHeader::getSiteSelectionNames(), bpp::MaseHeader::getTree(), bpp::MaseHeader::getTreeNames(), bpp::MultiRange< class >::size(), and bpp::MultiRange< class >::totalLength().
Referenced by writeMeta().
|
inline |
Definition at line 191 of file Mase.h.
References writeHeader_(), and writeSequences().
|
inline |
Definition at line 186 of file Mase.h.
References writeHeader_(), and writeSequences().
|
inlineoverridevirtual |
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::AbstractOSequence.
Definition at line 175 of file Mase.h.
References bpp::AbstractOSequence::writeSequences().
|
overridevirtual |
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::AbstractOSequence.
Definition at line 93 of file Mase.cpp.
References bpp::Commentable::getComments(), bpp::TemplateSequenceDataInterface< HashType >::getSequenceKeys(), and bpp::TemplateSequenceContainerInterface< SequenceType, HashType >::sequence().
Referenced by writeMeta().
|
private |
|
private |
Definition at line 113 of file Mase.h.
Referenced by checkNames().