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/seq__loc__from__string_8cpp_source.html below:

NCBI C++ ToolKit: src/objects/seq/seq_loc_from_string.cpp Source File

53  class

CLexToken :

public CObject 56

CLexToken(

unsigned int

token_type) { m_TokenType = token_type; m_HasError =

false

; }

57  virtual

~CLexToken() {}

58  unsigned int

GetTokenType() {

return

m_TokenType; }

59  bool

HasError () {

return

m_HasError; }

61  virtual unsigned int

GetInt() {

return

0; }

62  virtual string

GetString() {

return ""

; }

81  unsigned int

m_TokenType;

85  typedef

vector< CRef<CLexToken> > TLexTokenArray;

87  bool

s_ParseLex (

string text

, TLexTokenArray &token_list);

89  class

CLexTokenString :

public

CLexToken

92

CLexTokenString (

string

token_data);

93  virtual

~CLexTokenString();

94  virtual string

GetString() {

return

m_TokenData; };

99

CLexTokenString::CLexTokenString(

string

token_data) : CLexToken (e_String)

101

m_TokenData = token_data;

104

CLexTokenString::~CLexTokenString()

108  class

CLexTokenInt :

public

CLexToken

111

CLexTokenInt (

unsigned int

token_data);

112  virtual

~CLexTokenInt ();

113  virtual unsigned int

GetInt() {

return

m_TokenData; };

115  unsigned int

m_TokenData;

118

CLexTokenInt::CLexTokenInt(

unsigned int

token_data) : CLexToken (e_Int)

120

m_TokenData = token_data;

123

CLexTokenInt::~CLexTokenInt()

127  class

CLexTokenAccession :

public

