(
autoit =
head; it != end_it; ++it) {
128 switch(it->choice) {
133temp +=
"complement";
202 if(current != end(tokens))
252 if(tokens.size() == 1) {
255 autocurrent_it = begin(tokens);
257 for(
autoscanner_it =
next(current_it);
258scanner_it != end(tokens);
262 if(scanner_it != end(tokens) &&
271 for(
autocurrent_it = begin(tokens);
272current_it != end(tokens);
276 autoscanner_it =
next(current_it);
277 if(scanner_it != end(tokens)) {
280 while(scanner_it != end(tokens)) {
283 if(scanner_it != end(tokens) &&
301 unsigned intcurrent_col)
303 stringtemp_string = line.substr(0, current_col + 1) +
" ";
308 static unsigned advance_to(
const charc,
unsignedcurrent_pos,
const string& line)
310 intpos = current_pos;
311 while(pos < line.size()) {
312 if(line[pos] == c) {
323 if(accession.empty()) {
327 autoIsAlpha = [](
charc) {
return isalpha(c); };
329 autoit = find_if_not(begin(accession),
334 if(it == end(accession)) {
338 autoprefix_length = distance(begin(accession), it);
340 if(prefix_length != 2) {
344it = find_if_not(it, end(accession), IsAlpha);
345 if(it == end(accession)) {
348prefix_length = distance(begin(accession), it);
349 if(prefix_length == 3 || prefix_length == 7) {
350 returnprefix_length;
353}
else if(accession.size() >= 3 &&
356accession[2] ==
'S') {
360 if(prefix_length == 1 ||
361prefix_length == 2 ||
362prefix_length == 4 ||
363prefix_length == 6) {
364 returnprefix_length;
371 static int sGetAccession(
string& accession,
unsigned int& current_col,
const string& line,
boolaccver)
373 const autolength = line.size();
374string_view tempString(line.c_str() + current_col, length - current_col);
376 size_taccessionLength = prefixLength;
378tempString = tempString.substr(prefixLength);
379 autonotDigitPos = tempString.find_first_not_of(
"0123456789");
380 if(notDigitPos != string_view::npos) {
381accessionLength += notDigitPos;
382 if(accver && tempString[notDigitPos] ==
'.') {
384 if(tempString.size() > notDigitPos) {
385tempString = tempString.substr(notDigitPos + 1);
386notDigitPos = tempString.find_first_not_of(
"0123456789");
387 if(notDigitPos != string_view::npos) {
388accessionLength += notDigitPos;
393accessionLength = length - current_col;
397 if(notDigitPos == string_view::npos || tempString[notDigitPos] !=
':') {
403accession =
string(line.c_str() + current_col, accessionLength);
404current_col += accessionLength;
415 if(! linein.empty()) {
416 stringline{ linein };
418 autolength = line.size();
419 unsignedcurrent_col = 0;
421 while(current_col < length) {
423 if(
isspace(line[current_col]) || line[current_col] ==
'~') {
429 if(
isdigit(line[current_col])) {
431string_view tempString(line.c_str() + current_col,
size_t(length - current_col));
432 autonot_digit_pos = tempString.find_first_not_of(
"0123456789");
433 autonum_digits = (not_digit_pos == string_view::npos) ?
size_t(length - current_col) : not_digit_pos;
434current_token.
data=
string(line.c_str() + current_col, num_digits);
435tokens.push_back(current_token);
436current_col += num_digits;
440 boolskip_new_token =
false;
441 switch(line[current_col]) {
444 if(
autoclosing_quote_pos = line.find(
'\"', current_col + 1);
445closing_quote_pos == string::npos) {
449 size_t len= closing_quote_pos - current_col + 1;
450current_token.
data=
string(line.c_str() + current_col,
len);
462current_col =
advance_to(
'(', current_col, line);
478current_col =
advance_to(
'(', current_col, line);
497current_col =
advance_to(
'(', current_col, line);
508(current_col < length - 3) &&
509(line[current_col + 3] ==
'('||
510line[current_col + 3] ==
' '||
511line[current_col + 3] ==
'\t'||
512line[current_col + 3] ==
'\0')) {
514current_token.
data=
"gap";
517tokens.push_back(current_token);
528 for(;
isdigit(line[current_col]); current_col++)
536current_col =
advance_to(
'(', current_col, line);
550current_col =
advance_to(
'(', current_col, line);
564skip_new_token =
true;
576 if(current_col < length - 1 && line[current_col + 1] ==
's') {
579tokens.push_back(current_token);
583 if(current_col < length - 1) {
584 if(line[current_col + 1] ==
')') {
589tokens.push_back(current_token);
591tokens.push_back(current_token);
593 if(current_col < length - 1) {
594 if(line[current_col + 1] ==
';') {
619 if(current_col == length - 1 || line[current_col + 1] !=
'.') {
657 if(current_col < length - 1 && line[current_col + 1] ==
's') {
660 if(current_col < length - 1) {
661 if(line[current_col + 1] ==
';') {
678 if(! skip_new_token) {
679tokens.push_back(current_token);
691 if(current_token != end(tokens)) {
695 if(current_token == end(tokens)) {
697 const stringpar_msg =
"mismatched parentheses ("+ to_string(paren_count) +
")";
715 if(current_token != end(tokens)) {
748interval.
SetTo(range - 1);
752 id.SetGeneral().SetTag().SetId(0);
760 autoit =
next(current_it);
778 autogapsize_it = it++;
788current_it =
next(it);
813 boolstrange_sin_dot =
false;
814 autoend_it = end(tokens);
831strange_sin_dot =
true;
871 if(! strange_sin_dot) {
872 if(currentPt == end_it) {
880numPt =
fta_atoi(currentPt->data.c_str()) - 1;
893 if(num_found != 1) {
901 boolone_of_ok =
true;
902 boolat_end_one_of =
false;
912numPt =
fta_atoi(currentPt->data.c_str()) - 1;
918 while(one_of_ok && ! at_end_one_of && currentPt != end_it) {
919 switch(currentPt->choice) {
929at_end_one_of =
true;
934 if(! one_of_ok && ! at_end_one_of) {
935 while(! at_end_one_of && currentPt != end_it) {
937at_end_one_of =
true;
973 autoend_it = end(tokens);
976 if(accver && currentPt->data.find(
'.') >= currentPt->data.size() - 1) {
982new_id =
Ref(
new CSeq_id(currentPt->data));
985 if(currentPt == end_it) {
995}
else if(! seq_ids.empty()) {
997new_id->
Assign(*(*seq_ids.begin()));
1005 if(currentPt == end_it) {
1016 switch(currentPt->choice) {
1050ret->SetInt().SetFuzz_from(*new_fuzz);
1052ret->SetInt().SetId(*new_id);
1054 xgbload_number(ret->SetInt().SetFrom(), ret->SetInt().SetFuzz_from(), keep_rawPt, currentPt, tokens, numErrors,
TAKE_FIRST);
1057ret->SetInt().ResetFuzz_from();
1059 xgbcheck_range(ret->GetInt().GetFrom(), *new_id, keep_rawPt, numErrors, tokens, currentPt);
1065 if(currentPt != end_it) {
1066 boolin_caret =
false;
1067 switch(currentPt->choice) {
1096 if(ret->GetInt().IsSetFuzz_from()) {
1112 if(currentPt == end_it) {
1127 if(ret->GetInt().IsSetFuzz_from()) {
1137 xgbload_number(ret->SetInt().SetTo(), ret->SetInt().SetFuzz_to(), keep_rawPt, currentPt, tokens, numErrors,
TAKE_SECOND);
1140ret->SetInt().ResetFuzz_to();
1142 xgbcheck_range(ret->GetInt().GetTo(), *new_id, keep_rawPt, numErrors, tokens, currentPt);
1149 TSeqPosto = ret->GetInt().GetTo();
1153 if(point.
GetPoint() + 1 == to) {
1156point.
SetFuzz().SetRange().SetMax(to);
1162ret->GetInt().GetFrom() == ret->GetInt().GetTo() &&
1163! ret->GetInt().IsSetFuzz_from() &&
1164! ret->GetInt().IsSetFuzz_to()) {
1195 booladd_nulls =
false;
1196 autocurrent_token = currentPt;
1197 booldid_complement =
false;
1199 autoend_it = end(tokens);
1204 switch(current_token->choice) {
1207 if(currentPt == end_it) {
1222 if(currentPt == end_it) {
1235retval =
xgbloc_ver(keep_rawPt, parenPt, currentPt, tokens, numErrors, seq_ids, accver);
1240did_complement =
true;
1241 if(currentPt != end_it) {
1297 xgbgap(currentPt, end_it, retval,
false);
1300 xgbgap(currentPt, end_it, retval,
true);
1310retval =
xgbint_ver(keep_rawPt, currentPt, tokens, numErrors, seq_ids, accver);
1324}
while(in_sites && currentPt != end_it);
1326 if(! numErrors && ! did_complement && retval &&
1332 if(currentPt == end_it) {
1348 if(currentPt == end_it) {
1362 while(! numErrors && currentPt != end_it) {
1364 while(currentPt != end_it &&
1371 if(currentPt == end_it)
1376 if(retval->
IsMix())
1377retval->
SetMix().AddSeqLoc(*next_loc);
1379retval->
SetEquiv().Add(*next_loc);
1391 if(retval->
IsMix())
1392retval->
SetMix().AddSeqLoc(*null_loc);
1394retval->
SetEquiv().Add(*null_loc);
1404 if(currentPt == end_it) {
1425retval->
SetWhole().Assign(*(*seq_ids.begin()));
1442ret =
xgbloc_ver(keep_rawPt, parenPt, currentPt, tokens, numErrors, seq_ids, accver);
1444 if(currentPt == end(tokens)) {
1451 xgbparse_error(
"Missing comma after first location in replace",
1472keep_rawPt =
false;
1477 if(tokens.empty()) {
1489 autohead_token = tokens.begin();
1490 autocurrent_token = head_token;
1491 autoend_it = tokens.end();
1493 intparen_count = 0;
1497 if(current_token != end_it) {
1498 switch(current_token->choice) {
1504ret =
xgbloc_ver(keep_rawPt, paren_count, current_token, tokens, numErrors, seq_ids, accver);
1521 xgbparse_error(
"illegal initial token", tokens, current_token);
1537ret =
xgbint_ver(keep_rawPt, current_token, tokens, numErrors, seq_ids, accver);
1543ret =
xgbreplace_ver(keep_rawPt, paren_count, current_token, tokens, numErrors, seq_ids, accver);
1553}
while(in_sites && current_token != end_it);
std::list< CRef< objects::CSeq_id > > TSeqIdList
int fta_atoi(string_view sv)
void Nlm_ErrSetContext(const char *module, const char *fname, int line)
void Nlm_ErrPostStr(ErrSev sev, int lev1, int lev2, string_view str)
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
unsigned int TSeqPos
Type for sequence locations and lengths.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
void SetNull(void)
Override all setters to incorporate cache invalidation.
CSeq_loc * SeqLocRevCmpl(const CSeq_loc &loc, CScope *scope)
Get reverse complement of the seq-loc (?)
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
void Reset(void)
Reset reference object.
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty â pointing to an object and has a non-null value.
int32_t Int4
4-byte (32-bit) signed integer
uint32_t Uint4
4-byte (32-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string (in-place)
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
@ eNocase
Case insensitive compare.
void SetMin(TMin value)
Assign a value to Min data member.
TRange & SetRange(void)
Select the variant.
TMin GetMin(void) const
Get the Min member data.
void SetMax(TMax value)
Assign a value to Max data member.
TLim & SetLim(void)
Select the variant.
TMax GetMax(void) const
Get the Max member data.
const TRange & GetRange(void) const
Get the variant data.
@ eLim_tl
space to left of position
@ e_not_set
No variant selected.
void SetTo(TTo value)
Assign a value to To data member.
void SetPoint(TPoint value)
Assign a value to Point data member.
void SetId(TId &value)
Assign a value to Id data member.
bool IsMix(void) const
Check if variant Mix is selected.
TPoint GetPoint(void) const
Get the Point member data.
void SetId(TId &value)
Assign a value to Id data member.
TFrom GetFrom(void) const
Get the From member data.
void SetFuzz(TFuzz &value)
Assign a value to Fuzz data member.
void SetFrom(TFrom value)
Assign a value to From data member.
virtual void Reset(void)
Reset the whole object.
bool IsSetId(void) const
WARNING: this used to be optional Check if a value has been assigned to Id data member.
bool IsInt(void) const
Check if variant Int is selected.
const TInt & GetInt(void) const
Get the variant data.
bool IsNull(void) const
Check if variant Null is selected.
bool IsSetFuzz_from(void) const
Check if a value has been assigned to Fuzz_from data member.
bool IsPnt(void) const
Check if variant Pnt is selected.
constexpr auto front(list< Head, As... >, T=T()) noexcept -> Head
Miscellaneous common-use basic types and functionality.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static void xgbparse_error(string_view front, TTokenConstIt head, TTokenConstIt end_it)
static void do_xgbparse_error(string_view msg, string_view details)
static CRef< CSeq_loc > xgbloc_ver(bool &keep_rawPt, int &parenPt, TTokenIt ¤tPt, const TTokens &tokens, int &numErrors, const TSeqIdList &seq_ids, bool accver)
static void sConvertIntToPoint(CSeq_loc &loc)
static void xlex_error_func(string_view msg, const string &line, unsigned int current_col)
static CRef< CSeq_loc > xgbint_ver(bool &keep_rawPt, TTokenIt ¤tPt, const TTokens &tokens, int &numErrors, const TSeqIdList &seq_ids, bool accver)
static int xgbparselex_ver(string_view linein, TTokens &tokens, bool accver)
static void xgbgap(TTokenIt ¤t_it, TTokenConstIt end_it, CRef< CSeq_loc > &loc, bool unknown)
static void xfind_one_of_num(list< STokenInfo > &tokens)
list< STokenInfo > TTokens
static void * xgbparse_range_data
static CRef< CSeq_loc > XGapToSeqLocEx(Int4 range, bool unknown)
static void xgbparse_better_be_done(int &numErrors, TTokenIt current_token, const TTokens &tokens, bool &keep_rawPt, int paren_count)
static int sGetAccession(string &accession, unsigned int ¤t_col, const string &line, bool accver)
static string xgb_unparse(TTokenConstIt head, TTokenConstIt end_it)
TTokens::const_iterator TTokenConstIt
static CRef< CSeq_loc > xgbreplace_ver(bool &keep_rawPt, int &parenPt, TTokenIt ¤tPt, const TTokens &tokens, int &numErrors, const TSeqIdList &seq_ids, bool accver)
static void xgbload_number(TSeqPos &numPt, CInt_fuzz &fuzz, bool &keep_rawPt, TTokenIt ¤tPt, const TTokens &tokens, int &numErrors, int take_which)
void xinstall_gbparse_error_handler(X_gbparse_errfunc new_func)
const char * unkseqlitdbtag
void xinstall_gbparse_range_func(void *data, X_gbparse_rangefunc new_func)
static void xgbcheck_range(TSeqPos num, const CSeq_id &id, bool &keep_rawPt, int &numErrors, const TTokens &tokens, TTokenConstIt current)
TTokens::iterator TTokenIt
static unsigned advance_to(const char c, unsigned current_pos, const string &line)
static X_gbparse_errfunc Err_func
CRef< CSeq_loc > xgbparseint_ver(string_view raw_intervals, bool &keep_rawPt, int &numErrors, const TSeqIdList &seq_ids, bool accver)
static X_gbparse_rangefunc Range_func
#define ERR_FEATURE_LocationParsing_validatr
static size_t sParseAccessionPrefix(string_view accession)
Int4(* X_gbparse_rangefunc)(void *, const objects::CSeq_id &id)
void(* X_gbparse_errfunc)(string_view, string_view)
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