bpp-seq3  3.0.0
bpp::AbstractIAlignment Class Referenceabstract

Partial implementation of the IAlignment interface, dedicated to alignment readers. More...

#include <Bpp/Seq/Io/AbstractIAlignment.h>

+ Inheritance diagram for bpp::AbstractIAlignment:
+ Collaboration diagram for bpp::AbstractIAlignment:

Public Member Functions

 AbstractIAlignment ()
 
virtual ~AbstractIAlignment ()
 
const std::string getDataType () const
 
virtual const std::string getFormatName () const=0
 
virtual const std::string getFormatDescription () const=0
 
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< SiteContainerInterfacereadAlignment (const std::string &path, std::shared_ptr< const Alphabet > alpha) const override
 Create a new container from a file. More...
 
std::unique_ptr< SiteContainerInterfacereadAlignment (std::istream &input, std::shared_ptr< const Alphabet > alpha) const override
 Create a new container from a stream. More...
 

Protected Member Functions

virtual void appendAlignmentFromStream (std::istream &input, SequenceContainerInterface &sc) const =0
 Append sequences to a container from a stream. More...
 
virtual void appendAlignmentFromFile (const std::string &path, SequenceContainerInterface &sc) const
 Append sequences to a container from a file. More...
 
virtual std::unique_ptr< SiteContainerInterfacereadAlignmentFromStream (std::istream &input, std::shared_ptr< const Alphabet > alpha) const
 Read sequences from a stream. More...
 
virtual std::unique_ptr< SiteContainerInterfacereadAlignmentFromFile (const std::string &path, std::shared_ptr< const Alphabet > alpha) const
 Read sequences from a file. More...
 

Detailed Description

Partial implementation of the IAlignment interface, dedicated to alignment readers.

Definition at line 24 of file AbstractIAlignment.h.

Constructor & Destructor Documentation

◆ AbstractIAlignment()

bpp::AbstractIAlignment::AbstractIAlignment ( )
inline

Definition at line 28 of file AbstractIAlignment.h.

◆ ~AbstractIAlignment()

virtual bpp::AbstractIAlignment::~AbstractIAlignment ( )
inlinevirtual

Definition at line 29 of file AbstractIAlignment.h.

Member Function Documentation

◆ appendAlignmentFromFile()

virtual void bpp::AbstractIAlignment::appendAlignmentFromFile ( const std::string &  path,
SequenceContainerInterface sc 
) const
inlineprotectedvirtual

Append sequences to a container from a file.

Parameters
pathThe path to the file to read.
scThe sequence container to update.
Exceptions
ExceptionIf the file is not in the specified format.

Definition at line 93 of file AbstractIAlignment.h.

References appendAlignmentFromStream().

Referenced by readAlignment(), readAlignmentFromFile(), and bpp::AbstractIAlignment2::readSequences().

◆ appendAlignmentFromStream()

virtual void bpp::AbstractIAlignment::appendAlignmentFromStream ( std::istream &  input,
SequenceContainerInterface sc 
) const
protectedpure virtual

Append sequences to a container from a stream.

This is the unique method to implement!

Parameters
inputThe input stream to read.
scThe sequence container to update.
Exceptions
ExceptionIf the file is not in the specified format.

Implemented in bpp::Phylip, bpp::NexusIOSequence, bpp::Mase, bpp::Fasta, bpp::DCSE, and bpp::Clustal.

Referenced by appendAlignmentFromFile(), readAlignment(), readAlignmentFromStream(), and bpp::AbstractIAlignment2::readSequences().

◆ getDataType()

const std::string bpp::IOSequence::getDataType ( ) const
inlinevirtualinherited

Implements bpp::IOFormat.

Reimplemented in bpp::Pasta.

Definition at line 29 of file IoSequence.h.

◆ readAlignment() [1/4]

virtual void bpp::AbstractIAlignment::readAlignment ( const std::string &  path,
SequenceContainerInterface sc 
) const
inlineoverridevirtual

Add sequences to a container from a file.

Parameters
pathThe path to the file to read.
scThe sequence container to update.
Exceptions
ExceptionIf the file is not in the specified format.

Implements bpp::IAlignment.

Definition at line 57 of file AbstractIAlignment.h.

References appendAlignmentFromFile().

◆ readAlignment() [2/4]

std::unique_ptr<SiteContainerInterface> bpp::AbstractIAlignment::readAlignment ( const std::string &  path,
std::shared_ptr< const Alphabet alpha 
) const
inlineoverridevirtual

Create a new container from a file.

Parameters
pathThe path to the file to read.
alphaThe alphabet to be associated to the container.
Returns
A new SiteContainer object.
Exceptions
ExceptionIf the file is not in the specified format.

Implements bpp::IAlignment.

Definition at line 62 of file AbstractIAlignment.h.

References readAlignmentFromFile().

◆ readAlignment() [3/4]

virtual void bpp::AbstractIAlignment::readAlignment ( std::istream &  input,
SequenceContainerInterface sc 
) const
inlineoverridevirtual

Add sequences to a container from a stream.

Parameters
inputThe input stream to read.
scThe sequence container to update.
Exceptions
ExceptionIf the file is not in the specified format.

Implements bpp::IAlignment.

Definition at line 45 of file AbstractIAlignment.h.

References appendAlignmentFromStream().

Referenced by bpp::AbstractIAlignment2::readSequences(), bpp::Clustal::readSequences(), bpp::DCSE::readSequences(), and bpp::Phylip::readSequences().

◆ readAlignment() [4/4]

std::unique_ptr<SiteContainerInterface> bpp::AbstractIAlignment::readAlignment ( std::istream &  input,
std::shared_ptr< const Alphabet alpha 
) const
inlineoverridevirtual

Create a new container from a stream.

Parameters
inputThe input stream to read.
alphaThe alphabet to be associated to the container.
Returns
A new SiteContainer object.
Exceptions
ExceptionIf the file is not in the specified format.

Implements bpp::IAlignment.

Definition at line 67 of file AbstractIAlignment.h.

References readAlignmentFromStream().

◆ readAlignmentFromFile()

virtual std::unique_ptr<SiteContainerInterface> bpp::AbstractIAlignment::readAlignmentFromFile ( const std::string &  path,
std::shared_ptr< const Alphabet alpha 
) const
inlineprotectedvirtual

Read sequences from a file.

Parameters
pathThe path to the file to read.
alphaThe alphabet to use.
Returns
A sequence container.
Exceptions
ExceptionIf the file is not in the specified format.

Definition at line 125 of file AbstractIAlignment.h.

References appendAlignmentFromFile().

Referenced by readAlignment().

◆ readAlignmentFromStream()

virtual std::unique_ptr<SiteContainerInterface> bpp::AbstractIAlignment::readAlignmentFromStream ( std::istream &  input,
std::shared_ptr< const Alphabet alpha 
) const
inlineprotectedvirtual

Read sequences from a stream.

Parameters
inputThe input stream to read.
alphaThe alphabet to use.
Returns
A sequence container.
Exceptions
ExceptionIf the file is not in the specified format.

Definition at line 110 of file AbstractIAlignment.h.

References appendAlignmentFromStream().

Referenced by readAlignment().


The documentation for this class was generated from the following file: