NCBI C++ ToolKit
|
Search Toolkit Book for CSeqFormatter
Customizable sequence writer interface. More...
#include <objtools/blast/blastdb_format/seq_writer.hpp>
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... | |
CSeqFormatter & | operator= (const CSeqFormatter &rhs) |
Prohibit assignment operator. More... | |
Private Attributes | |
CNcbiOstream & | m_Out |
Stream to write output. More... | |
string | m_FmtSpec |
The output format specification. More... | |
CSeqDB & | m_BlastDb |
The BLAST database from which to extract data. More... | |
vector< SIZE_TYPE > | m_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... | |
Customizable sequence writer interface.
Definition at line 77 of file seq_writer.hpp.
CSeqFormatter::CSeqFormatter | ( | const string & | fmt_spec, |
CSeqDB & | blastdb, | ||
CNcbiOstream & | out, | ||
CSeqFormatterConfig | config = CSeqFormatterConfig() |
||
) |
Constructor.
fmt_spec | format specification [in] |
blastdb | BLAST database from which to retrieve the data [in] |
out | output 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().
|
private |
Prohibit copy constructor.
void CSeqFormatter::DumpAll | ( | CSeqDB & | blastdb, |
CSeqFormatterConfig | config = CSeqFormatterConfig() |
||
) |
Full database FASTA dump This is an optimized version that does not support range and mask retrieval.
CExcpetion | derived classes on error |
Definition at line 270 of file seq_writer.cpp.
References CScope::AddBioseq(), CSeqDB::CheckOrFindOID(), CRef< C, Locker >::Empty(), CFastaOstream::fEnableGI, CFastaOstream::fKeepGTSigns, CFastaOstream::fNoExpensiveOps, IRegistry::Get(), CSeqDB::GetBioseq(), CNcbiApplicationAPI::GetConfig(), CDbtag_Base::GetDb(), CSeq_id_Base::GetGeneral(), CBioseq_Base::GetId(), CObjectManager::GetInstance(), i, CNcbiApplication::Instance(), CSeq_id_Base::IsGeneral(), CSeq_id_Base::IsLocal(), m_Out, registry, CRef< C, Locker >::Reset(), s_GetTitle(), s_ReplaceCtrlAsInTitle(), CFastaOstream::SetAllFlags(), CFastaOstream::SetWidth(), CFastaOstream::Write(), and CFastaOstream::WriteSequence().
|
private |
Prohibit assignment operator.
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.
void CSeqFormatter::Write | ( | CBlastDBSeqId & | id | ) |
Write the sequence data associated with the requested ID in the format specified in the constructor.
id | identifier for a sequence in the BLAST database |
CException | derived 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().
|
private |
Build data for write.
data2write | data to replace in the output string [in] |
Definition at line 116 of file seq_writer.cpp.
References CBlastDBExtractor::ExtractAccession(), CBlastDBExtractor::ExtractAsn1Bioseq(), CBlastDBExtractor::ExtractAsn1Defline(), CBlastDBExtractor::ExtractBlastName(), CBlastDBExtractor::ExtractCommonTaxonomicName(), CBlastDBExtractor::ExtractGi(), CBlastDBExtractor::ExtractHash(), CBlastDBExtractor::ExtractLeafCommonTaxonomicNames(), CBlastDBExtractor::ExtractLeafScientificNames(), CBlastDBExtractor::ExtractLeafTaxIds(), CBlastDBExtractor::ExtractLinksInteger(), CBlastDBExtractor::ExtractMaskingData(), CBlastDBExtractor::ExtractMembershipInteger(), CBlastDBExtractor::ExtractOid(), CBlastDBExtractor::ExtractPig(), CBlastDBExtractor::ExtractScientificName(), CBlastDBExtractor::ExtractSeqData(), CBlastDBExtractor::ExtractSeqId(), CBlastDBExtractor::ExtractSeqLen(), CBlastDBExtractor::ExtractSuperKingdom(), CBlastDBExtractor::ExtractTaxId(), CBlastDBExtractor::ExtractTitle(), ITERATE, m_DataExtractor, m_ReplTypes, and NCBI_THROW.
Referenced by Write().
Replace format specifiers for the data contained in data2write.
data2write | data to replace in the output string [in] |
Definition at line 368 of file seq_writer.cpp.
Referenced by Write().
|
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().
|
private |
The BLAST database from which to extract data.
Definition at line 106 of file seq_writer.hpp.
Referenced by CSeqFormatter().
|
private |
Data extractor.
Definition at line 110 of file seq_writer.hpp.
Referenced by Write(), and x_Builder().
|
private |
Fasta output?
Definition at line 114 of file seq_writer.hpp.
Referenced by CSeqFormatter(), and Write().
|
private |
The output format specification.
Definition at line 104 of file seq_writer.hpp.
Referenced by CSeqFormatter().
|
private |
Stream to write output.
Definition at line 102 of file seq_writer.hpp.
|
private |
Vector of offsets where the replacements will take place.
Definition at line 108 of file seq_writer.hpp.
Referenced by CSeqFormatter().
|
private |
Vector of convertor objects.
Definition at line 112 of file seq_writer.hpp.
Referenced by CSeqFormatter(), x_Builder(), and x_RequireData().