NCBI C++ ToolKit
ftanet.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: ftanet.cpp 100208 2023-07-07 17:17:09Z stakhovv $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * File Name: ftanet.cpp
27  *
28  * Author: Sergey Bazhin
29  *
30  * File Description:
31  * Functions for real working with the servers and network.
32  *
33  */
34 
35 #include <ncbi_pch.hpp>
36 
37 #include "ftacpp.hpp"
38 
40 
45 #include <objects/seq/Pubdesc.hpp>
47 #include <objects/pub/Pub.hpp>
56 #include <objects/biblio/Affil.hpp>
60 #include <objects/pub/Pub_set.hpp>
63 #include <objmgr/util/sequence.hpp>
65 
66 #include <dbapi/driver/drivers.hpp>
67 
68 #include "index.h"
69 
72 #include <corelib/ncbi_message.hpp>
73 
74 #include "ftaerr.hpp"
75 #include "asci_blk.h"
76 #include "ftamed.h"
77 #include "utilfun.h"
78 #include "ref.h"
80 
81 #ifdef THIS_FILE
82 # undef THIS_FILE
83 #endif
84 #define THIS_FILE "ftanet.cpp"
85 
86 #define HEALTHY_ACC "U12345"
87 
90 
91 struct KwordBlk {
92  const char* str;
94 };
95 
96 static const KwordBlk PubStatus[] = {
97  { "Publication Status: Available-Online prior to print", 51 },
98  { "Publication Status : Available-Online prior to print", 52 },
99  { "Publication_Status: Available-Online prior to print", 51 },
100  { "Publication_Status : Available-Online prior to print", 52 },
101  { "Publication-Status: Available-Online prior to print", 51 },
102  { "Publication-Status : Available-Online prior to print", 52 },
103  { "Publication Status: Online-Only", 31 },
104  { "Publication Status : Online-Only", 32 },
105  { "Publication_Status: Online-Only", 31 },
106  { "Publication_Status : Online-Only", 32 },
107  { "Publication-Status: Online-Only", 31 },
108  { "Publication-Status : Online-Only", 32 },
109  { "Publication Status: Available-Online", 36 },
110  { "Publication Status : Available-Online", 37 },
111  { "Publication_Status: Available-Online", 36 },
112  { "Publication_Status : Available-Online", 37 },
113  { "Publication-Status: Available-Online", 36 },
114  { "Publication-Status : Available-Online", 37 },
115  { nullptr, 0 }
116 };
117 
118 /**********************************************************/
119 static char* fta_strip_pub_comment(char* comment, const KwordBlk* kbp)
120 {
121  char* p;
122  char* q;
123 
124  ShrinkSpaces(comment);
125  for (; kbp->str; kbp++) {
126  for (;;) {
127  p = StringIStr(comment, kbp->str);
128  if (! p)
129  break;
130  for (q = p + kbp->len; *q == ' ' || *q == ';';)
131  q++;
132  fta_StringCpy(p, q);
133  }
134  }
135 
136  ShrinkSpaces(comment);
137  p = (*comment == '\0') ? nullptr : StringSave(comment);
138  MemFree(comment);
139 
140  if (p && (StringEquNI(p, "Publication Status", 18) ||
141  StringEquNI(p, "Publication_Status", 18) ||
142  StringEquNI(p, "Publication-Status", 18)))
143  ErrPostEx(SEV_WARNING, ERR_REFERENCE_UnusualPubStatus, "An unusual Publication Status comment exists for this record: \"%s\". If it is a new variant of the special comments used to indicate ahead-of-print or online-only articles, then the comment must be added to the appropriate table of the parser.", p);
144 
145  return (p);
146 }
147 
148 /**********************************************************/
149 static void fta_fix_last_initials(CName_std& namestd,
150  bool initials)
151 {
152  char* str;
153  char* p;
154 
155  if (initials) {
156  if (! namestd.IsSetInitials())
157  return;
158  str = namestd.SetInitials().data();
159  } else {
160  if (! namestd.IsSetLast())
161  return;
162  str = namestd.SetLast().data();
163  }
164 
165  size_t i = strlen(str);
166  if (i > 5) {
167  p = &str[i - 5];
168  if ((*p == ' ' || *p == '.') && ! strcmp(p + 1, "III.")) {
169  namestd.SetSuffix("III");
170  if (*p == '.')
171  p++;
172  *p = '\0';
173  if (initials)
174  namestd.SetInitials(str);
175  else
176  namestd.SetLast(str);
177  return;
178  }
179  }
180  if (i > 4) {
181  p = &str[i - 4];
182  if ((*p == ' ' || *p == '.') &&
183  (! strcmp(p + 1, "III") || ! strcmp(p + 1, "2nd") ||
184  ! strcmp(p + 1, "Jr.") || ! strcmp(p + 1, "IV."))) {
185  if (! strcmp(p + 1, "III"))
186  namestd.SetSuffix("III");
187  else if (! strcmp(p + 1, "2nd"))
188  namestd.SetSuffix("II");
189  else if (! strcmp(p + 1, "Jr."))
190  namestd.SetSuffix("Jr.");
191  else
192  namestd.SetSuffix("IV");
193  if (*p == '.')
194  p++;
195  *p = '\0';
196  if (initials)
197  namestd.SetInitials(str);
198  else
199  namestd.SetLast(str);
200  return;
201  }
202  }
203  if (i > 3) {
204  p = &str[i - 3];
205  if ((*p == ' ' || *p == '.') &&
206  (! strcmp(p + 1, "Jr") || ! strcmp(p + 1, "IV") ||
207  ! strcmp(p + 1, "II"))) {
208  if (! strcmp(p + 1, "Jr"))
209  namestd.SetSuffix("Jr.");
210  else if (! strcmp(p + 1, "IV"))
211  namestd.SetSuffix("IV");
212  else
213  namestd.SetSuffix("II");
214  if (*p == '.')
215  p++;
216  *p = '\0';
217  if (initials)
218  namestd.SetInitials(str);
219  else
220  namestd.SetLast(str);
221  return;
222  }
223  }
224 }
225 
226 /**********************************************************/
228 {
229  for (const auto& pub : pub_list) {
230  if (! pub->IsPmid())
231  continue;
232  // got_pmid = true;
233  break;
234  }
235 
236  for (auto& pub : pub_list) {
237  CAuth_list* authors;
238  if (pub->IsArticle()) {
239  CCit_art& art = pub->SetArticle();
240  if (! art.IsSetAuthors() || ! art.CanGetAuthors())
241  continue;
242 
243  authors = &art.SetAuthors();
244  } else if (pub->IsSub()) {
245  CCit_sub& sub = pub->SetSub();
246  if (! sub.IsSetAuthors() || ! sub.CanGetAuthors())
247  continue;
248 
249  authors = &sub.SetAuthors();
250  } else if (pub->IsGen()) {
251  CCit_gen& gen = pub->SetGen();
252  if (! gen.IsSetAuthors() || ! gen.CanGetAuthors())
253  continue;
254 
255  authors = &gen.SetAuthors();
256  } else if (pub->IsBook()) {
257  CCit_book& book = pub->SetBook();
258  if (! book.IsSetAuthors() || ! book.CanGetAuthors())
259  continue;
260 
261  authors = &book.SetAuthors();
262  } else if (pub->IsMan()) {
263  CCit_let& man = pub->SetMan();
264  if (! man.IsSetCit() || ! man.CanGetCit())
265  continue;
266 
267  CCit_book& book = man.SetCit();
268  if (! book.IsSetAuthors() || ! book.CanGetAuthors())
269  continue;
270 
271  authors = &book.SetAuthors();
272  } else if (pub->IsPatent()) {
273  CCit_pat& pat = pub->SetPatent();
274  if (! pat.IsSetAuthors() || ! pat.CanGetAuthors())
275  continue;
276 
277  authors = &pat.SetAuthors();
278  } else
279  continue;
280 
281 
282  if (authors->IsSetAffil() && authors->CanGetAffil() &&
283  authors->GetAffil().Which() == CAffil::e_Str) {
284  CAffil& affil = authors->SetAffil();
285  char* aff = affil.SetStr().data();
286  ShrinkSpaces(aff);
287  affil.SetStr(aff);
288  }
289 
290  if (authors->IsSetNames() && authors->CanGetNames() &&
291  authors->GetNames().Which() == CAuth_list::TNames::e_Std) {
292  CAuth_list::TNames& names = authors->SetNames();
293  CAuth_list::TNames::TStd::iterator it = (names.SetStd()).begin();
294  CAuth_list::TNames::TStd::iterator it_end = (names.SetStd()).end();
295  for (; it != it_end; it++) {
296  if ((*it)->IsSetAffil() && (*it)->CanGetAffil() &&
297  (*it)->GetAffil().Which() == CAffil::e_Str) {
298  CAffil& affil = (*it)->SetAffil();
299  char* aff = affil.SetStr().data();
300  ShrinkSpaces(aff);
301  affil.SetStr(aff);
302  }
303  if ((*it)->IsSetName() && (*it)->CanGetName() &&
304  (*it)->GetName().IsName()) {
305  CName_std& namestd = (*it)->SetName().SetName();
306  if (namestd.IsSetSuffix())
307  continue;
308  fta_fix_last_initials(namestd, true);
309  if (! namestd.IsSetSuffix())
310  fta_fix_last_initials(namestd, false);
311  }
312  }
313  }
314  }
315 }
316 
317 /**********************************************************/
318 static void fta_fix_imprint_language(TPubList& pub_list)
319 {
320  for (auto& pub : pub_list) {
321  if (! pub->IsArticle())
322  continue;
323 
324  CCit_art& art = pub->SetArticle();
325  if (! art.IsSetFrom() || ! art.GetFrom().IsJournal())
326  continue;
327 
328  CCit_jour& journal = art.SetFrom().SetJournal();
329 
330  if (journal.IsSetImp() && journal.GetImp().IsSetLanguage()) {
331  string language = journal.GetImp().GetLanguage();
332  char* p;
333  char* lang = language.data();
334  for (p = lang; *p != '\0'; p++)
335  if (*p >= 'A' && *p <= 'Z')
336  *p |= 040; // tolower()
337  journal.SetImp().SetLanguage(lang);
338  }
339  }
340 }
341 
342 /**********************************************************/
343 static void fta_strip_er_remarks(CPubdesc& pub_descr)
344 {
345  if (! pub_descr.IsSetComment())
346  return;
347 
348  for (const auto& pub : pub_descr.GetPub().Get()) {
349  if (! pub->IsArticle())
350  continue;
351 
352  const CCit_art& art = pub->GetArticle();
353  if (! art.IsSetFrom() || ! art.GetFrom().IsJournal())
354  continue;
355 
356  const CCit_jour& journal = art.GetFrom().GetJournal();
357 
358  int status = 0;
359  if (journal.IsSetImp() && journal.GetImp().IsSetPubstatus())
360  status = journal.GetImp().GetPubstatus();
361 
362  if (status == ePubStatus_epublish ||
363  status == ePubStatus_ppublish ||
364  status == ePubStatus_aheadofprint) {
365  char* comment = StringSave(pub_descr.GetComment().c_str());
366  comment = fta_strip_pub_comment(comment, PubStatus);
367  if (comment && *comment != 0)
368  pub_descr.SetComment(comment);
369  else
370  pub_descr.ResetComment();
371 
372  MemFree(comment);
373  }
374  }
375 }
376 
377 /**********************************************************/
378 static Uint1 fta_init_med_server(bool normalize)
379 {
380  InitPubmedClient(normalize);
381  if (! GetPubmedClient()->Init())
382  return 2;
383  return 1;
384 }
385 
386 /**********************************************************/
388 {
389  CTaxon1 taxon_srv;
390  if (! taxon_srv.Init())
391  return (2);
392  return (1);
393 }
394 
395 /**********************************************************/
397 {
398  if (pp->taxserver != 0) {
400  if (pp->taxserver == 2) {
401  ErrPostEx(SEV_WARNING, ERR_SERVER_Failed, "TaxArchInit call failed.");
402  }
403  } else {
404  ErrPostEx(SEV_WARNING, ERR_SERVER_NoTaxLookup, "No taxonomy lookup will be performed.");
405  }
406 
407  if (pp->medserver != 0) {
409  if (pp->medserver == 2) {
410  ErrPostEx(SEV_ERROR, ERR_SERVER_Failed, "MedArchInit call failed.");
411  }
412  } else {
413  ErrPostEx(SEV_WARNING, ERR_SERVER_NoPubMedLookup, "No medline lookup will be performed.");
414  }
415 }
416 
417 /**********************************************************/
419 {
420  if (pp->medserver == 1)
421  GetPubmedClient()->Fini();
422  /* if(pp->taxserver == 1)
423  tax1_fini();*/
424 }
425 
426 #if 0 // RW-707
427 //std::shared_ptr<CPubseqAccess> s_pubseq;
428 
429 /**********************************************************/
430 static Uint1 fta_init_pubseq(void)
431 {
432  // C Toolkit's accpubseq.h library gets username/password from
433  // the environment.
434  // We are now using C++ Toolkit's cpubseq.hpp library which require
435  // credentials during the construction of CPubseqAccess. So read
436  // the environment here and pass it along to the constructor.
437 
439 // DBAPI_RegisterDriver_CTLIB();
440 
441  char* env_val = getenv("ALTER_OPEN_SERVER");
442  string idserver = env_val ? env_val : "";
443 
444  env_val = getenv("ALTER_USER_NAME");
445  string idusername = env_val ? env_val : "";
446 
447  env_val = getenv("ALTER_USER_PASSWORD");
448  string idpassword = env_val ? env_val : "";
449 
450  s_pubseq.reset(new CPubseqAccess(idserver.empty() ? "PUBSEQ_OS_INTERNAL_GI64" : idserver.c_str(),
451  idusername.empty() ? "anyone" : idusername.c_str(),
452  idpassword.empty() ? "allowed" : idpassword.c_str()));
453 
454  if (! s_pubseq || ! s_pubseq->CheckConnection())
455  return(2);
456  return(1);
457 }
458 
459 /**********************************************************/
460 void fta_entrez_fetch_enable(ParserPtr pp)
461 {
462  return; // RW-707
463 
464  if(pp->entrez_fetch != 0)
465  {
466  pp->entrez_fetch = fta_init_pubseq();
467  if(pp->entrez_fetch == 2)
468  {
470  "Failed to connect to PUBSEQ OS.");
471  }
472  }
473  else
474  {
476  "No PUBSEQ Bioseq fetch will be performed.");
477  }
478 }
479 
480 /**********************************************************/
481 void fta_entrez_fetch_disable(ParserPtr pp)
482 {
483  if(pp->entrez_fetch == 1)
484  s_pubseq.reset();
485 }
486 #endif
487 
488 /**********************************************************/
489 void fta_fill_find_pub_option(ParserPtr pp, bool htag, bool rtag)
490 {
491  pp->fpo.always_look = ! htag;
492  pp->fpo.replace_cit = ! rtag;
493  pp->fpo.merge_ids = true;
494 }
495 
496 
497 class CFindPub
498 {
499 
500 public:
502  m_pParser(pp),
504  {
505  if (m_pParser) {
506  const auto& findPubOptions = m_pParser->fpo;
507  m_pPubFix.reset(new edit::CPubFix(
508  findPubOptions.always_look,
509  findPubOptions.replace_cit,
510  findPubOptions.merge_ids,
511  m_pPubFixListener.get(),
512  GetPubmedClient()));
513  }
514  }
515 
516  using TEntryList = list<CRef<CSeq_entry>>;
517  void Apply(TEntryList& entries);
518 
519 private:
520  void fix_pub_equiv(CPub_equiv& pub_equiv, bool er);
521  void fix_pub_annot(CPub& pub, bool er);
522  void find_pub(list<CRef<CSeq_annot>>& annots, CSeq_descr& descrs);
523 
525  unique_ptr<CPubFixMessageListener> m_pPubFixListener;
526  unique_ptr<edit::CPubFix> m_pPubFix;
527 };
528 
529 
530 /**********************************************************/
531 static void fta_check_pub_ids(TPubList& pub_list)
532 {
533  bool found = false;
534  for (const auto& pub : pub_list) {
535  if (pub->IsArticle()) {
536  found = true;
537  break;
538  }
539  }
540 
541  if (found)
542  return;
543 
544  for (CPub_equiv::Tdata::iterator pub = pub_list.begin(); pub != pub_list.end();) {
545  if (! (*pub)->IsMuid() && ! (*pub)->IsPmid()) {
546  ++pub;
547  continue;
548  }
549 
550  ErrPostEx(SEV_ERROR, ERR_REFERENCE_ArticleIdDiscarded, "Article identifier was found for an unpublished, direct submission, book or unparsable article reference, and has been discarded : %s %d.", (*pub)->IsMuid() ? "MUID" : "PMID", (*pub)->GetMuid());
551 
552  pub = pub_list.erase(pub);
553  }
554 }
555 
556 
557 /**********************************************************/
558 void CFindPub::fix_pub_equiv(CPub_equiv& pub_equiv, bool er)
559 {
560  if (! m_pParser)
561  return;
562 
564 
565  list<CRef<CPub>> cit_arts;
566  for (auto& pPub : pub_equiv.Set()) {
567  if (! pPub->IsGen()) {
568  continue;
569  }
570  const CCit_gen& cit_gen = pPub->SetGen();
571  if (cit_gen.IsSetCit() &&
572  (StringEquN(cit_gen.GetCit().c_str(), "(er)", 4) || er)) {
573  cit_arts.push_back(pPub);
574  break;
575  }
576  }
577 
578  if (cit_arts.empty()) {
579  fta_check_pub_ids(pub_equiv.Set());
580  m_pPubFix->FixPubEquiv(pub_equiv);
581  return;
582  }
583 
584  auto& cit_gen = cit_arts.front();
585 
586  list<CRef<CPub>> others;
587  CRef<CPub> pMuid, pPmid;
588 
589  for (auto& pPub : pub_equiv.Set()) {
590  if (cit_gen == pPub)
591  continue;
592  if (pPub->IsMuid() && ! pMuid)
593  pMuid = pPub;
594  else if (pPub->IsPmid() && ! pPmid)
595  pPmid = pPub;
596  else if (! pPub->IsArticle())
597  others.push_back(pPub);
598  }
599 
600 
601  TEntrezId oldpmid = pPmid ? pPmid->GetPmid() : ZERO_ENTREZ_ID;
602  TEntrezId oldmuid = pMuid ? pMuid->GetMuid() : ZERO_ENTREZ_ID;
603  TEntrezId muid = ZERO_ENTREZ_ID;
604  TEntrezId pmid = ZERO_ENTREZ_ID;
605 
606  CRef<CCit_art> new_cit_art;
607  if (oldpmid > ZERO_ENTREZ_ID) {
608  new_cit_art = FetchPubPmId(oldpmid);
609  if (new_cit_art.Empty()) {
610  ErrPostEx(SEV_REJECT, ERR_REFERENCE_InvalidPmid, "MedArch failed to find a Cit-art for reference with pmid \"%d\".", oldpmid);
611  ibp->drop = true;
612  } else {
613  if (new_cit_art->IsSetIds()) {
614  for (const auto& pId : new_cit_art->GetIds().Get()) {
615  if (pId->IsPubmed()) {
616  pmid = pId->GetPubmed();
617  } else if (pId->IsMedline()) {
618  muid = pId->GetMedline();
619  }
620  }
621  }
622 
623  if (pmid == ZERO_ENTREZ_ID) {
624  ErrPostEx(SEV_REJECT, ERR_REFERENCE_CitArtLacksPmid, "Cit-art returned by MedArch lacks pmid identifier in its ArticleIdSet.");
625  ibp->drop = true;
626  } else if (pmid != oldpmid) {
627  ErrPostEx(SEV_REJECT, ERR_REFERENCE_DifferentPmids, "Pmid \"%d\" used for lookup does not match pmid \"%d\" in the ArticleIdSet of the Cit-art returned by MedArch.", oldpmid, pmid);
628  ibp->drop = true;
629  }
630  if (muid > ZERO_ENTREZ_ID && oldmuid > ZERO_ENTREZ_ID && muid != oldmuid) {
631  ErrPostEx(SEV_ERROR, ERR_REFERENCE_MuidPmidMissMatch, "Reference has supplied Medline UI \"%d\" but it does not match muid \"%d\" in the Cit-art returned by MedArch.", oldmuid, muid);
632  }
633  }
634  }
635 
636  if (new_cit_art.NotEmpty() && ! ibp->drop) {
637  cit_arts.clear();
638  CRef<CPub> new_pub(new CPub);
639  new_pub->SetArticle(*new_cit_art);
640  cit_arts.push_back(new_pub);
641 
642  if (pmid > ZERO_ENTREZ_ID && ! pPmid) {
643  pPmid = Ref(new CPub());
644  pPmid->SetPmid().Set(pmid);
645  }
646 
647  if (muid > ZERO_ENTREZ_ID && ! pMuid) {
648  pMuid = Ref(new CPub());
649  pMuid->SetMuid(muid);
650  }
651  }
652 
653  auto& pub_list = pub_equiv.Set();
654  pub_list = others;
655  if (pPmid) {
656  pub_list.push_back(pPmid);
657  }
658  if (pMuid && muid > ZERO_ENTREZ_ID) {
659  pub_list.push_back(pMuid);
660  }
661  pub_list.splice(pub_list.end(), cit_arts);
662 }
663 
664 /**********************************************************/
665 void CFindPub::fix_pub_annot(CPub& pub, bool er)
666 {
667  if (! m_pParser)
668  return;
669 
670  if (pub.IsEquiv()) {
671  fix_pub_equiv(pub.SetEquiv(), er);
672  if (m_pParser->qamode)
675  return;
676  }
677 
678  m_pPubFix->FixPub(pub);
679 }
680 
681 
682 /**********************************************************/
683 void CFindPub::find_pub(list<CRef<CSeq_annot>>& annots, CSeq_descr& descrs)
684 {
685  bool er = any_of(begin(descrs.Get()), end(descrs.Get()), [](CRef<CSeqdesc> pDesc) {
686  if (pDesc->IsPub()) {
687  const auto& pubdesc = pDesc->GetPub();
688  return (pubdesc.IsSetComment() &&
689  fta_remark_is_er(pubdesc.GetComment().c_str()));
690  }
691  return false;
692  });
693 
694 
695  for (auto& pDescr : descrs.Set()) {
696  if (! pDescr->IsPub())
697  continue;
698 
699  CPubdesc& pub_descr = pDescr->SetPub();
700  fix_pub_equiv(pub_descr.SetPub(), er);
701  if (m_pParser->qamode)
702  fta_fix_imprint_language(pub_descr.SetPub().Set());
703  fta_fix_affil(pub_descr.SetPub().Set(), m_pParser->source);
704  fta_strip_er_remarks(pub_descr);
705  }
706 
707  for (auto& pAnnot : annots) {
708  if (! pAnnot->IsSetData() || ! pAnnot->GetData().IsFtable()) /* feature table */
709  continue;
710 
711  for (auto& pFeat : pAnnot->SetData().SetFtable()) {
712  if (pFeat->IsSetData() && pFeat->GetData().IsPub()) /* pub feature */
713  {
714  fix_pub_equiv(pFeat->SetData().SetPub().SetPub(), er);
715  if (m_pParser->qamode)
716  fta_fix_imprint_language(pFeat->SetData().SetPub().SetPub().Set());
717  fta_fix_affil(pFeat->SetData().SetPub().SetPub().Set(), m_pParser->source);
718  fta_strip_er_remarks(pFeat->SetData().SetPub());
719  }
720 
721  if (! pFeat->IsSetCit()) {
722  continue;
723  }
724 
725  for (auto& pPub : pFeat->SetCit().SetPub()) {
726  if (pPub) {
727  fix_pub_annot(*pPub, er);
728  }
729  }
730  }
731  }
732 }
733 
734 /**********************************************************/
735 // static void fta_find_pub(ParserPtr pp, TEntryList& seq_entries)
736 void CFindPub::Apply(list<CRef<CSeq_entry>>& seq_entries)
737 {
738  for (auto& pEntry : seq_entries) {
739  for (CTypeIterator<CBioseq_set> bio_set(Begin(*pEntry)); bio_set; ++bio_set) {
740  find_pub(bio_set->SetAnnot(), bio_set->SetDescr());
741 
742  if (bio_set->GetDescr().Get().empty())
743  bio_set->ResetDescr();
744 
745  if (bio_set->SetAnnot().empty())
746  bio_set->ResetAnnot();
747  }
748 
749  for (CTypeIterator<CBioseq> bioseq(Begin(*pEntry)); bioseq; ++bioseq) {
750  find_pub(bioseq->SetAnnot(), bioseq->SetDescr());
751 
752  if (bioseq->GetDescr().Get().empty())
753  bioseq->ResetDescr();
754 
755  if (bioseq->SetAnnot().empty())
756  bioseq->ResetAnnot();
757  }
758  }
759 }
760 
761 /**********************************************************/
763 {
764  if (pp->medserver == 0)
765  return;
766 
767  if (pp->medserver == 2)
769 
770  if (pp->medserver == 1) {
771  CFindPub find_pub(pp);
772  find_pub.Apply(seq_entries);
773  }
774 }
775 
776 #if 0
777 /**********************************************************/
778 static void new_synonym(COrg_ref& org_ref, COrg_ref& tax_org_ref)
779 {
780  if (!org_ref.CanGetSyn() || !tax_org_ref.CanGetSyn())
781  return;
782 
783  for (const string& org_syn : org_ref.GetSyn()) {
784  bool found = false;
785  for (const string& tax_syn : tax_org_ref.GetSyn()) {
786  if (org_syn == tax_syn) {
787  found = true;
788  break;
789  }
790  }
791 
792  if (!found)
793  {
795  "New synonym: %s for [%s].",
796  org_syn.c_str(), org_ref.GetTaxname().c_str());
797  }
798  }
799 }
800 #endif
801 
802 #define TAX_SERVER_TIMEOUT 3
803 static const STimeout s_timeout = { TAX_SERVER_TIMEOUT, 0 };
804 
805 static void fix_synonyms(CTaxon1& taxon, COrg_ref& org_ref)
806 {
807  bool with_syns = taxon.SetSynonyms(false);
808  if (! with_syns)
809  org_ref.SetSyn().clear();
810  else
811  taxon.SetSynonyms(true);
812 }
813 
814 /**********************************************************/
815 static CRef<COrg_ref> fta_get_orgref_byid(ParserPtr pp, bool* drop, TTaxId taxid, bool isoh)
816 {
817  CConstRef<CTaxon2_data> taxdata;
818 
819  CTaxon1 taxon;
820 
821  bool connection_failed = false;
822  for (size_t i = 0; i < 3 && taxdata.Empty(); ++i) {
823  if (taxon.Init(&s_timeout)) {
824  taxdata = taxon.GetById(taxid);
825  } else {
826  connection_failed = true;
827  break;
828  }
829  }
830 
831  CRef<COrg_ref> ret;
832  if (taxdata.Empty()) {
833  if (connection_failed) {
834  ErrPostEx(SEV_FATAL, ERR_SERVER_TaxServerDown, "Taxonomy lookup failed for taxid %d, apparently because the server is down. Cannot generate ASN.1 for this entry.", TAX_ID_TO(int, taxid));
835  *drop = true;
836  } else {
837  ErrPostEx(SEV_ERROR, ERR_ORGANISM_TaxNameNotFound, "Taxname not found: [taxid %d].", TAX_ID_TO(int, taxid));
838  }
839  return ret;
840  }
841 
842  if (taxdata->GetIs_species_level() != 1 && ! isoh) {
843  ErrPostEx(SEV_WARNING, ERR_ORGANISM_TaxIdNotSpecLevel, "Taxarch hit is not on species level: [taxid %d].", TAX_ID_TO(int, taxid));
844  }
845 
846  ret.Reset(new COrg_ref);
847  ret->Assign(taxdata->GetOrg());
848  fix_synonyms(taxon, *ret);
849 
850  if (ret->IsSetSyn() && ret->GetSyn().empty())
851  ret->ResetSyn();
852 
853  return ret;
854 }
855 
856 /**********************************************************/
857 CRef<COrg_ref> fta_fix_orgref_byid(ParserPtr pp, TTaxId taxid, bool* drop, bool isoh)
858 {
859  CRef<COrg_ref> ret;
860 
861  if (taxid <= ZERO_TAX_ID && pp->taxserver == 0)
862  return ret;
863 
864  if (pp->taxserver == 2)
866 
867  if (pp->taxserver == 2) {
868  ErrPostEx(SEV_FATAL, ERR_SERVER_TaxServerDown, "Taxonomy lookup failed for taxid %d, because the server is down. Cannot generate ASN.1 for this entry.", TAX_ID_TO(int, taxid));
869  *drop = true;
870  return ret;
871  }
872 
873  ret = fta_get_orgref_byid(pp, drop, taxid, isoh);
874  if (ret.NotEmpty()) {
875  ErrPostEx(SEV_INFO, ERR_SERVER_TaxNameWasFound, "Taxname _was_ found for taxid %d", TAX_ID_TO(int, taxid));
876  }
877 
878  return ret;
879 }
880 
881 /**********************************************************/
882 static CRef<COrg_ref> fta_replace_org(ParserPtr pp, bool* drop, COrg_ref& org_ref, const Char* pn, int merge, Int4 attempt)
883 {
884  IndexblkPtr ibp = pp->entrylist[pp->curindx];
885 
886  CConstRef<CTaxon2_data> taxdata;
887 
888  CTaxon1 taxon;
889 
890  bool connection_failed = true;
891  for (size_t i = 0; i < 3 && taxdata.Empty(); ++i) {
892  if (taxon.Init(&s_timeout)) {
893  if (merge) {
894  taxdata = taxon.LookupMerge(org_ref);
895  } else
896  taxdata = taxon.Lookup(org_ref);
897  connection_failed = false;
898  break;
899  } else
900  taxon.Fini();
901  }
902 
903  CRef<COrg_ref> ret;
904 
905  if (taxdata.Empty()) {
906  if (attempt == 1)
907  return ret;
908 
909  if (connection_failed) {
910  ErrPostEx(SEV_FATAL, ERR_SERVER_TaxServerDown, "Taxonomy lookup failed for \"%s\", apparently because the server is down. Cannot generate ASN.1 for this entry.", pn);
911  *drop = true;
912  } else if (taxon.GetTaxIdByOrgRef(org_ref) < ZERO_TAX_ID) {
913  if ((pp->source == Parser::ESource::DDBJ || pp->source == Parser::ESource::EMBL) &&
914  ibp->is_pat && ibp->taxid > ZERO_TAX_ID && ! ibp->organism.empty()) {
915  ret = fta_fix_orgref_byid(pp, ibp->taxid, &ibp->drop, true);
916  if (ret.NotEmpty() && ret->IsSetTaxname() &&
917  ret->GetTaxname() == ibp->organism) {
918  ibp->no_gc_warning = true;
919  return ret;
920  }
921  }
922  ErrPostEx(SEV_ERROR, ERR_ORGANISM_TaxIdNotUnique, "Not an unique Taxonomic Id for [%s].", pn);
923  } else {
924  ErrPostEx(SEV_ERROR, ERR_ORGANISM_TaxNameNotFound, "Taxon Id not found for [%s].", pn);
925  }
926  return ret;
927  }
928 
929  if (taxdata->GetIs_species_level() != 1 && (ibp->is_pat == false ||
931  ErrPostEx(SEV_WARNING, ERR_ORGANISM_TaxIdNotSpecLevel, "Taxarch hit is not on species level for [%s].", pn);
932  }
933 
934  ret.Reset(new COrg_ref);
935 
936  if (merge)
937  ret->Assign(org_ref);
938  else
939  ret->Assign(taxdata->GetOrg());
940 
941  return ret;
942 }
943 
944 /**********************************************************/
945 void fta_fix_orgref(ParserPtr pp, COrg_ref& org_ref, bool* drop, char* organelle)
946 {
947  Int4 attempt;
948  int merge;
949 
950  if (org_ref.IsSetTaxname()) {
951  string taxname = org_ref.GetTaxname();
952 
953  size_t last_char = taxname.size();
954  for (; last_char; --last_char) {
955  if (! isspace(taxname[last_char]))
956  break;
957  }
958 
959  if (! isspace(taxname[last_char]))
960  ++last_char;
961  org_ref.SetTaxname(taxname.substr(0, last_char));
962  }
963 
964  if (pp->taxserver == 0)
965  return;
966 
967  if (pp->taxserver == 2)
969 
970  string old_taxname;
971  if (organelle) {
972  string taxname = org_ref.IsSetTaxname() ? org_ref.GetTaxname() : "",
973  organelle_str(organelle),
974  space(taxname.size() ? " " : "");
975 
976  old_taxname = taxname;
977  taxname = organelle_str + space + taxname;
978  org_ref.SetTaxname(taxname);
979  attempt = 1;
980  } else {
981  attempt = 2;
982  }
983 
984  string taxname = org_ref.IsSetTaxname() ? org_ref.GetTaxname() : "";
985  if (pp->taxserver == 2) {
986  ErrPostEx(SEV_FATAL, ERR_SERVER_TaxServerDown, "Taxonomy lookup failed for \"%s\", because the server is down. Cannot generate ASN.1 for this entry.", taxname.c_str());
987  *drop = true;
988  } else {
989  merge = 1;
990 
991  CRef<COrg_ref> new_org_ref = fta_replace_org(pp, drop, org_ref, taxname.c_str(), merge, attempt);
992  if (new_org_ref.Empty() && attempt == 1) {
993  org_ref.SetTaxname(old_taxname);
994  old_taxname.clear();
995  new_org_ref = fta_replace_org(pp, drop, org_ref, "", merge, 2);
996  }
997 
998  if (new_org_ref.NotEmpty()) {
999  ErrPostEx(SEV_INFO, ERR_SERVER_TaxNameWasFound, "Taxon Id _was_ found for [%s]", taxname.c_str());
1000 
1001  org_ref.Assign(*new_org_ref);
1002  }
1003  }
1004 
1005  if (org_ref.IsSetSyn() && org_ref.GetSyn().empty())
1006  org_ref.ResetSyn();
1007 }
1008 
1009 /**********************************************************/
1011 {
1012  TGi gi = sequence::GetGiForId(id, GetScope());
1013  if (gi > ZERO_GI)
1014  return (gi);
1015 
1016 
1017  CSeq_id test_id;
1018  test_id.SetGenbank().SetAccession(HEALTHY_ACC);
1019 
1020  int i = 0;
1021  for (; i < 5; i++) {
1022  if (sequence::GetGiForId(test_id, GetScope()) > ZERO_GI)
1023  break;
1024  SleepSec(3);
1025  }
1026 
1027  if (i == 5)
1028  return GI_CONST(-1);
1029 
1030  gi = sequence::GetGiForId(id, GetScope());
1031  if (gi > ZERO_GI)
1032  return (gi);
1033 
1034  return ZERO_GI;
1035 }
1036 
1037 /**********************************************************
1038  * returns -1 if couldn't get division;
1039  * 1 if it's CON;
1040  * 0 if it's not CON.
1041  */
1042 Int4 fta_is_con_div(ParserPtr pp, const CSeq_id& id, const Char* acc)
1043 {
1044  if (pp->entrez_fetch == 0)
1045  return (-1);
1046  // if (pp->entrez_fetch == 2)
1047  // pp->entrez_fetch = fta_init_pubseq();
1048  if (pp->entrez_fetch == 2) {
1049  ErrPostEx(SEV_ERROR, ERR_ACCESSION_CannotGetDivForSecondary, "Failed to determine division code for secondary accession \"%s\". Entry dropped.", acc);
1050  pp->entrylist[pp->curindx]->drop = true;
1051  return (-1);
1052  }
1053 
1054  TGi gi = fta_get_gi_for_seq_id(id);
1055  if (gi < ZERO_GI) {
1056  ErrPostEx(SEV_ERROR, ERR_ACCESSION_CannotGetDivForSecondary, "Failed to determine division code for secondary accession \"%s\". Entry dropped.", acc);
1057  pp->entrylist[pp->curindx]->drop = true;
1058  return (-1);
1059  }
1060 
1061  if (gi == ZERO_GI)
1062  return (0);
1063 #if 0 // RW-707
1064  CPubseqAccess::IdGiClass id_gi;
1065  CPubseqAccess::IdBlobClass id_blob;
1066 
1067  if (! s_pubseq->GetIdGiClass(gi, id_gi) || ! s_pubseq->GetIdBlobClass(id_gi, id_blob) ||
1068  id_blob.div[0] == '\0') {
1069  ErrPostEx(SEV_ERROR, ERR_ACCESSION_CannotGetDivForSecondary, "Failed to determine division code for secondary accession \"%s\". Entry dropped.", acc);
1070  pp->entrylist[pp->curindx]->drop = true;
1071  return (-1);
1072  }
1073  if (NStr::EqualNocase(id_blob.div, "CON"))
1074  return (1);
1075 #endif
1076  return (0);
1077 }
1078 
1079 /**********************************************************/
1081 {
1083 }
1084 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
void ShrinkSpaces(char *line)
Definition: asci_blk.cpp:118
@Affil.hpp User-defined methods of the data storage class.
Definition: Affil.hpp:56
@Auth_list.hpp User-defined methods of the data storage class.
Definition: Auth_list.hpp:57
CConstRef –.
Definition: ncbiobj.hpp:1266
void Apply(TEntryList &entries)
Definition: ftanet.cpp:736
list< CRef< CSeq_entry > > TEntryList
Definition: ftanet.cpp:516
unique_ptr< edit::CPubFix > m_pPubFix
Definition: ftanet.cpp:526
void find_pub(list< CRef< CSeq_annot >> &annots, CSeq_descr &descrs)
Definition: ftanet.cpp:683
void fix_pub_annot(CPub &pub, bool er)
Definition: ftanet.cpp:665
void fix_pub_equiv(CPub_equiv &pub_equiv, bool er)
Definition: ftanet.cpp:558
Parser * m_pParser
Definition: ftanet.cpp:524
unique_ptr< CPubFixMessageListener > m_pPubFixListener
Definition: ftanet.cpp:525
CFindPub(Parser *pp)
Definition: ftanet.cpp:501
static TRegisterLoaderInfo RegisterInObjectManager(CObjectManager &om, CReader *reader=0, CObjectManager::EIsDefault is_default=CObjectManager::eDefault, CObjectManager::TPriority priority=CObjectManager::kPriority_NotSet)
Definition: gbloader.cpp:366
@Name_std.hpp User-defined methods of the data storage class.
Definition: Name_std.hpp:56
Definition: Pub.hpp:56
@Pubdesc.hpp User-defined methods of the data storage class.
Definition: Pubdesc.hpp:54
@Seq_descr.hpp User-defined methods of the data storage class.
Definition: Seq_descr.hpp:55
CRef< CTaxon2_data > GetById(TTaxId tax_id)
Definition: taxon1.cpp:230
void Fini(void)
Definition: taxon1.cpp:203
TTaxId GetTaxIdByOrgRef(const COrg_ref &inp_orgRef)
Definition: taxon1.cpp:489
CConstRef< CTaxon2_data > LookupMerge(COrg_ref &inp_orgRef, string *psLog=0, TOrgRefStatus *pStatusOut=0)
Definition: taxon1.cpp:429
bool SetSynonyms(bool on_off)
Definition: taxon1.cpp:746
bool Init(void)
Definition: taxon1.cpp:101
CRef< CTaxon2_data > Lookup(const COrg_ref &inp_orgRef, string *psLog=0)
Definition: taxon1.cpp:384
Template class for iteration on objects of class C.
Definition: iterator.hpp:673
static void Init(void)
Definition: cursor6.c:76
static const struct name_t names[]
#define ERR_REFERENCE_UnusualPubStatus
Definition: flat2err.h:317
#define ERR_SERVER_NotUsed
Definition: flat2err.h:470
#define ERR_SERVER_NoTaxLookup
Definition: flat2err.h:476
#define ERR_SERVER_Failed
Definition: flat2err.h:471
#define ERR_REFERENCE_ArticleIdDiscarded
Definition: flat2err.h:316
#define ERR_REFERENCE_MuidPmidMissMatch
Definition: flat2err.h:312
#define ERR_ORGANISM_TaxIdNotSpecLevel
Definition: flat2err.h:193
#define ERR_ACCESSION_CannotGetDivForSecondary
Definition: flat2err.h:171
#define ERR_SERVER_NoPubMedLookup
Definition: flat2err.h:477
#define ERR_ORGANISM_TaxNameNotFound
Definition: flat2err.h:192
#define ERR_REFERENCE_InvalidPmid
Definition: flat2err.h:308
#define ERR_SERVER_TaxServerDown
Definition: flat2err.h:475
#define ERR_ORGANISM_TaxIdNotUnique
Definition: flat2err.h:191
#define ERR_SERVER_TaxNameWasFound
Definition: flat2err.h:474
#define ERR_REFERENCE_CitArtLacksPmid
Definition: flat2err.h:310
#define ERR_ORGANISM_NewSynonym
Definition: flat2err.h:194
#define ERR_REFERENCE_DifferentPmids
Definition: flat2err.h:311
list< CRef< objects::CSeq_entry > > TEntryList
std::list< CRef< objects::CPub > > TPubList
Definition: ftablock.h:62
char * StringSave(const char *s)
Definition: ftacpp.hpp:61
bool StringEquNI(const char *s1, const char *s2, size_t n)
Definition: ftacpp.hpp:116
bool StringEquN(const char *s1, const char *s2, size_t n)
Definition: ftacpp.hpp:106
void MemFree(char *p)
Definition: ftacpp.hpp:55
void InitPubmedClient(bool normalize)
Definition: ftamed.cpp:77
edit::IPubmedUpdater * GetPubmedClient()
Definition: ftamed.cpp:86
CRef< CCit_art > FetchPubPmId(TEntrezId pmid)
Definition: ftamed.cpp:92
USING_SCOPE(objects)
static CRef< COrg_ref > fta_get_orgref_byid(ParserPtr pp, bool *drop, TTaxId taxid, bool isoh)
Definition: ftanet.cpp:815
Int4 fta_is_con_div(ParserPtr pp, const CSeq_id &id, const Char *acc)
Definition: ftanet.cpp:1042
#define HEALTHY_ACC
Definition: ftanet.cpp:86
#define TAX_SERVER_TIMEOUT
Definition: ftanet.cpp:802
void fta_find_pub_explore(ParserPtr pp, TEntryList &seq_entries)
Definition: ftanet.cpp:762
static void fta_check_pub_ids(TPubList &pub_list)
Definition: ftanet.cpp:531
static TGi fta_get_gi_for_seq_id(const CSeq_id &id)
Definition: ftanet.cpp:1010
void fta_fini_servers(ParserPtr pp)
Definition: ftanet.cpp:418
CRef< COrg_ref > fta_fix_orgref_byid(ParserPtr pp, TTaxId taxid, bool *drop, bool isoh)
Definition: ftanet.cpp:857
void fta_init_servers(ParserPtr pp)
Definition: ftanet.cpp:396
static char * fta_strip_pub_comment(char *comment, const KwordBlk *kbp)
Definition: ftanet.cpp:119
static void fta_fix_affil(TPubList &pub_list, Parser::ESource source)
Definition: ftanet.cpp:227
static void fta_fix_last_initials(CName_std &namestd, bool initials)
Definition: ftanet.cpp:149
static Uint1 fta_init_tax_server(void)
Definition: ftanet.cpp:387
void fta_init_gbdataloader()
Definition: ftanet.cpp:1080
static const STimeout s_timeout
Definition: ftanet.cpp:803
void fta_fill_find_pub_option(ParserPtr pp, bool htag, bool rtag)
Definition: ftanet.cpp:489
static CRef< COrg_ref > fta_replace_org(ParserPtr pp, bool *drop, COrg_ref &org_ref, const Char *pn, int merge, Int4 attempt)
Definition: ftanet.cpp:882
static void fta_fix_imprint_language(TPubList &pub_list)
Definition: ftanet.cpp:318
static void fix_synonyms(CTaxon1 &taxon, COrg_ref &org_ref)
Definition: ftanet.cpp:805
static const KwordBlk PubStatus[]
Definition: ftanet.cpp:96
static void fta_strip_er_remarks(CPubdesc &pub_descr)
Definition: ftanet.cpp:343
static Uint1 fta_init_med_server(bool normalize)
Definition: ftanet.cpp:378
void fta_fix_orgref(ParserPtr pp, COrg_ref &org_ref, bool *drop, char *organelle)
Definition: ftanet.cpp:945
#define SEV_INFO
Definition: gicache.c:89
#define SEV_WARNING
Definition: gicache.c:90
#define SEV_ERROR
Definition: gicache.c:91
#define SEV_FATAL
Definition: gicache.c:93
#define SEV_REJECT
Definition: gicache.c:92
SStrictId_Entrez::TId TEntrezId
TEntrezId type for entrez ids which require the same strictness as TGi.
Definition: ncbimisc.hpp:1041
#define ZERO_TAX_ID
Definition: ncbimisc.hpp:1115
#define TAX_ID_TO(T, tax_id)
Definition: ncbimisc.hpp:1110
SStrictId_Tax::TId TTaxId
Taxon id type.
Definition: ncbimisc.hpp:1048
#define GI_CONST(gi)
Definition: ncbimisc.hpp:1087
#define ZERO_GI
Definition: ncbimisc.hpp:1088
#define ZERO_ENTREZ_ID
Definition: ncbimisc.hpp:1102
#define ErrPostEx(sev, err_code,...)
Definition: ncbierr.hpp:78
void DBAPI_RegisterDriver_FTDS(void)
TPrim & Set(void)
Definition: serialbase.hpp:351
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
CBeginInfo Begin(C &obj)
Get starting point of object hierarchy.
Definition: iterator.hpp:1004
TGi GetGiForId(const objects::CSeq_id &id, CScope &scope, EGetIdType flags=0)
Given a Seq-id retrieve the corresponding GI.
Definition: sequence.cpp:668
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
bool Empty(void) const THROWS_NONE
Check if CConstRef is empty – not pointing to any object which means having a null value.
Definition: ncbiobj.hpp:1385
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
Definition: ncbiobj.hpp:2015
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty – pointing to an object and has a non-null value.
Definition: ncbiobj.hpp:726
bool Empty(void) const THROWS_NONE
Check if CRef is empty – not pointing to any object, which means having a null value.
Definition: ncbiobj.hpp:719
uint8_t Uint1
1-byte (8-bit) unsigned integer
Definition: ncbitype.h:99
int16_t Int2
2-byte (16-bit) signed integer
Definition: ncbitype.h:100
int32_t Int4
4-byte (32-bit) signed integer
Definition: ncbitype.h:102
char Char
Alias for char.
Definition: ncbitype.h:93
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
Definition: ncbistr.hpp:5352
bool CanGetAffil(void) const
Check if it is safe to call GetAffil method.
Definition: Auth_list_.hpp:504
bool IsSetAffil(void) const
author affiliation Check if a value has been assigned to Affil data member.
Definition: Auth_list_.hpp:498
bool IsSetAuthors(void) const
authors (ANSI requires) Check if a value has been assigned to Authors data member.
Definition: Cit_art_.hpp:534
const TJournal & GetJournal(void) const
Get the variant data.
Definition: Cit_art_.cpp:111
void SetAuthors(TAuthors &value)
Assign a value to Authors data member.
Definition: Cit_pat_.cpp:68
const TFrom & GetFrom(void) const
Get the From member data.
Definition: Cit_art_.hpp:567
const TCit & GetCit(void) const
Get the Cit member data.
Definition: Cit_gen_.hpp:588
const TAffil & GetAffil(void) const
Get the Affil member data.
Definition: Auth_list_.hpp:510
void SetFrom(TFrom &value)
Assign a value to From data member.
Definition: Cit_art_.cpp:248
void SetAffil(TAffil &value)
Assign a value to Affil data member.
Definition: Auth_list_.cpp:160
bool IsSetFrom(void) const
Check if a value has been assigned to From data member.
Definition: Cit_art_.hpp:555
void SetAuthors(TAuthors &value)
Assign a value to Authors data member.
Definition: Cit_art_.cpp:227
bool IsSetAuthors(void) const
not necessarily authors of the paper Check if a value has been assigned to Authors data member.
Definition: Cit_sub_.hpp:345
void SetAuthors(TAuthors &value)
Assign a value to Authors data member.
Definition: Cit_sub_.cpp:74
bool IsSetCit(void) const
anything, not parsable Check if a value has been assigned to Cit data member.
Definition: Cit_gen_.hpp:576
const Tdata & Get(void) const
Get the member data.
TStr & SetStr(void)
Select the variant.
Definition: Affil_.hpp:1200
bool CanGetAuthors(void) const
Check if it is safe to call GetAuthors method.
Definition: Cit_sub_.hpp:351
void SetCit(TCit &value)
Assign a value to Cit data member.
Definition: Cit_let_.cpp:70
bool IsSetNames(void) const
Check if a value has been assigned to Names data member.
Definition: Auth_list_.hpp:464
bool CanGetCit(void) const
Check if it is safe to call GetCit method.
Definition: Cit_let_.hpp:261
bool IsSetAuthors(void) const
author/inventor Check if a value has been assigned to Authors data member.
Definition: Cit_pat_.hpp:703
E_Choice Which(void) const
Which variant is currently selected.
Definition: Affil_.hpp:1158
void SetNames(TNames &value)
Assign a value to Names data member.
Definition: Auth_list_.cpp:149
void SetAuthors(TAuthors &value)
Assign a value to Authors data member.
Definition: Cit_book_.cpp:93
bool CanGetNames(void) const
Check if it is safe to call GetNames method.
Definition: Auth_list_.hpp:472
bool CanGetAuthors(void) const
Check if it is safe to call GetAuthors method.
Definition: Cit_pat_.hpp:709
bool IsSetIds(void) const
lots of ids Check if a value has been assigned to Ids data member.
Definition: Cit_art_.hpp:585
bool IsSetAuthors(void) const
authors Check if a value has been assigned to Authors data member.
Definition: Cit_book_.hpp:335
bool IsJournal(void) const
Check if variant Journal is selected.
Definition: Cit_art_.hpp:495
const TNames & GetNames(void) const
Get the Names member data.
Definition: Auth_list_.hpp:478
bool IsSetCit(void) const
same fields as a book Check if a value has been assigned to Cit data member.
Definition: Cit_let_.hpp:255
const TIds & GetIds(void) const
Get the Ids member data.
Definition: Cit_art_.hpp:597
bool CanGetAuthors(void) const
Check if it is safe to call GetAuthors method.
Definition: Cit_art_.hpp:540
bool CanGetAuthors(void) const
Check if it is safe to call GetAuthors method.
Definition: Cit_book_.hpp:341
E_Choice Which(void) const
Which variant is currently selected.
Definition: Auth_list_.hpp:375
@ ePubStatus_ppublish
published in print by publisher
Definition: PubStatus_.hpp:69
@ ePubStatus_aheadofprint
epublish, but will be followed by print
Definition: PubStatus_.hpp:75
@ ePubStatus_epublish
published electronically by publisher
Definition: PubStatus_.hpp:68
@ e_Str
unparsed string
Definition: Affil_.hpp:545
@ e_Std
full citations
Definition: Auth_list_.hpp:113
void SetInitials(const TInitials &value)
Assign a value to Initials data member.
Definition: Name_std_.hpp:619
bool IsSetSuffix(void) const
Jr, Sr, III Check if a value has been assigned to Suffix data member.
Definition: Name_std_.hpp:645
void SetLast(const TLast &value)
Assign a value to Last data member.
Definition: Name_std_.hpp:431
bool IsSetInitials(void) const
first + middle initials Check if a value has been assigned to Initials data member.
Definition: Name_std_.hpp:598
bool IsSetLast(void) const
Check if a value has been assigned to Last data member.
Definition: Name_std_.hpp:410
void SetSuffix(const TSuffix &value)
Assign a value to Suffix data member.
Definition: Name_std_.hpp:666
bool CanGetSyn(void) const
Check if it is safe to call GetSyn method.
Definition: Org_ref_.hpp:510
void ResetSyn(void)
Reset Syn data member.
Definition: Org_ref_.cpp:76
TSyn & SetSyn(void)
Assign a value to Syn data member.
Definition: Org_ref_.hpp:522
const TTaxname & GetTaxname(void) const
Get the Taxname member data.
Definition: Org_ref_.hpp:372
const TSyn & GetSyn(void) const
Get the Syn member data.
Definition: Org_ref_.hpp:516
void SetTaxname(const TTaxname &value)
Assign a value to Taxname data member.
Definition: Org_ref_.hpp:381
bool IsSetTaxname(void) const
preferred formal name Check if a value has been assigned to Taxname data member.
Definition: Org_ref_.hpp:360
bool IsSetSyn(void) const
synonyms for taxname or common Check if a value has been assigned to Syn data member.
Definition: Org_ref_.hpp:504
TPmid & SetPmid(void)
Select the variant.
Definition: Pub_.hpp:690
TMuid & SetMuid(void)
Select the variant.
Definition: Pub_.hpp:615
const TPmid & GetPmid(void) const
Get the variant data.
Definition: Pub_.hpp:683
Tdata & Set(void)
Assign a value to data member.
Definition: Pub_equiv_.hpp:171
const Tdata & Get(void) const
Get the member data.
Definition: Pub_equiv_.hpp:165
TEquiv & SetEquiv(void)
Select the variant.
Definition: Pub_.cpp:393
bool IsEquiv(void) const
Check if variant Equiv is selected.
Definition: Pub_.hpp:671
TMuid GetMuid(void) const
Get the variant data.
Definition: Pub_.hpp:608
TArticle & SetArticle(void)
Select the variant.
Definition: Pub_.cpp:239
void SetAccession(const TAccession &value)
Assign a value to Accession data member.
TGenbank & SetGenbank(void)
Select the variant.
Definition: Seq_id_.cpp:243
bool IsSetComment(void) const
any comment on this pub in context Check if a value has been assigned to Comment data member.
Definition: Pubdesc_.hpp:973
void ResetComment(void)
Reset Comment data member.
Definition: Pubdesc_.cpp:118
void SetPub(TPub &value)
Assign a value to Pub data member.
Definition: Pubdesc_.cpp:72
const TComment & GetComment(void) const
Get the Comment member data.
Definition: Pubdesc_.hpp:985
const Tdata & Get(void) const
Get the member data.
Definition: Seq_descr_.hpp:166
void SetComment(const TComment &value)
Assign a value to Comment data member.
Definition: Pubdesc_.hpp:994
const TPub & GetPub(void) const
Get the Pub member data.
Definition: Pubdesc_.hpp:605
int i
const CharType(& source)[N]
Definition: pointer.h:1149
int strcmp(const char *str1, const char *str2)
Definition: odbc_utils.hpp:160
IMessage/IMessageListener interfaces and basic implementations.
void SleepSec(unsigned long sec, EInterruptOnSignal onsignal=eRestartOnSignal)
Sleep.
int isspace(Uchar c)
Definition: ncbictype.hpp:69
User-defined methods of the data storage class.
CRef< CPub > journal(ParserPtr pp, char *bptr, char *eptr, CRef< CAuth_list > &auth_list, CRef< CTitle::C_E > &title, bool has_muid, CRef< CCit_art > &cit_art, Int4 er)
Definition: ref.cpp:1468
static const char * str(char *buf, int n)
Definition: stats.c:84
bool no_gc_warning
Definition: ftablock.h:229
TTaxId taxid
Definition: ftablock.h:227
string organism
Definition: ftablock.h:226
bool is_pat
Definition: ftablock.h:205
bool drop
Definition: ftablock.h:185
const char * str
Definition: ftanet.cpp:92
Int2 len
Definition: ftanet.cpp:93
vector< IndexblkPtr > entrylist
SFindPubOptions fpo
Timeout structure.
Definition: ncbi_types.h:76
CScope & GetScope()
void fta_StringCpy(char *dst, const char *src)
Definition: utilfun.cpp:1641
Char * StringIStr(const Char *where, const Char *what)
Definition: utilfun.cpp:682
static wxAcceleratorEntry entries[3]
Modified on Fri Dec 08 08:23:12 2023 by modify_doxy.py rev. 669887