CLexToken {

129

CLexTokenAccession (

const string

&token_data);

130  virtual

~CLexTokenAccession();

131  virtual string

GetString(

void

) {

return

m_TokenData; };

136

CLexTokenAccession::CLexTokenAccession(

const string

&token_data )

137

: CLexToken(e_Accession), m_TokenData(token_data)

141

CLexTokenAccession::~CLexTokenAccession()

145  class

CLexTokenParenPair :

public

CLexToken

148

CLexTokenParenPair (

unsigned int

token_type,

string

between_text);

149  virtual

~CLexTokenParenPair();

156

TLexTokenArray m_TokenList;

159

CLexTokenParenPair::CLexTokenParenPair(

unsigned int

token_type,

string

between_text) : CLexToken (token_type)

162

m_HasError = ! s_ParseLex (between_text, m_TokenList);

165

CLexTokenParenPair::~CLexTokenParenPair()

171  CRef<CSeq_loc>

retval = ReadLocFromTokenList(m_TokenList,

id

, helper);

173  if

(m_TokenType == e_Complement) {

185  unsigned int

list_pos;

186

TLexTokenArray before_comma_list;

187

vector <unsigned int> comma_pos;

190  if

(token_list.size() < 1) {

195  for

(list_pos = 0; list_pos < token_list.size(); list_pos++) {

196  if

(token_list[list_pos]->GetTokenType() == CLexToken::e_Comma) {

197

comma_pos.push_back (list_pos);

201  if

(comma_pos.size() > 0) {

204  for

(

unsigned int

k = 0; k < comma_pos.size(); k++) {

205

before_comma_list.clear();

206  while

(list_pos < comma_pos[k]) {

207

before_comma_list.push_back (token_list[list_pos]);

210

add = ReadLocFromTokenList(before_comma_list,

id

, helper);

225

before_comma_list.clear();

226  while

(list_pos < token_list.size()) {

227

before_comma_list.push_back (token_list[list_pos]);

230

add = ReadLocFromTokenList(before_comma_list,

id

, helper);

240  switch

(token_list[0]->GetTokenType()) {

241  case

CLexToken::e_Accession:

242  id

=

new CSeq_id

( token_list[0]->GetString() );

243

token_list.erase( token_list.begin() );

245  case

CLexToken::e_Int:

246  if

(token_list.size() == 1) {

248

retval =

new CSeq_loc

(*

id

, token_list[0]->GetInt() - 1);

249

}

else if

(token_list[1]->GetTokenType() == CLexToken::e_DotDot) {

250  if

(token_list.size() < 3 || token_list[2]->GetTokenType() != CLexToken::e_Int) {

254  if

(token_list.size() > 4) {

258  if

(token_list.size() == 4 && token_list[3]->GetTokenType() != CLexToken::e_RightPartial) {

263

retval =

new CSeq_loc

(*

id

, token_list[0]->GetInt() - 1, token_list[2]->GetInt() - 1);

265  if

(retval && retval->

IsInt

() &&

273  if

(token_list.size() == 4) {

278  case

CLexToken::e_LeftPartial:

279  if

(token_list.size() < 2) {

282

}

else if

(token_list.size() == 2) {

284

retval =

new CSeq_loc

(*

id

, token_list[1]->GetInt() - 1);

286

}

else if

(token_list[2]->GetTokenType() == CLexToken::e_DotDot) {

287  if

(token_list.size() < 4 || token_list[3]->GetTokenType() != CLexToken::e_Int) {

291  if

(token_list.size() > 5) {

295  if

(token_list.size() == 5 && token_list[4]->GetTokenType() != CLexToken::e_RightPartial) {

300

retval =

new CSeq_loc

(*

id

, token_list[1]->GetInt() - 1, token_list[3]->GetInt() - 1);

302  if

(token_list.size() == 5) {

308  case

CLexToken::e_ParenPair:

309  case

CLexToken::e_Join:

310  case

CLexToken::e_Order:

311  case

CLexToken::e_Complement:

312  if

(token_list.size() > 1) {

316

retval = token_list[0]->GetLocation(

id

, helper);

318  case

CLexToken::e_String:

320  case

CLexToken::e_DotDot:

322  case

CLexToken::e_RightPartial:

324  case

CLexToken::e_Comma:

338  for

(pos = 0; pos <

str

.length(); pos++) {

339  if

(!

isspace

((

unsigned char

)

str

[pos]) && (

str

[pos] !=

'~'

)) {

347  size_t

s_GetParenLen (

string text

)

349

string::size_type

offset

= 0;

350  unsigned int

paren_count;

351

string::size_type next_quote;

360  while

(

offset

!=

text

.length() && paren_count > 0) {

371  if

(next_quote == string::npos) {

380  if

(paren_count > 0) {

387  bool

s_ParseLex (

string text

, TLexTokenArray &token_list)

391

string::size_type paren_len,

offset

= 0, end_pos;

406  if

(end_pos == string::npos) {

416  case '0'

:

case '1'

:

case '2'

:

case '3'

:

case '4'

:

417  case '5'

:

case '6'

:

case '7'

:

case '8'

:

case '9'

:

419  while

(end_pos <

text

.length() &&

isdigit

(

text

.c_str()[end_pos])) {

427

paren_len = s_GetParenLen(

text

.substr(

offset

));

428  if

(paren_len == 0) {

431

token_list.push_back (

CRef<CLexToken>

(

new

CLexTokenParenPair (CLexToken::e_ParenPair,

text

.substr(

offset

+ 1, paren_len - 2))));

432  if

(token_list[token_list.size() - 1]->HasError()) {

444

paren_len = s_GetParenLen(

text

.substr(

offset

));

445  if

(paren_len == 0) {

448

token_list.push_back (

CRef<CLexToken>

(

new

CLexTokenParenPair (CLexToken::e_Join,

text

.substr(

offset

+ 1, paren_len - 2))));

462

paren_len = s_GetParenLen(

text

.substr(

offset

));

463  if

(paren_len == 0) {

466

token_list.push_back (

CRef<CLexToken>

(

new

CLexTokenParenPair (CLexToken::e_Order,

text

.substr(

offset

+ 1, paren_len - 2))));

478

paren_len = s_GetParenLen(

text

.substr(

offset

));

479  if

(paren_len == 0) {

482

token_list.push_back (

CRef<CLexToken>

(

new

CLexTokenParenPair (CLexToken::e_Complement,

text

.substr(

offset

+ 1, paren_len - 2))));

490

token_list.push_back (

CRef<CLexToken>

(

new

CLexToken (CLexToken::e_DotDot)));

495

token_list.push_back (

CRef<CLexToken>

(

new

CLexToken (CLexToken::e_DotDot)));

502

token_list.push_back (

CRef<CLexToken>

(

new

CLexToken (CLexToken::e_RightPartial)));

506

token_list.push_back (

CRef<CLexToken>

(

new

CLexToken (CLexToken::e_LeftPartial)));

511

token_list.push_back (

CRef<CLexToken>

(

new

CLexToken (CLexToken::e_Comma)));

516

token_list.push_back (

CRef<CLexToken>

(

new

CLexToken (CLexToken::e_DotDot)));

528  while

(end_pos <

text

.length() &&

isupper

(

text

.c_str()[end_pos])) {

531  while

(end_pos <

text

.length() &&

isdigit

(

text

.c_str()[end_pos])) {

534  if

(

text

.c_str()[end_pos] ==

'.'

) {

536  while

(end_pos <

text

.length() &&

isdigit

(

text

.c_str()[end_pos])) {

540  if

(

text

.c_str()[end_pos] !=

':'

) {

583

TLexTokenArray token_list;

591  if

(s_ParseLex (

text

, token_list)) {

592

retval = CLexTokenParenPair::ReadLocFromTokenList (token_list, this_id, helper);

@ eExtreme_Positional

numerical value

User-defined methods of the data storage class.

virtual CRef< CSeq_loc > Seq_loc_Add(const CSeq_loc &loc1, const CSeq_loc &loc2, CSeq_loc::TOpFlags flags)

virtual ~CGetSeqLocFromStringHelper(void)

virtual CRef< CSeq_loc > GetRevComplement(const CSeq_loc &loc)

Wraps up any functionality needed that might be outside the scope of this library.

The NCBI C++ standard methods for dealing with std::string.

static string s_RemoveWhiteSpace(string str)

static const char * str(char *buf, int n)

unsigned int TSeqPos

Type for sequence locations and lengths.

void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)

virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)

Optimized implementation of CSerialObject::Assign, which is not so efficient.

virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)

Override Assign() to incorporate cache invalidation.

void Add(const CSeq_loc &other)

Simple adding of seq-locs.

void SetPartialStart(bool val, ESeqLocExtremes ext)

set / remove e_Lim fuzz on start or stop (lt/gt - indicating partial interval)

void SetStrand(ENa_strand strand)

Set the strand for all of the location's ranges.

void SetPartialStop(bool val, ESeqLocExtremes ext)

void Reset(void)

Reset reference object.

#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 int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)

Convert string to int.

static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)

Check if a string is blank (has no text).

static SIZE_TYPE Find(const CTempString str, const CTempString pattern, ECase use_case=eCase, EDirection direction=eForwardSearch, SIZE_TYPE occurrence=0)

Find the pattern in the 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 EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)

Case-insensitive equality of a substring with another string.

static bool Equal(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)

Test for equality of a substring with another string.

TFrom GetFrom(void) const

Get the From member data.

E_Choice Which(void) const

Which variant is currently selected.

TTo GetTo(void) const

Get the To member data.

bool IsInt(void) const

Check if variant Int is selected.

const TInt & GetInt(void) const

Get the variant data.

@ e_not_set

No variant selected.

static void text(MDB_val *v)

void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)

CRef< CSeq_loc > GetSeqLocFromString(const string &text, const CSeq_id *id, CGetSeqLocFromStringHelper *helper)

CSeq_loc * GetReverseComplement(const CSeq_loc &loc, CReverseComplementHelper *helper)

Get reverse complement of the seq-loc (?).


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