& idString,
58 const string& errMessage,
62 if(pMessageListener) {
63unique_ptr<CObjReaderLineException> pLineExpt(
69idString,
"",
"",
"",
72 if(pMessageListener->
PutError(*pLineExpt)) {
87 const string& idString,
88 const string& errMessage,
92unique_ptr<CObjReaderLineException> pLineExpt(
98idString,
"",
"",
"",
101 if(!pMessageListener) {
106 if(!pMessageListener->
PutError(*pLineExpt)) {
130has_range =
data.has_range;
131range_start =
data.range_start;
132range_end =
data.range_end;
133titles = std::move(
data.titles);
152 size_trange_len = 0;
155 data.has_range =
false;
163 if(defline[0] !=
'>') {
165 "Invalid defline. First character is not '>'", 0);
170 for(start = 1 ; start <
len; ++start ) {
171 if( !
isspace(defline[start]) ) {
177 size_ttitle_start =
NPOS;
184 while(pos <
len&& defline[pos] >
' ') {
190 data.range_start,
data.range_end, pMessageListener);
193 autoid_string = defline.
substr(start, pos - start - range_len);
196 "Unable to locate sequence id in definition line", 0);
206 data.has_range = (range_len>0);
210 while(title_start <
len 211&&
isspace((
unsigned char)defline[title_start])) {
215 if(title_start <
len) {
216 for(pos = title_start + 1; pos <
len; ++pos) {
217 if((
unsigned char)defline[pos] <
' ') {
222 data.titles.push_back(
224defline.
substr(title_start, pos - title_start), lineNumber));
240 boolon_start =
false;
245 for(pos = s.
length() - 1; pos > 0; --pos) {
246 unsigned charc = s[pos];
247 if(c >=
'0'&& c <=
'9') {
249start += (c -
'0') * mult;
251end += (c -
'0') * mult;
254}
else if(c ==
'-'&& !on_start && mult > 1) {
257}
else if(c ==
':'&& on_start && mult > 1) {
259}
else if(c ==
'c'&& pos > 0 && s[--pos] ==
':' 260&& on_start && mult > 1) {
267 if((
negative? (end > start) : (start > end)) || s[pos] !=
':') {
283 const string& idString,
285 const string&
msg);
287 using TCodePair= pair<CObjReaderLineException::EProblem, CObjReaderParseException::EErrCode>;
295m_pMessageListener(pMessageListener), m_IgnoreGeneralParsingError(ignoreGeneralParsingError) {}
300 const string& idString,
314 const autocit = s_CodeMap.
find(errCode);
317 const auto& problem = cit->second.first;
323 const auto& parseExceptionCode = cit->second.second;
344ids.push_back(pSeqId);
345f_id_check(ids,
info, pMessageListener);
358 autoto_parse = id_string;
359 if(id_string.
find(
',') !=
NPOS&&
361 const stringerr_message =
363+
", the sequence id string contains 'comma' symbol, which has been replaced with 'underscore' " 364+
"symbol. Please correct the sequence id string.";
373local_copy = id_string;
374 for(
auto& rit : local_copy)
378to_parse = local_copy;
394 "Could not construct seq-id from '"+ id_string +
"'",
406f_id_check(ids,
info, pMessageListener);
412 for(
auto id: ids) {
414 const TGigi =
id->GetGi();
430 if(
info.maxIdLength) {
447 const booladvance =
true;
static void x_ConvertNumericToLocal(TIds &ids)
vector< ILineError::EProblem > TIgnoredProblems
static TSeqPos ParseRange(const CTempString &s, TSeqPos &start, TSeqPos &end, ILineErrorListener *pMessageListener)
function< void(const TIds &id, const TInfo &info, ILineErrorListener *listener)> FIdCheck
static size_t s_MaxGeneralTagLength
static void x_ProcessIDs(const CTempString &id_string, const SDeflineParseInfo &info, TIds &ids, ILineErrorListener *pMessageListener, FIdCheck fn_id_check)
static size_t s_MaxAccessionLength
list< CRef< CSeq_id > > TIds
static void ParseDefline(const CTempString &defline, const SDeflineParseInfo &info, const TIgnoredProblems &ignoredErrors, TIds &ids, bool &hasRange, TSeqPos &rangeStart, TSeqPos &rangeEnd, TSeqTitles &seqTitles, ILineErrorListener *pMessageListener)
static size_t s_MaxLocalIDLength
vector< SLineTextAndLoc > TSeqTitles
virtual CRef< CSeq_id > GenerateID(bool unique_id)
bool x_IsUniqueIdHandle(CSeq_id_Handle idh)
CRef< CSeqIdGenerator > mp_IdGenerator
void SetMaxLocalIDLength(size_t length)
void SetMaxAccessionLength(size_t length)
void SetMaxGeneralTagLength(size_t length)
void operator()(EDiagSev severity, int lineNum, const string &idString, CFastaIdValidate::EErrCode errCode, const string &msg)
ILineErrorListener * m_pMessageListener
pair< CObjReaderLineException::EProblem, CObjReaderParseException::EErrCode > TCodePair
bool m_IgnoreGeneralParsingError
CIdErrorReporter(ILineErrorListener *pMessageListener, bool ignoreGeneralParsingError=false)
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.
@ eFormat
Some of these are pretty specialized.
@ fNumericIdsAsLocal
numeric identifiers are local IDs
@ fAllIdsAsLocal
all identifiers are local IDs
void operator()(const TIds &ids, const TInfo &info, ILineErrorListener *listener)
CFastaDeflineReader::TIds TIds
std::atomic< TCount > m_Counter
CRef< CSeq_id > GenerateID(const string &defline, bool advance)
CRef< CSeq_id > GenerateID(void) const
Equivalent to GenerateID(false)
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
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...
@ eProblem_UnexpectedAminoAcids
@ eProblem_UnexpectedNucResidues
@ eProblem_GeneralParsingError
const_iterator end() const
const_iterator find(const key_type &key) const
Operators to edit gaps in sequences.
static void s_PostError(ILineErrorListener *pMessageListener, const TSeqPos lineNumber, const string &idString, const string &errMessage, const CObjReaderLineException::EProblem problem, const CObjReaderParseException::EErrCode errCode)
static void s_PostWarning(ILineErrorListener *pMessageListener, const TSeqPos lineNumber, const string &idString, const string &errMessage, const CObjReaderLineException::EProblem problem, const CObjReaderParseException::EErrCode errCode)
unsigned int TSeqPos
Type for sequence locations and lengths.
#define LOG_POST_X(err_subcode, message)
#define DIAG_COMPILE_INFO
Make compile time diagnostic information object to use in CNcbiDiag and CException.
EDiagSev
Severity level for the posted diagnostics.
@ eDiag_Error
Error message.
@ eDiag_Warning
Warning message.
void Warning(CExceptionArgs_Base &args)
#define NCBI_THROW2(exception_class, err_code, message, extra)
Throw exception with extra parameter.
@ fNoParseID
Generate an ID (whole defline -> title)
@ fParseRawID
Try to identify raw accessions.
@ fDisableParseRange
No ranges in seq-ids. Ranges part of seq-id instead.
static const size_t kMaxAccessionLength
string GetSeqIdString(bool with_version=false) const
Return seqid string with optional version for text seqid type.
static const size_t kMaxLocalIDLength
ID length restrictions.
static SIZE_TYPE ParseIDs(CBioseq::TId &ids, const CTempString &s, TParseFlags flags=fParse_Default)
Parse a string representing one or more Seq-ids, appending the results to IDS.
static const size_t kMaxGeneralTagLength
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
@ fParse_RawText
Try to ID raw non-numeric accessions.
@ fParse_PartialOK
Warn rather than throwing an exception when a FASTA-style ID set contains unparsable portions,...
@ fParse_AnyLocal
Treat otherwise unidentified strings as local accessions as long as they don't resemble FASTA-style I...
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
bool empty(void) const
Return true if the represented string is empty (i.e., the length is zero)
size_type length(void) const
Return the length of the represented array.
CTempString substr(size_type pos) const
Obtain a substring from this string, beginning at a given offset.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
size_type find(const CTempString match, size_type pos=0) const
Find the first instance of the entire matching string within the current string, beginning at an opti...
TStr & SetStr(void)
Select the variant.
TId & SetId(void)
Select the variant.
TLocal & SetLocal(void)
Select the variant.
Defines NCBI C++ diagnostic APIs, classes, and macros.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4