A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/xgbparint_8cpp_source.html below:

NCBI C++ ToolKit: src/objtools/flatfile/xgbparint.cpp Source File

47 #define THIS_FILE "xgbparint.cpp" 95 #define ERR_FEATURE_LocationParsing_validatr 1, 5 127  for

(

auto

it =

head

; it != end_it; ++it) {

128  switch

(it->choice) {

133

temp +=

"complement"

;

202  if

(current != end(tokens))

252  if

(tokens.size() == 1) {

255  auto

current_it = begin(tokens);

257  for

(

auto

scanner_it =

next

(current_it);

258

scanner_it != end(tokens);

262  if

(scanner_it != end(tokens) &&

271  for

(

auto

current_it = begin(tokens);

272

current_it != end(tokens);

276  auto

scanner_it =

next

(current_it);

277  if

(scanner_it != end(tokens)) {

280  while

(scanner_it != end(tokens)) {

283  if

(scanner_it != end(tokens) &&

301  unsigned int

current_col)

303  string

temp_string = line.substr(0, current_col + 1) +

" "

;

308 static unsigned advance_to

(

const char

c,

unsigned

current_pos,

const string

& line)

310  int

pos = current_pos;

311  while

(pos < line.size()) {

312  if

(line[pos] == c) {

323  if

(accession.empty()) {

327  auto

IsAlpha = [](

char

c) {

return isalpha

(c); };

329  auto

it = find_if_not(begin(accession),

334  if

(it == end(accession)) {

338  auto

prefix_length = distance(begin(accession), it);

340  if

(prefix_length != 2) {

344

it = find_if_not(it, end(accession), IsAlpha);

345  if

(it == end(accession)) {

348

prefix_length = distance(begin(accession), it);

349  if

(prefix_length == 3 || prefix_length == 7) {

350  return

prefix_length;

353

}

else if

(accession.size() >= 3 &&

356

accession[2] ==

'S'

) {

360  if

(prefix_length == 1 ||

361

prefix_length == 2 ||

362

prefix_length == 4 ||

363

prefix_length == 6) {

364  return

prefix_length;

371 static int sGetAccession

(

string

& accession,

unsigned int

& current_col,

const string

& line,

bool

accver)

373  const auto

length = line.size();

374

string_view tempString(line.c_str() + current_col, length - current_col);

376  size_t

accessionLength = prefixLength;

378

tempString = tempString.substr(prefixLength);

379  auto

notDigitPos = tempString.find_first_not_of(

"0123456789"

);

380  if

(notDigitPos != string_view::npos) {

381

accessionLength += notDigitPos;

382  if

(accver && tempString[notDigitPos] ==

'.'

) {

384  if

(tempString.size() > notDigitPos) {

385

tempString = tempString.substr(notDigitPos + 1);

386

notDigitPos = tempString.find_first_not_of(

"0123456789"

);

387  if

(notDigitPos != string_view::npos) {

388

accessionLength += notDigitPos;

393

accessionLength = length - current_col;

397  if

(notDigitPos == string_view::npos || tempString[notDigitPos] !=

':'

) {

403

accession =

string

(line.c_str() + current_col, accessionLength);

404

current_col += accessionLength;

415  if

(! linein.empty()) {

416  string

line{ linein };

418  auto

length = line.size();

419  unsigned

current_col = 0;

421  while

(current_col < length) {

423  if

(

isspace

(line[current_col]) || line[current_col] ==

'~'

) {

429  if

(

isdigit

(line[current_col])) {

431

string_view tempString(line.c_str() + current_col,

size_t

(length - current_col));

432  auto

not_digit_pos = tempString.find_first_not_of(

"0123456789"

);

433  auto

num_digits = (not_digit_pos == string_view::npos) ?

size_t

(length - current_col) : not_digit_pos;

434

current_token.

data

=

string

(line.c_str() + current_col, num_digits);

435

tokens.push_back(current_token);

436

current_col += num_digits;

440  bool

skip_new_token =

false

;

441  switch

(line[current_col]) {

444  if

(

auto

closing_quote_pos = line.find(

'\"'

, current_col + 1);

445

closing_quote_pos == string::npos) {

449  size_t len

= closing_quote_pos - current_col + 1;

450

current_token.

data

=

string

(line.c_str() + current_col,

len

);

462

current_col =

advance_to

(

'('

, current_col, line);

478

current_col =

advance_to

(

'('

, current_col, line);

497

current_col =

advance_to

(

'('

, current_col, line);

508

(current_col < length - 3) &&

509

(line[current_col + 3] ==

'('

||

510

line[current_col + 3] ==

' '

||

511

line[current_col + 3] ==

'\t'

||

512

line[current_col + 3] ==

'\0'

)) {

514

current_token.

data

=

"gap"

;

517

tokens.push_back(current_token);

528  for

(;

isdigit

(line[current_col]); current_col++)

536

current_col =

advance_to

(

'('

, current_col, line);

550

current_col =

advance_to

(

'('

, current_col, line);

564

skip_new_token =

true

;

576  if

(current_col < length - 1 && line[current_col + 1] ==

's'

) {

579

tokens.push_back(current_token);

583  if

(current_col < length - 1) {

584  if

(line[current_col + 1] ==

')'

) {

589

tokens.push_back(current_token);

591

tokens.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) {

679

tokens.push_back(current_token);

691  if

(current_token != end(tokens)) {

695  if

(current_token == end(tokens)) {

697  const string

par_msg =

"mismatched parentheses ("

+ to_string(paren_count) +

")"

;

715  if

(current_token != end(tokens)) {

748

interval.

SetTo

(range - 1);

752  id

.SetGeneral().SetTag().SetId(0);

760  auto

it =

next

(current_it);

778  auto

gapsize_it = it++;

788

current_it =

next

(it);

813  bool

strange_sin_dot =

false

;

814  auto

end_it = end(tokens);

831

strange_sin_dot =

true

;

871  if

(! strange_sin_dot) {

872  if

(currentPt == end_it) {

880

numPt =

fta_atoi

(currentPt->data.c_str()) - 1;

893  if

(num_found != 1) {

901  bool

one_of_ok =

true

;

902  bool

at_end_one_of =

false

;

912

numPt =

fta_atoi

(currentPt->data.c_str()) - 1;

918  while

(one_of_ok && ! at_end_one_of && currentPt != end_it) {

919  switch

(currentPt->choice) {

929

at_end_one_of =

true

;

934  if

(! one_of_ok && ! at_end_one_of) {

935  while

(! at_end_one_of && currentPt != end_it) {

937

at_end_one_of =

true

;

973  auto

end_it = end(tokens);

976  if

(accver && currentPt->data.find(

'.'

) >= currentPt->data.size() - 1) {

982

new_id =

Ref

(

new CSeq_id

(currentPt->data));

985  if

(currentPt == end_it) {

995

}

else if

(! seq_ids.empty()) {

997

new_id->

Assign

(*(*seq_ids.begin()));

1005  if

(currentPt == end_it) {

1016  switch

(currentPt->choice) {

1050

ret->SetInt().SetFuzz_from(*new_fuzz);

1052

ret->SetInt().SetId(*new_id);

1054  xgbload_number

(ret->SetInt().SetFrom(), ret->SetInt().SetFuzz_from(), keep_rawPt, currentPt, tokens, numErrors,

TAKE_FIRST

);

1057

ret->SetInt().ResetFuzz_from();

1059  xgbcheck_range

(ret->GetInt().GetFrom(), *new_id, keep_rawPt, numErrors, tokens, currentPt);

1065  if

(currentPt != end_it) {

1066  bool

in_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

);

1140

ret->SetInt().ResetFuzz_to();

1142  xgbcheck_range

(ret->GetInt().GetTo(), *new_id, keep_rawPt, numErrors, tokens, currentPt);

1149  TSeqPos

to = ret->GetInt().GetTo();

1153  if

(point.

GetPoint

() + 1 == to) {

1156

point.

SetFuzz

().SetRange().SetMax(to);

1162

ret->GetInt().GetFrom() == ret->GetInt().GetTo() &&

1163

! ret->GetInt().IsSetFuzz_from() &&

1164

! ret->GetInt().IsSetFuzz_to()) {

1195  bool

add_nulls =

false

;

1196  auto

current_token = currentPt;

1197  bool

did_complement =

false

;

1199  auto

end_it = end(tokens);

1204  switch

(current_token->choice) {

1207  if

(currentPt == end_it) {

1222  if

(currentPt == end_it) {

1235

retval =

xgbloc_ver

(keep_rawPt, parenPt, currentPt, tokens, numErrors, seq_ids, accver);

1240

did_complement =

true

;

1241  if

(currentPt != end_it) {

1297  xgbgap

(currentPt, end_it, retval,

false

);

1300  xgbgap

(currentPt, end_it, retval,

true

);

1310

retval =

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

())

1377

retval->

SetMix

().AddSeqLoc(*next_loc);

1379

retval->

SetEquiv

().Add(*next_loc);

1391  if

(retval->

IsMix

())

1392

retval->

SetMix

().AddSeqLoc(*null_loc);

1394

retval->

SetEquiv

().Add(*null_loc);

1404  if

(currentPt == end_it) {

1425

retval->

SetWhole

().Assign(*(*seq_ids.begin()));

1442

ret =

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"

,

1472

keep_rawPt =

false

;

1477  if

(tokens.empty()) {

1489  auto

head_token = tokens.begin();

1490  auto

current_token = head_token;

1491  auto

end_it = tokens.end();

1493  int

paren_count = 0;

1497  if

(current_token != end_it) {

1498  switch

(current_token->choice) {

1504

ret =

xgbloc_ver

(keep_rawPt, paren_count, current_token, tokens, numErrors, seq_ids, accver);

1521  xgbparse_error

(

"illegal initial token"

, tokens, current_token);

1537

ret =

xgbint_ver

(keep_rawPt, current_token, tokens, numErrors, seq_ids, accver);

1543

ret =

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 &currentPt, 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 &currentPt, 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 &current_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 &current_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 &currentPt, const TTokens &tokens, int &numErrors, const TSeqIdList &seq_ids, bool accver)

static void xgbload_number(TSeqPos &numPt, CInt_fuzz &fuzz, bool &keep_rawPt, TTokenIt &currentPt, 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