vector<string>
dummy;
105 while(!istr.eof()) {
109 if(str_line.empty())
111 stringdb_name, db_string;
116 if(db_string.size() > 1 && db_string[0] ==
'n'&& (db_string[1] ==
't'|| db_string[1] ==
'r')) {
118mru_dbs.push_back(db_name);
133 if(notn->
GetJobID() != m_JobId)
return;
155CNetBlastLoadDBListJob(
const string& dir,
const string& dbtree);
156~CNetBlastLoadDBListJob() {}
158 typedefunordered_map<string, string> TDbMap;
162 virtualEJobState
Run();
172 voidx_SaveBlastDataBases(
const string&
md5);
202 ERR_POST(
"CBLASTDatabases::Load() - Failed to start BLAST DBs loading job");
212CNetBlastLoadDBListJob::CNetBlastLoadDBListJob(
const string& dir,
const string& dbtree)
213: m_Dir(dir), m_DBTreePath(dbtree)
232 stringCNetBlastLoadDBListJob::GetDescr()
const 234 return "Load BLAST DB list job";
244ex_md5_req->Add(
string(
"REQUEST"),
string(
"INFO/BLAST-DBS-EX-MD5DIGEST") );
245protocol_info_reply =
client.AskGet_protocol_info( *ex_md5_req );
248 if(!md5_param.
Empty() && md5_param->GetValue().IsString())
249 md5= md5_param->GetValue().GetString();
254 stringerr_msg, logMsg =
"Exception in CNetBlastLoadDBListJob: ";
264 CFilemd5file(md5path);
265 if(md5file.Exists()) {
270 LOG_POST(
Error<<
"CNetBlastLoadDBListJob. Failed to load blast databases checksum: "<< e.
GetMsg());
278 if(!cached_md5.empty() && cached_md5 ==
md5) {
281 if(nuclFile.Exists() && protFile.Exists())
290x_CategorizeDBs(dbs);
297x_SaveBlastDataBases(
md5);
301err_msg = logMsg + e.
GetMsg();
302}
catch(
conststd::exception& e) {
303err_msg = logMsg + e.what();
309 if(!err_msg.empty()) {
318 static void s_SaveDbMap(
const string& path,
constCNetBlastLoadDBListJob::TDbMap& dbmap)
322 ITERATE(CNetBlastLoadDBListJob::TDbMap, it, dbmap) {
323 string first= it->first, second = it->second;
330 voidCNetBlastLoadDBListJob::x_SaveBlastDataBases(
const string&
md5)
332 if(
md5.empty() || m_NucDbMap.empty())
334 LOG_POST(
Info<<
"Net BLAST Data Source - saving blast databases...");
343 LOG_POST(
Info<<
"Net BLAST Data Source - finished saving blast databases");
345 LOG_POST(
Info<<
"Net BLAST Data Source - failed to save databases - "<< e.
GetMsg());
364fields.push_back(*it);
374 LOG_POST(
Info<<
"CNetBlastLoadDBListJob.s_GetDBTree()"<<
": "<<
sw.
Elapsed() <<
" seconds");
381list<CConstRef<CUser_field> > fields;
390 typedefunordered_map<string, pair<bool, string> > TValidDbNames;
391TValidDbNames valid_db_names(db_data.size());
401 const string& db_name =
info.GetDatabase().GetName();
407 string label, db_name, desc;
412 label=
f.GetLabel().GetStr();
413db_name =
f.GetField(
"Db").GetData().GetStr();
416desc.append(
f.GetField(
"Descr").GetData().GetStr());
418TValidDbNames::const_iterator dbname_iter = valid_db_names.find(db_name);
420 if(dbname_iter == valid_db_names.end()) {
426categorized_dbs.
insert(db_name);
427TDbMap& db = dbname_iter->second.first ? m_ProtDbMap : m_NucDbMap;
444string::size_type pos = db_desc.find_first_not_of(
"\"'");
445 if(pos != string::npos) {
446db_desc.erase(0, pos);
448pos = db_desc.find_last_not_of(
"\"'");
449 if(pos != string::npos) {
451 if(pos < db_desc.size()) {
467 stringname, visible_name;
468 stringdb_desc, tax_label;
469 stringorg_name_label =
"organism_label";
472 stringvisual_priority_label =
"interface_priority";
477m_NucDbMap.reserve(db_data.size());
496 const string& db_name =
info.GetDatabase().GetName();
498 if(!(db_name ==
"nr"|| db_name ==
"nt"))
500db_desc =
info.GetDescription();
503visible_name = db_name;
504 if( ! db_desc.empty() && db_name.find(db_desc) == string::npos) {
505name +=
" ("+ db_desc +
")";
506 stringdb_desc_trimmed(db_desc);
507visible_name +=
" ("+ db_desc_trimmed +
")";
509visible_name =
string(
" ") + visible_name;
511 if(db_name ==
"nr") {
514TDbMap& db =
prot? m_ProtDbMap : m_NucDbMap;
522x_AddCategorizedDBs(dbs, categorized_dbs);
525 stringdb_desc_trimmed;
537 const string& db_name =
info->GetDatabase().GetName();
539 if(db_name ==
"nr"|| db_name ==
"nt")
541 if(categorized_dbs.
find(db_name) != categorized_dbs.
end())
544db_desc =
info->GetDescription();
547visible_name = db_name;
550 if( ! db_desc.empty() && db_name.find(db_desc) == string::npos) {
552name.append(db_desc);
554db_desc_trimmed = db_desc;
555visible_name.append(
" (");
556visible_name.append(db_desc_trimmed);
557visible_name.append(
")");
562TDbMap& db = m_NucDbMap;
564 if(tax_id == 9606 || tax_id == 10090) {
572vector<string> word_split_vec;
576 if( (*it)->CanGetExtended() ) {
578list< CRef< CBlast4_parameter > >::const_iterator pit = ext.
Get().begin();
579 for(; pit != ext.
Get().end(); pit++) {
580prop_name = (*pit)->GetName();
581 if(prop_name == org_name_label) {
582 if( (*pit)->CanGetValue() ){
588 if(prop_name == visual_priority_label) {
589 if( (*pit)->CanGetValue() ){
593 if(vp > 0 && s.empty()) {
605 if( tax_label.empty() ){
606 ERR_POST(
Warning<<
"BLAST database without tax name:"<< visible_name);
607tax_label = tax_cache.
GetLabel(tax_id);
638 if(tax_label.empty()) {
642 if(word_split_vec.size() > 2) {
643s.append(word_split_vec[0]);
645s.append(word_split_vec[1]);
651s.append(
"( taxid: ");
654s.append(visible_name);
673 ERR_POST(
Info<<
"x_CategorizeBD() takes "<< watch.AsSmartString() );
DEFINE_STATIC_MUTEX(s_Mutex)
void s_GetDBTree(const string &file, list< CConstRef< CUser_field > > &fields)
static const char * kBlastDbDataProt
static void s_SaveDbMap(const string &path, const CNetBlastLoadDBListJob::TDbMap &dbmap)
static void s_GetBlastDbMd5(CBlast4Client &client, string &md5)
static const CCompressStream::EMethod kDbDataCompressMethod
static const char * kBlastDbDataNucl
static const char * kBlastDbDataMD5
static void sPrepareDBDescr(string &db_desc)
User-defined methods of the data storage class.
CAppJobError Default implementation for IAppJobError - encapsulates a text error message.
CAppJobNotification Notification send by CAppJobEventTranslator.
void x_UpdateDbMap(bool nuc)
void x_OnJobNotification(CEvent *evt)
static CBLASTDatabases & GetInstance()
vector< string > m_Prot_DefMRU_DBs
const TDbMap & GetDbMap(bool nuc)
void Load(const char *path, const char *dbtree)
vector< string > m_Nuc_DefMRU_DBs
const vector< string > & GetDefaultMRU_DBs(bool nuc_db)
std::unordered_map< string, string > TDbMap
CBlast4_database_info â.
CBlast4_get_databases_ex_request â.
CBlast4_get_protocol_info_request â.
CEvent - generic event implementation TODO TODO - Attachments.
Base class to build jobs with cancel functionality.
static CTaxonCache & GetInstance()
string GetLabel(int tax_id)
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
const_iterator end() const
std::ofstream out("events_result.xml")
main entry point for tests
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static void md5(const char *src, const char *out)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
EMethod
Compression/decompression methods.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#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)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string & GetMsg(void) const
Get message string.
void Warning(CExceptionArgs_Base &args)
string ReportAll(TDiagPostFlags flags=eDPF_Exception) const
Report all exceptions.
void Info(CExceptionArgs_Base &args)
static string ConcatPath(const string &first, const string &second)
Concatenate two parts of the path for the current OS.
virtual CConstIRef< IAppJobProgress > GetProgress()=0
return progress object, the function shall be synchronized internally.
static CAppJobDispatcher & GetInstance()
virtual CConstIRef< IAppJobError > GetError()=0
Returns IAppJobError object describing internal error that caused the Job to fail.
virtual CRef< CObject > GetResult()=0
Returns the Job Result.
EJobState
Job states (describe FSM)
TJobID StartJob(IAppJob &job, const string &engine_name, IEngineParams *params=NULL)
Starts a Job on the specified engine in "passive mode" - no notifications or progress reports will be...
virtual string GetDescr() const =0
Returns a human readable description of the Job (optional)
#define ON_EVENT(type, id, handler)
virtual EJobState Run()=0
Function that does all the useful work, called by the Engine.
#define END_EVENT_MAP()
Ends definition of Command Map.
#define BEGIN_EVENT_MAP(thisClass, baseClass)
Begins definition of Command Map for CEventHandler-derived class.
TJobState GetState() const
#define MSerial_AsnText
I/O stream manipulators â.
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.
CNcbiIstream & NcbiGetlineEOL(CNcbiIstream &is, string &str, string::size_type *count=NULL)
Read from "is" to "str" the next line (taking into account platform specifics of End-of-Line)
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
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 void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string (in-place)
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
static string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
@ eTrunc_End
Truncate trailing whitespace only.
void Run(void)
Enter the main loop.
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
void Start(void)
Start the timer.
@ eStart
Start timer immediately after creating.
static const char label[]
bool IsInteger(void) const
Check if variant Integer is selected.
TInteger GetInteger(void) const
Get the variant data.
const Tdata & Get(void) const
Get the member data.
const TString & GetString(void) const
Get the variant data.
list< CRef< CBlast4_database_info > > Tdata
bool IsString(void) const
Check if variant String is selected.
@ eBlast4_residue_type_protein
const TData & GetData(void) const
Get the Data member data.
const TFields & GetFields(void) const
Get the variant data.
vector< CRef< CUser_field > > TFields
double value_type
The numeric datatype used by the parser.
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
std::istream & in(std::istream &in_, double &x_)
@ eCanceled
Request canceled.
Declares the CRemoteBlast class.
static CNamedPipeClient * client
C++ I/O stream wrappers to compress/decompress data on-the-fly.
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