5 #ifndef BPP_SEQ_IO_FASTA_H
6 #define BPP_SEQ_IO_FASTA_H
9 #include "../Container/SequenceContainer.h"
10 #include "../Container/VectorSequenceContainer.h"
11 #include "../Sequence.h"
94 const std::string
getFormatName()
const override {
return "FASTA file"; }
98 return "Sequence name (preceded by >) in one line, sequence content, no comments";
161 void build(
const std::string& path,
const bool strictSequenceNames);
170 void read(
const std::string& path);
174 void write(
const std::string& path);
179 void getSequence(
const std::string& seqid,
Sequence& seq,
const std::string& path,
const bool strictSequenceNames)
const;
182 std::map<std::string, std::streampos>
index_;
Partial implementation of the IAlignment interface, dedicated to alignment readers.
Partial implementation of the ISequence interface.
Partial implementation of the OAlignment interface.
void writeSequences(std::ostream &output, const SequenceContainerInterface &sc) const override=0
Write a container to a stream.
The SequenceFileIndex class for Fasta format.
void read(const std::string &path)
Read the index from a file.
void build(const std::string &path)
Build the index given a path to the file.
size_t getNumberOfSequences() const
Get the number of sequences.
std::map< std::string, std::streampos > index_
void write(const std::string &path)
Write the index to a file.
void getSequence(const std::string &seqid, Sequence &seq, const std::string &path) const
Get a sequence given its ID.
std::streampos getSequencePosition(const std::string &id) const
Get the position of a Sequence given its ID.
The fasta sequence file format.
unsigned int charsByLine_
The maximum number of chars to be written on a line.
void appendAlignmentFromStream(std::istream &input, SequenceContainerInterface &sc) const override
Append sequences to a container from a stream.
const std::string getFormatDescription() const override
void checkNames(bool yn)
Tell whether the sequence names should be checked when reading from files.
bool nextSequence(std::istream &input, Sequence &seq) const override
void appendSequencesFromStream(std::istream &input, SequenceContainerInterface &sc) const override
Append sequences to a container from a stream.
Fasta(unsigned int charsByLine=100, bool checkSequenceNames=true, bool extended=false, bool strictSequenceNames=false)
Build a new Fasta object.
void writeSequences(const std::string &path, const SequenceContainerInterface &sc, bool overwrite=true) const override
Write a container to a file.
void strictNames(bool yn)
Tell wethed the sequence name should be restrected to the first non blank characters.
void writeSequence(std::ostream &output, const Sequence &seq) const override
void writeSequences(std::ostream &output, const SequenceContainerInterface &sc) const override
Write a container to a stream.
const std::string getFormatName() const override
Index to retrieve Sequence in a file.
A basic implementation of the Sequence interface.
The ISequenceStream interface.
The OSequenceStream interface.
The SequenceContainer interface.
This alphabet is used to deal NumericAlphabet.