bpp-seq
2.2.0
|
The fasta sequence file format. More...
#include <Bpp/Seq/Io/Fasta.h>
Classes | |
class | FileIndex |
The SequenceFileIndex class for Fasta format. More... | |
Public Member Functions | |
Fasta (unsigned int charsByLine=100, bool checkSequenceNames=true, bool extended=false, bool strictSequenceNames=false) | |
Build a new Fasta object. More... | |
virtual | ~Fasta () |
bool | checkNames () const |
void | checkNames (bool yn) |
Tell whether the sequence names should be checked when reading from files. More... | |
bool | strictNames () const |
void | strictNames (bool yn) |
Tell wethed the sequence name should be restrected to the first non blank characters. More... | |
const std::string | getDataType () const |
The AbstractISequence interface. | |
void | appendSequencesFromStream (std::istream &input, SequenceContainer &sc) const throw (Exception) |
Append sequences to a container from a stream. More... | |
The AbstractIAlignment interface. | |
void | appendAlignmentFromStream (std::istream &input, SiteContainer &sc) const throw (Exception) |
Append sequences to a container from a stream. More... | |
The OSequence interface. | |
void | writeSequences (std::ostream &output, const SequenceContainer &sc) const throw (Exception) |
Write a container to a stream. More... | |
void | writeSequences (const std::string &path, const SequenceContainer &sc, bool overwrite=true) const throw (Exception) |
Write a container to a file. More... | |
The IOSequence interface. | |
const std::string | getFormatName () const |
const std::string | getFormatDescription () const |
The ISequenceStream interface. | |
bool | nextSequence (std::istream &input, Sequence &seq) const throw (Exception) |
Read sequence from stream. More... | |
The OSequenceStream interface. | |
void | writeSequence (std::ostream &output, const Sequence &seq) const throw (Exception) |
Read sequence from stream. More... | |
ISequence methods: | |
virtual void | readSequences (std::istream &input, SequenceContainer &sc) const throw (Exception) |
Add sequences to a container from a stream. More... | |
virtual void | readSequences (const std::string &path, SequenceContainer &sc) const throw (Exception) |
Add sequences to a container from a file. More... | |
virtual VectorSequenceContainer * | readSequences (std::istream &input, const Alphabet *alpha) const throw (Exception) |
Create a new container from a stream. More... | |
virtual VectorSequenceContainer * | readSequences (const std::string &path, const Alphabet *alpha) const throw (Exception) |
Create a new container from a file. More... | |
IAlignment methods: | |
virtual void | readAlignment (std::istream &input, SiteContainer &sc) const throw (Exception) |
Add sequences to a container from a stream. More... | |
virtual void | readAlignment (const std::string &path, SiteContainer &sc) const throw (Exception) |
Add sequences to a container from a file. More... | |
virtual AlignedSequenceContainer * | readAlignment (const std::string &path, const Alphabet *alpha) const throw (Exception) |
Create a new container from a file. More... | |
virtual AlignedSequenceContainer * | readAlignment (std::istream &input, const Alphabet *alpha) const throw (Exception) |
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 SiteContainer &sc) const throw (Exception) |
Write a container to a stream. More... | |
void | writeAlignment (const std::string &path, const SiteContainer &sc, bool overwrite=true) const throw (Exception) |
Write a container to a file. More... | |
Protected Member Functions | |
virtual void | appendSequencesFromFile (const std::string &path, SequenceContainer &sc) const throw (Exception) |
Append sequences to a container from a file. More... | |
virtual VectorSequenceContainer * | readSequencesFromStream (std::istream &input, const Alphabet *alpha) const throw (Exception) |
Read sequences from a stream. More... | |
virtual VectorSequenceContainer * | readSequencesFromFile (const std::string &path, const Alphabet *alpha) const throw (Exception) |
Append sequences to a container from a file. More... | |
virtual void | appendAlignmentFromFile (const std::string &path, SiteContainer &sc) const throw (Exception) |
Append sequences to a container from a file. More... | |
virtual AlignedSequenceContainer * | readAlignmentFromStream (std::istream &input, const Alphabet *alpha) const throw (Exception) |
Read sequences from a stream. More... | |
virtual AlignedSequenceContainer * | readAlignmentFromFile (const std::string &path, const Alphabet *alpha) const throw (Exception) |
Read sequences from a file. More... | |
Private Attributes | |
unsigned int | charsByLine_ |
The maximum number of chars to be written on a line. More... | |
bool | checkNames_ |
bool | extended_ |
bool | strictNames_ |
The fasta sequence file format.
Read and write from/to Fasta files.
|
inline |
Build a new Fasta object.
charsByLine | Number of character per line when writing files. |
checkSequenceNames | Tells if the names in the file should be checked for unicity (slower, in o(n*n) where n is the number of sequences). |
extended | Tells 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 143 of file AbstractIAlignment.h.
References bpp::AbstractIAlignment::appendAlignmentFromStream().
Referenced by bpp::AbstractIAlignment::readAlignment(), and bpp::AbstractIAlignment::readAlignmentFromFile().
|
inlinevirtual |
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 110 of file Fasta.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 142 of file AbstractISequence.h.
References bpp::AbstractISequence::appendSequencesFromStream().
Referenced by bpp::AbstractISequence::readSequences(), and bpp::AbstractISequence::readSequencesFromFile().
|
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::AbstractISequence.
Definition at line 147 of file Fasta.cpp.
Referenced by appendAlignmentFromStream().
|
inline |
Definition at line 159 of file Fasta.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 166 of file Fasta.h.
References checkNames_.
|
inlineinherited |
Definition at line 65 of file IoSequence.h.
|
inline |
|
inline |
|
virtual |
Read sequence from stream.
Read one sequence from a stream.
input | The stream to read. |
seq | The sequence to fill. |
Exception | IOExecption and Sequence related Exceptions. |
Implements bpp::ISequenceStream.
Definition at line 56 of file Fasta.cpp.
Referenced by bpp::Fasta::FileIndex::getSequence().
|
inlinevirtualinherited |
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(), bpp::Clustal::readSequences(), bpp::NexusIOSequence::readSequences(), and bpp::Phylip::readSequences().
|
inlinevirtualinherited |
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().
|
inlinevirtualinherited |
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().
|
inlinevirtualinherited |
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().
|
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 173 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 158 of file AbstractIAlignment.h.
References bpp::AbstractIAlignment::appendAlignmentFromStream().
Referenced by bpp::AbstractIAlignment::readAlignment().
|
inlinevirtualinherited |
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 82 of file AbstractISequence.h.
References bpp::AbstractISequence::appendSequencesFromStream().
Referenced by bpp::Mase::readMeta().
|
inlinevirtualinherited |
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 94 of file AbstractISequence.h.
References bpp::AbstractISequence::appendSequencesFromFile().
|
inlinevirtualinherited |
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 105 of file AbstractISequence.h.
References bpp::AbstractISequence::readSequencesFromStream().
|
inlinevirtualinherited |
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 116 of file AbstractISequence.h.
References bpp::AbstractISequence::readSequencesFromFile().
|
inlineprotectedvirtualinherited |
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 171 of file AbstractISequence.h.
References bpp::AbstractISequence::appendSequencesFromFile().
Referenced by bpp::AbstractISequence::readSequences().
|
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 157 of file AbstractISequence.h.
References bpp::AbstractISequence::appendSequencesFromStream().
Referenced by bpp::AbstractISequence::readSequences().
|
inline |
Definition at line 171 of file Fasta.h.
References strictNames_.
|
inline |
Tell wethed the sequence name should be restrected to the first non blank characters.
yn | whether the sequence names should be restrected. |
Definition at line 178 of file Fasta.h.
References strictNames_.
|
inlinevirtualinherited |
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 92 of file AbstractOSequence.h.
References bpp::AbstractOSequence::writeSequences().
|
inlinevirtualinherited |
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 96 of file AbstractOSequence.h.
References bpp::AbstractOSequence::writeSequences().
|
virtual |
Read sequence from stream.
Read one sequence from a stream.
output | The stream where write. |
seq | The sequence to write. |
Exception | IOExecption. |
Implements bpp::OSequenceStream.
|
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::AbstractOSequence.
|
inlinevirtual |
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 122 of file Fasta.h.
References bpp::AbstractOSequence::writeSequences().
|
private |
|
private |
Definition at line 76 of file Fasta.h.
Referenced by checkNames().
|
private |
Definition at line 78 of file Fasta.h.
Referenced by strictNames().