bpp-seq3
3.0.0
|
The Pasta sequence file format. More...
#include <Bpp/Seq/Io/Pasta.h>
Public Types | |
typedef Table< double > | DataTable |
Public Member Functions | |
Pasta (unsigned int charsByLine=100, bool extended=false, bool strictSequenceNames=false) | |
Build a new Pasta object. More... | |
virtual | ~Pasta () |
const std::string | getFormatName () const override |
Get the format name. More... | |
const std::string | getFormatDescription () const override |
void | writeSequence (std::ostream &output, const ProbabilisticSequence &seq, bool header) const |
void | writeSequence (std::ostream &output, const Sequence &seq, bool header) const |
const std::string | getDataType () const override |
void | writeAlignment (std::ostream &output, const SiteContainerInterface &sc) const override |
void | writeAlignment (const std::string &path, const SiteContainerInterface &sc, bool overwrite=true) const override |
The "ISequenceStream interface" | |
bool | nextSequence (std::istream &input, ProbabilisticSequence &seq, bool hasLabels, const std::vector< size_t > &permutationMap) const |
The OSequence interface" | |
void | writeSequences (std::ostream &output, const SequenceContainerInterface &sc) const override |
Write a container to a stream. More... | |
void | writeSequences (std::ostream &output, const SequenceContainerInterface &sc) const override=0 |
void | writeSequences (const std::string &path, const SequenceContainerInterface &sc, bool overwrite=true) const override |
The "I/OProbabilisticSequence interface" | |
void | appendAlignmentFromStream (std::istream &input, ProbabilisticSequenceContainerInterface &psc) const override |
Append sequences to a container from a stream. More... | |
void | writeAlignment (std::ostream &output, const ProbabilisticSiteContainerInterface &psc) const override |
Write a container to a stream. More... | |
IProbabilisticAlignment methods: | |
void | readAlignment (std::istream &input, ProbabilisticSequenceContainerInterface &sc) const override |
Add sequences to a container from a stream. More... | |
void | readAlignment (const std::string &path, ProbabilisticSequenceContainerInterface &sc) const override |
Add sequences to a container from a file. More... | |
std::unique_ptr< ProbabilisticSiteContainerInterface > | readAlignment (const std::string &path, std::shared_ptr< const Alphabet > alpha) const override |
Create a new container from a file. More... | |
std::unique_ptr< ProbabilisticSiteContainerInterface > | readAlignment (std::istream &input, std::shared_ptr< const Alphabet > alpha) const override |
Create a new container from a stream. More... | |
OProbabilisticAlignment methods: | |
void | writeAlignment (const std::string &path, const ProbabilisticSiteContainerInterface &psc, bool overwrite=true) const override |
Write a container to a file. 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... | |
OSequence methods: | |
void | writeSequences (const std::string &path, const SequenceContainerInterface &sc, bool overwrite=true) const override |
Write a container to a file. More... | |
Protected Member Functions | |
virtual void | appendAlignmentFromFile (const std::string &path, ProbabilisticSequenceContainerInterface &sc) const |
Append sequences to a container from a file. More... | |
virtual std::unique_ptr< ProbabilisticSiteContainerInterface > | readAlignmentFromStream (std::istream &input, std::shared_ptr< const Alphabet > &alpha) const |
Read sequences from a stream. More... | |
virtual std::unique_ptr< ProbabilisticSiteContainerInterface > | readAlignmentFromFile (const std::string &path, std::shared_ptr< const Alphabet > &alpha) const |
Read sequences from a file. More... | |
Protected Attributes | |
unsigned int | charsByLine_ |
The maximum number of chars to be written on a line. More... | |
bool | extended_ |
bool | strictNames_ |
The Pasta sequence file format.
Read and write from/to Pasta files – a format that is more general than the Fasta format : while the Fasta format contains sequence information in the form of character states at each site of the sequence, the Pasta format contains sequence information in the form of probability of presence of each character state at each site. See implementation of methods below for more details
typedef Table<double> bpp::Pasta::DataTable |
|
inline |
Build a new Pasta object.
charsByLine | Number of characters per line when writing files. |
extended | Tell if we should read general comments and sequence comments in HUPO-PSI format. |
strictSequenceNames | Tells if the sequence names should be restricted to the characters between '>' and the first blank one. |
|
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 250 of file AbstractIAlignment.h.
References bpp::AbstractIProbabilisticAlignment::appendAlignmentFromStream().
Referenced by bpp::AbstractIProbabilisticAlignment::readAlignment(), bpp::AbstractIProbabilisticAlignment::readAlignmentFromFile(), and bpp::AbstractIProbabilisticAlignment2::readSequences().
|
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. |
Implements bpp::AbstractIProbabilisticAlignment.
Definition at line 156 of file Pasta.cpp.
References bpp::TemplateSequenceContainerInterface< SequenceType, HashType >::addSequence(), bpp::TemplateSequenceDataInterface< HashType >::getAlphabet(), bpp::StringTokenizer::hasMoreToken(), bpp::StringTokenizer::nextToken(), and bpp::Commentable::setComments().
|
inlineoverridevirtual |
Reimplemented from bpp::IOSequence.
|
inlineoverridevirtual |
Implements bpp::IOFormat.
|
inlineoverridevirtual |
bool Pasta::nextSequence | ( | std::istream & | input, |
ProbabilisticSequence & | seq, | ||
bool | hasLabels, | ||
const std::vector< size_t > & | permutationMap | ||
) | const |
Definition at line 19 of file Pasta.cpp.
References bpp::Table< class >::addColumn(), bpp::ProbabilisticSymbolList::getAlphabet(), bpp::Table< class >::getData(), bpp::StringTokenizer::hasMoreToken(), bpp::TextTools::isWhiteSpaceCharacter(), bpp::StringTokenizer::nextToken(), bpp::SimpleCommentable::setComments(), bpp::ProbabilisticSymbolList::setContent(), and bpp::AbstractCoreSequence::setName().
|
inlineoverridevirtualinherited |
Add sequences to a container from a file.
path | The path to the file to read. |
sc | The sequence container to update. |
Implements bpp::IProbabilisticAlignment.
Definition at line 215 of file AbstractIAlignment.h.
References bpp::AbstractIProbabilisticAlignment::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. |
Implements bpp::IProbabilisticAlignment.
Definition at line 220 of file AbstractIAlignment.h.
References bpp::AbstractIProbabilisticAlignment::readAlignmentFromFile().
|
inlineoverridevirtualinherited |
Add sequences to a container from a stream.
input | The input stream to read. |
sc | The sequence container to update. |
Implements bpp::IProbabilisticAlignment.
Definition at line 204 of file AbstractIAlignment.h.
References bpp::AbstractIProbabilisticAlignment::appendAlignmentFromStream().
Referenced by bpp::AbstractIProbabilisticAlignment2::readSequences().
|
inlineoverridevirtualinherited |
Create a new container from a stream.
input | The input stream to read. |
alpha | The alphabet to be associated to the container. |
Implements bpp::IProbabilisticAlignment.
Definition at line 225 of file AbstractIAlignment.h.
References bpp::AbstractIProbabilisticAlignment::readAlignmentFromStream().
|
inlineprotectedvirtualinherited |
Read sequences from a file.
path | The path to the file to read. |
alpha | The alphabet to use. |
Definition at line 280 of file AbstractIAlignment.h.
References bpp::AbstractIProbabilisticAlignment::appendAlignmentFromFile().
Referenced by bpp::AbstractIProbabilisticAlignment::readAlignment().
|
inlineprotectedvirtualinherited |
Read sequences from a stream.
input | The input stream to read. |
alpha | The alphabet to use. |
Definition at line 266 of file AbstractIAlignment.h.
References bpp::AbstractIProbabilisticAlignment::appendAlignmentFromStream().
Referenced by bpp::AbstractIProbabilisticAlignment::readAlignment().
|
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. |
Implements bpp::OProbabilisticAlignment.
Definition at line 65 of file AbstractOAlignment.h.
References bpp::AbstractOProbabilisticAlignment::writeAlignment().
|
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().
|
inlineoverride |
Definition at line 78 of file AbstractOSequence.h.
|
inlineoverridevirtual |
Write a container to a stream.
output | The output stream where to write. |
sc | The container to write. |
Implements bpp::AbstractOProbabilisticAlignment.
Definition at line 112 of file Pasta.h.
References bpp::TemplateSequenceDataInterface< HashType >::getNumberOfSequences(), bpp::TemplateSequenceContainerInterface< SequenceType, HashType >::sequence(), and writeSequence().
|
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().
|
inlineoverride |
Definition at line 73 of file AbstractOSequence.h.
void Pasta::writeSequence | ( | std::ostream & | output, |
const ProbabilisticSequence & | seq, | ||
bool | header | ||
) | const |
Definition at line 276 of file Pasta.cpp.
References bpp::ProbabilisticSymbolList::getAlphabet(), bpp::SimpleCommentable::getComments(), bpp::ProbabilisticSymbolList::getContent(), bpp::AbstractCoreSequence::getName(), and bpp::VectorTools::print().
Referenced by writeAlignment(), and writeSequences().
void Pasta::writeSequence | ( | std::ostream & | output, |
const Sequence & | seq, | ||
bool | header | ||
) | const |
Definition at line 318 of file Pasta.cpp.
References bpp::AbstractTemplateSymbolList< T >::getAlphabet(), bpp::SimpleCommentable::getComments(), bpp::AbstractCoreSequence::getName(), bpp::Sequence::getStateValueAt(), and bpp::AbstractTemplateSymbolList< T >::size().
|
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::OSequence.
Reimplemented in bpp::Mase, and bpp::Fasta.
Definition at line 38 of file AbstractOSequence.h.
References bpp::AbstractOSequence::writeSequences().
|
inlineoverride |
Definition at line 38 of file AbstractOSequence.h.
|
inlineoverridevirtual |
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 91 of file Pasta.h.
References bpp::TemplateSequenceDataInterface< HashType >::getNumberOfSequences(), bpp::TemplateSequenceContainerInterface< SequenceType, HashType >::sequence(), and writeSequence().
|
override |
|
protected |