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

Go to the SVN repository for this file.

1 #ifndef OBJTOOLS__PUBSEQ_GATEWAY__IPG__IPG_REPORT_ENTRY_HPP_
2 #define OBJTOOLS__PUBSEQ_GATEWAY__IPG__IPG_REPORT_ENTRY_HPP_
3 /*****************************************************************************
4  * $Id: ipg_report_entry.hpp 98379 2022-11-03 15:34:46Z saprykin $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * IPG report entry
28  *
29  *****************************************************************************/
30 
31 #include <corelib/ncbistd.hpp>
32 
33 #include <list>
34 #include <set>
35 #include <sstream>
36 #include <string>
37 #include <utility>
38 #include <vector>
39 
40 #include <corelib/ncbitime.hpp>
41 
45 
47 BEGIN_SCOPE(ipg)
48 
50 {
51  public:
56 
59 
61  m_Ipg = value;
62  return *this;
63  }
64 
66  m_Accession = value;
67  return *this;
68  }
69 
71  m_Accession = move(value);
72  return *this;
73  }
74 
76  m_Cds = value;
77  return *this;
78  }
79 
81  m_Length = value;
82  return *this;
83  }
84 
86  m_NucAccession = value;
87  return *this;
88  }
89 
91  m_NucAccession = move(value);
92  return *this;
93  }
94 
96  m_ProductName = value;
97  return *this;
98  }
99 
101  m_ProductName = move(value);
102  return *this;
103  }
104 
106  m_Strain = value;
107  return *this;
108  }
109 
111  m_Strain = move(value);
112  return *this;
113  }
114 
116  m_SrcDb = value;
117  return *this;
118  }
119 
121  m_Taxid = value;
122  return *this;
123  }
124 
125  CIpgStorageReportEntry& SetRefseq(list<string> const& value) {
126  m_Refseq = value;
127  return *this;
128  }
129 
131  swap(m_Refseq, value);
132  return *this;
133  }
134 
136  m_Div = value;
137  return *this;
138  }
139 
141  m_Div = move(value);
142  return *this;
143  }
144 
146  m_Assembly = value;
147  return *this;
148  }
149 
151  m_Assembly = move(value);
152  return *this;
153  }
154 
156  m_GbState = value;
157  return *this;
158  }
159 
161  m_Updated = value;
162  return *this;
163  }
164 
166  m_Created = value;
167  return *this;
168  }
169 
171  m_WriteTime = value;
172  return *this;
173  }
174 
176  m_ProtGi = value;
177  return *this;
178  }
179 
181  m_Weights = move(value);
182  return *this;
183  }
184 
186  m_Weights = value;
187  return *this;
188  }
189 
191  m_BioProject = value;
192  return *this;
193  }
194 
196  m_BioProject = move(value);
197  return *this;
198  }
199 
200  CIpgStorageReportEntry& SetGenome(objects::CBioSource::EGenome value) {
201  m_Genome = value;
202  return *this;
203  }
204 
206  x_SetFlag(value, EIpgProteinFlags::ePartial);
207  return *this;
208  }
209 
211  x_SetFlag(value, EIpgProteinFlags::eRemote);
212  return *this;
213  }
214 
217  return *this;
218  }
219 
222  return *this;
223  }
224 
226  m_Flags = value;
227  return *this;
228  }
229 
231  m_Satkey = value;
232  return *this;
233  }
234 
236  m_IsPatent = value;
237  return *this;
238  }
239 
241  m_PubMedIds.insert(id);
242  return *this;
243  }
244 
246  m_PubMedIds = move(ids);
247  return *this;
248  }
249 
251  m_PubMedIds = ids;
252  return *this;
253  }
254 
255  CIpgStorageReportEntry& SetDefLine(string const & defline) {
256  m_DefLine = defline;
257  return *this;
258  }
259 
261  m_DefLine = move(value);
262  return *this;
263  }
264 
265 //-----------------------------------------
266 
267  inline bool IsValid() const {
268  return m_Length > 0;
269  }
270 
271  TIpg GetIpg() const {
272  return m_Ipg;
273  }
274 
275  string const& GetAccession() const {
276  return m_Accession;
277  }
278 
279  TIpgCds const& GetCds() const {
280  return m_Cds;
281  }
282 
283  Int4 GetLength() const {
284  return m_Length;
285  }
286 
287  string const& GetNucAccession() const {
288  return m_NucAccession;
289  }
290 
291  string const& GetProductName() const {
292  return m_ProductName;
293  }
294 
295  Int4 GetSrcDb() const {
296  return m_SrcDb;
297  }
298 
299  TTaxId GetTaxid() const {
300  return m_Taxid;
301  }
302 
303  list<string> const& GetRefseq() const {
304  return m_Refseq;
305  }
306 
307  string const& GetDiv() const {
308  return m_Div;
309  }
310 
311  string const& GetAssembly() const {
312  return m_Assembly;
313  }
314 
315  string const& GetStrain() const {
316  return m_Strain;
317  }
318 
319  TIpgWeights const& GetWeights() const {
320  return m_Weights;
321  }
322 
324  return m_GbState;
325  }
326 
327  CTime GetUpdated() const {
328  return m_Updated;
329  }
330 
331  CTime GetCreated() const {
332  return m_Created;
333  }
334 
335  CTime GetWriteTime() const {
336  return m_WriteTime;
337  }
338 
339  TGi GetProtGi() const {
340  return m_ProtGi;
341  }
342 
343  string const& GetBioProject() const {
344  return m_BioProject;
345  }
346 
347  objects::CBioSource::EGenome GetGenome() const {
348  return m_Genome;
349  }
350 
351  bool GetPartial() const {
352  return x_GetFlag(EIpgProteinFlags::ePartial);
353  }
354 
355  bool GetRemote() const {
356  return x_GetFlag(EIpgProteinFlags::eRemote);
357  }
358 
359  bool GetUnverified() const {
360  return x_GetFlag(EIpgProteinFlags::eUnverified);
361  }
362 
363  bool GetMatPeptide() const {
364  return x_GetFlag(EIpgProteinFlags::eMatPeptide);
365  }
366 
367  Int4 GetFlags() const {
368  return m_Flags;
369  }
370 
371  Int4 GetSatkey() const {
372  return m_Satkey;
373  }
374 
375  bool IsPatent() const {
376  return m_IsPatent;
377  }
378 
379  bool HasPubMed() const {
380  return !m_PubMedIds.empty();
381  }
382 
383  const TPubMedIds& GetPubMedLinks() const {
384  return m_PubMedIds;
385  }
386 
387  string const& GetDefLine() const {
388  return m_DefLine.empty() ? m_ProductName : m_DefLine;
389  }
390 
391  private:
392  void x_SetFlag(bool set_flag, EIpgProteinFlags flag_value) {
393  if (set_flag) {
394  m_Flags |= static_cast<Int4>(flag_value);
395  } else {
396  m_Flags &= ~(static_cast<Int4>(flag_value));
397  }
398  }
399 
400  bool x_GetFlag(EIpgProteinFlags flag_value) const {
401  return m_Flags & static_cast<Int4>(flag_value);
402  }
403 
404  TIpg m_Ipg{TIpg()};
405  string m_Accession;
407 
409  string m_Div;
410  string m_Assembly;
411  string m_Strain;
412  string m_BioProject;
413  // BD-811,BD-814 : defline cannot in general be derived from product name,
414  // so it's saved in a separate column.
415  string m_DefLine;
416  list<string> m_Refseq;
418 
419  // ID-4390 : needed to support restricting BLAST searches by IPGs which are
420  // referenced in PubMed articles.
422 
423  // Used for delayed accession and length batch retrieval for
424  // FAR-pointer proteins.
425  TGi m_ProtGi{ZERO_GI};
426 
430 
431  TTaxId m_Taxid{ZERO_TAX_ID};
432  Int4 m_Length{0};
433  Int4 m_Flags{0}; // Added as decided in ID-3941
434  Int4 m_Satkey{0}; // Needed for failure reporting
435  Int4 m_SrcDb{0};
436 
438  objects::CBioSource::EGenome m_Genome{objects::CBioSource::eGenome_unknown};
439 
441 
442  // ID-4118 : for nuc-prots, patent Seq-id is present on nucleotides only,
443  // so need to pass this info to the protein entry, however his is NOT
444  // intended to be saved in Cassandra.
445  bool m_IsPatent{false};
446 };
447 
448 using CPubseqGatewayIpgReportConsumeCallback = function<bool(vector<CIpgStorageReportEntry> &&, bool is_last)>;
449 
450 END_SCOPE(ipg)
452 
453 #endif // OBJTOOLS__PUBSEQ_GATEWAY__IPG__IPG_REPORT_ENTRY_HPP_
CTime –.
Definition: ncbitime.hpp:296
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define bool
Definition: bool.h:34
#define ZERO_TAX_ID
Definition: ncbimisc.hpp:1115
SStrictId_Tax::TId TTaxId
Taxon id type.
Definition: ncbimisc.hpp:1048
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
Definition: ncbimisc.hpp:1508
#define ZERO_GI
Definition: ncbimisc.hpp:1088
int32_t Int4
4-byte (32-bit) signed integer
Definition: ncbitype.h:102
#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
function< bool(vector< CIpgStorageReportEntry > &&, bool is_last)> CPubseqGatewayIpgReportConsumeCallback
vector< double > TIpgWeights
Definition: ipg_types.hpp:47
Int4 TGbState
Definition: ipg_types.hpp:44
EIpgProteinFlags
Definition: ipg_types.hpp:51
Int8 TIpg
Definition: ipg_types.hpp:43
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Defines: CTimeFormat - storage class for time format.
CIpgStorageReportEntry & SetPatent(bool value)
CIpgStorageReportEntry & SetDefLine(string const &defline)
bool x_GetFlag(EIpgProteinFlags flag_value) const
CIpgStorageReportEntry & SetAssembly(string &&value)
CIpgStorageReportEntry & SetDiv(string const &value)
CIpgStorageReportEntry & SetSatkey(Int4 value)
CIpgStorageReportEntry & SetProductName(string const &value)
CIpgStorageReportEntry & SetIpg(TIpg value)
CIpgStorageReportEntry & SetProtGi(TGi &value)
CIpgStorageReportEntry & SetGenome(objects::CBioSource::EGenome value)
CIpgStorageReportEntry & SetNucAccession(string const &value)
CIpgStorageReportEntry & SetRefseq(list< string > &&value)
CIpgStorageReportEntry & SetBioProject(string const &value)
objects::CBioSource::EGenome GetGenome() const
CIpgStorageReportEntry & SetWriteTime(CTime value)
CIpgStorageReportEntry & SetTaxid(TTaxId value)
CIpgStorageReportEntry & SetAccession(string &&value)
CIpgStorageReportEntry()=default
string const & GetAssembly() const
CIpgStorageReportEntry(CIpgStorageReportEntry &&)=default
CIpgStorageReportEntry & SetWeights(TIpgWeights &&value)
CIpgStorageReportEntry & SetUpdated(CTime value)
CIpgStorageReportEntry & SetPartial(bool value)
CIpgStorageReportEntry & SetUnverified(bool value=true)
string const & GetProductName() const
CIpgStorageReportEntry & SetDiv(string &&value)
CIpgStorageReportEntry & SetAssembly(string const &value)
CIpgStorageReportEntry & SetStrain(string const &value)
CIpgStorageReportEntry(CIpgStorageReportEntry const &)=default
CIpgStorageReportEntry & SetPubMedIds(TPubMedIds &&ids)
CIpgStorageReportEntry & SetProductName(string &&value)
CIpgStorageReportEntry & SetDefLine(string &&value)
CIpgStorageReportEntry & SetMatPeptide(bool value=true)
CIpgStorageReportEntry & SetFlags(Int4 value)
CIpgStorageReportEntry & SetCds(TIpgCds value)
CIpgStorageReportEntry & SetNucAccession(string &&value)
string const & GetAccession() const
CIpgStorageReportEntry & SetPubMedIds(TPubMedIds const &ids)
const TPubMedIds & GetPubMedLinks() const
CIpgStorageReportEntry & SetStrain(string &&value)
TGbState GetGbState() const
CIpgStorageReportEntry & SetBioProject(string &&value)
CIpgStorageReportEntry & operator=(CIpgStorageReportEntry &&)=default
CIpgStorageReportEntry & AddPubMedId(int id)
string const & GetBioProject() const
CIpgStorageReportEntry & SetRemote(bool value=true)
list< string > const & GetRefseq() const
void x_SetFlag(bool set_flag, EIpgProteinFlags flag_value)
CIpgStorageReportEntry & SetAccession(string const &value)
string const & GetDiv() const
CIpgStorageReportEntry & SetCreated(CTime value)
TIpgWeights const & GetWeights() const
string const & GetDefLine() const
string const & GetStrain() const
CIpgStorageReportEntry & SetWeights(TIpgWeights const &value)
CIpgStorageReportEntry & SetRefseq(list< string > const &value)
CIpgStorageReportEntry & SetLength(Int4 value)
TIpgCds const & GetCds() const
CIpgStorageReportEntry & SetGbState(TGbState value)
CIpgStorageReportEntry & SetSrcDb(Int4 value)
CIpgStorageReportEntry & operator=(CIpgStorageReportEntry const &)=default
string const & GetNucAccession() const
@ NCBI_gb_state_eWGSGenBankLive
Definition: wgsread.hpp:86
Modified on Wed May 22 11:36:05 2024 by modify_doxy.py rev. 669887