NCBI C++ ToolKit
Dbtag.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: Dbtag.hpp 102498 2024-05-15 16:43:18Z kans $
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  * Author: .......
27  *
28  * File Description:
29  * .......
30  *
31  * Remark:
32  * This code was originally generated by application DATATOOL
33  * using specifications from the ASN data definition file
34  * 'general.asn'.
35  *
36  * ---------------------------------------------------------------------------
37  */
38 
39 #ifndef OBJECTS_GENERAL_DBTAG_HPP
40 #define OBJECTS_GENERAL_DBTAG_HPP
41 
42 
43 // generated includes
45 
46 // generated classes
47 
49 
50 BEGIN_objects_SCOPE // namespace ncbi::objects::
51 
53 {
55 public:
56 
57  // this must be kept in sync with the (private) list in Dbtag.cpp!
58  enum EDbtagType {
60 
238  eDbtagType_VEuPathDB
239  };
240 
241  enum EDbtagGroup {
242  fNone = 0,
243  fGenBank = 1 << 0,
244  fRefSeq = 1 << 1,
245  fSrc = 1 << 2,
246  fProbe = 1 << 3
247  };
248 
249  typedef int TDbtagGroup; ///< holds bitwise OR of "EDbtagGroup"
250 
251  // constructor
252  CDbtag(void);
253  // destructor
254  ~CDbtag(void);
255 
256  // Comparison functions
257  int Compare(const CDbtag& dbt2) const;
258 
259  // Matching ids
260  bool Match(const CDbtag& dbt2) const;
261  // Set this id to me matching to the argument
262  // return false if there is no matching id
263  bool SetAsMatchingTo(const CDbtag& dbt2);
264 
265  // Appends a label to "label" based on content of CDbtag
266  void GetLabel(string* label) const;
267 
268  // Test if DB is approved by the consortium.
269  // 'GenBank', 'EMBL' and 'DDBJ' are approved only in the
270  // context of a RefSeq record.
271  enum EIsRefseq {
272  eIsRefseq_No = 0,
273  eIsRefseq_Yes
274  };
275  enum EIsSource {
276  eIsSource_No = 0,
277  eIsSource_Yes
278  };
279  enum EIsEstOrGss {
280  eIsEstOrGss_No = 0,
282  };
283  bool IsApproved(EIsRefseq refseq = eIsRefseq_No, EIsSource is_source = eIsSource_No, EIsEstOrGss is_est_or_gss = eIsEstOrGss_No ) const;
284  // Test if DB is approved (case insensitive).
285  // Returns the case sensetive DB name if approved, NULL otherwise.
286  const char* IsApprovedNoCase(EIsRefseq refseq = eIsRefseq_No, EIsSource is_source = eIsSource_No) const;
287  // Extended version allows many DB categories
288  bool IsApproved(TDbtagGroup group) const;
289 
290  // Test if appropriate to omit from displays, formatting, etc.
291  bool IsSkippable(void) const;
292 
293  // Retrieve the enumerated type for the dbtag
294  EDbtagType GetType(void) const;
295 
296  // determine the situations where the dbtag would be appropriate
297  bool GetDBFlags (bool& is_refseq, bool& is_src, string& correct_caps) const;
298  // Extended version allows many DB categories
299  TDbtagGroup GetDBFlags (string& correct_caps) const;
300 
301  // Force a refresh of the internal type
302  void InvalidateType(void);
303 
304  // Get a URL to the resource (if available)
305  // @return
306  // the URL or an empty string if non is available
307  string GetUrl(void) const;
308 
309  // Get a URL to the resource (if available)
310  // @param taxid organism taxid for URL generation
311  // @return
312  // the URL or an empty string if non is available
313  string GetUrl(TTaxId taxid) const;
314 
315  // Get a URL to the resource (if available)
316  // @param taxname organism taxname (e.g. "Danio rerio") for URL generation
317  // @return
318  // the URL or an empty string if non is available
319  string GetUrl(const string &taxname) const;
320 
321  // Get a URL to the resource (if available). This function assumes
322  // that only 1 of the following 3 states can occur: 1. all parameters
323  // empty. 2. genus and species set, but not subspecies.
324  // 3. all parameters set.
325  // Any other state of parameters may give an unexpected result, but
326  // no crash or exception will be thrown.
327  // @param genus organism genus for URL generation
328  // @param species organism species for URL generation
329  // @param subspecies organism subspecies for URL generation
330  // @return
331  // the URL or an empty string if non is available
332  string GetUrl(const string & genus,
333  const string & species,
334  const string & subspecies = kEmptyStr ) const;
335 
336 private:
337 
338  // our enumerated (parsed) type
340 
341  // Prohibit copy constructor & assignment operator
342  CDbtag(const CDbtag&);
344 
345  // returns true if the given tag looks like an accession and
346  // it also gives the number of alpha, digit and underscores found in it
347  static bool x_LooksLikeAccession(const string &tag,
348  int &out_num_alpha,
349  int &out_num_digit,
350  int &out_num_unscr);
351 };
352 
353 
354 
355 /////////////////// CDbtag inline methods
356 
357 // constructor
358 inline
360  : m_Type(eDbtagType_bad)
361 {
362 }
363 
364 
365 /////////////////// end of CDbtag inline methods
366 
367 
368 END_objects_SCOPE // namespace ncbi::objects::
369 
371 
372 #endif // OBJECTS_GENERAL_DBTAG_HPP
Data storage class.
Dbtag is generalized for tagging eg.
Definition: Dbtag_.hpp:80
Definition: Dbtag.hpp:53
CDbtag(void)
Definition: Dbtag.hpp:359
static bool x_LooksLikeAccession(const string &tag, int &out_num_alpha, int &out_num_digit, int &out_num_unscr)
EIsRefseq
Definition: Dbtag.hpp:271
EIsSource
Definition: Dbtag.hpp:275
CDbtag_Base Tparent
Definition: Dbtag.hpp:54
EDbtagGroup
Definition: Dbtag.hpp:241
string GetUrl(TTaxId taxid) const
string GetUrl(void) const
string GetUrl(const string &taxname) const
CDbtag(const CDbtag &)
EDbtagType m_Type
Definition: Dbtag.hpp:339
int TDbtagGroup
holds bitwise OR of "EDbtagGroup"
Definition: Dbtag.hpp:249
EDbtagType
Definition: Dbtag.hpp:58
@ eDbtagType_EnsemblGenomes_Gn
Definition: Dbtag.hpp:203
@ eDbtagType_ViPR
Definition: Dbtag.hpp:197
@ eDbtagType_FANTOM_DB
Definition: Dbtag.hpp:92
@ eDbtagType_Interpro
Definition: Dbtag.hpp:122
@ eDbtagType_ESTLIB
Definition: Dbtag.hpp:90
@ eDbtagType_PDB
Definition: Dbtag.hpp:139
@ eDbtagType_dbSNP
Definition: Dbtag.hpp:185
@ eDbtagType_LRG
Definition: Dbtag.hpp:126
@ eDbtagType_PBmice
Definition: Dbtag.hpp:138
@ eDbtagType_EnsemblGenomes_Tr
Definition: Dbtag.hpp:204
@ eDbtagType_CollecTF
Definition: Dbtag.hpp:85
@ eDbtagType_NASONIABASE
Definition: Dbtag.hpp:194
@ eDbtagType_RAP_DB
Definition: Dbtag.hpp:148
@ eDbtagType_Assembly
Definition: Dbtag.hpp:208
@ eDbtagType_I5KNAL
Definition: Dbtag.hpp:213
@ eDbtagType_EPDnew
Definition: Dbtag.hpp:220
@ eDbtagType_GI
Definition: Dbtag.hpp:99
@ eDbtagType_IKMC
Definition: Dbtag.hpp:196
@ eDbtagType_GiardiaDB
Definition: Dbtag.hpp:231
@ eDbtagType_IMGT_LIGM
Definition: Dbtag.hpp:117
@ eDbtagType_JCM
Definition: Dbtag.hpp:124
@ eDbtagType_PFAM
Definition: Dbtag.hpp:140
@ eDbtagType_HOMD
Definition: Dbtag.hpp:109
@ eDbtagType_DDBJ
Definition: Dbtag.hpp:86
@ eDbtagType_dictyBase
Definition: Dbtag.hpp:187
@ eDbtagType_NRESTdb
Definition: Dbtag.hpp:133
@ eDbtagType_CGNC
Definition: Dbtag.hpp:81
@ eDbtagType_FungiDB
Definition: Dbtag.hpp:230
@ eDbtagType_dbSTS
Definition: Dbtag.hpp:186
@ eDbtagType_TriTrypDB
Definition: Dbtag.hpp:237
@ eDbtagType_BDGP_EST
Definition: Dbtag.hpp:74
@ eDbtagType_IFO
Definition: Dbtag.hpp:114
@ eDbtagType_HGNC
Definition: Dbtag.hpp:107
@ eDbtagType_EchinoBase
Definition: Dbtag.hpp:227
@ eDbtagType_BoLD
Definition: Dbtag.hpp:78
@ eDbtagType_niaEST
Definition: Dbtag.hpp:189
@ eDbtagType_VectorBase
Definition: Dbtag.hpp:174
@ eDbtagType_NMPDR
Definition: Dbtag.hpp:132
@ eDbtagType_Fungorum
Definition: Dbtag.hpp:95
@ eDbtagType_RefSeq
Definition: Dbtag.hpp:201
@ eDbtagType_BEETLEBASE
Definition: Dbtag.hpp:76
@ eDbtagType_PID
Definition: Dbtag.hpp:192
@ eDbtagType_GeneID
Definition: Dbtag.hpp:104
@ eDbtagType_UniGene
Definition: Dbtag.hpp:168
@ eDbtagType_RATMAP
Definition: Dbtag.hpp:149
@ eDbtagType_BioProject
Definition: Dbtag.hpp:195
@ eDbtagType_GO
Definition: Dbtag.hpp:100
@ eDbtagType_RFAM
Definition: Dbtag.hpp:153
@ eDbtagType_GRIN
Definition: Dbtag.hpp:102
@ eDbtagType_Osa1
Definition: Dbtag.hpp:136
@ eDbtagType_dbVar
Definition: Dbtag.hpp:224
@ eDbtagType_EnsemblRapid
Definition: Dbtag.hpp:225
@ eDbtagType_PomBase
Definition: Dbtag.hpp:146
@ eDbtagType_ApiDB
Definition: Dbtag.hpp:69
@ eDbtagType_axeldb
Definition: Dbtag.hpp:180
@ eDbtagType_RGD
Definition: Dbtag.hpp:154
@ eDbtagType_BB
Definition: Dbtag.hpp:73
@ eDbtagType_IMGT_HLA
Definition: Dbtag.hpp:116
@ eDbtagType_COG
Definition: Dbtag.hpp:83
@ eDbtagType_AceView_WormGenes
Definition: Dbtag.hpp:67
@ eDbtagType_GOA
Definition: Dbtag.hpp:101
@ eDbtagType_dbCloneLib
Definition: Dbtag.hpp:182
@ eDbtagType_GeneDB
Definition: Dbtag.hpp:103
@ eDbtagType_SRPDB
Definition: Dbtag.hpp:161
@ eDbtagType_ASAP
Definition: Dbtag.hpp:63
@ eDbtagType_IMGT_GENEDB
Definition: Dbtag.hpp:115
@ eDbtagType_CCDS
Definition: Dbtag.hpp:79
@ eDbtagType_RZPD
Definition: Dbtag.hpp:155
@ eDbtagType_FLYBASE
Definition: Dbtag.hpp:94
@ eDbtagType_HPM
Definition: Dbtag.hpp:110
@ eDbtagType_UniProt_SwissProt
Definition: Dbtag.hpp:169
@ eDbtagType_bad
Definition: Dbtag.hpp:59
@ eDbtagType_GrainGenes
Definition: Dbtag.hpp:105
@ eDbtagType_dbProbe
Definition: Dbtag.hpp:184
@ eDbtagType_ATCC
Definition: Dbtag.hpp:64
@ eDbtagType_PubChem
Definition: Dbtag.hpp:198
@ eDbtagType_PBR
Definition: Dbtag.hpp:137
@ eDbtagType_SGD
Definition: Dbtag.hpp:158
@ eDbtagType_TAIR
Definition: Dbtag.hpp:164
@ eDbtagType_RiceGenes
Definition: Dbtag.hpp:156
@ eDbtagType_BEI
Definition: Dbtag.hpp:215
@ eDbtagType_SK_FST
Definition: Dbtag.hpp:160
@ eDbtagType_AntWeb
Definition: Dbtag.hpp:68
@ eDbtagType_SEED
Definition: Dbtag.hpp:157
@ eDbtagType_H_InvDB
Definition: Dbtag.hpp:113
@ eDbtagType_dbEST
Definition: Dbtag.hpp:183
@ eDbtagType_CGD
Definition: Dbtag.hpp:207
@ eDbtagType_HMP
Definition: Dbtag.hpp:108
@ eDbtagType_MGD
Definition: Dbtag.hpp:191
@ eDbtagType_UNITE
Definition: Dbtag.hpp:167
@ eDbtagType_PeptideAtlas
Definition: Dbtag.hpp:219
@ eDbtagType_AmoebaDB
Definition: Dbtag.hpp:228
@ eDbtagType_CryptoDB
Definition: Dbtag.hpp:229
@ eDbtagType_Pathema
Definition: Dbtag.hpp:144
@ eDbtagType_GEO
Definition: Dbtag.hpp:98
@ eDbtagType_CDD
Definition: Dbtag.hpp:80
@ eDbtagType_MIM
Definition: Dbtag.hpp:129
@ eDbtagType_Trace
Definition: Dbtag.hpp:200
@ eDbtagType_EMBL
Definition: Dbtag.hpp:88
@ eDbtagType_PGN
Definition: Dbtag.hpp:141
@ eDbtagType_TubercuList
Definition: Dbtag.hpp:205
@ eDbtagType_IntrepidBio
Definition: Dbtag.hpp:123
@ eDbtagType_Ensembl
Definition: Dbtag.hpp:221
@ eDbtagType_MGI
Definition: Dbtag.hpp:128
@ eDbtagType_ECOCYC
Definition: Dbtag.hpp:87
@ eDbtagType_ISD
Definition: Dbtag.hpp:119
@ eDbtagType_RBGE_herbarium
Definition: Dbtag.hpp:151
@ eDbtagType_VBASE2
Definition: Dbtag.hpp:172
@ eDbtagType_UNILIB
Definition: Dbtag.hpp:166
@ eDbtagType_BGD
Definition: Dbtag.hpp:77
@ eDbtagType_ApiDB_ToxoDB
Definition: Dbtag.hpp:72
@ eDbtagType_HPRD
Definition: Dbtag.hpp:111
@ eDbtagType_Phytozome
Definition: Dbtag.hpp:145
@ eDbtagType_MedGen
Definition: Dbtag.hpp:206
@ eDbtagType_TrichDB
Definition: Dbtag.hpp:236
@ eDbtagType_Araport
Definition: Dbtag.hpp:216
@ eDbtagType_EcoGene
Definition: Dbtag.hpp:91
@ eDbtagType_SubtiList
Definition: Dbtag.hpp:163
@ eDbtagType_BEEBASE
Definition: Dbtag.hpp:193
@ eDbtagType_taxon
Definition: Dbtag.hpp:190
@ eDbtagType_REBASE
Definition: Dbtag.hpp:152
@ eDbtagType_APHIDBASE
Definition: Dbtag.hpp:62
@ eDbtagType_FBOL
Definition: Dbtag.hpp:93
@ eDbtagType_AllianceGenome
Definition: Dbtag.hpp:226
@ eDbtagType_PiroplasmaDB
Definition: Dbtag.hpp:233
@ eDbtagType_CloneID
Definition: Dbtag.hpp:84
@ eDbtagType_EnsemblGenomes
Definition: Dbtag.hpp:202
@ eDbtagType_UniProt_TrEMBL
Definition: Dbtag.hpp:170
@ eDbtagType_SoyBase
Definition: Dbtag.hpp:162
@ eDbtagType_dbClone
Definition: Dbtag.hpp:181
@ eDbtagType_Vega
Definition: Dbtag.hpp:175
@ eDbtagType_BioSample
Definition: Dbtag.hpp:210
@ eDbtagType_PseudoCAP
Definition: Dbtag.hpp:222
@ eDbtagType_HSSP
Definition: Dbtag.hpp:112
@ eDbtagType_CK
Definition: Dbtag.hpp:82
@ eDbtagType_GDB
Definition: Dbtag.hpp:97
@ eDbtagType_ToxoDB
Definition: Dbtag.hpp:235
@ eDbtagType_OrthoMCL
Definition: Dbtag.hpp:135
@ eDbtagType_WorfDB
Definition: Dbtag.hpp:176
@ eDbtagType_TIGRFAM
Definition: Dbtag.hpp:165
@ eDbtagType_InterimID
Definition: Dbtag.hpp:121
@ eDbtagType_PSEUDO
Definition: Dbtag.hpp:143
@ eDbtagType_ApiDB_CryptoDB
Definition: Dbtag.hpp:70
@ eDbtagType_NextDB
Definition: Dbtag.hpp:134
@ eDbtagType_miRBase
Definition: Dbtag.hpp:188
@ eDbtagType_ZFIN
Definition: Dbtag.hpp:179
@ eDbtagType_IRD
Definition: Dbtag.hpp:118
@ eDbtagType_BDGP_INS
Definition: Dbtag.hpp:75
@ eDbtagType_ISFinder
Definition: Dbtag.hpp:120
@ eDbtagType_VGNC
Definition: Dbtag.hpp:217
@ eDbtagType_MicrosporidiaDB
Definition: Dbtag.hpp:232
@ eDbtagType_ApiDB_PlasmoDB
Definition: Dbtag.hpp:71
@ eDbtagType_GenBank
Definition: Dbtag.hpp:209
@ eDbtagType_ATCC_in_host
Definition: Dbtag.hpp:66
@ eDbtagType_VISTA
Definition: Dbtag.hpp:214
@ eDbtagType_RBGE_garden
Definition: Dbtag.hpp:150
@ eDbtagType_UniSTS
Definition: Dbtag.hpp:171
@ eDbtagType_PlasmoDB
Definition: Dbtag.hpp:234
@ eDbtagType_MycoBank
Definition: Dbtag.hpp:131
@ eDbtagType_RNAcentral
Definition: Dbtag.hpp:218
@ eDbtagType_SGN
Definition: Dbtag.hpp:159
@ eDbtagType_ENSEMBL
Definition: Dbtag.hpp:89
@ eDbtagType_ATCC_dna
Definition: Dbtag.hpp:65
@ eDbtagType_ISHAM_ITS
Definition: Dbtag.hpp:211
@ eDbtagType_Greengenes
Definition: Dbtag.hpp:106
@ eDbtagType_MaizeGDB
Definition: Dbtag.hpp:130
@ eDbtagType_Xenbase
Definition: Dbtag.hpp:178
@ eDbtagType_SRA
Definition: Dbtag.hpp:199
@ eDbtagType_MarpolBase
Definition: Dbtag.hpp:223
@ eDbtagType_JGIDB
Definition: Dbtag.hpp:125
@ eDbtagType_PIR
Definition: Dbtag.hpp:142
@ eDbtagType_WormBase
Definition: Dbtag.hpp:177
@ eDbtagType_VBRC
Definition: Dbtag.hpp:173
@ eDbtagType_AFTOL
Definition: Dbtag.hpp:61
@ eDbtagType_LocusID
Definition: Dbtag.hpp:127
@ eDbtagType_PseudoCap
Definition: Dbtag.hpp:147
@ eDbtagType_GABI
Definition: Dbtag.hpp:96
@ eDbtagType_ERIC
Definition: Dbtag.hpp:212
EIsEstOrGss
Definition: Dbtag.hpp:279
@ eIsEstOrGss_Yes
Definition: Dbtag.hpp:281
string GetUrl(const string &genus, const string &species, const string &subspecies=kEmptyStr) const
SStrictId_Tax::TId TTaxId
Taxon id type.
Definition: ncbimisc.hpp:1048
string GetLabel(const CSeq_id &id)
sequence::ECompare Compare(const CSeq_loc &loc1, const CSeq_loc &loc2, CScope *scope)
Returns the sequence::ECompare containment relationship between CSeq_locs.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define kEmptyStr
Definition: ncbistr.hpp:123
#define NCBI_GENERAL_EXPORT
Definition: ncbi_export.h:512
static const char label[]
CDbtag_Base & operator=(const CDbtag_Base &)
const char * tag
@ fNone
Modified on Wed Sep 04 14:58:28 2024 by modify_doxy.py rev. 669887