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

Search Toolkit Book for CSeqFormatter

Customizable sequence writer interface. More...

#include <objtools/blast/blastdb_format/seq_writer.hpp>

+ Collaboration diagram for CSeqFormatter:

Public Member Functions

 CSeqFormatter (const string &fmt_spec, CSeqDB &blastdb, CNcbiOstream &out, CSeqFormatterConfig config=CSeqFormatterConfig())
 Constructor. More...
 
void Write (CBlastDBSeqId &id)
 Write the sequence data associated with the requested ID in the format specified in the constructor. More...
 
void DumpAll (CSeqDB &blastdb, CSeqFormatterConfig config=CSeqFormatterConfig())
 Full database FASTA dump This is an optimized version that does not support range and mask retrieval. More...
 
void SetConfig (TSeqRange range, objects::ENa_strand strand, int filt_algo_id)
 Set range, strand and filter algo for each seq id. More...
 

Private Member Functions

void x_Builder (vector< string > &data2write)
 Build data for write. More...
 
string x_Replacer (const vector< string > &data2write) const
 Replace format specifiers for the data contained in data2write. More...
 
bool x_RequireData () const
 Specifies whether or not data (e.g., Bioseq) is required. More...
 
 CSeqFormatter (const CSeqFormatter &rhs)
 Prohibit copy constructor. More...
 
CSeqFormatteroperator= (const CSeqFormatter &rhs)
 Prohibit assignment operator. More...
 

Private Attributes

CNcbiOstreamm_Out
 Stream to write output. More...
 
string m_FmtSpec
 The output format specification. More...
 
CSeqDBm_BlastDb
 The BLAST database from which to extract data. More...
 
vector< SIZE_TYPEm_ReplOffsets
 Vector of offsets where the replacements will take place. More...
 
CBlastDBExtractor m_DataExtractor
 Data extractor. More...
 
vector< char > m_ReplTypes
 Vector of convertor objects. More...
 
bool m_Fasta
 Fasta output? More...
 

Detailed Description

Customizable sequence writer interface.

Definition at line 77 of file seq_writer.hpp.

Constructor & Destructor Documentation

◆ CSeqFormatter() [1/2]

CSeqFormatter::CSeqFormatter ( const string fmt_spec,
CSeqDB blastdb,
CNcbiOstream out,
CSeqFormatterConfig  config = CSeqFormatterConfig() 
)

Constructor.

Parameters
fmt_specformat specification [in]
blastdbBLAST database from which to retrieve the data [in]
outoutput stream to write the data [in]

Definition at line 47 of file seq_writer.cpp.

References i, m_BlastDb, m_Fasta, m_FmtSpec, m_ReplOffsets, m_ReplTypes, NCBI_THROW, and CSeqDB::ValidateMaskAlgorithms().

◆ CSeqFormatter() [2/2]

CSeqFormatter::CSeqFormatter ( const CSeqFormatter rhs)
private

Prohibit copy constructor.

Member Function Documentation

◆ DumpAll()

void CSeqFormatter::DumpAll ( CSeqDB blastdb,
CSeqFormatterConfig  config = CSeqFormatterConfig() 
)

◆ operator=()

CSeqFormatter& CSeqFormatter::operator= ( const CSeqFormatter rhs)
private

Prohibit assignment operator.

◆ SetConfig()

void CSeqFormatter::SetConfig ( TSeqRange  range,
objects::ENa_strand  strand,
int  filt_algo_id 
)

Set range, strand and filter algo for each seq id.

Definition at line 390 of file seq_writer.cpp.

◆ Write()

void CSeqFormatter::Write ( CBlastDBSeqId id)

Write the sequence data associated with the requested ID in the format specified in the constructor.

Parameters
ididentifier for a sequence in the BLAST database
Exceptions
CExceptionderived classes on error

Definition at line 220 of file seq_writer.cpp.

References CBlastDBExtractor::ExtractFasta(), m_DataExtractor, m_Fasta, m_Out, CBlastDBExtractor::SetSeqId(), x_Builder(), x_Replacer(), and x_RequireData().

◆ x_Builder()

void CSeqFormatter::x_Builder ( vector< string > &  data2write)
private

◆ x_Replacer()

string CSeqFormatter::x_Replacer ( const vector< string > &  data2write) const
private

Replace format specifiers for the data contained in data2write.

Parameters
data2writedata to replace in the output string [in]

Definition at line 368 of file seq_writer.cpp.

Referenced by Write().

◆ x_RequireData()

bool CSeqFormatter::x_RequireData ( ) const
private

Specifies whether or not data (e.g., Bioseq) is required.

Definition at line 97 of file seq_writer.cpp.

References ITERATE, and m_ReplTypes.

Referenced by Write().

Member Data Documentation

◆ m_BlastDb

CSeqDB& CSeqFormatter::m_BlastDb
private

The BLAST database from which to extract data.

Definition at line 106 of file seq_writer.hpp.

Referenced by CSeqFormatter().

◆ m_DataExtractor

CBlastDBExtractor CSeqFormatter::m_DataExtractor
private

Data extractor.

Definition at line 110 of file seq_writer.hpp.

Referenced by Write(), and x_Builder().

◆ m_Fasta

bool CSeqFormatter::m_Fasta
private

Fasta output?

Definition at line 114 of file seq_writer.hpp.

Referenced by CSeqFormatter(), and Write().

◆ m_FmtSpec

string CSeqFormatter::m_FmtSpec
private

The output format specification.

Definition at line 104 of file seq_writer.hpp.

Referenced by CSeqFormatter().

◆ m_Out

CNcbiOstream& CSeqFormatter::m_Out
private

Stream to write output.

Definition at line 102 of file seq_writer.hpp.

Referenced by DumpAll(), and Write().

◆ m_ReplOffsets

vector<SIZE_TYPE> CSeqFormatter::m_ReplOffsets
private

Vector of offsets where the replacements will take place.

Definition at line 108 of file seq_writer.hpp.

Referenced by CSeqFormatter().

◆ m_ReplTypes

vector<char> CSeqFormatter::m_ReplTypes
private

Vector of convertor objects.

Definition at line 112 of file seq_writer.hpp.

Referenced by CSeqFormatter(), x_Builder(), and x_RequireData().


The documentation for this class was generated from the following files:
Modified on Wed Sep 04 15:06:09 2024 by modify_doxy.py rev. 669887