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

Go to the SVN repository for this file.

1 /* $Id: genomic_collections_cli.hpp 91807 2020-12-14 15:03:53Z grichenk $
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  */
27 
28 /// @file genomic_collections_cli.hpp
29 /// User-defined methods of the data storage class.
30 ///
31 /// This file was originally generated by application DATATOOL
32 /// using the following specifications:
33 /// 'gencoll_client.asn'.
34 ///
35 /// New methods or data members can be added to it if needed.
36 /// See also: genomic_collections_cli_.hpp
37 
38 
39 #ifndef INTERNAL_GPIPE_OBJECTS_GENOMECOLL_GENOMIC_COLLECTIONS_CLI_HPP
40 #define INTERNAL_GPIPE_OBJECTS_GENOMECOLL_GENOMIC_COLLECTIONS_CLI_HPP
41 
46 
48 
49 class CSQLITE_Connection;
50 class CArgDescriptions;
51 class CArgs;
52 
53 BEGIN_objects_SCOPE // namespace ncbi::objects::
54 
58 
59 
61 {
62 public:
63  CGCServiceException(const CDiagCompileInfo& diag, const objects::CGCClient_Error& srv_error);
64 
65  //all error codes are taken from the CGCClient_Error_Base::EError_id, please refer to them
66  typedef objects::CGCClient_Error::EError_id EErrCode;
67 
69  const char* GetErrCodeString(void) const override;
70 };
71 
72 /////////////////////////////////////////////////////////////////////////////
74 {
75 public:
76  // add the 'automatic' cache parameter, for the calling application
77  static void AddArguments(CArgDescriptions& arg_desc);
78 
79  CGenomicCollectionsService(const string& cache_file="");
80  CGenomicCollectionsService(const CArgs& args);
82 
83  CRef<CGC_Assembly> GetAssembly(const string& acc, const string& mode);
84  CRef<CGC_Assembly> GetAssembly(int releaseId, const string& mode);
85 
86  //Some general modes
87  //please contact NCBI if you have other needs
89  {
90  //as defined in GenomeColl_Master.dbo.CodeServiceModeAlias
91 
92  //minimal contents: Only metadata
93  static string kAssemblyOnly() {return "AssemblyOnly";};
94 
95  // Top-level molecules
96  // No statistics
97  // No alignments data (which could be very large)
98  // pseudo scaffolds are reported as unlocalized/unplaced, as needed for analysis
99  static string kScaffolds() {return "Scaffolds";};
100 
101  // Top-level molecules
102  // all statistics on assembly, units and replicons
103  // alignments data when available
104  // pseudo scaffolds are reported as unlocalized/unplaced, as needed for analysis
105  static string kScaffoldsWithAlignments() {return "ScaffoldsWithAlignments";};
106 
107  // Scaffolds
108  // No alignment data
109  // pseudo scaffolds reported as submitted.
110  static string kEntrezIndexing() {return "EntrezIndexing";};
111 
112  // Almost maximum contents:
113  // all sequences down to contigs
114  // No statistics
115  // No alignments data (which could be very large)
116  // pseudo scaffolds are reported as unlocalized/unplaced, as needed for analysis
117  static string kAllSequences() {return "AllSequences";};
118 
119  // Maximum contents:
120  // all sequences down to contigs
121  // all statistics on assembly, units and replicons
122  // alignments data when available
123  // pseudo scaffolds are reported as unlocalized/unplaced, as needed for analysis
124  static string kAllSequencesWithAlignments() {return "AllSequencesWithAlignments";};
125  };
126 
127  string ValidateChrType(const string& chrType, const string& chrLoc);
128 
129  /// Find assembly by sequence accession
130  ///
131  /// @param sequence_acc
132  /// Sequence accession in ACC.VER format
133  /// @param filter
134  /// Bitfield, OR-ed combination of eGCClient_GetAssemblyBySequenceFilter_* values:
135  /// eGCClient_GetAssemblyBySequenceFilter_all - do not filter out anything
136  /// eGCClient_GetAssemblyBySequenceFilter_latest - look up for latest releases only
137  /// eGCClient_GetAssemblyBySequenceFilter_major - look up for major releases only
138  /// eGCClient_GetAssemblyBySequenceFilter_genbank - look up for GenBank releases only
139  /// eGCClient_GetAssemblyBySequenceFilter_refseq - look up for RefSeq releases only
140  /// If none of genbank of refseq filters are specified then both GenBank and RefSeq releases will be returned
141  /// @param sort
142  /// Assembly ordering:
143  /// CGCClient_GetAssemblyBySequenceRequest::eSort_default - sort by number of sequences found in assembly, then by reference/representative/other, then by modification date
144  /// CGCClient_GetAssemblyBySequenceRequest::eSort_latest - sort by number of sequences found in assembly, then latest first, then by reference/representative/other, then by modification date
145  /// CGCClient_GetAssemblyBySequenceRequest::eSort_major - sort by number of sequences found in assembly, then major first, then by reference/representative/other, then by modification date
146  /// @return Assembly if found, NULL otherwise.
148  (const string& sequence_acc,
149  int filter,
151 
152  /// Find assembly by sequence accessions
153  ///
154  /// @param sequence_acc
155  /// Sequence accessions in ACC.VER format
156  /// @param filter
157  /// Bitfield, OR-ed combination of eGCClient_GetAssemblyBySequenceFilter_* values:
158  /// eGCClient_GetAssemblyBySequenceFilter_all - do not filter out anything
159  /// eGCClient_GetAssemblyBySequenceFilter_latest - look up for latest releases only
160  /// eGCClient_GetAssemblyBySequenceFilter_major - look up for major releases only
161  /// eGCClient_GetAssemblyBySequenceFilter_genbank - look up for GenBank releases only
162  /// eGCClient_GetAssemblyBySequenceFilter_refseq - look up for RefSeq releases only
163  /// If none of genbank of refseq filters are specified then both GenBank and RefSeq releases will be returned
164  /// @param sort
165  /// Assembly ordering:
166  /// CGCClient_GetAssemblyBySequenceRequest::eSort_default - sort by number of sequences found in assembly, then by reference/representative/other, then by modification date
167  /// CGCClient_GetAssemblyBySequenceRequest::eSort_latest - sort by number of sequences found in assembly, then latest first, then by reference/representative/other, then by modification date
168  /// CGCClient_GetAssemblyBySequenceRequest::eSort_major - sort by number of sequences found in assembly, then major first, then by reference/representative/other, then by modification date
169  /// @return If assembly is found then return it with list of related sequences. NULL otherwise.
171  (const list<string>& sequence_acc,
172  int filter,
174  bool with_roles = false);
175 
176  /// Find assemblies by sequence accession
177  ///
178  /// @param sequence_acc
179  /// Sequence accession in ACC.VER format
180  /// @param filter
181  /// Bitfield, OR-ed combination of eGCClient_GetAssemblyBySequenceFilter_* values:
182  /// eGCClient_GetAssemblyBySequenceFilter_all - do not filter out anything
183  /// eGCClient_GetAssemblyBySequenceFilter_latest - look up for latest releases only
184  /// eGCClient_GetAssemblyBySequenceFilter_major - look up for major releases only
185  /// eGCClient_GetAssemblyBySequenceFilter_genbank - look up for GenBank releases only
186  /// eGCClient_GetAssemblyBySequenceFilter_refseq - look up for RefSeq releases only
187  /// If none of genbank of refseq filters are specified then both GenBank and RefSeq releases will be returned
188  /// @param sort
189  /// Assembly ordering:
190  /// CGCClient_GetAssemblyBySequenceRequest::eSort_default - sort by number of sequences found in assembly, then by reference/representative/other, then by modification date
191  /// CGCClient_GetAssemblyBySequenceRequest::eSort_latest - sort by number of sequences found in assembly, then latest first, then by reference/representative/other, then by modification date
192  /// CGCClient_GetAssemblyBySequenceRequest::eSort_major - sort by number of sequences found in assembly, then major first, then by reference/representative/other, then by modification date
193  /// @return List of found assemblies with related sequences.
195  (const string& sequence_acc,
196  int filter,
198  bool with_roles = false);
199 
200  /// Find assemblies by sequence accessions
201  ///
202  /// @param sequence_acc
203  /// Sequence accessions in ACC.VER format
204  /// @param filter
205  /// Bitfield, OR-ed combination of eGCClient_GetAssemblyBySequenceFilter_* values:
206  /// eGCClient_GetAssemblyBySequenceFilter_all - do not filter out anything
207  /// eGCClient_GetAssemblyBySequenceFilter_latest - look up for latest releases only
208  /// eGCClient_GetAssemblyBySequenceFilter_major - look up for major releases only
209  /// eGCClient_GetAssemblyBySequenceFilter_genbank - look up for GenBank releases only
210  /// eGCClient_GetAssemblyBySequenceFilter_refseq - look up for RefSeq releases only
211  /// If none of genbank of refseq filters are specified then both GenBank and RefSeq releases will be returned
212  /// @param sort
213  /// Assembly ordering:
214  /// CGCClient_GetAssemblyBySequenceRequest::eSort_default - sort by number of sequences found in assembly, then by reference/representative/other, then by modification date
215  /// CGCClient_GetAssemblyBySequenceRequest::eSort_latest - sort by number of sequences found in assembly, then latest first, then by reference/representative/other, then by modification date
216  /// CGCClient_GetAssemblyBySequenceRequest::eSort_major - sort by number of sequences found in assembly, then major first, then by reference/representative/other, then by modification date
217  /// @return List of found assemblies with related sequences.
219  (const list<string>& sequence_acc,
220  int filter,
222  bool with_roles = false);
223 
224 
225 
227  int equivalency); // see CGCClient_GetEquivalentAssembliesRequest_::EEquivalency
228 
229 private:
230  // Prohibit copy constructor and assignment operator
233 
235  const list<string>& sequence_acc,
236  int filter,
238  bool top_only,
239  bool with_roles);
240 
241  void x_ConfigureConnection();
242 
243  void x_ConfigureCache(const string& cache_file);
244  string m_CacheFile;
245  unique_ptr<CSQLITE_Connection> m_CacheConn;
246 };
247 
248 END_objects_SCOPE
250 #endif
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CArgDescriptions –.
Definition: ncbiargs.hpp:541
CArgs –.
Definition: ncbiargs.hpp:379
Incapsulate compile time information such as __FILE__, __LINE__, NCBI_MODULE, current function.
Definition: ncbidiag.hpp:65
CGCClient_AssemblyInfo –.
CGCClient_AssemblySequenceInfo –.
CGCClient_EquivalentAssemblies –.
objects::CGCClient_Error::EError_id EErrCode
const char * GetErrCodeString(void) const override
Get error code interpreted as text.
NCBI_EXCEPTION_DEFAULT(CGCServiceException, CException)
CGCServiceException(const CDiagCompileInfo &diag, const objects::CGCClient_Error &srv_error)
CGenomicCollectionsService_Base –.
CRef< CGCClient_EquivalentAssemblies > GetEquivalentAssemblies(const string &acc, int equivalency)
CGenomicCollectionsService(const string &cache_file="")
CGenomicCollectionsService & operator=(const CGenomicCollectionsService &value)
CGenomicCollectionsService(const CGenomicCollectionsService &value)
unique_ptr< CSQLITE_Connection > m_CacheConn
static void AddArguments(CArgDescriptions &arg_desc)
CRef< CGCClient_AssembliesForSequences > FindAssembliesBySequences(const string &sequence_acc, int filter, CGCClient_GetAssemblyBySequenceRequest::ESort sort=CGCClient_GetAssemblyBySequenceRequest::eSort_default, bool with_roles=false)
Find assemblies by sequence accession.
CRef< CGC_Assembly > GetAssembly(const string &acc, const string &mode)
CRef< CGCClient_AssemblyInfo > FindOneAssemblyBySequences(const string &sequence_acc, int filter, CGCClient_GetAssemblyBySequenceRequest::ESort sort=CGCClient_GetAssemblyBySequenceRequest::eSort_default)
Find assembly by sequence accession.
string ValidateChrType(const string &chrType, const string &chrLoc)
CRef< CGCClient_AssembliesForSequences > x_FindAssembliesBySequences(const list< string > &sequence_acc, int filter, CGCClient_GetAssemblyBySequenceRequest::ESort sort, bool top_only, bool with_roles)
void x_ConfigureCache(const string &cache_file)
Connection to SQLite database.
Data storage class.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
constexpr auto sort(_Init &&init)
mdb_mode_t mode
Definition: lmdb++.h:38
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Modified on Fri Sep 20 14:58:19 2024 by modify_doxy.py rev. 669887