bpp-seq3  3.0.0
bpp::Fasta::FileIndex Class Reference

The SequenceFileIndex class for Fasta format. More...

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

+ Inheritance diagram for bpp::Fasta::FileIndex:
+ Collaboration diagram for bpp::Fasta::FileIndex:

Public Member Functions

 FileIndex ()
 
 ~FileIndex ()
 
void build (const std::string &path)
 Build the index given a path to the file. More...
 
void build (const std::string &path, const bool strictSequenceNames)
 Constructor. More...
 
std::streampos getSequencePosition (const std::string &id) const
 Get the position of a Sequence given its ID. More...
 
size_t getNumberOfSequences () const
 Get the number of sequences. More...
 
void read (const std::string &path)
 Read the index from a file. More...
 
void write (const std::string &path)
 Write the index to a file. More...
 
void getSequence (const std::string &seqid, Sequence &seq, const std::string &path) const
 Get a sequence given its ID. More...
 
void getSequence (const std::string &seqid, Sequence &seq, const std::string &path, const bool strictSequenceNames) const
 

Private Attributes

std::map< std::string, std::streampos > index_
 
std::streampos fileSize_
 

Detailed Description

The SequenceFileIndex class for Fasta format.

Author
Sylvain Gaillard

Definition at line 146 of file Fasta.h.

Constructor & Destructor Documentation

◆ FileIndex()

bpp::Fasta::FileIndex::FileIndex ( )
inline

Definition at line 149 of file Fasta.h.

◆ ~FileIndex()

bpp::Fasta::FileIndex::~FileIndex ( )
inline

Definition at line 150 of file Fasta.h.

Member Function Documentation

◆ build() [1/2]

void bpp::Fasta::FileIndex::build ( const std::string &  path)
inlinevirtual

Build the index given a path to the file.

Implements bpp::SequenceFileIndex.

Definition at line 151 of file Fasta.h.

◆ build() [2/2]

void Fasta::FileIndex::build ( const std::string &  path,
const bool  strictSequenceNames 
)

Constructor.

Parameters
pathThe path to the file.
strictSequenceNamesTells if the sequence names should be restricted to the characters between '>' and the first blank one.

Definition at line 205 of file Fasta.cpp.

◆ getNumberOfSequences()

size_t bpp::Fasta::FileIndex::getNumberOfSequences ( ) const
inlinevirtual

Get the number of sequences.

Implements bpp::SequenceFileIndex.

Definition at line 163 of file Fasta.h.

References index_.

◆ getSequence() [1/2]

void Fasta::FileIndex::getSequence ( const std::string &  seqid,
Sequence seq,
const std::string &  path 
) const

Get a sequence given its ID.

Definition at line 270 of file Fasta.cpp.

◆ getSequence() [2/2]

void Fasta::FileIndex::getSequence ( const std::string &  seqid,
Sequence seq,
const std::string &  path,
const bool  strictSequenceNames 
) const

Definition at line 275 of file Fasta.cpp.

References bpp::Fasta::nextSequence(), and bpp::Fasta::strictNames().

◆ getSequencePosition()

streampos Fasta::FileIndex::getSequencePosition ( const std::string &  id) const
virtual

Get the position of a Sequence given its ID.

Implements bpp::SequenceFileIndex.

Definition at line 233 of file Fasta.cpp.

◆ read()

void Fasta::FileIndex::read ( const std::string &  path)

◆ write()

void Fasta::FileIndex::write ( const std::string &  path)

Write the index to a file.

Definition at line 260 of file Fasta.cpp.

References bpp::TextTools::toString().

Member Data Documentation

◆ fileSize_

std::streampos bpp::Fasta::FileIndex::fileSize_
private

Definition at line 183 of file Fasta.h.

◆ index_

std::map<std::string, std::streampos> bpp::Fasta::FileIndex::index_
private

Definition at line 182 of file Fasta.h.

Referenced by getNumberOfSequences().


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