PlastLibrary
database::impl::FastaSequenceIterator Class Reference

Sequence iterator that parses FASTA files. More...

#include <FastaSequenceIterator.hpp>

Inheritance diagram for database::impl::FastaSequenceIterator:

Public Member Functions

 FastaSequenceIterator (const char *filename, size_t commentMaxSize=2 *1024, u_int64_t offset0=0, u_int64_t offset1=0)
 
virtual ~FastaSequenceIterator ()
 
void first ()
 
dp::IteratorStatus next ()
 
bool isDone ()
 
ISequencecurrentItem ()
 
ISequenceIteratorclone ()
 
- Public Member Functions inherited from database::impl::AbstractSequenceIterator
 AbstractSequenceIterator ()
 
virtual ~AbstractSequenceIterator ()
 
void setBuilder (ISequenceBuilder *builder)
 
void setEncoding (Encoding encoding)
 
Encoding getEncoding ()
 
std::string getId ()
 
std::string transformComment (const char *comment)
 
- Public Member Functions inherited from dp::Iterator< const ISequence * >
virtual void iterate (void *aClient, Method method)
 
- Public Member Functions inherited from dp::SmartPointer
virtual void use ()
 
virtual void forget ()
 

Additional Inherited Members

- Public Types inherited from dp::Iterator< const ISequence * >
typedef void(IteratorClient::* Method) (const ISequence * t)
 
- Protected Member Functions inherited from database::impl::AbstractSequenceIterator
ISequenceBuildergetBuilder () const
 
- Protected Member Functions inherited from dp::SmartPointer
 SmartPointer ()
 
virtual ~SmartPointer ()
 

Detailed Description

Sequence iterator that parses FASTA files.

This class implements the ISequenceIterator interface by iterating sequences read from a FASTA file.

It is possible to set a maximum size for the comment associated to each sequence.

It is also possible to set a range to be read in the file. This range is given by two offsets (begin, end); such offsets may have been computed through the IDatabaseQuickReader::getOffsets method. If (0,0) is provided, the full file is read.

void foo ()
{
// We create a FASTA iterator
FastaSequenceIterator itSeq ("myDb");
for (itSeq.first(); !itSeq.isDone(); itSeq.next())
{
// We can retrieve the current sequence
const ISequence* seq = itSeq.currentItem();
}
}

Constructor & Destructor Documentation

database::impl::FastaSequenceIterator::FastaSequenceIterator ( const char *  filename,
size_t  commentMaxSize = 2*1024,
u_int64_t  offset0 = 0,
u_int64_t  offset1 = 0 
)

Constructor.

Parameters
[in]filename: path of the FASTA file to be read.
[in]commentMaxSize: maximum size of sequences comments
[in]offset0: starting offset in the file
[in]offset1: ending offset in the file
database::impl::FastaSequenceIterator::~FastaSequenceIterator ( )
virtual

Destructor.

Member Function Documentation

ISequenceIterator* database::impl::FastaSequenceIterator::clone ( )
inlinevirtual

Method that clones the instance.

Returns
the cloned iterator

Implements database::ISequenceIterator.

ISequence* database::impl::FastaSequenceIterator::currentItem ( )
inlinevirtual

Method that returns the current iterated item. Note that the returned type is the template type.

Returns
the current item in the iteration.

Implements dp::Iterator< const ISequence * >.

void database::impl::FastaSequenceIterator::first ( )
virtual

Method that initializes the iteration.

Implements dp::Iterator< const ISequence * >.

bool database::impl::FastaSequenceIterator::isDone ( )
inlinevirtual

Method telling whether the iteration is finished or not.

Returns
true if iteration is finished, false otherwise.

Implements dp::Iterator< const ISequence * >.

dp::IteratorStatus database::impl::FastaSequenceIterator::next ( )
virtual

Method that goes to the next item in the iteration.

Returns
status of the iteration

Implements dp::Iterator< const ISequence * >.


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