50 #define NCBI_USE_ERRCODE_X Objects_ProtRef
92 #include "ecnum_ambiguous.inc"
93 #include "ecnum_deleted.inc"
94 #include "ecnum_replaced.inc"
95 #include "ecnum_specific.inc"
102 if (tab_pos ==
NPOS) {
104 <<
"; disregarding");
106 string lhs(line.
substr(0, tab_pos)), rhs(line.
substr(tab_pos + 1));
112 if (tab_pos ==
NPOS) {
115 string lhs(line.
substr(0, tab_pos));
123 const char*
const *fallback,
124 size_t fallback_count,
130 if ( !dir.empty() ) {
137 if (getenv(
"NCBI_DEBUG")) {
138 LOG_POST(
"Reading " + name +
" EC number data from built-in table");
140 while (fallback_count--) {
144 if (getenv(
"NCBI_DEBUG")) {
145 LOG_POST(
"Reading " + name +
" EC number data from " +
file);
151 }
while ( !lr->
AtEOF() );
164 const char* env_val =
NULL;
165 env_val = getenv(
"NCBI_ECNUM_USE_DATA_DIR_FIRST");
169 if ( !
file.empty() ) {
173 LOG_POST(
"s_InitializeECNumberMaps: reading specific EC Numbers from built-in data.");
175 LOG_POST(
"s_InitializeECNumberMaps: reading specific EC Numbers from " +
file);
178 #define LOAD_EC(x) s_LoadECNumberTable \
179 (dir, #x, kECNum_##x, sizeof(kECNum_##x) / sizeof(*kECNum_##x), \
233 if (
NStr::Find(replacement,
"\t") != string::npos) {
280 if (is_ambig)
return false;
283 }
else if (ch ==
'-') {
288 }
else if (ch ==
'n') {
289 if (numperiods == 3 && numdigits == 0 &&
isdigit(*(ptr + 1))) {
297 }
else if (ch ==
'.') {
299 if (numdigits > 0 && numdashes > 0)
return false;
300 if (numdigits == 0 && numdashes == 0)
return false;
301 if (numdashes > 1)
return false;
312 if (numperiods == 3) {
313 if (numdigits > 0 && numdashes > 0)
return false;
314 if (numdigits > 0 || numdashes == 1)
return true;
326 CProt_ref::TEc::iterator it =
SetEc().begin();
327 while (it !=
SetEc().end()) {
346 CProt_ref::TEc::iterator it =
SetEc().begin();
347 while (it !=
SetEc().end()) {
352 it =
SetEc().erase(it);
static bool s_ECNumberMapsInitialized
map< string, CProt_ref::EECNumberStatus, PNocase > TECNumberStatusMap
static CProt_ref::EECNumberFileStatus s_ECNumAmbiguousStatus
static void s_ProcessECNumberLine(const CTempString &line, CProt_ref::EECNumberStatus status)
static CProt_ref::EECNumberFileStatus s_ECNumSpecificStatus
static CProt_ref::EECNumberFileStatus s_ECNumDeletedStatus
DEFINE_STATIC_FAST_MUTEX(s_ECNumberMutex)
static CProt_ref::EECNumberFileStatus s_ECNumReplacedStatus
map< string, string > TECNumberReplacementMap
static CProt_ref::EECNumberFileStatus s_LoadECNumberTable(const string &dir, const string &name, const char *const *fallback, size_t fallback_count, CProt_ref::EECNumberStatus status)
static TECNumberReplacementMap s_ECNumberReplacementMap
static void s_InitializeECNumberMaps(void)
static TECNumberStatusMap s_ECNumberStatusMap
static EECNumberFileStatus GetECNumAmbiguousStatus()
static EECNumberFileStatus GetECNumSpecificStatus()
EECNumberFileStatus
Enzyme Commission file status.
@ eECFile_not_found
File was not found in expected directory.
@ eECFile_not_attempted
No attempt has been made to read the file.
@ eECFile_not_read
File was found but could not be read.
@ eECFile_read
File was read successfully (and is being instead of the compiled fallback data.
void GetLabel(string *label) const
static bool IsECNumberSplit(const string &old_ecno)
static bool IsValidECNumberFormat(const string &ecno)
Verify correct form of EC number.
static const string & GetECNumberReplacement(const string &old_ecno)
Return a replaced EC number's replacement.
static EECNumberFileStatus GetECNumDeletedStatus()
EECNumberStatus
Enzyme Commission number status.
@ eEC_replaced
Obsolete synonym for some other EC number.
@ eEC_unknown
Unrecognized; possibly malformed.
@ eEC_deleted
Withdrawn, with no (single?) replacement.
static EECNumberFileStatus GetECNumReplacedStatus()
static EECNumberStatus GetECNumberStatus(const string &ecno)
Determine an EC number's validity and specificity.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
container_type::const_iterator const_iterator
const_iterator end() const
const_iterator find(const key_type &key) const
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Warning(CExceptionArgs_Base &args)
static string MakePath(const string &dir=kEmptyStr, const string &base=kEmptyStr, const string &ext=kEmptyStr)
Assemble a path from basic components.
static string AddTrailingPathSeparator(const string &path)
Add trailing path separator, if needed.
static CRef< ILineReader > New(const string &filename)
Return a new ILineReader object corresponding to the given filename, taking "-" (but not "....
virtual bool AtEOF(void) const =0
Indicates (negatively) whether there is any more input.
void Reset(void)
Reset reference object.
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
NCBI_NS_STD::string::size_type SIZE_TYPE
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.
CTempString substr(size_type pos) const
Obtain a substring from this string, beginning at a given offset.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another 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...
static const char label[]
bool IsSetDesc(void) const
description (instead of name) Check if a value has been assigned to Desc data member.
const TDb & GetDb(void) const
Get the Db member data.
TEc & SetEc(void)
Assign a value to Ec data member.
const TName & GetName(void) const
Get the Name member data.
bool IsSetDb(void) const
ids in other dbases Check if a value has been assigned to Db data member.
bool IsSetEc(void) const
E.C.
bool IsSetName(void) const
protein name Check if a value has been assigned to Name data member.
const TDesc & GetDesc(void) const
Get the Desc member data.
void ResetEc(void)
Reset Ec data member.
Definition of all error codes used in objects libraries.
Lightweight interface for getting lines of data with minimal memory copying.
constexpr bool empty(list< Ts... >) noexcept
Multi-threading – mutexes; rw-locks; semaphore.
string g_FindDataFile(const CTempString &name, CDirEntry::EType type=CDirEntry::eFile)
Look for an NCBI application data file or directory of the given name and type; in general,...