(
const auto& pPub :
arr) {
77 returnpPub->GetPmid().Get();
83 static bools_IsConnectionFailure(
EPubmedErrorerrorVal)
100 intmaxCount =
max(1, maxAttempts);
108 boolisConnectionError = s_IsConnectionFailure(errorVal);
109 if(isConnectionError &&
count< maxCount - 1) {
113std::ostringstream oss;
114oss <<
"Failed to retrieve publication for PMID " 117 if(isConnectionError) {
118oss <<
count+ 1 <<
" attempts made. ";
120oss <<
"Pubmed error: "<< errorVal;
121 string msg= oss.str();
122 if(pMessageListener) {
152 const STimeouttimeout = { seconds, 0 };
183std::ostringstream os;
186 if(reply.
Empty()) {
196reply =
result->SetReply().front();
197 if(reply->
IsError() && f_logger) {
198 const string& error_message =
203f_logger(error_message);
226vector<string> keys(
n);
227vector<CRef<CT3Reply>*> cache_refs(
n);
229 for(
size_t i= 0;
i<
n; ++
i) {
230std::ostringstream os;
232keys[
i] = os.str();
234cache_refs[
i] = &reply;
239to_ask[keys[
i]] = make_pair(
query[
i], &reply);
242 if( !to_ask.
empty() ) {
245 for(
const auto& it : to_ask ) {
246to_ask_vec.push_back(it.second);
248 size_tm = to_ask_vec.size();
250 auto& requests = whole_request.
SetRequest();
251 for(
auto& it : to_ask_vec ) {
253rq->SetOrg(*it.first);
254requests.push_back(rq);
260 auto& replies = whole_reply->SetReply();
261 if( replies.size() != m ) {
264 const string& error_message =
268logger(error_message);
274 for(
auto& reply : replies ) {
275 auto& ask = to_ask_vec[
i++];
277 if(reply->IsError() && logger) {
278 auto& in_org = *ask.first;
279 const string& error_message =
282reply->GetError().GetMessage();
284logger(error_message);
285}
else if(reply->IsData() && reply->SetData().IsSetOrg()) {
286reply->SetData().SetOrg().ResetSyn();
294 for(
size_t i= 0;
i<
n; ++
i) {
295 result->SetReply().push_back(*cache_refs[
i]);
299 for(
const auto& it :
query) {
316 if(! (pub && pub->IsMedline())) {
323 if(! pub->GetMedline().IsSetCit()) {
343 arr.push_back(new_pmid);
344 arr.push_back(new_pub);
368copied->Assign(*res);
375 if(cfg.
HasEntry(
"RemoteTaxonomyUpdate")) {
376 const stringsect =
"RemoteTaxonomyUpdate";
377 intdelay = cfg.
GetInt(sect,
"RetryDelay", 20);
383 boolexponential = cfg.
GetBool(sect,
"RetryExponentially",
false);
396 if(cfg.
HasEntry(
"RemotePubmedUpdate")) {
397 const stringsect =
"RemotePubmedUpdate";
403 if(cfg.
HasEntry(sect,
"UseCache")) {
415 if(desc.
IsOrg()) {
435std::lock_guard<std::mutex> guard(
m_Mutex);
456m_pMessageListener(pMessageListener)
459 m_logger= [
this](
const string& error_message) {
477m_pMessageListener(pMessageListener), m_pm_normalize(norm)
483m_taxon(logger), m_pubmed(
nullptr, norm)
488m_taxon(pMessageListener), m_pubmed(pMessageListener, norm)
498std::lock_guard<std::mutex> guard(
m_Mutex);
507std::lock_guard<std::mutex> guard(
m_Mutex);
531 for(
auto& it : submit->
SetData().SetEntrys()) {
547 if(entry.
IsSet()) {
561std::lock_guard<std::mutex> guard(
m_Mutex);
563 for(
auto& pDesc : seq_descr.
Set()) {
564 if(! pDesc->IsPub() || ! pDesc->GetPub().IsSetPub()) {
568 auto&
arr= pDesc->SetPub().SetPub().Set();
589 for(
const auto& pPub :
arr) {
590 if(pPub->IsArticle()) {
609 void_UpdateOrgFromTaxon(
CSeq_entry& entry, TOrgMap& m)
611 if(entry.
IsSet()) {
613_UpdateOrgFromTaxon(*it, m);
620 for(
auto& it : entry.
SetDescr().Set()) {
624 if(desc.
IsOrg()) {
631std::ostringstream os;
635v.owner.insert(&owner);
641 voidxUpdate(TOwnerSet& owners,
COrg_ref& org_ref)
643 for(
auto& owner_it : owners) {
644 if((*owner_it)->IsOrg()) {
645(*owner_it)->SetOrg(org_ref);
646}
else if((*owner_it)->IsSource()) {
647(*owner_it)->SetSource().SetOrg(org_ref);
655TOrgMap org_to_update;
657_UpdateOrgFromTaxon(entry, org_to_update);
658 if(org_to_update.empty())
661std::lock_guard<std::mutex> guard(
m_Mutex);
672vector<CRef<COrg_ref>> reflist;
673 for(
auto& it : org_to_update) {
674reflist.push_back(it.second.org_ref);
679 for(
auto& it : org_to_update) {
680vector<CRef<COrg_ref>> reflist;
681reflist.push_back(it.second.org_ref);
685 auto& reply_it = reply->SetReply().front();
686 if(reply_it->IsData() && reply_it->SetData().IsSetOrg()) {
687xUpdate(it.second.owner, reply_it->SetData().SetOrg());
703list<CRef<CAuthor>> authors_with_affil;
705 if(it->IsSetAffil()) {
706authors_with_affil.push_back(it);
710 if(authors_with_affil.size() == 1) {
713 ERR_POST(
Error<<
"publication contains multiple affiliations");
715auth_list.
SetAffil(authors_with_affil.front()->SetAffil());
716authors_with_affil.front()->ResetAffil();
731 if(desc_it->IsPub()) {
744 if(it->IsSetAuthors()) {
752 for(
CBioseq_CIbioseq_it(obj); bioseq_it; ++bioseq_it) {
766std::lock_guard<std::mutex> guard(
m_Mutex);
776std::lock_guard<std::mutex> guard(
m_Mutex);
785std::lock_guard<std::mutex> guard(
m_Mutex);
790upd->ReportStats(os);
User-defined methods of the data storage class.
@Auth_list.hpp User-defined methods of the data storage class.
void ConvertMlToStd(bool normalize_suffix)
CRef< CTaxon3_reply > SendOrgRefList(const vector< CRef< COrg_ref >> &query, CTaxonomyUpdater::FLogger logger)
CRef< CT3Reply > GetOrgReply(const COrg_ref &in_org, CTaxonomyUpdater::FLogger f_logger)
map< string, CRef< CT3Reply > > CCachedReplyMap
unique_ptr< CTaxon3 > m_taxon
void InitWithTimeout(unsigned seconds, unsigned retries, bool exponential)
void ReportStats(std::ostream &str)
unique_ptr< CCachedReplyMap > m_cache
CRef< COrg_ref > GetOrg(const COrg_ref &org, CTaxonomyUpdater::FLogger f_logger)
virtual CRef< CPub > GetPubmedEntry(TEntrezId pmid, EPubmedError *=nullptr)
CAuth_list & SetAuthors(void)
bool IsSetAuthors(void) const
@Pubdesc.hpp User-defined methods of the data storage class.
IObjtoolsListener * m_pMessageListener
TPubInterceptor m_pm_interceptor
static void ConvertToStandardAuthors(CAuth_list &auth_list)
CPub::E_Choice m_pm_pub_type
CPubmedUpdater(IObjtoolsListener *, CEUtilsUpdater::ENormalize=CEUtilsUpdater::ENormalize::Off)
void ReportStats(std::ostream &str)
CEUtilsUpdater::ENormalize m_pm_normalize
void SetPubmedClient(CEUtilsUpdater *)
static void PostProcessPubs(CSeq_entry_EditHandle &obj)
void xUpdatePubReferences(CSeq_entry &entry)
bool xUpdatePubPMID(list< CRef< CPub >> &pubs, TEntrezId id)
void SetMaxMlaAttempts(int max)
unique_ptr< CEUtilsUpdater > m_pubmed
void UpdatePubReferences(CSerialObject &obj)
static CRemoteUpdater & GetInstance()
CRemoteUpdater(IObjtoolsListener *pMessageListener, CEUtilsUpdater::ENormalize=CEUtilsUpdater::ENormalize::Off)
@Seq_descr.hpp User-defined methods of the data storage class.
void SetDescr(CSeq_descr &value)
bool IsSetDescr(void) const
Base class for all serializable objects.
void SetTaxonTimeout(unsigned seconds=20, unsigned retries=5, bool exponential=false)
function< void(const string &)> FLogger
void xUpdateOrgTaxname(COrg_ref &org)
CTaxonomyUpdater(IObjtoolsListener *pMessageListener)
IObjtoolsListener * m_pMessageListener
void UpdateOrgFromTaxon(CSeq_entry &entry)
void ReportStats(std::ostream &)
unique_ptr< CCachedTaxon3_impl > m_taxClient
CConstRef< CTaxon3_reply > SendOrgRefList(const vector< CRef< COrg_ref >> &list)
taxupdate_func_t m_taxon_update
static vector< string > arr
@ cannot_connect_searchbackend_pmdb
static const char * str(char *buf, int n)
SStrictId_Entrez::TId TEntrezId
TEntrezId type for entrez ids which require the same strictness as TGi.
const CNcbiRegistry & GetConfig(void) const
Get the application's cached configuration parameters (read-only).
static CNcbiApplicationAPI * Instance(void)
Singleton method.
SStrictId_Tax::TId TTaxId
Taxon id type.
#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...
@ eDiag_Warning
Warning message.
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.
void Info(CExceptionArgs_Base &args)
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
virtual const CTypeInfo * GetThisTypeInfo(void) const =0
#define MSerial_AsnText
I/O stream manipulators â.
bool NotNull(void) const THROWS_NONE
Check if pointer is not null â same effect as NotEmpty().
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.
bool Empty(void) const THROWS_NONE
Check if CRef is empty â not pointing to any object, which means having a null value.
virtual bool GetBool(const string §ion, const string &name, bool default_value, TFlags flags=0, EErrAction err_action=eThrow) const
Get boolean value of specified parameter name.
virtual int GetInt(const string §ion, const string &name, int default_value, TFlags flags=0, EErrAction err_action=eThrow) const
Get integer value of specified parameter name.
virtual bool HasEntry(const string §ion, const string &name=kEmptyStr, TFlags flags=0) const
virtual string GetString(const string §ion, const string &name, const string &default_value, TFlags flags=0) const
Get the parameter string value.
#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 enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
@ eStart
Start timer immediately after creating.
virtual bool IsType(TTypeInfo type) const
bool IsSetAffil(void) const
author affiliation Check if a value has been assigned to Affil data member.
void SetAffil(TAffil &value)
Assign a value to Affil data member.
bool IsSetNames(void) const
Check if a value has been assigned to Names data member.
void SetNames(TNames &value)
Assign a value to Names data member.
const TNames & GetNames(void) const
Get the Names member data.
bool IsStd(void) const
Check if variant Std is selected.
bool IsSetOrg(void) const
Check if a value has been assigned to Org data member.
void SetOrg(TOrg &value)
Assign a value to Org data member.
const TTaxname & GetTaxname(void) const
Get the Taxname member data.
bool IsSetTaxname(void) const
preferred formal name Check if a value has been assigned to Taxname data member.
TPmid & SetPmid(void)
Select the variant.
TMedline & SetMedline(void)
Select the variant.
TArticle & SetArticle(void)
Select the variant.
TSet & SetSet(void)
Select the variant.
bool IsSeq(void) const
Check if variant Seq is selected.
bool IsSet(void) const
Check if variant Set is selected.
TSeq & SetSeq(void)
Select the variant.
TSeq_set & SetSeq_set(void)
Assign a value to Seq_set data member.
void SetPub(TPub &value)
Assign a value to Pub data member.
TOrg & SetOrg(void)
Select the variant.
bool IsOrg(void) const
Check if variant Org is selected.
const TSource & GetSource(void) const
Get the variant data.
bool IsSource(void) const
Check if variant Source is selected.
TSource & SetSource(void)
Select the variant.
void SetDescr(TDescr &value)
Assign a value to Descr data member.
bool IsSetPub(void) const
the citation(s) Check if a value has been assigned to Pub data member.
Tdata & Set(void)
Assign a value to data member.
@ e_Pub
a reference to the publication
void SetData(TData &value)
Assign a value to Data data member.
bool IsData(void) const
Check if variant Data is selected.
bool IsSetOrg(void) const
Check if a value has been assigned to Org data member.
TRequest & SetRequest(void)
Assign a value to Request data member.
void SetOrg(TOrg &value)
Assign a value to Org data member.
bool IsError(void) const
Check if variant Error is selected.
const TError & GetError(void) const
Get the variant data.
const TMessage & GetMessage(void) const
Get the Message member data.
TData & SetData(void)
Select the variant.
static const bool kUseBulkTaxonQuery
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
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