}
catch(std::exception& ex) {
58 LOG_POST(
Error<<
"Exception in CTaxonCache::CTaxonCache() : "<< ex.what());
67}
catch(std::exception& ex) {
68 LOG_POST(
Error<<
"Exception in CTaxonCache::~CTaxonCache() : "<< ex.what());
78 for(
auto&tax_it :
m_Map) {
79ostr << tax_it.first <<
'\t'<< tax_it.second.Label <<
'\t'<< tax_it.second.TaxName <<
'\t'<< tax_it.second.CommonName <<
'\t'<< tax_it.second.BlastName <<
'\n';
89 stringstr_id,
label;
91 while( !line_reader->
AtEOF() ) {
108 m_Map[tax_id] = tax_info;
129vector<int> to_initialize;
130 ITERATE(vector<int>, it, tax_ids) {
132to_initialize.push_back(*it);
135 if(to_initialize.empty())
142 ITERATE(vector<int>, it, to_initialize) {
143 boolis_species =
false;
144 boolis_uncultured =
false;
151org_ref->GetLabel(&tax_info.
Label);
152 if(org_ref->CanGetTaxname())
153tax_info.
TaxName= org_ref->GetTaxname();
154 if(org_ref->CanGetCommon())
158 m_Map[*it] = tax_info;
162 catch(
constexception& ex) {
163 LOG_POST(
Error<<
"CTaxonCache::Initialize: "<< ex.what());
178 if(conn_res !=
true) {
186 boolis_species =
false;
187 boolis_uncultured =
false;
194org_ref->GetLabel(&tax_info.
Label);
195 if(org_ref->CanGetTaxname())
196tax_info.
TaxName= org_ref->GetTaxname();
197 if(org_ref->CanGetCommon())
201 m_Map[tax_id] = tax_info;
213 catch(
constexception& ex) {
220 catch(
constexception& ex)
222 LOG_POST(
Error<<
"Second try of CTaxonCache::GetLabel: "<< ex.what());
236 returnit->second.Label;
246 returnit->second.TaxName;
256 returnit->second.CommonName;
266 returnit->second.BlastName;
CConstRef< COrg_ref > GetOrgRef(TTaxId tax_id, bool &is_species, bool &is_uncultured, string &blast_name, bool *is_specified=NULL)
void Initialize(const vector< int > &tax_ids)
void ResetConnection()
Drop connection to NCBI taxon service.
static void InitStorage(const char *cache_path)
TMap::const_iterator x_GetItem(int tax_id)
string GetTaxname(int tax_id)
static CTaxonCache & GetInstance()
string GetCommon(int tax_id)
string GetLabel(int tax_id)
void x_QueryTaxonService(int tax_id)
string GetBlastName(int tax_id)
void x_SaveTaxonCache() const
unique_ptr< objects::CTaxon1 > m_TaxonClient
static string m_CachePath
container_type::const_iterator const_iterator
const_iterator end() const
const_iterator find(const key_type &key) const
static const char *const strings[]
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define TAX_ID_FROM(T, value)
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
void Info(CExceptionArgs_Base &args)
CTempString GetCurrentLine(void) const
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.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
static int StringToInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to int.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static const char label[]
Lightweight interface for getting lines of data with minimal memory copying.
Multi-threading â mutexes; rw-locks; semaphore.
DEFINE_STATIC_MUTEX(s_Mutex)
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