NCBI C++ ToolKit
|
Search Toolkit Book for CAgpReader
Detects scaffolds, object boundaries, errors that involve 2 consecutive lines, and is intended as a superclass for more complex readers. More...
#include <objtools/readers/agp_util.hpp>
Public Types | |
enum | EFinalize { eFinalize_No , eFinalize_Yes } |
Whether or not the function should call Finalize() when it's done successfully. More... | |
Public Member Functions | |
CAgpReader (CAgpErr *arg, EAgpVersion agp_version=eAgpVersion_auto) | |
CAgpReader (EAgpVersion agp_version=eAgpVersion_auto) | |
virtual | ~CAgpReader () |
virtual int | ReadStream (CNcbiIstream &is, EFinalize eFinalize=eFinalize_Yes) |
Read an AGP file from the given input stream. More... | |
int | ReadStream (CNcbiIstream &is, bool bFinalize) |
Deprecated backward-compatibility wrapper. More... | |
virtual int | Finalize () |
This is called at the end of the file, usually automatically but can be called manually if the automatic call was intentionally disabled. More... | |
virtual string | GetErrorMessage (const string &filename=NcbiEmptyString) |
Return a string with one (or two, depending on error) source line(s) on which the error occured, along with the error message(s) themselves. More... | |
bool | ProcessThisRow () |
Invoked from ReadStream(), after the row has been parsed, and seldom needs to be invoked by user. More... | |
virtual void | SetVersion (EAgpVersion ver) |
Change what AGP version to use for the next input that's read. More... | |
CAgpErr * | GetErrorHandler () |
void | SetErrorHandler (CAgpErr *arg) |
EAgpVersion | GetVersion () |
Protected Member Functions | |
virtual void | OnScaffoldEnd () |
virtual void | OnObjectChange () |
virtual void | OnGapOrComponent () |
virtual bool | OnError () |
virtual void | OnComment () |
Private Member Functions | |
void | Init () |
void | x_CheckPragmaComment (void) |
Private Attributes | |
CRef< CAgpErr > | m_AgpErr |
Detects scaffolds, object boundaries, errors that involve 2 consecutive lines, and is intended as a superclass for more complex readers.
Definition at line 326 of file agp_util.hpp.
Whether or not the function should call Finalize() when it's done successfully.
Enumerator | |
---|---|
eFinalize_No | |
eFinalize_Yes |
Definition at line 336 of file agp_util.hpp.
CAgpReader::CAgpReader | ( | CAgpErr * | arg, |
EAgpVersion | agp_version = eAgpVersion_auto |
||
) |
Definition at line 977 of file agp_util.cpp.
CAgpReader::CAgpReader | ( | EAgpVersion | agp_version = eAgpVersion_auto | ) |
Definition at line 970 of file agp_util.cpp.
|
virtual |
Definition at line 997 of file agp_util.cpp.
|
virtual |
This is called at the end of the file, usually automatically but can be called manually if the automatic call was intentionally disabled.
Reimplemented in CAgpToSeqEntry.
Definition at line 1160 of file agp_util.cpp.
References CAgpErr::fAtPrevLine, CAgpRow::GapEndsScaffold(), CAgpRow::GapValidAtObjectEnd(), CAgpRow::GetObject(), CAgpRow::is_gap, m_AgpErr, m_at_beg, m_at_end, m_error_code, m_new_obj, m_prev_line_skipped, m_prev_row, CAgpErr::Msg(), OnObjectChange(), OnScaffoldEnd(), and CAgpErr::W_GapObjEnd.
Referenced by CAgpToSeqEntry::Finalize(), ProcessStream(), and ReadStream().
|
inline |
Definition at line 481 of file agp_util.hpp.
References m_AgpErr.
Referenced by CAgpValidateReader::OnGapOrComponent(), and CAgpRenumber::OnObjectChange().
|
virtual |
Return a string with one (or two, depending on error) source line(s) on which the error occured, along with the error message(s) themselves.
filename | If filename is non-empty, each line is preceded with "FILENAME:" (useful when reading several files). |
Definition at line 1194 of file agp_util.cpp.
References CAgpErr::AppliesTo(), CAgpErr::fAtNone, CAgpErr::fAtPrevLine, CAgpErr::fAtThisLine, CAgpErr::GetErrorMessage(), i2s, m_AgpErr, m_line, m_line_num, m_prev_line_num, m_prev_row, msg(), and CAgpRow::ToString().
Referenced by CAgpObjectLoader::Execute(), and ProcessStream().
|
inline |
Definition at line 483 of file agp_util.hpp.
References m_agp_version.
|
private |
Definition at line 989 of file agp_util.cpp.
References m_agp_version, m_AgpErr, m_at_beg, m_prev_line_num, m_prev_row, m_this_row, and CAgpRow::New().
Referenced by CAgpReader().
|
inlineprotectedvirtual |
Reimplemented in CAgpRenumber, and CAgpValidateReader.
Definition at line 466 of file agp_util.hpp.
Referenced by ReadStream().
|
inlineprotectedvirtual |
Reimplemented in CAgpRenumber, and CAgpValidateReader.
Definition at line 450 of file agp_util.hpp.
Referenced by ProcessThisRow(), and ReadStream().
|
inlineprotectedvirtual |
Reimplemented in CAgpToSeqEntry, CAgpRenumber, and CAgpValidateReader.
Definition at line 445 of file agp_util.hpp.
Referenced by ProcessThisRow().
|
inlineprotectedvirtual |
Reimplemented in CAgpRenumber, and CAgpValidateReader.
Definition at line 439 of file agp_util.hpp.
Referenced by Finalize(), and ProcessThisRow().
|
inlineprotectedvirtual |
Reimplemented in CAgpValidateReader.
Definition at line 431 of file agp_util.hpp.
Referenced by Finalize(), and ProcessThisRow().
bool CAgpReader::ProcessThisRow | ( | ) |
Invoked from ReadStream(), after the row has been parsed, and seldom needs to be invoked by user.
One occassion is in agp_renumber - to force a line NOT to be skipped it is called from OnError() when m_line_skipped=true and m_error_code=E_ObjRangeNeGap or E_ObjRangeNeComp.
Definition at line 1001 of file agp_util.cpp.
References CAgpErr::Clear(), CAgpErr::E_ObjBegNePrevEndPlus1, CAgpErr::E_ObjMustBegin1, CAgpErr::E_PartNumberNot1, CAgpErr::E_PartNumberNotPlus1, CAgpErr::E_SameConseqGaps, CAgpRow::eGapContamination, CAgpErr::fAtPrevLine, CAgpErr::fAtThisLine, CAgpRow::gap_type, CAgpRow::GapEndsScaffold(), CAgpRow::GapValidAtObjectEnd(), CAgpRow::GetObject(), CAgpRow::is_gap, CAgpRow::linkage, m_AgpErr, m_at_beg, m_error_code, m_line_num, m_line_skipped, m_new_obj, m_prev_line_num, m_prev_line_skipped, m_prev_row, m_this_row, CAgpErr::Msg(), CAgpRow::object_beg, CAgpRow::object_end, OnError(), OnGapOrComponent(), OnObjectChange(), OnScaffoldEnd(), CAgpRow::part_number, CAgpErr::W_ConseqGaps, CAgpErr::W_GapObjBegin, and CAgpErr::W_GapObjEnd.
Referenced by CAgpRenumber::OnError(), and ReadStream().
|
inline |
Deprecated backward-compatibility wrapper.
Definition at line 358 of file agp_util.hpp.
References eFinalize_No, eFinalize_Yes, and ReadStream().
|
virtual |
Read an AGP file from the given input stream.
is | The input stream we're reading the AGP from |
eFinalize | If we successfully read the AGP file, this param determines whether or not we call Finalize(). |
Definition at line 1084 of file agp_util.cpp.
References CAgpErr::Clear(), CAgpRow::cols, CAgpErr::E_NoValidLines, eAgpVersion_2_0, eFinalize_Yes, CAgpRow::eGapContig, CAgpErr::fAtNone, Finalize(), CAgpRow::FromString(), CAgpRow::gap_type, CAgpRow::is_gap, CAgpRow::linkage, m_agp_version, m_AgpErr, m_at_beg, m_at_end, m_content_line_seen, m_error_code, m_line, m_line_num, m_line_skipped, m_prev_line_skipped, m_prev_row, m_this_row, CAgpErr::Msg(), NcbiEmptyString, NcbiGetline(), OnComment(), OnError(), ProcessThisRow(), CAgpErr::W_CommentsAfterStart, CAgpErr::W_NoEolAtEof, and x_CheckPragmaComment().
Referenced by CAgpObjectLoader::Execute(), ProcessStream(), ReadStream(), CFileLoader::x_LoadAGP(), CAgpConverter::x_ReadAgpEntries(), CFormatGuessEx::x_TryAgp(), CAgpValidateApplication::x_ValidateFile(), and CMultiReaderApp::xProcessAgp().
void CAgpReader::SetErrorHandler | ( | CAgpErr * | arg | ) |
Definition at line 1187 of file agp_util.cpp.
References m_AgpErr, m_prev_row, m_this_row, and CAgpRow::SetErrorHandler().
Referenced by CAgpRenumber::CAgpRenumber().
|
virtual |
Change what AGP version to use for the next input that's read.
Please prefer setting the version in the CAgpReader constructor instead and if SetVersion must be used, it's best to use it at a clean stopping point. (Example: immediately after a Finalize() call)
Definition at line 1075 of file agp_util.cpp.
References m_agp_version, m_prev_row, m_this_row, and CAgpRow::SetVersion().
Referenced by CAgpRow::ParseGapCols(), and CAgpValidateApplication::x_ValidateFile().
|
private |
Definition at line 1227 of file agp_util.cpp.
References eAgpVersion_1_1, eAgpVersion_2_0, eAgpVersion_auto, CAgpErr::fAtNone, m_agp_version, m_AgpErr, m_line, m_prev_row, m_this_row, CAgpErr::Msg(), NPOS, CAgpRow::SetVersion(), NStr::StartsWith(), dtl::version, CAgpErr::W_AGPVersionCommentInvalid, and CAgpErr::W_AGPVersionCommentUnnecessary.
Referenced by ReadStream().
|
protected |
Definition at line 392 of file agp_util.hpp.
Referenced by GetVersion(), Init(), ReadStream(), SetVersion(), x_CheckPragmaComment(), and CAgpValidateReader::x_PrintTotals().
Definition at line 474 of file agp_util.hpp.
Referenced by CAgpReader(), Finalize(), GetErrorHandler(), GetErrorMessage(), Init(), ProcessThisRow(), ReadStream(), SetErrorHandler(), and x_CheckPragmaComment().
|
protected |
Definition at line 394 of file agp_util.hpp.
Referenced by Finalize(), Init(), CAgpValidateReader::OnGapOrComponent(), CAgpValidateReader::OnObjectChange(), CAgpRenumber::OnObjectChange(), ProcessThisRow(), and ReadStream().
|
protected |
Definition at line 396 of file agp_util.hpp.
Referenced by Finalize(), CAgpValidateReader::OnObjectChange(), CAgpRenumber::OnObjectChange(), and ReadStream().
|
protected |
Definition at line 406 of file agp_util.hpp.
Referenced by ReadStream().
|
protected |
Definition at line 408 of file agp_util.hpp.
Referenced by Finalize(), CAgpRenumber::OnError(), CAgpRenumber::OnObjectChange(), ProcessThisRow(), and ReadStream().
|
protected |
Definition at line 418 of file agp_util.hpp.
Referenced by GetErrorMessage(), CAgpValidateReader::OnComment(), CAgpRenumber::OnComment(), CAgpValidateReader::OnError(), CAgpRenumber::OnError(), CAgpValidateReader::OnGapOrComponent(), CAgpRenumber::OnGapOrComponent(), ReadStream(), and x_CheckPragmaComment().
|
protected |
Definition at line 417 of file agp_util.hpp.
Referenced by GetErrorMessage(), CAgpValidateReader::OnError(), CAgpValidateReader::OnGapOrComponent(), CAgpValidateReader::OnObjectChange(), ProcessThisRow(), and ReadStream().
|
protected |
Definition at line 400 of file agp_util.hpp.
Referenced by CAgpValidateReader::OnError(), CAgpRenumber::OnError(), ProcessThisRow(), and ReadStream().
|
protected |
Definition at line 404 of file agp_util.hpp.
Referenced by Finalize(), and ProcessThisRow().
|
protected |
Definition at line 417 of file agp_util.hpp.
Referenced by GetErrorMessage(), Init(), and ProcessThisRow().
|
protected |
Definition at line 401 of file agp_util.hpp.
Referenced by Finalize(), CAgpRenumber::OnError(), ProcessThisRow(), and ReadStream().
Definition at line 415 of file agp_util.hpp.
Referenced by Finalize(), GetErrorMessage(), Init(), CAgpValidateReader::OnGapOrComponent(), CAgpToSeqEntry::OnGapOrComponent(), CAgpValidateReader::OnObjectChange(), CAgpValidateReader::OnScaffoldEnd(), ProcessThisRow(), ReadStream(), SetErrorHandler(), SetVersion(), and x_CheckPragmaComment().
Definition at line 416 of file agp_util.hpp.
Referenced by Init(), CAgpValidateReader::OnError(), CAgpValidateReader::OnGapOrComponent(), CAgpRenumber::OnGapOrComponent(), CAgpToSeqEntry::OnGapOrComponent(), CAgpValidateReader::OnObjectChange(), CAgpRenumber::OnObjectChange(), ProcessThisRow(), ReadStream(), SetErrorHandler(), SetVersion(), x_CheckPragmaComment(), and CAgpToSeqEntry::x_SetSeqGap().