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

Go to the SVN repository for this file.

1 /* $Id: Dbtag.hpp 99591 2023-04-20 19:39: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 
227  eDbtagType_EchinoBase
228  };
229 
230  enum EDbtagGroup {
231  fNone = 0,
232  fGenBank = 1 << 0,
233  fRefSeq = 1 << 1,
234  fSrc = 1 << 2,
235  fProbe = 1 << 3
236  };
237 
238  typedef int TDbtagGroup; ///< holds bitwise OR of "EDbtagGroup"
239 
240  // constructor
241  CDbtag(void);
242  // destructor
243  ~CDbtag(void);
244 
245  // Comparison functions
246  int Compare(const CDbtag& dbt2) const;
247 
248  // Matching ids
249  bool Match(const CDbtag& dbt2) const;
250  // Set this id to me matching to the argument
251  // return false if there is no matching id
252  bool SetAsMatchingTo(const CDbtag& dbt2);
253 
254  // Appends a label to "label" based on content of CDbtag
255  void GetLabel(string* label) const;
256 
257  // Test if DB is approved by the consortium.
258  // 'GenBank', 'EMBL' and 'DDBJ' are approved only in the
259  // context of a RefSeq record.
260  enum EIsRefseq {
261  eIsRefseq_No = 0,
262  eIsRefseq_Yes
263  };
264  enum EIsSource {
265  eIsSource_No = 0,
266  eIsSource_Yes
267  };
268  enum EIsEstOrGss {
269  eIsEstOrGss_No = 0,
271  };
272  bool IsApproved(EIsRefseq refseq = eIsRefseq_No, EIsSource is_source = eIsSource_No, EIsEstOrGss is_est_or_gss = eIsEstOrGss_No ) const;
273  // Test if DB is approved (case insensitive).
274  // Returns the case sensetive DB name if approved, NULL otherwise.
275  const char* IsApprovedNoCase(EIsRefseq refseq = eIsRefseq_No, EIsSource is_source = eIsSource_No) const;
276  // Extended version allows many DB categories
277  bool IsApproved(TDbtagGroup group) const;
278 
279  // Test if appropriate to omit from displays, formatting, etc.
280  bool IsSkippable(void) const;
281 
282  // Retrieve the enumerated type for the dbtag
283  EDbtagType GetType(void) const;
284 
285  // determine the situations where the dbtag would be appropriate
286  bool GetDBFlags (bool& is_refseq, bool& is_src, string& correct_caps) const;
287  // Extended version allows many DB categories
288  TDbtagGroup GetDBFlags (string& correct_caps) const;
289 
290  // Force a refresh of the internal type
291  void InvalidateType(void);
292 
293  // Get a URL to the resource (if available)
294  // @return
295  // the URL or an empty string if non is available
296  string GetUrl(void) const;
297 
298  // Get a URL to the resource (if available)
299  // @param taxid organism taxid for URL generation
300  // @return
301  // the URL or an empty string if non is available
302  string GetUrl(TTaxId taxid) const;
303 
304  // Get a URL to the resource (if available)
305  // @param taxname organism taxname (e.g. "Danio rerio") for URL generation
306  // @return
307  // the URL or an empty string if non is available
308  string GetUrl(const string &taxname) const;
309 
310  // Get a URL to the resource (if available). This function assumes
311  // that only 1 of the following 3 states can occur: 1. all parameters
312  // empty. 2. genus and species set, but not subspecies.
313  // 3. all parameters set.
314  // Any other state of parameters may give an unexpected result, but
315  // no crash or exception will be thrown.
316  // @param genus organism genus for URL generation
317  // @param species organism species for URL generation
318  // @param subspecies organism subspecies for URL generation
319  // @return
320  // the URL or an empty string if non is available
321  string GetUrl(const string & genus,
322  const string & species,
323  const string & subspecies = kEmptyStr ) const;
324 
325 private:
326 
327  // our enumerated (parsed) type
329 
330  // Prohibit copy constructor & assignment operator
331  CDbtag(const CDbtag&);
333 
334  // returns true if the given tag looks like an accession and
335  // it also gives the number of alpha, digit and underscores found in it
336  static bool x_LooksLikeAccession(const string &tag,
337  int &out_num_alpha,
338  int &out_num_digit,
339  int &out_num_unscr);
340 };
341 
342 
343 
344 /////////////////// CDbtag inline methods
345 
346 // constructor
347 inline
349  : m_Type(eDbtagType_bad)
350 {
351 }
352 
353 
354 /////////////////// end of CDbtag inline methods
355 
356 
357 END_objects_SCOPE // namespace ncbi::objects::
358 
360 
361 #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:348
static bool x_LooksLikeAccession(const string &tag, int &out_num_alpha, int &out_num_digit, int &out_num_unscr)
EIsRefseq
Definition: Dbtag.hpp:260
EIsSource
Definition: Dbtag.hpp:264
CDbtag_Base Tparent
Definition: Dbtag.hpp:54
EDbtagGroup
Definition: Dbtag.hpp:230
string GetUrl(TTaxId taxid) const
string GetUrl(void) const
string GetUrl(const string &taxname) const
CDbtag(const CDbtag &)
EDbtagType m_Type
Definition: Dbtag.hpp:328
int TDbtagGroup
holds bitwise OR of "EDbtagGroup"
Definition: Dbtag.hpp:238
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_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_dbSTS
Definition: Dbtag.hpp:186
@ eDbtagType_BDGP_EST
Definition: Dbtag.hpp:74
@ eDbtagType_IFO
Definition: Dbtag.hpp:114
@ eDbtagType_HGNC
Definition: Dbtag.hpp:107
@ 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_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_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_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_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_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_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:268
@ eIsEstOrGss_Yes
Definition: Dbtag.hpp:270
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 Tue Apr 16 20:06:43 2024 by modify_doxy.py rev. 669887