110 #define NCBI_USE_ERRCODE_X Objtools_Rd_RepMask
157 const string& annotName,
158 const string& annotTitle,
163 m_uProgressReportInterval(0),
164 m_uNextProgressReport(0),
166 m_AnnotName(annotName),
167 m_AnnotTitle(annotTitle),
171 mSeqIdResolve(seqidresolver),
231 if (readerData.empty()) {
235 while (!readerData.empty()) {
240 "Data import interrupted by user.");
360 annots.push_back(annot);
404 "Error allowance exceeded",
435 if (!pContainer || !pContainer->
PutError(err)) {
460 const list<string>& stringFlags,
465 for (
auto stringFlag: stringFlags) {
466 auto flagEntry = flagMap.
find(stringFlag);
467 if (flagEntry == flagMap.
end()) {
468 string message =
"Unrecognized FASTA flag : " + stringFlag;
471 baseFlags |= flagEntry->second;
478 const string& strRaw,
485 "Bad browser line: cannot parse browser position.");
516 interval.
SetTo(n_to-1);
531 desc.
Set().push_back( region );
537 const string& strLine,
544 "Bad browser line: incomplete position directive.");
551 vector<string> fields;
553 for ( vector<string>::iterator it = fields.begin(); it != fields.end(); ++it ) {
554 if ( *it ==
"position" ) {
556 if ( it == fields.end() ) {
581 const string& strLine)
584 vector<string> parts;
628 if (countInfos + countWarnings + countErrors + countCritical == 0) {
632 conversioninfo->
SetType().SetStr(
"Conversion Info");
633 conversioninfo->
AddField(
"critical errors",
static_cast<int>(countCritical));
634 conversioninfo->
AddField(
"errors",
static_cast<int>(countErrors));
635 conversioninfo->
AddField(
"warnings",
static_cast<int>(countWarnings));
636 conversioninfo->
AddField(
"notes",
static_cast<int>(countInfos));
639 user->
SetUser(*conversioninfo);
640 annot.
SetDesc().Set().push_back(user);
673 unsigned int uCurrentTime = (
unsigned int)time(0);
726 if (strLine.
empty()) {
729 return (strLine[0] ==
'#' && strLine[1] !=
'#');
737 if (strLine ==
"track") {
752 return (line ==
"###");
775 while (!
lr.AtEOF()) {
862 "Exception: " +
error.GetMsg());
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CReaderBase implementation that reads BED data files, either a single object or all objects found.
Base class for reading FASTA sequences.
void Throw(void) const
copy constructor is protected so please use this function to throw the object.
void SetLineNumber(unsigned int uLineNumber)
void Throw(void) const
this function to throw this object.
static CObjReaderLineException * Create(EDiagSev eSeverity, unsigned int uLine, const std::string &strMessage, EProblem eProblem=eProblem_GeneralParsingError, const std::string &strSeqId=string(""), const std::string &strFeatureName=string(""), const std::string &strQualifierName=string(""), const std::string &strQualifierValue=string(""), CObjReaderLineException::EErrCode eErrCode=eFormat, const TVecOfLines &vecOfOtherLines=TVecOfLines())
Please use this instead of the constructor because the ctor is protected.
std::string Message() const
static void Tokenize(const string &instr, const string &delim, vector< string > &tokens)
Tokenize a given string, respecting quoted substrings an atomic units.
Defines and provides stubs for a general interface to a variety of file readers.
unique_ptr< CReaderMessageHandler > m_pMessageHandler
void xProcessLineError(const ILineError &, ILineErrorListener *)
virtual void xSetBrowserRegion(const string &, CAnnot_descr &)
void xGuardedGetData(ILineReader &, TReaderData &, ILineErrorListener *)
virtual CRef< CSerialObject > ReadObject(CNcbiIstream &istr, ILineErrorListener *pErrors=nullptr)
Read an object from a given input stream, render it as the most appropriate Genbank object.
virtual void xValidateAnnot(const CSeq_annot &)
virtual void xProcessData(const TReaderData &, CSeq_annot &)
bool xIsReportingProgress() const
void SetProgressReportInterval(unsigned int intv)
virtual void ReadSeqAnnots(TAnnots &annots, CNcbiIstream &istr, ILineErrorListener *pErrors=nullptr)
Read all objects from given insput stream, returning them as a vector of Seq-annots.
virtual bool xUngetLine(ILineReader &)
virtual bool xIsCommentLine(const CTempString &)
virtual CRef< CSeq_annot > xCreateSeqAnnot()
unsigned int m_uDataCount
virtual CRef< CSeq_entry > ReadSeqEntry(CNcbiIstream &istr, ILineErrorListener *pErrors=nullptr)
Read an object from a given input stream, render it as a single Seq-entry, if possible.
unsigned int m_uLineNumber
void xProcessReaderMessage(CReaderMessage &, ILineErrorListener *)
static CReaderBase * GetReader(CFormatGuess::EFormat format, TReaderFlags flags=0, CReaderListener *=nullptr)
Allocate a CReaderBase derived reader object based on the given file format.
unique_ptr< CTrackData > m_pTrackDefaults
virtual bool xParseBrowserLine(const string &, CSeq_annot &)
CReaderBase(TReaderFlags flags=0, const string &name="", const string &title="", SeqIdResolver seqresolver=CReadUtil::AsSeqId, CReaderListener *pListener=nullptr)
Protected constructor. Use GetReader() to get an actual reader object.
bool xIsOperationCanceled() const
unsigned int m_uProgressReportInterval
unsigned int m_uNextProgressReport
virtual void xPostProcessAnnot(CSeq_annot &)
virtual bool xProgressInit(ILineReader &istr)
void ProcessError(CObjReaderLineException &, ILineErrorListener *)
vector< TReaderLine > TReaderData
virtual bool xGetLine(ILineReader &, string &)
virtual void xAddConversionInfo(CSeq_annot &, ILineErrorListener *)
virtual void xGuardedProcessData(const TReaderData &, CSeq_annot &, ILineErrorListener *)
bool xParseComment(const CTempString &, CRef< CSeq_annot > &)
virtual bool xIsBrowserLine(const CTempString &)
virtual bool xParseTrackLine(const string &)
void xReportProgress(ILineErrorListener *=nullptr)
virtual void xAssignTrackData(CSeq_annot &)
void SetCanceler(ICanceled *=nullptr)
void xProcessUnknownException(const CException &)
virtual void xGetData(ILineReader &, TReaderData &)
virtual CRef< CSeq_annot > ReadSeqAnnot(CNcbiIstream &istr, ILineErrorListener *pErrors=nullptr)
Read an object from a given input stream, render it as a single Seq-annot.
struct SReaderLine { SReaderLine(unsigned int line, string data):mLine(line), mData(data) {} TReaderLine
static void xAddStringFlagsWithMap(const list< string > &stringFlags, const map< string, TReaderFlags > flagMap, TReaderFlags &baseFlags)
void ProcessWarning(CObjReaderLineException &, ILineErrorListener *)
virtual bool xIsTrackTerminator(const CTempString &)
virtual bool xIsTrackLine(const CTempString &)
void SetLineNumber(int lineNumber)
virtual EDiagSev Severity() const
Implements a concrete class for reading RepeatMasker output from tabular form and rendering it as ASN...
void SetNameDesc(const string &name)
void SetTitleDesc(const string &title)
Simple implementation of ILineReader for i(o)streams.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
static bool IsTrackData(const LineData &)
CUser_object & AddField(const string &label, const string &value, EParseField parse=eParse_String)
add a data field to the user object that holds a given value
Interface for testing cancellation request in a long lasting operation.
virtual bool PutError(const ILineError &)=0
Store error in the container, and return true if error was stored fine, and return false if the calle...
virtual size_t LevelCount(EDiagSev)=0
Returns the number of errors seen so far at the given severity.
bool PutMessage(const IObjtoolsMessage &message) override
virtual string Message() const
@ eProblem_GeneralParsingError
string SeverityStr() const
Abstract base class for lightweight line-by-line reading.
const_iterator end() const
const_iterator find(const key_type &key) const
Include a standard set of the NCBI C++ Toolkit most basic headers.
Operators to edit gaps in sequences.
static const char location[]
@ eDiag_Info
Informational message.
@ eDiag_Error
Error message.
@ eDiag_Warning
Warning message.
@ eDiag_Fatal
Fatal error – guarantees exit(or abort)
@ eDiag_Critical
Critical error message.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
virtual CT_POS_TYPE GetPosition(void) const =0
Return the current (absolute) position.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
virtual bool IsCanceled(void) const =0
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
static CTempString TruncateSpaces_Unsafe(const CTempString str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
bool empty(void) const
Return true if the represented string is empty (i.e., the length is zero)
static int Compare(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Compare of a substring with another string.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
@ fAllowCommas
Allow commas. See 'ENumToStringFlags::fWithCommas'.
@ fSplit_MergeDelimiters
Merge adjacent delimiters.
void SetType(TType &value)
Assign a value to Type data member.
void SetTo(TTo value)
Assign a value to To data member.
void SetFrom(TFrom value)
Assign a value to From data member.
void SetStrand(TStrand value)
Assign a value to Strand data member.
Tdata & Set(void)
Assign a value to data member.
void SetDesc(TDesc &value)
Assign a value to Desc data member.
TUser & SetUser(void)
Select the variant.
TRegion & SetRegion(void)
Select the variant.
unsigned int
A callback function used to compare two keys in a database.
Lightweight interface for getting lines of data with minimal memory copying.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines NCBI C++ exception handling.
Multi-threading – classes, functions, and features.
Useful/utility classes and methods.
static SLJIT_INLINE sljit_ins lr(sljit_gpr dst, sljit_gpr src)