NCBI C++ ToolKit
Public Member Functions | Private Types | Private Attributes | List of all members
CSequenceIStreamFasta Class Reference

Search Toolkit Book for CSequenceIStreamFasta

Sequence stream for reading FASTA formatted files. More...

#include <algo/blast/dbindex/sequence_istream_fasta.hpp>

+ Inheritance diagram for CSequenceIStreamFasta:
+ Collaboration diagram for CSequenceIStreamFasta:

Public Member Functions

 CSequenceIStreamFasta (const std::string &name, size_t pos=0)
 Object constructor. More...
 
 CSequenceIStreamFasta (CNcbiIstream &input_stream, size_t pos=0)
 Object constructor. More...
 
virtual ~CSequenceIStreamFasta ()
 Object destructor. More...
 
virtual CRef< TSeqDatanext ()
 Retrieve and return the next sequence from the sequnce stream. More...
 
virtual void putback ()
 Roll back to the start of the previous sequence. More...
 
- Public Member Functions inherited from CSequenceIStream
virtual ~CSequenceIStream ()
 Object destructor. More...
 

Private Types

typedef CT_POS_TYPE pos_type
 Alias for the standard IO stream position type. More...
 

Private Attributes

bool stream_allocated_
 Whether to deallocate the stream at destruction. More...
 
CNcbiIstreamistream_
 Standard IO stream for reading FASTA data. More...
 
objects::CFastaReader * fasta_reader_
 Object to read fasta files. More...
 
std::vector< pos_typeseq_positions_
 Starting positions of sequences withing the FASTA stream. More...
 
std::string name_
 FASTA file name, if available. More...
 
CRef< TSeqDatacache_
 Last read sequence. More...
 
bool use_cache_
 Next time read from cache. More...
 

Additional Inherited Members

- Public Types inherited from CSequenceIStream
typedef CSeqData TSeqData
 Public alias for sequence info data type. More...
 
typedef TSeqData::TMask TMask
 Public alias for type containing masking info. More...
 
typedef Uint4 TStreamPos
 Type used to represent positions within a sequence stream. More...
 

Detailed Description

Sequence stream for reading FASTA formatted files.

Definition at line 46 of file sequence_istream_fasta.hpp.

Member Typedef Documentation

◆ pos_type

Alias for the standard IO stream position type.

Definition at line 51 of file sequence_istream_fasta.hpp.

Constructor & Destructor Documentation

◆ CSequenceIStreamFasta() [1/2]

CSequenceIStreamFasta::CSequenceIStreamFasta ( const std::string name,
size_t  pos = 0 
)

Object constructor.

Creates a FASTA sequence stream by the file name. The stream is rewound to the start of the given sequence.

Parameters
nameFASTA file name
posstarting sequence

Definition at line 55 of file sequence_istream_fasta.cpp.

References CFASTAREADER_FLAGS, and NCBI_THROW.

◆ CSequenceIStreamFasta() [2/2]

CSequenceIStreamFasta::CSequenceIStreamFasta ( CNcbiIstream input_stream,
size_t  pos = 0 
)

Object constructor.

Creates a FASTA sequence stream from the standard IO stream. The stream is rewound to the start of the given sequence.

Parameters
input_streamC++ iostream containing the FASTA data
posstarting sequence

Definition at line 74 of file sequence_istream_fasta.cpp.

References CFASTAREADER_FLAGS, fasta_reader_, istream_, and NCBI_THROW.

◆ ~CSequenceIStreamFasta()

CSequenceIStreamFasta::~CSequenceIStreamFasta ( )
virtual

Object destructor.

Definition at line 90 of file sequence_istream_fasta.cpp.

References istream_, and stream_allocated_.

Member Function Documentation

◆ next()

CRef< CSequenceIStream::TSeqData > CSequenceIStreamFasta::next ( )
virtual

Retrieve and return the next sequence from the sequnce stream.

See also
CSequenceIStream::next()

Implements CSequenceIStream.

Definition at line 98 of file sequence_istream_fasta.cpp.

References cache_, fasta_reader_, result, and use_cache_.

◆ putback()

void CSequenceIStreamFasta::putback ( )
virtual

Roll back to the start of the previous sequence.

See also
CSequenceIStream::putback()

Implements CSequenceIStream.

Definition at line 121 of file sequence_istream_fasta.cpp.

References use_cache_.

Member Data Documentation

◆ cache_

CRef< TSeqData > CSequenceIStreamFasta::cache_
private

Last read sequence.

Definition at line 62 of file sequence_istream_fasta.hpp.

Referenced by next().

◆ fasta_reader_

objects::CFastaReader* CSequenceIStreamFasta::fasta_reader_
private

Object to read fasta files.

Definition at line 56 of file sequence_istream_fasta.hpp.

Referenced by CSequenceIStreamFasta(), and next().

◆ istream_

CNcbiIstream* CSequenceIStreamFasta::istream_
private

Standard IO stream for reading FASTA data.

Definition at line 54 of file sequence_istream_fasta.hpp.

Referenced by CSequenceIStreamFasta(), and ~CSequenceIStreamFasta().

◆ name_

std::string CSequenceIStreamFasta::name_
private

FASTA file name, if available.

Definition at line 61 of file sequence_istream_fasta.hpp.

◆ seq_positions_

std::vector< pos_type > CSequenceIStreamFasta::seq_positions_
private

Starting positions of sequences withing the FASTA stream.

Definition at line 59 of file sequence_istream_fasta.hpp.

◆ stream_allocated_

bool CSequenceIStreamFasta::stream_allocated_
private

Whether to deallocate the stream at destruction.

Definition at line 53 of file sequence_istream_fasta.hpp.

Referenced by ~CSequenceIStreamFasta().

◆ use_cache_

bool CSequenceIStreamFasta::use_cache_
private

Next time read from cache.

Definition at line 63 of file sequence_istream_fasta.hpp.

Referenced by next(), and putback().


The documentation for this class was generated from the following files:
Modified on Fri Sep 20 14:58:08 2024 by modify_doxy.py rev. 669887