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

Go to the SVN repository for this file.

1 /* $Id: obj_fingerprint.cpp 45881 2021-01-05 03:10:02Z rudnev $
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  * Authors: Roman Katargin, Victor Joukov
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 #include <corelib/ncbimtx.hpp>
34 #include <corelib/ncbi_bswap.hpp>
36 #include <gui/objutils/utils.hpp>
37 #include <gui/utils/track_info.hpp>
38 #include <objmgr/util/sequence.hpp>
39 #include <serial/serialbase.hpp>
40 
41 #include <stdio.h>
42 
43 #define CKSUM_ADD_INTEGER(cksum, value) \
44  CObjFingerprint::AddInteger(cksum, (unsigned char*)&value, sizeof(value))
45 
46 #define CKSUM_INTEGER_FIELD(cksum, Type, field) \
47 if (obj.IsSet##field()) { \
48  Type::T##field value = obj.Get##field(); \
49  CObjFingerprint::AddInteger(cksum, (unsigned char*)&value, sizeof(value)); \
50 }
51 
52 #define CKSUM_INTEGER_FIELD2(cksum, Type, field) \
53 { \
54  Type::T##field value = obj.Get##field(); \
55  CObjFingerprint::AddInteger(cksum, (unsigned char*)&value, sizeof(value)); \
56 }
57 
58 #include "fingp_seqid.cpp"
59 #include "fingp_seqloc.cpp"
60 #include "fingp_seqfeat.cpp"
61 #include "fingp_seqalign.cpp"
62 #include "fingp_seqgraph.cpp"
63 
65 
67 
69 {
70  CMutexGuard LOCK(s_Mutex);
71  x_GetInstance().x_Register(type_info, func);
72 }
73 
75  objects::CScope* scope)
76 {
77  CMutexGuard LOCK(s_Mutex);
78  x_GetInstance().Fingerprint(checksum, obj, scope);
79 }
80 
82 {
83  static CObjFingerprint instance;
84  return instance;
85 }
86 
87 void CObjFingerprint::Fingerprint(CChecksum& checksum, const CObject& obj,
88  objects::CScope* scope) const
89 {
90  const CVcfVariant* vcf_variant = dynamic_cast<const CVcfVariant*>(&obj);
91  if(vcf_variant != NULL) {
92  Fingerprint(checksum, vcf_variant->GetLocation(), scope);
93  return;
94  }
95  const CSerialObject* so = dynamic_cast<const CSerialObject*>(&obj);
96  if (so == NULL)
97  return;
98 
100  if (it == m_Map.end())
101  return;
102 
103  it->second(checksum, obj, scope, *this);
104 }
105 
106 void CObjFingerprint::x_Register(TTypeInfo type_info, TFingerPFunc func)
107 {
108  m_Map[type_info] = func;
109 }
110 
111 
112 
113 void CObjFingerprint::AddInteger(CChecksum& checksum, unsigned char* pvalue, int size)
114 {
115  Int4 value = 0;
116 
117  switch(size) {
118  case 1:
119  value = (Int4)*pvalue;
120  break;
121  case 2:
122  value = (Int4)*(Int2*)pvalue;
123  break;
124  case 4:
125  value = *(Int4*)pvalue;
126  break;
127  case 8:
128  {{
129  string str;
130  str = NStr::UInt8ToString(*(Uint8*)pvalue, 0, 16);
131  checksum.AddLine(str);
132  return;
133  }}
134  }
135 
136 #ifdef WORDS_BIGENDIAN
137  CByteSwap::PutInt4((unsigned char*)&value, value);
138 #endif
139 
140  checksum.AddChars((const char*)&value, sizeof(value));
141 }
142 
144 {
145  string str;
147  checksum.AddLine(str);
148 }
149 
150 
151 // signatures
152 string CObjFingerprint::GetFeatSignature(const objects::CSeq_feat& feat,
153  objects::CScope* scope, const string& data_source,
154  const string& sAdditionalInfo)
155 {
156  return GetFeatSignature(feat, feat.GetLocation(), scope, data_source, sAdditionalInfo);
157 }
158 
159 
160 // signatures
161 string CObjFingerprint::GetFeatSignature(const objects::CSeq_feat& feat,
162  objects::CScope* scope, const objects::CSeq_annot_Handle& annot_handle,
163  const string& sAdditionalInfo)
164 {
165  return GetFeatSignature(feat, feat.GetLocation(), scope, annot_handle, sAdditionalInfo);
166 }
167 
168 
169 string CObjFingerprint::GetFeatSignature(const objects::CSeq_feat& feat,
170  const objects::CSeq_loc& loc,
171  objects::CScope* scope,
172  const objects::CSeq_annot_Handle& annot_handle,
173  const string& sAdditionalInfo)
174 {
175  string annot_name = "Unnamed";
176  if (annot_handle.IsNamed()) {
177  annot_name = annot_handle.GetName();
178  }
179  return GetFeatSignature(feat, loc, scope, annot_name, sAdditionalInfo);
180 }
181 
182 
183 static inline void s_EscapeDash(string& id)
184 {
185  // we need to escape '\' itself to cancel out
186  // one JSON decoding so that '-' is still escaped
187  NStr::ReplaceInPlace(id, "-", "\\\\-");
188 }
189 
190 
191 string CObjFingerprint::GetFeatSignature(const objects::CSeq_feat& feat,
192  const objects::CSeq_loc& loc,
193  objects::CScope* scope,
194  const string& data_source,
195  const string& sAdditionalInfo)
196 {
197  //CSeq_id_Handle shdl = sequence::GetIdHandle(loc, scope);
198  //shdl = sequence::GetId(shdl, *scope, sequence::eGetId_ForceGi);
199  //int gi = shdl.GetGi();
200  CSeq_id_Handle shdl = sequence::GetIdHandle(loc, scope);
201  shdl = sequence::GetId(shdl, *scope, sequence::eGetId_Canonical);
202  string id_str = shdl.GetSeqId()->AsFastaString();
203  s_EscapeDash(id_str);
204 
205  TSeqRange range = loc.GetTotalRange();
206 
207  Uint2 type = (eFeature) << 8;
208  type |= feat.GetData().GetSubtype() & 0xff;
209 
210  CChecksum cs;
211  GetFingerprint(cs, feat, scope);
212  Uint4 checksum = cs.GetChecksum();
213 
214  bool is_naa = CSeqUtils::IsNAA(data_source);
215  bool is_rmt = CSeqUtils::isRmtAnnotName(data_source);
216  char buf[128];
217  if (data_source.empty()) {
218  sprintf(buf, "-%08x-%08x-%04x-%08x",
219  range.GetFrom(), range.GetTo(), type, checksum);
220  } else if (is_naa || is_rmt) {
221  sprintf(buf, "-%08x-%08x-%04x-%08x-",
222  range.GetFrom(), range.GetTo(), type, checksum);
223  } else {
224  CChecksum ds_cs;
225  ds_cs.AddLine(data_source);
226  Uint4 ds_checksum = ds_cs.GetChecksum();
227  sprintf(buf, "-%08x-%08x-%04x-%08x-%08x",
228  range.GetFrom(), range.GetTo(), type, checksum, ds_checksum);
229  }
230  string sAdditionalInfoDigest;
231  if(!sAdditionalInfo.empty()) {
232  CChecksum AdditionalInfoCS;
233  AdditionalInfoCS.AddLine(sAdditionalInfo);
234  sAdditionalInfoDigest = AdditionalInfoCS.GetHexSum();
235 
236  }
237  return id_str + buf + ((is_naa || is_rmt) ? data_source : "") + (sAdditionalInfoDigest.empty() ? "" : ("-" + sAdditionalInfoDigest));
238 }
239 
240 
241 string CObjFingerprint::GetGraphSignature(const objects::CSeq_graph& graph,
242  objects::CScope* scope, const string& data_source)
243 {
244  CSeq_id_Handle shdl = sequence::GetId(*graph.GetLoc().GetId(), *scope,
246  string id_str = shdl.GetSeqId()->AsFastaString();
247  s_EscapeDash(id_str);
248 
249  TSeqRange range = graph.GetLoc().GetTotalRange();
250 
251  Uint2 type = (eGraph) << 8;
252 
253  CChecksum cs;
254  GetFingerprint(cs, graph, scope);
255  Uint4 checksum = cs.GetChecksum();
256 
257  bool is_naa = CSeqUtils::IsNAA(data_source);
258  char buf[128];
259  if (data_source.empty()) {
260  sprintf(buf, "-%08x-%08x-%04x-%08x",
261  range.GetFrom(), range.GetTo(), type, checksum);
262  } else if (is_naa) {
263  sprintf(buf, "-%08x-%08x-%04x-%08x-",
264  range.GetFrom(), range.GetTo(), type, checksum);
265  } else {
266  CChecksum ds_cs;
267  ds_cs.AddLine(data_source);
268  Uint4 ds_checksum = ds_cs.GetChecksum();
269  sprintf(buf, "-%08x-%08x-%04x-%08x-%08x",
270  range.GetFrom(), range.GetTo(), type, checksum, ds_checksum);
271  }
272 
273  return id_str + buf + (is_naa ? data_source : "");
274 }
275 
276 
277 string CObjFingerprint::GetAlignSignature(const objects::CSeq_align& align,
278  const objects::CSeq_loc& on_loc,
279  objects::CScope* scope,
280  const objects::CSeq_annot_Handle& annot_handle)
281 {
282  string annot_name = "Unnamed";
283  if (annot_handle.IsNamed()) {
284  annot_name = annot_handle.GetName();
285  }
286  return GetAlignSignature(align, on_loc, scope, annot_name);
287 }
288 
289 
290 string CObjFingerprint::GetAlignSignature(const objects::CSeq_align& align,
291  const objects::CSeq_loc& on_loc, objects::CScope* scope,
292  const string& data_source)
293 {
294  CSeq_id_Handle shdl = sequence::GetId(*on_loc.GetId(), *scope,
296 
297  string id_str = shdl.GetSeqId()->AsFastaString();
298  s_EscapeDash(id_str);
299 
300  TSeqRange range = on_loc.GetTotalRange();
301 
302  Uint2 type = (eAlignment) << 8;
303 
304  CChecksum cs;
305  GetFingerprint(cs, align, scope);
306  Uint4 checksum = cs.GetChecksum();
307 
308  // we should include the data source/annot into the signature if it's either named or
309  // AlignDb
310  bool is_include_ds = CSeqUtils::IsNAA(data_source) || CSeqUtils::IsAlignDb(data_source);
311 
312  // named annotation or AlignDb#batch
313  string AdjustedDS(data_source);
314  char buf[128];
315  if (data_source.empty()) {
316  sprintf(buf, "-%08x-%08x-%04x-%08x",
317  range.GetFrom(), range.GetTo(), type, checksum);
318  } else if (is_include_ds) {
319  sprintf(buf, "-%08x-%08x-%04x-%08x-",
320  range.GetFrom(), range.GetTo(), type, checksum);
321  if(CSeqUtils::IsAlignDb(data_source)) {
322  AdjustedDS = "AlignDb";
323  // get the batch from score named "batch_id"
324  //!! an alternative way would be to parse data_source since it now contains all necessary info,
325  //!! but in a proprietary way like: "AlignDb:batch_id in (114783) AND status = \'ONLINE\':subject"
326  int batch(0);
327  bool batch_found(align.GetNamedScore("batch_id", batch)); (void)batch_found;
328  NCBI_ASSERT(batch_found, "AlignDb sourced alignment does not have a \"batch_id\" score!");
329 
330  // besides the batch_id, we need to get whether the query was obtained as "query" or "subject"
331  // ("is_source_assembly_query" from SV-3197)
332  // there is no direct way to get this from seq-align, but indirectly this can be seen by comparing the
333  // seq-id in the 0 row and the id_str
334  string sIsQuery("N");
335  try {
336  if(align.GetSeq_id(0).AsFastaString() == id_str) {
337  sIsQuery = "Y";
338  }
339  } catch(...) {}
340 
341  AdjustedDS += string("#") + NStr::NumericToString(batch) + "#" + sIsQuery;
342  }
343  } else {
344  CChecksum ds_cs;
345  ds_cs.AddLine(data_source);
346  Uint4 ds_checksum = ds_cs.GetChecksum();
347  sprintf(buf, "-%08x-%08x-%04x-%08x-%08x",
348  range.GetFrom(), range.GetTo(), type, checksum, ds_checksum);
349  }
350 
351 
352  return id_str + buf + (is_include_ds ? AdjustedDS : "");
353 }
354 
355 
356 string CObjFingerprint::GetSeqLocSignature(const objects::CSeq_loc& loc,
357  objects::CScope* scope)
358 {
359  CSeq_id_Handle shdl = sequence::GetId(*loc.GetId(), *scope,
361 
362  string id_str = shdl.GetSeqId()->AsFastaString();
363  s_EscapeDash(id_str);
364 
365  TSeqRange range = loc.GetTotalRange();
366 
367  Uint2 type = (eLocation) << 8;
368 
369  CChecksum cs;
370  GetFingerprint(cs, loc, scope);
371  Uint4 checksum = cs.GetChecksum();
372 
373  char buf[128];
374  sprintf(buf, "-%08x-%08x-%04x-%08x",
375  range.GetFrom(), range.GetTo(), type, checksum);
376 
377  return id_str + buf;
378 }
379 
380 
381 string CObjFingerprint::GetHistogramSignature(const objects::CSeq_loc& loc,
382  EObjectType obj_type,
383  objects::CScope* scope,
384  const string& title,
385  const string& data_source,
386  int subtype)
387 {
388  CSeq_id_Handle shdl = sequence::GetId(*loc.GetId(), *scope,
390 
391  string id_str = shdl.GetSeqId()->AsFastaString();
392  TSeqRange range = loc.GetTotalRange();
393  s_EscapeDash(id_str);
394 
395  Uint2 type = (obj_type) << 8;
396  type |= subtype & 0xff;
397 
398  CChecksum cs;
399  cs.AddLine(title);
400  Uint4 checksum = cs.GetChecksum();
401 
402  bool is_naa = CSeqUtils::IsNAA(data_source);
403  bool is_rmt = CSeqUtils::isRmtAnnotName(data_source);
404  char buf[128];
405  if (data_source.empty()) {
406  sprintf(buf, "-%08x-%08x-%04x-%08x",
407  range.GetFrom(), range.GetTo(), type, checksum);
408  } else if (is_naa || is_rmt) {
409  sprintf(buf, "-%08x-%08x-%04x-%08x-",
410  range.GetFrom(), range.GetTo(), type, checksum);
411  } else {
412  CChecksum ds_cs;
413  ds_cs.AddLine(data_source);
414  Uint4 ds_checksum = ds_cs.GetChecksum();
415  sprintf(buf, "-%08x-%08x-%04x-%08x-%08x",
416  range.GetFrom(), range.GetTo(), type, checksum, ds_checksum);
417  }
418 
419  return id_str + buf + ((is_naa || is_rmt) ? data_source : "");
420 }
421 
422 
423 string
424 CObjFingerprint::GetComponentSignature(const objects::CSeq_loc& comp_loc,
425  const objects::CSeq_loc& mapped_loc,
426  objects::CScope* scope)
427 {
428  CSeq_id_Handle shdl = sequence::GetId(*mapped_loc.GetId(), *scope,
430 
431  string id_str = shdl.GetSeqId()->AsFastaString();
432  s_EscapeDash(id_str);
433 
434  TSeqRange range = mapped_loc.GetTotalRange();
435 
436  Uint2 type = (eComponent) << 8;
437 
438  CChecksum cs;
439  GetFingerprint(cs, comp_loc, scope);
440  Uint4 checksum = cs.GetChecksum();
441 
442  char buf[128];
443  sprintf(buf, "-%08x-%08x-%04x-%08x",
444  range.GetFrom(), range.GetTo(), type, checksum);
445 
446  return id_str + buf;
447 }
448 
449 
450 string CObjFingerprint::GetRsiteSignature(const CSeq_feat& feat, int pnt, CScope* scope)
451 {
452  CSeq_id_Handle shdl = sequence::GetIdHandle(feat.GetLocation(), scope);
453  shdl = sequence::GetId(shdl, *scope, sequence::eGetId_Canonical);
454  string id_str = shdl.GetSeqId()->AsFastaString();
455  s_EscapeDash(id_str);
456 
457  Uint2 type = (eRsite) << 8;
458 
459  CChecksum cs;
460  GetFingerprint(cs, feat, scope);
461  Uint4 checksum = cs.GetChecksum();
462 
463  char buf[128];
464  sprintf(buf, "-%08x-%08x-%04x-%08x", pnt, pnt, type, checksum);
465  return id_str + buf;
466 }
467 
469 {
470  CSeq_id_Handle shdl = sequence::GetIdHandle(vcf_variant.GetLocation(), scope);
471  shdl = sequence::GetId(shdl, *scope, sequence::eGetId_Canonical);
472  string id_str = shdl.GetSeqId()->AsFastaString();
473  s_EscapeDash(id_str);
474 
475  TSeqRange range = vcf_variant.GetLocation().GetTotalRange();
476 
477  Uint2 type = (eVcfTrack) << 8;
478 
479  CChecksum cs;
480  GetFingerprint(cs, vcf_variant, scope);
481  Uint4 checksum = cs.GetChecksum();
482 
483  char buf[128];
484  sprintf(buf, "-%08x-%08x-%04x-%08x",
485  range.GetFrom(), range.GetTo(), type, checksum);
486 
487  return id_str + buf;
488 }
489 
490 void CObjFingerprint::ParseSignature(const string& sig,
491  objects::CSeq_id_Handle& sih,
492  TSeqPos& from,
493  TSeqPos& to,
494  EObjectType& type,
495  int& subtype,
496  Uint4& fingerprint,
497  Uint4& ds_fingerprint,
498  string& ds_name,
499  objects::CScope* scope)
500 {
501  if ( !NStr::MatchesMask(sig, "*-*-*-*-*") ) {
502  NCBI_THROW(CException, eUnknown, "invalid object signature");
503  }
504 
505  vector<string> toks;
506  CTrackUtils::TokenizeWithEscape(sig, "-", toks, true);
507  vector<string>::const_iterator iter = toks.begin();
508 
509  /// first: id can be in any forms (gi, accession, local, gnl ...)
510  string id_str = *iter++;
511 
512  CRef<CSeq_id> id(new CSeq_id);
513  id->Set(id_str);
514  sih = sequence::GetId(*id, *scope);
515  if ( !sih ) {
517  "failed to retrieve sequence (ParseSignature) : " + id_str);
518  }
519 
520  /// next: total range
521  from = NStr::StringToUInt(*iter++, 0, 16);
522  to = NStr::StringToUInt(*iter++, 0, 16);
523 
524  /// next: type and subtype
525  Uint4 tmp = NStr::StringToUInt(*iter++, 0, 16);
526  type = static_cast<EObjectType>((tmp & 0xff00) >> 8);
527  subtype = tmp & 0xff;
528 
529  /// next: fingerprint
530  fingerprint = NStr::StringToUInt(*iter++, 0, 16);
531 
532  /// last: data source fingerprint (optional)
533  if (iter != toks.end()) {
534  const string& ds = *iter++;
535  if (CSeqUtils::IsNAA(ds) || CSeqUtils::IsAlignDb(ds)) {
536  ds_name = ds;
537  ds_fingerprint = 0;
538  } else {
539  ds_fingerprint = NStr::StringToUInt(ds, 0, 16);
540  }
541  } else {
542  ds_fingerprint = 0;
543  }
544 
545 }
546 
547 string CObjFingerprint::ParseSignatureDS(const string& sig)
548 {
549  vector<string> toks;
550  CTrackUtils::TokenizeWithEscape(sig, "-", toks, true);
551 
552  return toks.size() > 5 ? toks[5] : "";
553 }
554 
555 
557 
static void PutInt4(unsigned char *ptr, Int4 value)
Definition: ncbi_bswap.hpp:138
CChecksum – Checksum calculator.
Definition: checksum.hpp:302
static void AddDouble(CChecksum &checksum, double value)
void Fingerprint(CChecksum &checksum, const CObject &obj, objects::CScope *scope) const
void x_Register(TTypeInfo type_info, TFingerPFunc func)
static void ParseSignature(const string &sig, objects::CSeq_id_Handle &sih, TSeqPos &from, TSeqPos &to, EObjectType &type, int &subtype, Uint4 &fingerprint, Uint4 &ds_fingerprint, string &ds_name, objects::CScope *scope)
parse signature with data source info.
static string GetRsiteSignature(const objects::CSeq_feat &feat, int pnt, objects::CScope *scope)
static void Register(TTypeInfo type_info, TFingerPFunc func)
static string GetHistogramSignature(const objects::CSeq_loc &loc, EObjectType obj_type, objects::CScope *scope, const string &title, const string &data_source="", int subtype=0)
static string GetGraphSignature(const objects::CSeq_graph &graph, objects::CScope *scope, const string &data_source="")
static void GetFingerprint(CChecksum &checksum, const CObject &obj, objects::CScope *scope=NULL)
static string GetComponentSignature(const objects::CSeq_loc &comp_loc, const objects::CSeq_loc &mapped_loc, objects::CScope *scope)
void(* TFingerPFunc)(CChecksum &checksum, const CObject &obj, objects::CScope *scope, const CObjFingerprint &fingerP)
static string GetVcfVariantSignature(const objects::CVcfVariant &vcf_variant, objects::CScope *scope)
static string ParseSignatureDS(const string &sig)
static string GetFeatSignature(const objects::CSeq_feat &feat, objects::CScope *scope, const string &data_source="", const string &sAdditionalInfo="")
static string GetSeqLocSignature(const objects::CSeq_loc &loc, objects::CScope *scope)
static string GetAlignSignature(const objects::CSeq_align &align, const objects::CSeq_loc &on_loc, objects::CScope *scope, const objects::CSeq_annot_Handle &annot_handle)
static void AddInteger(CChecksum &checksum, unsigned char *pvalue, int size)
static CObjFingerprint & x_GetInstance()
CObject –.
Definition: ncbiobj.hpp:180
CScope –.
Definition: scope.hpp:92
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
Base class for all serializable objects.
Definition: serialbase.hpp:150
CTypeInfo class contains all information about C++ types (both basic and classes): members and layout...
Definition: typeinfo.hpp:76
const_iterator end() const
Definition: map.hpp:152
const_iterator find(const key_type &key) const
Definition: map.hpp:153
static const char * str(char *buf, int n)
Definition: stats.c:84
static char tmp[3200]
Definition: utf8.c:42
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
string
Definition: cgiapp.hpp:687
#define NULL
Definition: ncbistd.hpp:225
string GetHexSum(void) const
Return string with checksum in hexadecimal form.
Definition: checksum.hpp:353
void AddLine(const char *line, size_t len)
Definition: checksum.hpp:609
Uint4 GetChecksum(void) const
Return calculated checksum.
Definition: checksum.hpp:341
void AddChars(const char *str, size_t len)
Update current control sum with data provided.
Definition: checksum.hpp:602
#define NCBI_ASSERT(expr, mess)
Definition: ncbidbg.hpp:130
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
static bool IsNAA(const string &annot, bool isStrict=false)
check if a given annotation is a named annotation accession[.version][number] when isSctrict == false...
Definition: utils.cpp:796
static bool IsAlignDb(const string &annot)
check if a given annotation is AlignDb (potentially suffixed with batch identication string after a '...
Definition: utils.cpp:861
static bool isRmtAnnotName(const string &sAnnotname)
check if a given annotation was created by a remote file pipeline
Definition: utils.cpp:813
static void TokenizeWithEscape(const string &str, const string &delim, vector< string > &tokens, bool remove_escape=false)
Tokenize a string using the delim.
Definition: track_info.cpp:352
const objects::CSeq_loc & GetLocation() const
Definition: snp_gui.hpp:302
virtual const CTypeInfo * GetThisTypeInfo(void) const =0
const string AsFastaString(void) const
Definition: Seq_id.cpp:2266
CConstRef< CSeq_id > GetSeqId(void) const
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
CSeq_id_Handle GetIdHandle(const CSeq_loc &loc, CScope *scope)
@ eGetId_Canonical
Definition: sequence.hpp:114
int16_t Int2
2-byte (16-bit) signed integer
Definition: ncbitype.h:100
int32_t Int4
4-byte (32-bit) signed integer
Definition: ncbitype.h:102
uint32_t Uint4
4-byte (32-bit) unsigned integer
Definition: ncbitype.h:103
uint16_t Uint2
2-byte (16-bit) unsigned integer
Definition: ncbitype.h:101
uint64_t Uint8
8-byte (64-bit) unsigned integer
Definition: ncbitype.h:105
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
Definition: ncbistr.hpp:5187
static bool MatchesMask(CTempString str, CTempString mask, ECase use_case=eCase)
Match "str" against the "mask".
Definition: ncbistr.cpp:389
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
Definition: ncbistr.cpp:642
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 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:3405
static string UInt8ToString(Uint8 value, TNumToStringFlags flags=0, int base=10)
Convert UInt8 to string.
Definition: ncbistr.hpp:5168
const TLocation & GetLocation(void) const
Get the Location member data.
Definition: Seq_feat_.hpp:1117
char * buf
range(_Ty, _Ty) -> range< _Ty >
const struct ncbi::grid::netcache::search::fields::SIZE size
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
Multi-threading – mutexes; rw-locks; semaphore.
DEFINE_STATIC_MUTEX(s_Mutex)
static void s_EscapeDash(string &id)
Definition: type.c:6
Modified on Fri Apr 12 17:16:59 2024 by modify_doxy.py rev. 669887