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

Go to the SVN repository for this file.

1 /* $Id: qualifiers.cpp 101909 2024-03-01 12:11:21Z 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 * Although all reasonable efforts have been taken to ensure the accuracy
14 * and reliability of the software and data, the NLM and the U.S.
15 * Government do not and cannot warrant the performance or results that
16 * may be obtained by using this software or data. The NLM and the U.S.
17 * Government disclaim all warranties, express or implied, including
18 * warranties of performance, merchantability or fitness for any particular
19 * purpose.
20 *
21 * Please cite the author in any work or product based on this material.
22 *
23 * ===========================================================================
24 *
25 * Author: Aaron Ucko, NCBI
26 *
27 * File Description:
28 * new (early 2003) flat-file generator -- qualifier types
29 * (mainly of interest to implementors)
30 *
31 * ===========================================================================
32 */
33 #include <ncbi_pch.hpp>
34 #include <corelib/ncbistd.hpp>
35 #include <util/sgml_entity.hpp>
36 #include <serial/enumvalues.hpp>
39 #include <objects/pub/Pub.hpp>
40 #include <objects/pub/Pub_set.hpp>
46 //#include <objects/seqfeat/Gb_qual.hpp>
49 #include <objects/seq/Seq_inst.hpp>
50 #include <objects/seq/MolInfo.hpp>
52 #include <objmgr/seq_vector.hpp>
54 
57 #include <objmgr/util/objutil.hpp>
58 
59 
62 
63 const string IFlatQVal::kSpace = " ";
64 const string IFlatQVal::kSemicolon = ";";
65 const string IFlatQVal::kSemicolonEOL = ";\n";
66 const string IFlatQVal::kComma = ",";
67 const string IFlatQVal::kEOL = "\n";
68 
70 {
71  return (flags & IFlatQVal::fIsNote) && !ctx.Config().IsModeDump();
72 }
73 
74 
75 static bool s_StringIsJustQuotes(const string& str)
76 {
77  ITERATE(string, it, str) {
78  if ( (*it != '"') && (*it != '\'') ) {
79  return false;
80  }
81  }
82 
83  return true;
84 }
85 
86 static string s_GetGOText(
87  const CUser_field& field,
88  const bool is_ftable,
89  const bool is_html)
90 {
91  const string *text_string = nullptr,
92  *evidence = nullptr,
93  *go_id = nullptr,
94  *go_ref = nullptr;
95  string temp;
96  int pmid = 0;
97 
99  if ( !(*it)->IsSetLabel() || !(*it)->GetLabel().IsStr() ) {
100  continue;
101  }
102 
103  const string& label = (*it)->GetLabel().GetStr();
104  const CUser_field::C_Data& data = (*it)->GetData();
105 
106  if (data.IsStr()) {
107  if (label == "text string") {
108  text_string = &data.GetStr();
109  } else if (label == "go id") {
110  go_id = &data.GetStr();
111  } else if (label == "evidence") {
112  evidence = &data.GetStr();
113  } else if (label == "go ref") {
114  go_ref = &data.GetStr();
115  }
116  } else if (data.IsInt()) {
117  if (label == "go id") {
118  NStr::IntToString(temp, data.GetInt());
119  go_id = &temp;
120  } else if (label == "pubmed id") {
121  pmid = data.GetInt();
122  }
123  }
124  }
125 
126  string go_text;
127  if (text_string) {
128  go_text = *text_string;
129  }
130  if ( is_ftable ) {
131  go_text += '|';
132  if (go_id) {
133  go_text += *go_id;
134  }
135  go_text += '|';
136  if ( pmid != 0 ) {
137  go_text += NStr::IntToString(pmid);
138  }
139  if (evidence) {
140  go_text += '|';
141  go_text += *evidence;
142  }
143  } else {
144  bool add_dash = false;
145  // RW-922 only make one link from GO:id - text.
146  go_text.clear();
147  if (go_id) {
148  if( is_html ) {
149  go_text += "<a href=\"";
150  go_text += strLinkBaseGeneOntology + *go_id + "\">";
151  }
152  go_text += string( "GO:" );
153  go_text += *go_id;
154  add_dash = true;
155  }
156  if (text_string && text_string->length() > 0) {
157  if (add_dash) {
158  go_text += string( " - " );
159  }
160  // NO, we NO LONGER have the dash here even if there's no go_id (RETAIN compatibility with CHANGE in C)
161  go_text += *text_string;
162  }
163  if (is_html && go_id) {
164  go_text += "</a>";
165  }
166  if (evidence) {
167  go_text += string( " [Evidence " ) + *evidence + string( "]" );
168  }
169  if ( pmid != 0 ) {
170  string pmid_str = NStr::IntToString(pmid);
171 
172  go_text += " [PMID ";
173  if (is_html && go_id) {
174  go_text += "<a href=\"";
175  go_text += strLinkBasePubmed + pmid_str + "\">";
176  }
177  go_text += pmid_str;
178  if(is_html && go_id) {
179  go_text += "</a>";
180  }
181  go_text += "]";
182  }
183  if (go_ref) {
184  go_text += " [GO Ref ";
185  if( is_html ) {
186  go_text += "<a href=\"";
187  go_text += strLinkBaseGeneOntologyRef + *go_ref + "\">";
188  }
189  go_text += *go_ref;
190  if( is_html ) {
191  go_text += "</a>";
192  }
193  go_text += "]";
194  }
195  }
196  CleanAndCompress(go_text, go_text.c_str());
198  return go_text;
199 }
200 
201 
202 static void s_ReplaceUforT(string& codon)
203 {
204  NON_CONST_ITERATE (string, base, codon) {
205  if (*base == 'T') {
206  *base = 'U';
207  }
208  }
209 }
210 
211 
212 static char s_MakeDegenerateBase(const string &str1, const string& str2)
213 {
214  static const char kIdxToSymbol[] = "?ACMGRSVUWYHKDBN";
215 
216  vector<char> symbol_to_idx(256, '\0');
217  for (size_t i = 0; i < sizeof(kIdxToSymbol) - 1; ++i) {
218  symbol_to_idx[kIdxToSymbol[i]] = i;
219  }
220 
221  size_t idx = symbol_to_idx[str1[2]] | symbol_to_idx[str2[2]];
222  return kIdxToSymbol[idx];
223 }
224 
225 
226 static size_t s_ComposeCodonRecognizedStr(const CTrna_ext& trna, string& recognized)
227 {
228  recognized.erase();
229 
230  if (!trna.IsSetCodon()) {
231  return 0;
232  }
233 
234  list<string> codons;
235 
236  ITERATE (CTrna_ext::TCodon, it, trna.GetCodon()) {
237  string codon = CGen_code_table::IndexToCodon(*it);
238  s_ReplaceUforT(codon);
239  if (!codon.empty()) {
240  codons.push_back(codon);
241  }
242  }
243  if (codons.empty()) {
244  return 0;
245  }
246  size_t size = codons.size();
247  if (size > 1) {
248  codons.sort();
249 
250  list<string>::iterator it = codons.begin();
251  list<string>::iterator prev = it++;
252  while (it != codons.end()) {
253  string& codon1 = *prev;
254  string& codon2 = *it;
255  if (codon1[0] == codon2[0] && codon1[1] == codon2[1]) {
256  codon1[2] = s_MakeDegenerateBase(codon1, codon2);
257  it = codons.erase(it);
258  } else {
259  prev = it;
260  ++it;
261  }
262  }
263  }
264 
265  recognized = NStr::Join(codons, ", ");
266  return size;
267 }
268 
269 static bool s_AltitudeIsValid(const string & str )
270 {
271  // this is the regex we're validating, but for speed and library dependency
272  // reasons, we're using a more raw approach:
273  //
274  // ^[+-]?[0-9]+(\.[0-9]+)?[ ]m\.$
275 
276  // we use c-style strings so we don't have to worry about constantly
277  // checking if we're out of bounds: we get a '\0' which lets us be cleaner
278  const char *pch = str.c_str();
279 
280  // optional sign at start
281  if( *pch == '+' || *pch == '-' ) {
282  ++pch;
283  }
284 
285  // then a number, maybe with one decimal point
286  if( ! isdigit(*pch) ) {
287  return false;
288  }
289  while( isdigit(*pch) ) {
290  ++pch;
291  }
292  if( *pch == '.' ) {
293  ++pch;
294  if( ! isdigit(*pch) ) {
295  return false;
296  }
297  while( isdigit(*pch) ) {
298  ++pch;
299  }
300  }
301 
302  // should end with " m"
303  return NStr::Equal(pch, " m");
304 }
305 
306 /////////////////////////////////////////////////////////////////////////////
307 // CFormatQual - low-level formatted qualifier
308 
310 (const CTempString& name,
311  const CTempString& value,
312  const CTempString& prefix,
313  const CTempString& suffix,
314  TStyle style,
315  TFlags flags,
316  ETrim trim ) :
317  m_Name(name),
318  m_Prefix(prefix),
319  m_Suffix(suffix),
320  m_Style(style), m_Flags(flags), m_Trim(trim), m_AddPeriod(false)
321 {
323 }
324 
325 
327  m_Name(name),
328  m_Prefix(" "), m_Suffix(kEmptyStr),
329  m_Style(style), m_Flags(flags), m_Trim(trim), m_AddPeriod(false)
330 {
332 }
333 
334 
335 // === CFlatStringQVal ======================================================
336 
338  : IFlatQVal(&kSpace, &kSemicolon),
339  m_Style(style), m_Trim(trim), m_AddPeriod(0)
340 {
342 }
343 
344 
346 (const CTempString& value,
347  const string& pfx,
348  const string& sfx,
349  TStyle style,
350  ETrim trim)
351  : IFlatQVal(&pfx, &sfx),
352  m_Style(style), m_Trim(trim), m_AddPeriod(0)
353 {
355 }
356 
358  ETrim trim )
359 : IFlatQVal(&kSpace, &kSemicolon),
360  m_Style(CFormatQual::eQuoted), m_Trim(trim), m_AddPeriod(0)
361 {
363 }
364 
365 
369  { "function", eTilde_tilde },
370  { "prot_desc", eTilde_note },
371  { "prot_note", eTilde_note },
372  { "seqfeat_note", eTilde_note }
373 };
375 
376 // a few kinds don't use the default tilde style
377 ETildeStyle s_TildeStyleFromName( const string &name )
378 {
379  TNameTildeStyleMap::const_iterator result = sc_NameTildeStyleMap.find( name.c_str() );
380  if( sc_NameTildeStyleMap.end() == result ) {
381  return eTilde_space;
382  } else {
383  return result->second;
384  }
385 }
386 
389 {
390  bool bHtml = ctx.Config().DoHTML();
391  if ( bHtml && name == "EC_number" ) {
392  string strLink = "<a href=\"";
393  strLink += strLinkBaseExpasy;
394  strLink += m_Value;
395  strLink += "\">";
396  strLink += m_Value;
397  strLink += "</a>";
398  x_AddFQ(q, name, strLink, m_Style, 0, m_Trim);
399  return;
400  }
401  flags |= m_AddPeriod;
402 
403  ETildeStyle tilde_style = s_TildeStyleFromName( name );
404  ExpandTildes(m_Value, tilde_style);
405 
406  const bool is_note = s_IsNote(flags, ctx);
407 
408  // e.g. CP001398
409  // if( ! is_note ) {
410  // e.g. NP_008173
413  }
414  // }
415 
416  // eventually, the last part will be replaced with a hash-table
417  // or something, but this is fine while we're only checking for
418  // one type.
419  // This prevents quals like /metagenomic="metagenomic" (e.g. EP508672)
420  const bool forceNoValue = (
421  ! ctx.Config().SrcQualsToNote() &&
422  name == m_Value &&
423  name == "metagenomic" );
424 
425  const bool prependNewline = (flags & fPrependNewline) && ! q.empty();
426  TFlatQual qual = x_AddFQ(
427  q, (is_note ? "note" : name),
428  ( prependNewline ? CTempString("\n" + m_Value) : CTempString(m_Value) ),
429  ( forceNoValue ? CFormatQual::eEmpty : m_Style ),
430  0, m_Trim );
431 
432  if ((flags & fAddPeriod) && qual) {
433  qual->SetAddPeriod();
434  }
435 }
436 
437 
438 // === CFlatNumberQVal ======================================================
439 
440 
442 (TFlatQuals& quals,
443  const CTempString& name,
445  TFlags flags) const
446 {
447  if (ctx.Config().CheckQualSyntax()) {
448  if (NStr::IsBlank(m_Value)) {
449  return;
450  }
451  bool has_space = false;
452  ITERATE (string, it, m_Value) {
453  if (isspace((unsigned char)(*it))) {
454  has_space = true;
455  } else if (has_space) {
456  // non-space after space
457  return;
458  }
459  }
460  }
461 
462  CFlatStringQVal::Format(quals, name, ctx, flags);
463 }
464 
465 
466 // === CFlatBondQVal ========================================================
467 
469 (TFlatQuals& quals,
470  const CTempString& name,
472  TFlags flags) const
473 {
474  string value = m_Value;
475  if (s_IsNote(flags, ctx)) {
476  value += " bond";
477  }
478  x_AddFQ(quals, (s_IsNote(flags, ctx) ? "note" : name), value, m_Style);
479 }
480 
481 
482 // === CFlatGeneQVal ========================================================
483 
485 (TFlatQuals& quals,
486  const CTempString& name,
488  TFlags flags) const
489 {
490  CFlatStringQVal::Format(quals, name, ctx, flags);
491 }
492 
493 
494 // === CFlatSiteQVal ========================================================
495 
497 (TFlatQuals& quals,
498  const CTempString& name,
500  TFlags flags) const
501 {
502  if ( m_Value == "transmembrane-region" ) {
503  m_Value = "transmembrane region";
504  }
505  if ( m_Value == "signal-peptide" ) {
506  m_Value = "signal peptide";
507  }
508  if ( m_Value == "transit-peptide" ) {
509  m_Value = "transit peptide";
510  }
511  if (m_Value != "transit peptide" && m_Value != "signal peptide" &&
512  m_Value != "transmembrane region" && s_IsNote(flags, ctx))
513  {
514  const static char *pchSiteSuffix = " site";
515  if( ! NStr::EndsWith(m_Value, pchSiteSuffix) ) {
516  m_Value += pchSiteSuffix;
517  }
518  }
519  CFlatStringQVal::Format(quals, name, ctx, flags);
520 }
521 
522 
523 // === CFlatStringListQVal ==================================================
524 
525 
527 (TFlatQuals& q,
528  const CTempString& name,
530  IFlatQVal::TFlags flags) const
531 {
532  if (m_Value.empty()) {
533  return;
534  }
535 
536  if ( s_IsNote(flags, ctx) ) {
537  m_Suffix = &kSemicolon;
538  }
539 
540  x_AddFQ(q,
541  (s_IsNote(flags, ctx) ? "note" : name),
542  JoinString(m_Value, "; "),
543  m_Style);
544 }
545 
546 
547 // === CFlatGeneSynonymsQVal ================================================
548 
550 public:
551  bool operator()( const string &str1, const string &str2 ) {
552  // C++'s built-in stuff compares via "tolower" which gets a different ordering
553  // in some subtle cases than C's no-case comparison which uses "toupper"
554  SIZE_TYPE pos = 0;
555  const SIZE_TYPE min_length = min( str1.length(), str2.length() );
556  for( ; pos < min_length; ++pos ) {
557  const char textComparison = toupper( str1[pos] ) - toupper( str2[pos] );
558  if( textComparison != 0 ) {
559  return textComparison < 0;
560  }
561  }
562  // if we reached the end, compare via length (shorter first)
563  return ( str1.length() < str2.length() );
564  }
565 };
566 
568 (TFlatQuals& q,
569  const CTempString& name,
571  IFlatQVal::TFlags flags) const
572 {
573  if (GetValue().empty()) {
574  return;
575  }
576 
577  string qual = "gene_synonym";
578  const list<string> &synonyms = GetValue();
579  vector<string> sub;
580  std::copy(synonyms.begin(), synonyms.end(),
581  back_inserter(sub));
582 
583  // For compatibility with C, we use a slightly different sorting algo
584  // In the future, we might go back to the other one for simplicity
585  // std::sort(sub.begin(), sub.end(), PNocase());
586  stable_sort(sub.begin(), sub.end(), CLessThanNoCaseViaUpper() );
587 
588  if (ctx.IsRefSeq() && !ctx.Config().IsModeDump()) {
589  x_AddFQ( q, qual, NStr::Join(sub, "; "), m_Style, 0, CFormatQual::eTrim_WhitespaceOnly );
590  } else {
591  ITERATE (vector<string>, it, sub) {
593  }
594  }
595 }
596 
597 // === CFlatCodeBreakQVal ===================================================
598 
601 {
602  static const char* kOTHER = "OTHER";
603 
605  const char* aa = kOTHER;
606  switch ((*it)->GetAa().Which()) {
608  aa = GetAAName((*it)->GetAa().GetNcbieaa(), true);
609  break;
611  aa = GetAAName((*it)->GetAa().GetNcbi8aa(), false);
612  break;
614  aa = GetAAName((*it)->GetAa().GetNcbistdaa(), false);
615  break;
616  default:
617  return;
618  }
619 
620  string pos = CFlatSeqLoc( (*it)->GetLoc(), ctx).GetString();
621  x_AddFQ(q, name, "(pos:" + pos + ",aa:" + aa + ')',
623  }
624 }
625 
628 {
629  if( m_Value.IsNull() ) {
630  return;
631  }
632 
633  if( ! m_Value->CanGetStatus() || ! m_Value->CanGetSymbol() || m_Value->GetSymbol().empty() ) {
634  return;
635  }
636 
637  // we build up the final result in this variable
638  string nomenclature;
639 
640  // add the status part
641  switch( m_Value->GetStatus() ) {
643  nomenclature += "Official ";
644  break;
646  nomenclature += "Interim ";
647  break;
648  default:
649  nomenclature += "Unclassified ";
650  break;
651  }
652  nomenclature += "Symbol: ";
653 
654  // add the symbol part
655  nomenclature += m_Value->GetSymbol();
656 
657  // add the name part, if any
658  if( m_Value->CanGetName() && ! m_Value->GetName().empty() ) {
659  nomenclature += " | Name: " + m_Value->GetName();
660  }
661 
662  // add the source part, if any
663  if( m_Value->CanGetSource() ) {
664  const CGene_nomenclature_Base::TSource& source = m_Value->GetSource();
665 
666  if( source.CanGetDb() && ! source.GetDb().empty() && source.CanGetTag() ) {
667  if( source.GetTag().IsId() || ( source.GetTag().IsStr() && ! source.GetTag().GetStr().empty() ) ) {
668  nomenclature += " | Provided by: " + source.GetDb() + ":";
669  if( source.GetTag().IsStr() ) {
670  nomenclature += source.GetTag().GetStr();
671  } else {
672  nomenclature += NStr::IntToString( source.GetTag().GetId() );
673  }
674  }
675  }
676  }
677 
678  x_AddFQ(q, name, nomenclature, CFormatQual::eQuoted );
679 }
680 
681 
682 CFlatCodonQVal::CFlatCodonQVal(unsigned int codon, unsigned char aa, bool is_ascii)
683  : m_Codon(CGen_code_table::IndexToCodon(codon)),
684  m_AA(GetAAName(aa, is_ascii)), m_Checked(true)
685 {
686 }
687 
688 
690  IFlatQVal::TFlags) const
691 {
692  if ( !m_Checked ) {
693  // ...
694  }
695  x_AddFQ(q, name, "(seq:\"" + m_Codon + "\",aa:" + m_AA + ')');
696 }
697 
699  const string& value )
700  : m_str( value )
701 {
702  if ( m_str.empty() ) {
703  m_str = "experimental evidence, no additional details recorded";
704  }
705 }
706 
709 {
710  x_AddFQ(q, name, m_str.c_str(), CFormatQual::eQuoted);
711 }
712 
713 
714 CFlatInferenceQVal::CFlatInferenceQVal( const string& gbValue ) :
715  m_str( "non-experimental evidence, no additional details recorded" )
716 {
717  //
718  // the initial "non-experimental ..." is just a default value which may be
719  // overridden through an additional "inference" Gb-qual in the ASN.1.
720  // However, it can't be overriden to be just anything, only certain strings
721  // are allowed.
722  // The following code will change m_str from its default if gbValue is a
723  // legal replacement for "non-experimental ...", and leave it alone
724  // otherwise.
725  //
726  string prefix;
727  string remainder;
729  if (!NStr::IsBlank(prefix)) {
730  m_str = gbValue;
731  }
732 }
733 
734 
737 {
739 }
740 
741 
743  IFlatQVal::TFlags) const
744 {
745  // XXX - return if too strict
746 
747  // special case: in sequin mode, orig_protein_id and orig_transcript_id removed,
748  // even though we usually keep illegal quals in sequin mode
749  if( m_Value->GetQual() == "orig_protein_id" ||
750  m_Value->GetQual() == "orig_transcript_id" )
751  {
752  return;
753  }
754 
755  x_AddFQ(q, m_Value->GetQual(), m_Value->GetVal());
756 }
757 
758 
761 {
762  const char* s = nullptr;
763  switch ( m_Biomol ) {
764 
765  default:
766  break;
767 
769  switch ( m_Mol ) {
770  case CSeq_inst::eMol_dna:
771  s = "unassigned DNA";
772  break;
773  case CSeq_inst::eMol_rna:
774  s = "unassigned RNA";
775  break;
776  default:
777  break;
778  }
779  break;
780 
782  switch ( m_Mol ) {
783  case CSeq_inst::eMol_dna:
784  s = "genomic DNA";
785  break;
786  case CSeq_inst::eMol_rna:
787  s = "genomic RNA";
788  break;
789  default:
790  break;
791  }
792  break;
793 
795  s = "mRNA";
796  break;
797 
799  s = "rRNA";
800  break;
801 
803  s = "tRNA";
804  break;
805 
813  s = "transcribed RNA";
814  break;
815 
818  switch ( m_Mol ) {
819  case CSeq_inst::eMol_dna:
820  s = "other DNA";
821  break;
822  case CSeq_inst::eMol_rna:
823  s = "other RNA";
824  break;
825  default:
826  break;
827  }
828  break;
829 
831  s = "viral cRNA";
832  break;
833 
834  }
835 
836  if (! s) {
837  switch ( m_Mol ) {
838  case CSeq_inst::eMol_rna:
839  s = "unassigned RNA";
840  break;
841  case CSeq_inst::eMol_aa:
842  s = nullptr;
843  break;
844  case CSeq_inst::eMol_dna:
845  default:
846  s = "unassigned DNA";
847  break;
848  }
849  }
850 
851  if (s) {
852  x_AddFQ(q, name, s);
853  }
854 }
855 
858 {
859  switch ( m_Tech ) {
860  case CMolInfo::eTech_wgs:
861  case CMolInfo::eTech_tsa:
863  ITERATE (CBioseq::TId, itr, ctx.GetBioseqIds()) {
864  const CSeq_id& id = **itr;
865  if ( id.Which() != CSeq_id::e_General ) continue;
866  const CDbtag& dbtag = id.GetGeneral();
867  if ( ! dbtag.IsSetDb() ) continue;
868  string dbname = dbtag.GetDb();
869  if ( ! NStr::StartsWith(dbname, "WGS:" ) && ! NStr::StartsWith(dbname, "TSA:" ) && ! NStr::StartsWith(dbname, "TLS:" ) ) continue;
870  dbname.erase(0, 4);
871  if (NStr::StartsWith(dbname, "NZ_" )) {
872  dbname.erase(0, 3);
873  }
874  int num_letters = 0;
875  int num_digits = 0;
876  int len = (int) dbname.length();
877  if ( len != 6 && len != 8 ) continue;
878  bool bail = false;
879  for ( int i = 0; i < len; i++ ) {
880  char ch = dbname[i];
881  if ( isupper(ch) || islower(ch) ) {
882  num_letters++;
883  if ( num_digits > 0 ) {
884  bail = true;
885  }
886  } else if ( isdigit(ch) ) {
887  num_digits++;
888  } else {
889  bail = true;
890  }
891  }
892  if ( num_letters != 4 && num_letters != 6 ) {
893  bail = true;
894  }
895  if ( num_digits != 2 ) {
896  bail = true;
897  }
898  if ( bail ) continue;
899  if ( dbtag.IsSetTag() && dbtag.GetTag().IsStr() ) {
900  string tag = dbtag.GetTag().GetStr();
901  x_AddFQ(q, name, tag);
902  }
903  }
904  break;
905  default:
906  break;
907  }
908 }
909 
912 {
913  TFlatQual qual;
914 
915  string subname = m_Value->GetSubname();
916  if ( s_StringIsJustQuotes(subname) ) {
917  subname = kEmptyStr;
918  }
920  CleanAndCompress(subname, subname.c_str());
923 
924  if (s_IsNote(flags, ctx)) {
925  bool add_period = RemovePeriodFromEnd(subname, true);
926  if (!subname.empty() || add_period ) {
927  bool is_src_orgmod_note =
928  (flags & IFlatQVal::fIsSource) && (name == "orgmod_note");
929  if (is_src_orgmod_note) {
930  if (add_period) {
932  }
933  m_Prefix = &kEOL;
934  m_Suffix = ( add_period ? &kEOL : &kSemicolonEOL );
935  qual = x_AddFQ(q, "note", subname);
936  } else {
937  qual = x_AddFQ(q, "note", string(name) + ": " + subname,
939  }
940  if (add_period && qual) {
941  qual->SetAddPeriod();
942  }
943  }
944  } else {
945  // TODO: consider adding this back when we switch to just C++
946  // x_AddFQ(q, name, s_GetSpecimenVoucherText(ctx, subname) );
947  x_AddFQ(q, name, subname );
948  }
949 }
950 
951 
954 {
955  const string& organelle
956  = CBioSource::ENUM_METHOD_NAME(EGenome)()->FindName(m_Value, true);
957 
958  switch (m_Value) {
965  x_AddFQ(q, name, "plastid:" + organelle);
966  break;
967 
969  x_AddFQ(q, name, "mitochondrion:kinetoplast");
970  break;
971 
977  x_AddFQ(q, name, organelle);
978  break;
979 
982  x_AddFQ(q, organelle, kEmptyStr, CFormatQual::eEmpty);
983  break;
985 // x_AddFQ(q, organelle, kEmptyStr, CFormatQual::eEmpty);
986  break;
987 
990  x_AddFQ(q, organelle, kEmptyStr);
991  break;
992 
994  x_AddFQ(q, "insertion_seq", kEmptyStr);
995  break;
996 
997  default:
998  break;
999  }
1000 }
1001 
1002 
1005 {
1006  const bool bHtml = ctx.Config().DoHTML();
1007 
1008  if( ! m_Value->IsPub() ) {
1009  return; // TODO: is this right?
1010  }
1011 
1012  // copy the list
1013  list< CRef< CPub > > unusedPubs = m_Value->GetPub();
1014 
1015  if( ctx.GetReferences().empty() ) {
1016  // Yes, this even skips creating "/citation=[PUBMED ...]" items
1017  return;
1018  }
1019 
1020  ITERATE (vector< CRef<CReferenceItem> >, ref_iter, ctx.GetReferences()) {
1021  CPub_set_Base::TPub::iterator pub_iter = unusedPubs.begin();
1022  for( ; pub_iter != unusedPubs.end() ; ++pub_iter ) {
1023  if( (*ref_iter)->Matches( **pub_iter ) ) {
1024  // We have a match, so create the qual
1025  string value;
1026  string pub_id_str;
1027  int serial = (*ref_iter)->GetSerial();
1028  TEntrezId pmid = (*ref_iter)->GetPMID();
1029  if (serial) {
1030  pub_id_str = NStr::IntToString(serial);
1031  } else if (pmid != ZERO_ENTREZ_ID) {
1032  pub_id_str = NStr::NumericToString(pmid);
1033  }
1034  /*
1035  string pub_id_str =
1036  ((*ref_iter)->GetPMID() ? NStr::IntToString((*ref_iter)->GetPMID()) :
1037  NStr::IntToString((*ref_iter)->GetSerial()));
1038  */
1039 
1040  if(bHtml && pmid != ZERO_ENTREZ_ID) {
1041  // create a link
1042  value = "[<a href=\"";
1043  value += strLinkBasePubmed + NStr::NumericToString(pmid) + "\">" + pub_id_str + "</a>]";
1044  } else {
1045  value = '[' + pub_id_str + ']';
1046  }
1048 
1049  pub_iter = unusedPubs.erase( pub_iter ); // only one citation should be created per reference
1050  break; // break so we don't show the same ref more than once
1051  }
1052  }
1053  }
1054 
1055  // out of the pubs which are still unused, we may still be able to salvage some
1056  // under certain conditions.
1057  string pubmed;
1058  if (ctx.IsRefSeq() && !ctx.Config().IsModeRelease()) {
1059  CPub_set_Base::TPub::iterator pub_iter = unusedPubs.begin();
1060  for (; pub_iter != unusedPubs.end(); ++pub_iter) {
1061  if ((*pub_iter)->IsPmid()) {
1062  const TEntrezId pmid = (*pub_iter)->GetPmid().Get();
1063  string pmid_str = NStr::NumericToString(pmid);
1064  pubmed = "[PUBMED ";
1065  if (bHtml) {
1066  pubmed += "<a href=\"";
1067  pubmed += strLinkBasePubmed;
1068  pubmed += pmid_str;
1069  pubmed += "\">";
1070  }
1071  pubmed += pmid_str;
1072  if (bHtml) {
1073  pubmed += "</a>";
1074  }
1075  pubmed += ']';
1076 
1077  x_AddFQ(q, name, pubmed, CFormatQual::eUnquoted);
1078  }
1079  }
1080  }
1081 }
1082 
1084  CBioseqContext& ctx, TFlags) const
1085 {
1086  bool bHtml = ctx.Config().DoHTML();
1087 
1088  string value = NStr::IntToString(m_Value);
1089  if ( bHtml && name == "transl_table" ) {
1090  string link = "<a href=\"";
1091  link += strLinkBaseTransTable;
1092  link += value;
1093  link += "\">";
1094  link += value;
1095  link += "</a>";
1096  value = link;
1097  }
1098  x_AddFQ( q, name, value, CFormatQual::eUnquoted);
1099 }
1100 
1101 
1104 {
1105  bool bHtml = ctx.Config().DoHTML();
1106 
1107  string id_str;
1108  if ( m_Value->IsGi() ) {
1109  if ( m_GiPrefix ) {
1110  id_str = "GI:";
1111  if ((ctx.Config().HideGI() || ctx.Config().IsPolicyFtp() || ctx.Config().IsPolicyGenomes()) && name == "db_xref") return;
1112  }
1113  m_Value->GetLabel(&id_str, CSeq_id::eContent);
1114  } else {
1115  id_str = m_Value->GetSeqIdString(true);
1116  }
1117 
1118  if (name == "protein_id") {
1119  ctx.Config().GetHTMLFormatter().FormatProteinId(id_str, *m_Value, string(id_str));
1120  }
1121  if (name == "transcript_id") {
1122  ctx.Config().GetHTMLFormatter().FormatTranscriptId(id_str, *m_Value, string(id_str));
1123  }
1124  x_AddFQ(q, name, id_str);
1125 }
1126 
1127 
1128 void s_ConvertGtLt(string& subname)
1129 {
1130  SIZE_TYPE pos;
1131  for (pos = subname.find('<'); pos != NPOS; pos = subname.find('<', pos)) {
1132  subname.replace(pos, 1, "&lt;");
1133  }
1134  for (pos = subname.find('>'); pos != NPOS; pos = subname.find('>', pos)) {
1135  subname.replace(pos, 1, "&gt;");
1136  }
1137 }
1138 
1139 void s_HtmlizeLatLon( string &subname ) {
1140  string lat;
1141  string north_or_south;
1142  string lon;
1143  string east_or_west;
1144 
1145  if (subname.length() < 1) {
1146  return;
1147  }
1148  char ch = subname[0];
1149  if (ch < '0' || ch > '9') {
1150  return;
1151  }
1152 
1153  // extract the pieces
1154  CNcbiIstrstream lat_lon_stream( subname );
1155  lat_lon_stream >> lat;
1156  lat_lon_stream >> north_or_south;
1157  lat_lon_stream >> lon;
1158  lat_lon_stream >> east_or_west;
1159  if( lat_lon_stream.bad() ) {
1160  return;
1161  }
1162 
1163  if( north_or_south != "N" && north_or_south != "S" ) {
1164  return;
1165  }
1166 
1167  if( east_or_west != "E" && east_or_west != "W" ) {
1168  return;
1169  }
1170 
1171  // see if lat and lon make numerical sense
1172  try {
1173  double lat_num = NStr::StringToDouble( lat );
1174  double lon_num = NStr::StringToDouble( lon );
1175 
1176  // cap ranges
1177  if( lon_num < -180.0 ) {
1178  lon = "-180";
1179  } else if( lon_num > 180.0 ) {
1180  lon = "180";
1181  }
1182  if( lat_num < -90.0 ) {
1183  lat = "-90";
1184  } else if( lat_num > 90.0 ) {
1185  lat = "90";
1186  }
1187  } catch( CStringException & ) {
1188  // error parsing numbers
1189  return;
1190  }
1191 
1192  // negate the numbers if we're west of prime meridian or south of equator
1193  if( east_or_west == "W" && ! NStr::StartsWith(lon, "-") ) {
1194  lon = "-" + lon;
1195  }
1196  if( north_or_south == "S" && ! NStr::StartsWith(lat, "-")) {
1197  lat = "-" + lat;
1198  }
1199 
1200  // now we can form the HTML
1202  /*
1203  result << "<a href=\"" << strLinkBaseLatLon << "?lat="
1204  << lat
1205  << "&amp;lon="
1206  << lon
1207  << "\">"
1208  << subname << "</a>";
1209  */
1210  result << "<a href=\"" << "https://www.google.com/maps/place/"
1211  << lat
1212  << "+"
1213  << lon
1214  << "\">"
1215  << subname << "</a>";
1217 }
1218 
1220  TFlatQuals& q,
1221  const CTempString& name,
1223  IFlatQVal::TFlags flags) const
1224 {
1225  vector< string > fwd_names;
1226  if ( ! m_fwd_name.empty() ) {
1227  string fwd_name = m_fwd_name;
1228  if ( NStr::StartsWith( m_fwd_name, "(" ) && NStr::EndsWith( m_fwd_name, ")" ) ) {
1229  fwd_name = m_fwd_name.substr( 1, m_fwd_name.size() - 2 );
1230  }
1231  NStr::Split( fwd_name, ",", fwd_names );
1232  }
1233 
1234  vector< string > rev_names;
1235  if ( ! m_rev_name.empty() ) {
1236  string rev_name = m_rev_name;
1237  if ( NStr::StartsWith( m_rev_name, "(" ) && NStr::EndsWith( m_rev_name, ")" ) ) {
1238  rev_name = m_rev_name.substr( 1, m_rev_name.size() - 2 );
1239  }
1240  NStr::Split( rev_name, ",", rev_names );
1241  }
1242 
1243  vector< string > fwd_seqs;
1244  if ( ! m_fwd_seq.empty() ) {
1245  string fwd_seq = NStr::Replace( m_fwd_seq, "(", "" );
1246  NStr::ReplaceInPlace( fwd_seq, ")", "" );
1247  NStr::Split( fwd_seq, ",", fwd_seqs );
1248  }
1249  if ( fwd_seqs.empty() ) {
1250  return;
1251  }
1252 
1253  vector< string > rev_seqs;
1254  if ( ! m_rev_seq.empty() ) {
1255  string rev_seq = NStr::Replace( m_rev_seq, "(", "" );
1256  NStr::ReplaceInPlace( rev_seq, ")", "" );
1257  NStr::Split( rev_seq, ",", rev_seqs );
1258  }
1259 
1260  for ( size_t i=0; i < fwd_seqs.size(); ++i ) {
1261 
1262  string value;
1263  string sep;
1264  if ( i < fwd_names.size() ) {
1265  value += sep + "fwd_name: ";
1266  value += fwd_names[i];
1267  sep = ", ";
1268  }
1269  if( i < fwd_seqs.size() ) {
1270  value += sep + "fwd_seq: ";
1271  value += fwd_seqs[i];
1272  sep = ", ";
1273  }
1274  if ( i < rev_names.size() ) {
1275  value += sep + "rev_name: ";
1276  value += rev_names[i];
1277  sep = ", ";
1278  }
1279  if( i < rev_seqs.size() ) {
1280  value += sep + "rev_seq: ";
1281  value += rev_seqs[i];
1282  sep = ", ";
1283  }
1284  x_AddFQ( q, "PCR_primers", value );
1285  }
1286 }
1287 
1288 string s_TruncateLatLon( string &subname ) {
1289  string lat;
1290  string north_or_south;
1291  string lon;
1292  string east_or_west;
1293 
1294  if (subname.length() < 1) {
1295  return subname;
1296  }
1297  char ch = subname[0];
1298  if (ch < '0' || ch > '9') {
1299  return subname;
1300  }
1301 
1302  // extract the pieces
1303  CNcbiIstrstream lat_lon_stream( subname );
1304  lat_lon_stream >> lat;
1305  lat_lon_stream >> north_or_south;
1306  lat_lon_stream >> lon;
1307  lat_lon_stream >> east_or_west;
1308  if( lat_lon_stream.bad() ) {
1309  return subname;
1310  }
1311 
1312  if( north_or_south != "N" && north_or_south != "S" ) {
1313  return subname;
1314  }
1315 
1316  if( east_or_west != "E" && east_or_west != "W" ) {
1317  return subname;
1318  }
1319 
1320  size_t pos = NStr::Find(lat, ".");
1321  if (pos > 0) {
1322  size_t len = lat.length();
1323  if (pos + 9 < len) {
1324  lat.erase(pos + 9);
1325  }
1326  }
1327 
1328  pos = NStr::Find(lon, ".");
1329  if (pos > 0) {
1330  size_t len = lon.length();
1331  if (pos + 9 < len) {
1332  lon.erase(pos + 9);
1333  }
1334  }
1335 
1336  return lat + " " + north_or_south + " " + lon + " " + east_or_west;
1337 }
1338 
1341 {
1342  TFlatQual qual;
1343  string subname = m_Value->CanGetName() ? m_Value->GetName() : kEmptyStr;
1344  if ( s_StringIsJustQuotes(subname) ) {
1345  subname = kEmptyStr;
1346  }
1348  CleanAndCompress(subname, subname.c_str());
1350  if (ctx.Config().DoHTML()) {
1352  }
1353 
1354  if ( s_IsNote(flags, ctx) ) {
1355  bool add_period = RemovePeriodFromEnd(subname, true);
1356  if (!subname.empty()) {
1357  bool is_subsource_note =
1359  if (is_subsource_note) {
1360  if (add_period) {
1361  AddPeriod(subname);
1362  }
1363  m_Suffix = ( add_period ? &kEOL : &kSemicolonEOL );
1364  qual = x_AddFQ(q, "note", subname);
1365  } else {
1366  qual = x_AddFQ(q, "note", string(name) + ": " + subname);
1367  }
1368  if (add_period && qual) {
1369  qual->SetAddPeriod();
1370  }
1371  }
1372  } else {
1374  switch( subtype ) {
1375 
1382  break;
1383 
1386  x_AddFQ(q, name, subname);
1387  break;
1388 
1391  if( ctx.Config().DoHTML() ) {
1393  }
1395  x_AddFQ(q, name, subname);
1396  break;
1397 
1399  // skip invalid /altitudes
1400  if( s_AltitudeIsValid(subname) ||
1401  ( ! ctx.Config().IsModeRelease() && ! ctx.Config().IsModeEntrez() ) )
1402  {
1403  x_AddFQ(q, name, subname);
1404  }
1405  break;
1406 
1407  default:
1408  if ( ! subname.empty() ) {
1410  x_AddFQ(q, name, subname);
1411  }
1412  break;
1413  }
1414  }
1415 }
1416 
1418 {
1419  bool operator()(const CDbtag* dbt1, const CDbtag* dbt2)
1420  {
1421  return (dbt1->Compare(*dbt2)<0);
1422  }
1423 };
1424 
1425 
1428 {
1429  // to avoid duplicates, keep track of ones we've already done
1430  set<string> quals_already_done;
1431 
1432  TXref temp(m_Value);
1433 
1434  sort(temp.begin(), temp.end(), SSortReferenceByName());
1435 
1436  string id;
1437  string db_xref; db_xref.reserve(100);
1438 
1439  ITERATE(TXref, it, temp) {
1440  const CDbtag& dbt = **it;
1441  if (!m_Quals.Empty() && x_XrefInGeneXref(dbt)) {
1442  continue;
1443  }
1444 
1445  CTempString db = dbt.GetDb();
1446  if (db == "PID" || db == "GI") {
1447  continue;
1448  }
1449 
1450  if( db == "taxon" && (flags & fIsSource) == 0 ) {
1451  continue;
1452  }
1453 
1454  if (db == "cdd") {
1455  db = "CDD"; // canonicalize
1456  }
1457 
1458  if (ctx.Config().DropBadDbxref()) {
1459 
1460  // Special case for EST or GSS: we don't filter the dbtags as toughly
1462  const CMolInfo* mol_info = ctx.GetMolinfo();
1463  if (mol_info && mol_info->CanGetTech()) {
1464  if( mol_info->GetTech() == CMolInfo::eTech_est || mol_info->GetTech() == CMolInfo::eTech_survey ) {
1465  is_est_or_gss = CDbtag::eIsEstOrGss_Yes;
1466  }
1467  }
1468 
1469  const CDbtag::EIsRefseq is_refseq = ( ctx.IsRefSeq() ? CDbtag::eIsRefseq_Yes : CDbtag::eIsRefseq_No );
1471  if (!dbt.IsApproved( is_refseq, is_source, is_est_or_gss )) {
1472  continue;
1473  }
1474  }
1475 
1476  const CDbtag::TTag& tag = (*it)->GetTag();
1477  id.clear();
1478  if (tag.IsId()) {
1479  id = NStr::IntToString(tag.GetId());
1480  } else if (tag.IsStr()) {
1481  id = tag.GetStr();
1482  if (NStr::EqualNocase(db, "MGI") || NStr::EqualNocase(db, "MGD")) {
1483  if (NStr::StartsWith(id, "MGI:", NStr::eNocase) ||
1484  NStr::StartsWith(id, "MGD:", NStr::eNocase)) {
1485  db = "MGI";
1486  id.erase(0, 4);
1487  }
1488  }
1489  // trim
1490  TrimSpacesAndJunkFromEnds( id, true );
1491  }
1492  if (NStr::IsBlank(id)) {
1493  continue;
1494  }
1495 
1496  if (NStr::EqualNocase(db, "HGNC")) {
1497  if (!NStr::StartsWith(id, "HGNC:", NStr::eNocase)) {
1498  id = "HGNC:" + id;
1499  }
1500  } else if (NStr::EqualNocase(db, "VGNC")) {
1501  if (!NStr::StartsWith(id, "VGNC:", NStr::eNocase)) {
1502  id = "VGNC:" + id;
1503  }
1504  } else if (NStr::EqualNocase(db, "MGI")) {
1505  if (!NStr::StartsWith(id, "MGI:", NStr::eNocase)) {
1506  id = "MGI:" + id;
1507  }
1508  }
1509 
1510  if (NStr::EqualNocase(db, "GO")) {
1511  if (!id.empty()){
1512  while (id.size() < SIZE_TYPE(7)){
1513  id = '0' + id;
1514  }
1515  }
1516  }
1517 
1518  db_xref.clear();
1519  db_xref.append(db.data(), db.length()).push_back(':');
1520 
1521  if (ctx.Config().DoHTML()) {
1522  string url = dbt.GetUrl( ctx.GetTaxname() );
1523  if (!NStr::IsBlank(url)) {
1524  db_xref.append("<a href=\"").append(url).append("\">").append(id).append("</a>");
1525  } else {
1526  db_xref.append(id);
1527  }
1528  } else {
1529  db_xref.append(id);
1530  }
1531 
1532  // add quals not already done
1533  if (quals_already_done.find(db_xref) == quals_already_done.end()) {
1534  quals_already_done.insert(db_xref);
1535  x_AddFQ(q, name, db_xref);
1536  }
1537  }
1538 }
1539 
1540 
1541 bool CFlatXrefQVal::x_XrefInGeneXref(const CDbtag& dbtag) const
1542 {
1543  if ( !m_Quals->HasQual(eFQ_gene_xref) ) {
1544  return false;
1545  }
1546 
1547  typedef TQuals::const_iterator TQCI;
1548  TQCI gxref = m_Quals->LowerBound(eFQ_gene_xref);
1549  TQCI end = m_Quals->end();
1550  while (gxref != end && gxref->first == eFQ_gene_xref) {
1551  const CFlatXrefQVal* xrefqv =
1552  dynamic_cast<const CFlatXrefQVal*>(gxref->second.GetPointerOrNull());
1553  if (xrefqv) {
1554  ITERATE (TXref, dbt, xrefqv->m_Value) {
1555  if (dbtag.Match(**dbt)) {
1556  return true;
1557  }
1558  }
1559  }
1560  ++gxref;
1561  }
1562  /*pair<TQCI, TQCI> gxrefs = m_Quals->GetQuals(eFQ_gene_xref);
1563  for ( TQCI it = gxrefs.first; it != gxrefs.second; ++it ) {
1564  const CFlatXrefQVal* xrefqv =
1565  dynamic_cast<const CFlatXrefQVal*>(it->second.GetPointerOrNull());
1566  if (xrefqv) {
1567  ITERATE (TXref, dbt, xrefqv->m_Value) {
1568  if ( dbtag.Match(**dbt) ) {
1569  return true;
1570  }
1571  }
1572  }
1573  }*/
1574  return false;
1575 }
1576 
1577 
1578 static size_t s_CountAccessions(const CUser_field& field)
1579 {
1580  size_t count = 0;
1581 
1582  if (!field.IsSetData() || !field.GetData().IsFields()) {
1583  return 0;
1584  }
1585 
1586  //
1587  // Each accession consists of yet another block of "Fields" one of which carries
1588  // a label named "accession":
1589  //
1591  const CUser_field& uf = **it;
1592  if ( uf.CanGetData() && uf.GetData().IsFields() ) {
1593 
1595  const CUser_field& inner = **it2;
1596  if ( inner.IsSetLabel() && inner.GetLabel().IsStr() ) {
1597  if ( inner.GetLabel().GetStr() == "accession" ) {
1598  ++count;
1599  }
1600  }
1601  }
1602  }
1603  }
1604  return count;
1605 }
1606 
1607 
1609 (TFlatQuals& q,
1610  const CTempString& name,
1612  IFlatQVal::TFlags flags) const
1613 {
1614  size_t num_mrna = 0, num_prot = 0, num_est = 0, num_long_sra = 0;
1615  size_t rnaseq_base_coverage = 0, rnaseq_biosamples_introns_full = 0;
1616  const string* method = nullptr;
1617 
1619  const CUser_field& field = **it;
1620  if (! field.IsSetLabel() || ! field.GetLabel().IsStr()) {
1621  continue;
1622  }
1623  const string& label = field.GetLabel().GetStr();
1624  if (label == "Method") {
1625  method = &label;
1626  if ( field.CanGetData() && field.GetData().IsStr() ) {
1627  method = &( field.GetData().GetStr() );
1628  }
1629  } else if (label == "Counts") {
1631  if (!(*i)->IsSetLabel() && (*i)->GetLabel().IsStr()) {
1632  continue;
1633  }
1634  const string& label = (*i)->GetLabel().GetStr();
1635  if (label == "mRNA") {
1636  num_mrna = (*i)->GetData().GetInt();
1637  } else if (label == "EST") {
1638  num_est = (*i)->GetData().GetInt();
1639  } else if (label == "Protein") {
1640  num_prot = (*i)->GetData().GetInt();
1641  } else if (label == "long SRA read") {
1642  num_long_sra = (*i)->GetData().GetInt();
1643  }
1644  }
1645  } else if (label == "mRNA") {
1646  num_mrna = s_CountAccessions(field);
1647  } else if (label == "EST") {
1648  num_est = s_CountAccessions(field);
1649  } else if (label == "Protein") {
1650  num_prot = s_CountAccessions(field);
1651  } else if (label == "long SRA read") {
1652  num_long_sra = s_CountAccessions(field);
1653  } else if (label == "rnaseq_base_coverage" ) {
1654  if ( field.CanGetData() && field.GetData().IsInt() ) {
1655  rnaseq_base_coverage = field.GetData().GetInt();
1656  }
1657  } else if (label == "rnaseq_biosamples_introns_full" ) {
1658  if ( field.CanGetData() && field.GetData().IsInt() ) {
1659  rnaseq_biosamples_introns_full = field.GetData().GetInt();
1660  }
1661  }
1662  }
1663 
1665  text << "Derived by automated computational analysis";
1666  if (method && ! NStr::IsBlank(*method)) {
1667  text << " using gene prediction method: " << *method;
1668  }
1669  text << ".";
1670 
1671  if (num_mrna > 0 || num_est > 0 || num_prot > 0 || num_long_sra > 0 ||
1672  rnaseq_base_coverage > 0 )
1673  {
1674  text << " Supporting evidence includes similarity to:";
1675  }
1676  string section_prefix = " ";
1677  // The countable section
1678  if( num_mrna > 0 || num_est > 0 || num_prot > 0 || num_long_sra > 0 )
1679  {
1680  text << section_prefix;
1681  string prefix;
1682  if (num_mrna > 0) {
1683  text << prefix << num_mrna << " mRNA";
1684  if (num_mrna > 1) {
1685  text << 's';
1686  }
1687  prefix = ", ";
1688  }
1689  if (num_est > 0) {
1690  text << prefix << num_est << " EST";
1691  if (num_est > 1) {
1692  text << 's';
1693  }
1694  prefix = ", ";
1695  }
1696  if (num_long_sra > 0) {
1697  text << prefix << num_long_sra << " long SRA read";
1698  if (num_long_sra > 1) {
1699  text << 's';
1700  }
1701  prefix = ", ";
1702  }
1703  if (num_prot > 0) {
1704  text << prefix << num_prot << " Protein";
1705  if (num_prot > 1) {
1706  text << 's';
1707  }
1708  prefix = ", ";
1709  }
1710  section_prefix = ", and ";
1711  }
1712  // The RNASeq section
1713  if( rnaseq_base_coverage > 0 )
1714  {
1715  text << section_prefix;
1716 
1717  text << rnaseq_base_coverage << "% coverage of the annotated genomic feature by RNAseq alignments";
1718  if( rnaseq_biosamples_introns_full > 0 ) {
1719  text << ", including " << rnaseq_biosamples_introns_full;
1720  text << " sample";
1721  if( rnaseq_biosamples_introns_full > 1 ) {
1722  text << 's';
1723  }
1724  text << " with support for all annotated introns";
1725  }
1726 
1727  section_prefix = ", and ";
1728  }
1729 
1730  x_AddFQ(q, name, CNcbiOstrstreamToString(text).operator std::string());
1731 }
1732 
1733 
1735 (TFlatQuals& q,
1736  const CTempString& name,
1738  IFlatQVal::TFlags flags) const
1739 {
1741  const bool is_ftable = ctx.Config().IsFormatFTable();
1742  const bool is_html = ctx.Config().DoHTML();
1743 
1744  if ( s_IsNote(flags, ctx) ) {
1745  static const string sfx = ";";
1746  m_Prefix = &kEOL;
1747  m_Suffix = &sfx;
1748  x_AddFQ(q, "note", string(name) + ": " + s_GetGOText(*m_Value, is_ftable, is_html));
1749  } else {
1750  x_AddFQ(q, name, s_GetGOText(*m_Value, is_ftable, is_html));
1751  }
1752 }
1753 
1754 bool CFlatGoQVal::Equals( const CFlatGoQVal &rhs ) const
1755 {
1756  return m_Value->Equals( *rhs.m_Value );
1757 }
1758 
1759 const string & CFlatGoQVal::GetTextString(void) const
1760 {
1761  if( m_Value.IsNull() ) {
1762  return kEmptyStr;
1763  }
1764 
1765  CConstRef<CUser_field> textStringField = m_Value->GetFieldRef("text string");
1766  if( textStringField.IsNull() ) {
1767  return kEmptyStr;
1768  }
1769 
1770  const CUser_field_Base::TData & textStringData = textStringField->GetData();
1771  if( ! textStringData.IsStr() ) {
1772  return kEmptyStr;
1773  }
1774 
1775  return textStringData.GetStr();
1776 }
1777 
1779 {
1780  if( m_Value.IsNull() ) {
1781  return 0;
1782  }
1783 
1784  CConstRef<CUser_field> pmidField = m_Value->GetFieldRef("pubmed id");
1785  if( pmidField.IsNull() ) {
1786  return 0;
1787  }
1788 
1789  const CUser_field_Base::TData & pmidData = pmidField->GetData();
1790  if( ! pmidData.IsInt() ) {
1791  return 0;
1792  }
1793 
1794  return pmidData.GetInt();
1795 }
1796 
1798 (TFlatQuals& q,
1799  const CTempString& name,
1801  IFlatQVal::TFlags flags) const
1802 {
1803  if ( m_Aa.empty() ) {
1804  return;
1805  }
1806 
1807  const CSeq_loc& slp = *m_Anticodon;
1808  CRef<CSeq_loc> loc2(new CSeq_loc);
1809  loc2->Assign(slp);
1810  loc2->SetId(*ctx.GetPrimaryId());
1811  string locationString = CFlatSeqLoc(*loc2, ctx).GetString();
1812 
1813  string text;
1814  text = "(pos:";
1815  text += locationString;
1816  text += ",aa:";
1817  text += m_Aa;
1818 
1819  CScope & scope = ctx.GetScope();
1820  if (sequence::GetLength(*m_Anticodon, &scope) == 3) { // "3" because 3 nucleotides to an amino acid (and thus anticodon sequence)
1821 
1822  try {
1824  if (seq_vector.size() == 3) {
1825  string seq("---");
1826  seq_vector.GetSeqData(0, 3, seq);
1827  NStr::ToLower(seq);
1828  text += ",seq:";
1829  text += seq;
1830  }
1831  }
1832  catch (...) {
1833  // ignore any sort of error that occurs in this process
1834  }
1835  }
1836  text += ')';
1837 
1838  x_AddFQ(q, name, text, CFormatQual::eUnquoted);
1839 }
1840 
1841 
1843 (TFlatQuals& q,
1844  const CTempString& name,
1846  IFlatQVal::TFlags flags) const
1847 {
1848  if (!m_Value || !m_Value->IsSetCodon()) {
1849  return;
1850  }
1851  string recognized;
1852  size_t num = s_ComposeCodonRecognizedStr(*m_Value, recognized);
1853  if ( 0 == num ) {
1854  return;
1855  }
1856 
1857  if ( ctx.Config().CodonRecognizedToNote() ) {
1858  if (num == 1) {
1859  string str = "codon recognized: " + recognized;
1860  if (NStr::Find(m_Seqfeat_note, str) == NPOS) {
1861  x_AddFQ(q, name, str);
1862  }
1863  }
1864  else {
1865  x_AddFQ(q, name, "codons recognized: " + recognized);
1866  }
1867  } else {
1868  x_AddFQ(q, "codon_recognized", recognized);
1869  }
1870 }
1871 
1872 
1874 (TFlatQuals& quals,
1875  const CTempString& name,
1877  TFlags flags) const
1878 {
1879  if (m_Value.size() < 2) {
1880  return;
1881  }
1882  bool note = s_IsNote(flags, ctx);
1883 
1884  CProt_ref::TName::const_iterator it = m_Value.begin();
1885  ++it; // first is used for /product
1886  while (it != m_Value.end() && !NStr::IsBlank(*it)) {
1887  if (*it != m_Gene) {
1888  x_AddFQ(quals, (note ? "note" : name), *it);
1889  }
1890  ++it;
1891  }
1892 }
1893 
1894 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
#define true
Definition: bool.h:35
#define false
Definition: bool.h:36
Definition: Dbtag.hpp:53
EIsRefseq
Definition: Dbtag.hpp:260
@ eIsRefseq_No
Definition: Dbtag.hpp:261
@ eIsRefseq_Yes
Definition: Dbtag.hpp:262
bool Match(const CDbtag &dbt2) const
Definition: Dbtag.cpp:158
EIsSource
Definition: Dbtag.hpp:264
@ eIsSource_Yes
Definition: Dbtag.hpp:266
@ eIsSource_No
Definition: Dbtag.hpp:265
string GetUrl(void) const
EIsEstOrGss
Definition: Dbtag.hpp:268
@ eIsEstOrGss_Yes
Definition: Dbtag.hpp:270
@ eIsEstOrGss_No
Definition: Dbtag.hpp:269
bool IsApproved(EIsRefseq refseq=eIsRefseq_No, EIsSource is_source=eIsSource_No, EIsEstOrGss is_est_or_gss=eIsEstOrGss_No) const
Definition: Dbtag.cpp:215
int Compare(const CDbtag &dbt2) const
Definition: Dbtag.cpp:176
CConstRef< CSeq_loc > m_Anticodon
Definition: qualifiers.hpp:650
void Format(TFlatQuals &q, const CTempString &n, CBioseqContext &ctx, TFlags) const
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
Definition: qualifiers.cpp:469
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
Definition: qualifiers.cpp:599
CCdregion::TCode_break m_Value
Definition: qualifiers.hpp:393
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
Definition: qualifiers.cpp:689
CFlatCodonQVal(unsigned int codon, unsigned char aa, bool is_ascii=true)
Definition: qualifiers.cpp:682
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
Definition: qualifiers.cpp:707
CFlatExperimentQVal(const string &="")
Definition: qualifiers.cpp:698
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
Definition: qualifiers.cpp:485
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
Definition: qualifiers.cpp:568
int GetPubmedId(void) const
bool Equals(const CFlatGoQVal &rhs) const
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
CConstRef< CUser_field > m_Value
Definition: qualifiers.hpp:637
const string & GetTextString(void) const
CConstRef< CGb_qual > m_Value
Definition: qualifiers.hpp:443
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
Definition: qualifiers.cpp:742
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
Definition: qualifiers.cpp:735
CFlatInferenceQVal(const string &="")
Definition: qualifiers.cpp:714
void Format(TFlatQuals &q, const CTempString &n, CBioseqContext &, TFlags) const
CConstRef< CUser_object > m_Value
Definition: qualifiers.hpp:620
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
Definition: qualifiers.cpp:759
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
Definition: qualifiers.cpp:626
CConstRef< CGene_ref_Base::TFormal_name > m_Value
Definition: qualifiers.hpp:382
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
Definition: qualifiers.cpp:442
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
Definition: qualifiers.cpp:910
CConstRef< COrgMod > m_Value
Definition: qualifiers.hpp:496
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
Definition: qualifiers.cpp:952
CBioSource::TGenome m_Value
Definition: qualifiers.hpp:508
CProt_ref::TName m_Value
Definition: qualifiers.hpp:684
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
CConstRef< CPub_set > m_Value
Definition: qualifiers.hpp:520
CConstRef< CSeq_id > m_Value
Definition: qualifiers.hpp:533
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
const string & GetString(void) const
Definition: flat_seqloc.hpp:88
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
Definition: qualifiers.cpp:497
const TValue & GetValue(void) const
Definition: qualifiers.hpp:352
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
Definition: qualifiers.cpp:527
CFlatStringQVal(const CTempString &value, TStyle style=CFormatQual::eQuoted, ETrim trim=CFormatQual::eTrim_Normal)
Definition: qualifiers.cpp:337
IFlatQVal::TFlags m_AddPeriod
Definition: qualifiers.hpp:288
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
Definition: qualifiers.cpp:387
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
CConstRef< CSubSource > m_Value
Definition: qualifiers.hpp:562
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
Definition: qualifiers.cpp:856
const string & m_Seqfeat_note
Definition: qualifiers.hpp:666
CConstRef< CTrna_ext > m_Value
Definition: qualifiers.hpp:665
void Format(TFlatQuals &q, const CTempString &n, CBioseqContext &ctx, TFlags) const
void Format(TFlatQuals &quals, const CTempString &name, CBioseqContext &ctx, TFlags flags) const
CSeq_feat::TDbxref TXref
Definition: qualifiers.hpp:596
bool x_XrefInGeneXref(const CDbtag &dbtag) const
CConstRef< TQuals > m_Quals
Definition: qualifiers.hpp:608
@ fFlags_showEvenIfRedund
Definition: qualifiers.hpp:81
CFormatQual(const CTempString &name, const CTempString &value, const CTempString &prefix, const CTempString &suffix, TStyle style=eQuoted, TFlags flags=0, ETrim trim=eTrim_Normal)
Definition: qualifiers.cpp:310
string m_Value
Definition: qualifiers.hpp:121
@ eTrim_WhitespaceOnly
Definition: qualifiers.hpp:93
static string IndexToCodon(int index)
static void GetPrefixAndRemainder(const string &inference, string &prefix, string &remainder)
Definition: Gb_qual.cpp:381
bool operator()(const string &str1, const string &str2)
Definition: qualifiers.cpp:551
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
Definition: ncbistre.hpp:802
TQualMMap::const_iterator const_iterator
Definition: qualifiers.hpp:185
CRef –.
Definition: ncbiobj.hpp:618
CScope –.
Definition: scope.hpp:92
CSeqVector –.
Definition: seq_vector.hpp:65
class CStaticArrayMap<> is an array adaptor that provides an STLish interface to statically-defined a...
Definition: static_map.hpp:105
TBase::const_iterator const_iterator
Definition: static_map.hpp:109
CStringException –.
Definition: ncbistr.hpp:4506
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Definition: tempstr.hpp:65
CConstRef< CUser_field > GetFieldRef(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase) const
Return a field reference representing the tokenized key, or a NULL reference if the key doesn't exist...
Definition: User_field.cpp:226
static const string kSpace
Definition: qualifiers.hpp:150
static const string kSemicolonEOL
Definition: qualifiers.hpp:147
static const string kSemicolon
Definition: qualifiers.hpp:146
static const string kEOL
Definition: qualifiers.hpp:149
TFlatQual x_AddFQ(TFlatQuals &q, const CTempString &n, const CTempString &v, TStyle st=CFormatQual::eQuoted, CFormatQual::TFlags flags=0, ETrim trim=CFormatQual::eTrim_Normal) const
Definition: qualifiers.hpp:162
const string * m_Prefix
Definition: qualifiers.hpp:171
const string * m_Suffix
Definition: qualifiers.hpp:172
static const string kComma
Definition: qualifiers.hpp:148
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
const_iterator find(const key_type &key) const
Definition: set.hpp:137
const_iterator end() const
Definition: set.hpp:136
char value[7]
Definition: config.c:431
Include a standard set of the NCBI C++ Toolkit most basic headers.
static uch flags
CS_CONTEXT * ctx
Definition: t0006.c:12
static DLIST_TYPE *DLIST_NAME() prev(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
Definition: dlist.tmpl.h:61
@ eFQ_gene_xref
const TResidue codons[4][4]
Definition: gnomon_seq.cpp:76
static const int kSpace
SStrictId_Entrez::TId TEntrezId
TEntrezId type for entrez ids which require the same strictness as TGi.
Definition: ncbimisc.hpp:1041
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
Definition: ncbimisc.hpp:822
#define ZERO_ENTREZ_ID
Definition: ncbimisc.hpp:1102
string
Definition: cgiapp.hpp:687
#define ENUM_METHOD_NAME(EnumName)
Definition: serialbase.hpp:994
virtual bool Equals(const CSerialObject &object, ESerialRecursionMode how=eRecursive) const
Check if both objects contain the same values.
string GetSeqIdString(bool with_version=false) const
Return seqid string with optional version for text seqid type.
Definition: Seq_id.cpp:2144
void GetLabel(string *label, ELabelType type=eDefault, TLabelFlags flags=fLabel_Default) const
Append a label for this Seq-id to the supplied string.
Definition: Seq_id.cpp:2039
@ eContent
Untagged human-readable accession or the like.
Definition: Seq_id.hpp:573
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Override Assign() to incorporate cache invalidation.
Definition: Seq_loc.cpp:337
void SetId(CSeq_id &id)
set the 'id' field in all parts of this location
Definition: Seq_loc.cpp:3474
TSeqPos GetLength(const CSeq_id &id, CScope *scope)
Get sequence length if scope not null, else return max possible TSeqPos.
@ eCoding_Iupac
Set coding to printable coding (Iupacna or Iupacaa)
void GetSeqData(TSeqPos start, TSeqPos stop, string &buffer) const
Fill the buffer string with the sequence data for the interval [start, stop).
Definition: seq_vector.cpp:304
TSeqPos size(void) const
Definition: seq_vector.hpp:291
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
Definition: ncbiobj.hpp:1401
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define END_SCOPE(ns)
End the previously defined scope.
Definition: ncbistl.hpp:75
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define BEGIN_SCOPE(ns)
Define a new scope.
Definition: ncbistl.hpp:72
NCBI_NS_STD::string::size_type SIZE_TYPE
Definition: ncbistr.hpp:132
#define kEmptyStr
Definition: ncbistr.hpp:123
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.
Definition: ncbistr.cpp:3457
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
Definition: ncbistr.hpp:5430
static bool IsBlank(const CTempString str, SIZE_TYPE pos=0)
Check if a string is blank (has no text).
Definition: ncbistr.cpp:106
static double StringToDouble(const CTempStringEx str, TStringToNumFlags flags=0)
Convert string to double.
Definition: ncbistr.cpp:1387
#define NPOS
Definition: ncbistr.hpp:133
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate spaces in a string (in-place)
Definition: ncbistr.cpp:3197
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5084
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.
Definition: ncbistr.cpp:2887
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
Definition: ncbistr.hpp:2697
const char * data(void) const
Return a pointer to the array represented.
Definition: tempstr.hpp:313
void erase(size_type pos=0)
Truncate the string at some specified position Note: basic_string<> supports additional erase() optio...
Definition: tempstr.hpp:514
static string & Replace(const string &src, const string &search, const string &replace, string &dst, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
Definition: ncbistr.cpp:3310
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
Definition: ncbistr.hpp:5412
size_type length(void) const
Return the length of the represented array.
Definition: tempstr.hpp:320
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:5353
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.
Definition: ncbistr.hpp:673
static bool Equal(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2, ECase use_case=eCase)
Test for equality of a substring with another string.
Definition: ncbistr.hpp:5384
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.
Definition: ncbistr.cpp:3401
static string & ToLower(string &str)
Convert string to lower case – string& version.
Definition: ncbistr.cpp:405
@ eNocase
Case insensitive compare.
Definition: ncbistr.hpp:1206
static const char label[]
TSubtype GetSubtype(void) const
Get the Subtype member data.
Definition: SubSource_.hpp:310
bool CanGetName(void) const
Check if it is safe to call GetName method.
Definition: SubSource_.hpp:344
const TName & GetName(void) const
Get the Name member data.
Definition: SubSource_.hpp:350
@ eSubtype_lat_lon
+/- decimal degrees
Definition: SubSource_.hpp:113
@ eSubtype_environmental_sample
Definition: SubSource_.hpp:111
const TStr & GetStr(void) const
Get the variant data.
bool IsStr(void) const
Check if variant Str is selected.
Definition: Object_id_.hpp:291
bool IsSetDb(void) const
name of database or system Check if a value has been assigned to Db data member.
Definition: Dbtag_.hpp:208
const TTag & GetTag(void) const
Get the Tag member data.
Definition: Dbtag_.hpp:267
const TData & GetData(void) const
Get the Data member data.
bool CanGetData(void) const
Check if it is safe to call GetData method.
bool IsSetTag(void) const
appropriate tag Check if a value has been assigned to Tag data member.
Definition: Dbtag_.hpp:255
const TFields & GetFields(void) const
Get the variant data.
const TDb & GetDb(void) const
Get the Db member data.
Definition: Dbtag_.hpp:220
vector< CRef< CUser_field > > TFields
bool IsFields(void) const
Check if variant Fields is selected.
bool IsInt(void) const
Check if variant Int is selected.
bool IsStr(void) const
Check if variant Str is selected.
bool IsSetLabel(void) const
field label Check if a value has been assigned to Label data member.
const TStr & GetStr(void) const
Get the variant data.
Definition: Object_id_.hpp:297
TInt GetInt(void) const
Get the variant data.
const TData & GetData(void) const
Get the Data member data.
const TLabel & GetLabel(void) const
Get the Label member data.
bool IsSetData(void) const
Check if a value has been assigned to Data data member.
vector< CRef< CUser_field > > TData
const TSubname & GetSubname(void) const
Get the Subname member data.
Definition: OrgMod_.hpp:347
const TPub & GetPub(void) const
Get the variant data.
Definition: Pub_set_.hpp:386
bool IsPub(void) const
Check if variant Pub is selected.
Definition: Pub_set_.hpp:380
const TCodon & GetCodon(void) const
Get the Codon member data.
Definition: Trna_ext_.hpp:624
bool IsSetCodon(void) const
codon(s) as in Genetic-code Check if a value has been assigned to Codon data member.
Definition: Trna_ext_.hpp:612
list< int > TCodon
Definition: Trna_ext_.hpp:306
const TVal & GetVal(void) const
Get the Val member data.
Definition: Gb_qual_.hpp:259
list< CRef< CCode_break > > TCode_break
Definition: Cdregion_.hpp:111
const TQual & GetQual(void) const
Get the Qual member data.
Definition: Gb_qual_.hpp:212
@ e_Ncbi8aa
NCBI8aa code.
@ e_Ncbieaa
ASCII value of NCBIeaa code.
bool IsGi(void) const
Check if variant Gi is selected.
Definition: Seq_id_.hpp:883
@ e_General
for other databases
Definition: Seq_id_.hpp:105
TTech GetTech(void) const
Get the Tech member data.
Definition: MolInfo_.hpp:497
list< CRef< CSeq_id > > TId
Definition: Bioseq_.hpp:94
bool CanGetTech(void) const
Check if it is safe to call GetTech method.
Definition: MolInfo_.hpp:478
@ eTech_targeted
targeted locus sets/studies
Definition: MolInfo_.hpp:147
@ eTech_tsa
transcriptome shotgun assembly
Definition: MolInfo_.hpp:146
@ eTech_wgs
whole genome shotgun sequencing
Definition: MolInfo_.hpp:143
@ eTech_survey
one-pass genomic sequence
Definition: MolInfo_.hpp:127
@ eTech_est
Expressed Sequence Tag.
Definition: MolInfo_.hpp:125
@ eBiomol_pre_RNA
precursor RNA of any sort really
Definition: MolInfo_.hpp:102
@ eBiomol_cRNA
viral RNA genome copy intermediate
Definition: MolInfo_.hpp:111
@ eBiomol_snoRNA
small nucleolar RNA
Definition: MolInfo_.hpp:112
@ eBiomol_transcribed_RNA
transcribed RNA other than existing classes
Definition: MolInfo_.hpp:113
@ eBiomol_other_genetic
other genetic material
Definition: MolInfo_.hpp:109
char * dbname(DBPROCESS *dbproc)
Get name of current database.
Definition: dblib.c:6929
unsigned int
A callback function used to compare two keys in a database.
Definition: types.hpp:1210
int i
int len
static void text(MDB_val *v)
Definition: mdb_dump.c:62
static char * subname
Definition: mdb_load.c:26
constexpr auto sort(_Init &&init)
constexpr bool empty(list< Ts... >) noexcept
const struct ncbi::grid::netcache::search::fields::SIZE size
const CharType(& source)[N]
Definition: pointer.h:1149
const char * tag
int isspace(Uchar c)
Definition: ncbictype.hpp:69
int isdigit(Uchar c)
Definition: ncbictype.hpp:64
int toupper(Uchar c)
Definition: ncbictype.hpp:73
int islower(Uchar c)
Definition: ncbictype.hpp:66
int isupper(Uchar c)
Definition: ncbictype.hpp:70
T min(T x_, T y_)
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
Definition: njn_matrix.hpp:613
bool TrimSpacesAndJunkFromEnds(string &str, bool allow_ellipsis=false)
Definition: objutil.cpp:475
const char * strLinkBaseGeneOntologyRef
Definition: objutil.cpp:1660
bool RemovePeriodFromEnd(string &str, bool keep_ellipsis=true)
Definition: objutil.cpp:299
ETildeStyle
Definition: objutil.hpp:47
@ eTilde_tilde
Definition: objutil.hpp:48
@ eTilde_space
Definition: objutil.hpp:49
@ eTilde_note
Definition: objutil.hpp:52
const char * strLinkBaseGeneOntology
Definition: objutil.cpp:1658
void ExpandTildes(string &s, ETildeStyle style)
Definition: objutil.cpp:152
const char * strLinkBaseTransTable
Definition: objutil.cpp:1646
bool ConvertQuotesNotInHTMLTags(string &str)
Definition: objutil.cpp:1774
const char * GetAAName(unsigned char aa, bool is_ascii)
Definition: objutil.cpp:1559
const char * strLinkBasePubmed
Definition: objutil.cpp:1648
void JoinString(string &to, const string &prefix, const string &str, bool noRedundancy=true)
Definition: objutil.cpp:1050
void AddPeriod(string &str)
Definition: objutil.cpp:377
void CleanAndCompress(string &dest, const CTempString &instr)
Definition: objutil.cpp:823
void ConvertQuotes(string &str)
Definition: objutil.cpp:240
const char * strLinkBaseExpasy
Definition: objutil.cpp:1650
static const char * suffix[]
Definition: pcregrep.c:408
static const char * prefix[]
Definition: pcregrep.c:405
CStaticPairArrayMap< const char *, ETildeStyle, PCase_CStr > TNameTildeStyleMap
Definition: qualifiers.cpp:367
static bool s_IsNote(IFlatQVal::TFlags flags, CBioseqContext &ctx)
Definition: qualifiers.cpp:69
DEFINE_STATIC_ARRAY_MAP(TNameTildeStyleMap, sc_NameTildeStyleMap, kNameTildeStyleMap)
static size_t s_ComposeCodonRecognizedStr(const CTrna_ext &trna, string &recognized)
Definition: qualifiers.cpp:226
SStaticPair< const char *, ETildeStyle > TNameTildeStylePair
Definition: qualifiers.cpp:366
void s_ConvertGtLt(string &subname)
static void s_ReplaceUforT(string &codon)
Definition: qualifiers.cpp:202
static size_t s_CountAccessions(const CUser_field &field)
void s_HtmlizeLatLon(string &subname)
static char s_MakeDegenerateBase(const string &str1, const string &str2)
Definition: qualifiers.cpp:212
static bool s_StringIsJustQuotes(const string &str)
Definition: qualifiers.cpp:75
static string s_GetGOText(const CUser_field &field, const bool is_ftable, const bool is_html)
Definition: qualifiers.cpp:86
static bool s_AltitudeIsValid(const string &str)
Definition: qualifiers.cpp:269
static const TNameTildeStylePair kNameTildeStyleMap[]
Definition: qualifiers.cpp:368
ETildeStyle s_TildeStyleFromName(const string &name)
Definition: qualifiers.cpp:377
string s_TruncateLatLon(string &subname)
vector< TFlatQual > TFlatQuals
Definition: qualifiers.hpp:129
static const char * str(char *buf, int n)
Definition: stats.c:84
bool operator()(const CDbtag *dbt1, const CDbtag *dbt2)
Template structure SStaticPair is simlified replacement of STL pair<> Main reason of introducing this...
Definition: static_set.hpp:60
#define _ASSERT
else result
Definition: token2.c:20
Modified on Wed Mar 27 11:20:49 2024 by modify_doxy.py rev. 669887