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

Go to the SVN repository for this file.

1 /* $Id: snploader_impl.cpp 100839 2023-09-18 17:16:25Z vasilche $
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: Eugene Vasilchenko
27  *
28  * File Description: SNP file data loader
29  *
30  * ===========================================================================
31  */
32 
33 #include <ncbi_pch.hpp>
34 #include <corelib/ncbistd.hpp>
35 
38 #include <objects/seq/seq__.hpp>
42 
52 #include <serial/objistr.hpp>
53 #include <serial/serial.hpp>
54 
55 #include <sra/error_codes.hpp>
59 
61 
63 
64 #include <algorithm>
65 #include <cmath>
66 
68 
69 #define NCBI_USE_ERRCODE_X SNPLoader
71 
73 
74 class CDataLoader;
75 
76 NCBI_PARAM_DECL(int, SNP_LOADER, DEBUG);
77 NCBI_PARAM_DEF_EX(int, SNP_LOADER, DEBUG, 0,
78  eParam_NoThread, SNP_LOADER_DEBUG);
79 
80 enum {
86  eDebug_data = 9
87 };
88 
89 static int GetDebugLevel(void)
90 {
91  static CSafeStatic<NCBI_PARAM_TYPE(SNP_LOADER, DEBUG)> s_Value;
92  return s_Value->Get();
93 }
94 
95 
96 NCBI_PARAM_DECL(size_t, SNP_LOADER, GC_SIZE);
97 NCBI_PARAM_DEF_EX(size_t, SNP_LOADER, GC_SIZE, 10,
98  eParam_NoThread, SNP_LOADER_GC_SIZE);
99 
100 static size_t GetGCSize(void)
101 {
102  static CSafeStatic<NCBI_PARAM_TYPE(SNP_LOADER, GC_SIZE)> s_Value;
103  return s_Value->Get();
104 }
105 
106 
107 NCBI_PARAM_DECL(unsigned, SNP_LOADER, RETRY_COUNT);
108 NCBI_PARAM_DEF(unsigned, SNP_LOADER, RETRY_COUNT, 3);
109 
110 static unsigned GetRetryCountParam(void)
111 {
112  static unsigned value = NCBI_PARAM_TYPE(SNP_LOADER, RETRY_COUNT)::GetDefault();
113  return value;
114 }
115 
116 
117 NCBI_PARAM_DECL(unsigned, SNP_LOADER, FILE_REOPEN_TIME);
118 NCBI_PARAM_DEF(unsigned, SNP_LOADER, FILE_REOPEN_TIME, 60*60); // 1 hour
119 
120 
121 static unsigned GetFileReopenTimeParam(void)
122 {
123  static unsigned value =
124  NCBI_PARAM_TYPE(SNP_LOADER, FILE_REOPEN_TIME)::GetDefault();
125  return value;
126 }
127 
128 
129 NCBI_PARAM_DECL(unsigned, SNP_LOADER, FILE_RECHECK_TIME);
130 NCBI_PARAM_DEF(unsigned, SNP_LOADER, FILE_RECHECK_TIME, 5*60); // 5 minutes
131 
132 
133 static unsigned GetFileRecheckTimeParam(void)
134 {
135  static unsigned value =
136  NCBI_PARAM_TYPE(SNP_LOADER, FILE_RECHECK_TIME)::GetDefault();
137  return value;
138 }
139 
140 
141 /*
142 NCBI_PARAM_DECL(string, SNP_LOADER, ANNOT_NAME);
143 NCBI_PARAM_DEF_EX(string, SNP_LOADER, ANNOT_NAME, "SNP",
144  eParam_NoThread, SNP_LOADER_ANNOT_NAME);
145 
146 static string GetDefaultAnnotName(void)
147 {
148  static CSafeStatic<NCBI_PARAM_TYPE(SNP_LOADER, ANNOT_NAME)> s_Value;
149  return s_Value->Get();
150 }
151 */
152 
153 
154 NCBI_PARAM_DECL(bool, SNP_LOADER, SPLIT);
155 NCBI_PARAM_DEF_EX(bool, SNP_LOADER, SPLIT, true,
156  eParam_NoThread, SNP_LOADER_SPLIT);
157 
158 static bool IsSplitEnabled(void)
159 {
160  static CSafeStatic<NCBI_PARAM_TYPE(SNP_LOADER, SPLIT)> s_Value;
161  return s_Value->Get();
162 }
163 
164 
165 /////////////////////////////////////////////////////////////////////////////
166 // CSNPBlobId
167 /////////////////////////////////////////////////////////////////////////////
168 
169 // Blob id:
170 // sat = 2001-2099 : SNP NA version 1 - 99
171 // or, for primary SNP track:
172 // sat = 3001-3099 : SNP NA version 1 - 99
173 // subsat : NA accession number
174 // or, for primary SNP graph track:
175 // NA accession number + kSNPSubSatGraph(=1000000000)
176 // satkey : SequenceIndex + 1000000*FilterIndex;
177 // satkey bits 24-30:
178 
179 const int kSNPSatBase = 2000;
180 const int kSNPSatPrimary = 3000;
181 const int kSNPSubSatGraph = 1000000000;
182 const int kNAVersionMin = 1;
183 const int kNAVersionMax = 99;
184 const int kSeqIndexCount = 1000000;
185 const int kFilterIndexCount = 2000;
186 const int kFilterIndexMaxLength = 4;
187 
189 {
190  FromString(str);
191 }
192 
193 
195  const CSeq_id_Handle& seq_id,
196  size_t filter_index)
197  : m_NAIndex(0),
198  m_NAVersion(0),
199  m_IsPrimaryTrack(false),
200  m_IsPrimaryTrackGraph(false),
201  m_SeqIndex(0),
202  m_FilterIndex(Uint4(filter_index)),
203  m_Accession(file.GetAccession()),
204  m_SeqId(seq_id)
205 {
206  // non-SatId
207 }
208 
209 
211  size_t seq_index,
212  size_t filter_index)
213  : m_NAIndex(0),
214  m_NAVersion(0),
215  m_IsPrimaryTrack(false),
216  m_IsPrimaryTrackGraph(false),
217  m_SeqIndex(Uint4(seq_index)),
218  m_FilterIndex(Uint4(filter_index))
219 {
220  if ( file.IsValidNA() ) {
221  SetSatNA(file.GetAccession());
222  }
223  else {
224  // non-SatId
225  m_Accession = file.GetAccession();
226  }
227  SetSeqAndFilterIndex(seq_index, filter_index);
228 }
229 
230 
232  size_t filter_index)
233 {
234  SetSatNA(seq.GetDb().GetDbPath());
235  SetSeqAndFilterIndex(seq.GetVDBSeqIndex(), filter_index);
236 }
237 
238 
240 {
241 }
242 
243 
244 bool CSNPBlobId::IsValidNAIndex(size_t na_index)
245 {
246  return na_index > 0 && na_index < 1000000000;
247 }
248 
249 
250 bool CSNPBlobId::IsValidNAVersion(size_t na_version)
251 {
252  return na_version >= kNAVersionMin && na_version <= kNAVersionMax;
253 }
254 
255 
256 bool CSNPBlobId::IsValidSeqIndex(size_t seq_index)
257 {
258  return seq_index < kSeqIndexCount;
259 }
260 
261 
262 bool CSNPBlobId::IsValidFilterIndex(size_t filter_index)
263 {
264  return filter_index < kFilterIndexCount;
265 }
266 
267 
268 void CSNPBlobId::SetNAIndex(size_t na_index)
269 {
270  _ASSERT(IsValidNAIndex(na_index));
271  m_NAIndex = Uint4(na_index);
272 }
273 
274 
275 bool CSNPBlobId::IsValidSubSat(void) const
276 {
277  return IsValidNAIndex(GetNAIndex());
278 }
279 
280 
281 int CSNPBlobId::GetSatBase(void) const
282 {
284 }
285 
286 
287 int CSNPBlobId::GetSubSatBase(void) const
288 {
290 }
291 
292 
293 void CSNPBlobId::SetNAVersion(size_t na_version)
294 {
295  _ASSERT(IsValidNAVersion(na_version));
296  m_NAVersion = Uint2(na_version);
297 }
298 
299 
300 bool CSNPBlobId::IsSatId(void) const
301 {
302  return m_NAIndex != 0;
303 }
304 
305 
306 Int4 CSNPBlobId::GetSat(void) const
307 {
309  return Int4(GetSatBase() + GetNAVersion());
310 }
311 
312 
313 Int4 CSNPBlobId::GetSubSat(void) const
314 {
316  return Int4(GetSubSatBase() + GetNAIndex());
317 }
318 
319 
320 Int4 CSNPBlobId::GetSatKey(void) const
321 {
325 }
326 
327 
328 bool CSNPBlobId::IsValidSat(void) const
329 {
330  return IsValidNAVersion(GetNAVersion());
331 }
332 
333 
334 pair<size_t, size_t> CSNPBlobId::ParseNA(CTempString acc)
335 {
336  pair<size_t, size_t> ret(0, 0);
337  // NA123456789.1
338  if ( acc.size() < 13 || acc.size() > 15 ||
339  acc[0] != 'N' || acc[1] != 'A' || acc[11] != '.' ) {
340  return ret;
341  }
342  size_t na_index = NStr::StringToNumeric<size_t>(acc.substr(2, 9),
344  if ( !IsValidNAIndex(na_index) ) {
345  return ret;
346  }
347  size_t na_version = NStr::StringToNumeric<size_t>(acc.substr(12),
349  if ( !IsValidNAVersion(na_version) ) {
350  return ret;
351  }
352  ret.first = na_index;
353  ret.second = na_version;
354  return ret;
355 }
356 
357 
358 string CSNPBlobId::GetSatNA(void) const
359 {
361  str << "NA" << setw(9) << setfill('0') << GetNAIndex()
362  << '.' << GetNAVersion();
364 }
365 
366 
368 {
369  pair<size_t, size_t> na = ParseNA(acc);
370  SetNAIndex(na.first);
371  SetNAVersion(na.second);
372 }
373 
374 
375 void CSNPBlobId::SetSeqAndFilterIndex(size_t seq_index,
376  size_t filter_index)
377 {
378  _ASSERT(IsValidSeqIndex(seq_index));
379  _ASSERT(IsValidFilterIndex(filter_index));
380  m_SeqIndex = Uint4(seq_index);
381  m_FilterIndex = Uint4(filter_index);
382 }
383 
384 
385 bool CSNPBlobId::IsValidSatKey(void) const
386 {
387  return IsValidSeqIndex(GetSeqIndex()) &&
389 }
390 
391 
393 {
394  _ASSERT(!IsSatId());
395  return m_SeqId;
396 }
397 
398 
399 string CSNPBlobId::GetAccession(void) const
400 {
401  if ( m_Accession.empty() ) {
402  return GetSatNA();
403  }
404  else {
405  return m_Accession;
406  }
407 }
408 
409 
411 {
413  m_IsPrimaryTrack = true;
414  m_IsPrimaryTrackGraph = false;
415 }
416 
417 
419 {
421  m_IsPrimaryTrack = true;
422  m_IsPrimaryTrackGraph = true;
423 }
424 
425 
426 static const char kFileEnd[] = "|||";
427 static const char kFilterPrefixChar = '#';
428 
429 
430 static
431 size_t sx_ExtractFilterIndex(string& s)
432 {
433  size_t size = s.size();
434  size_t pos = size;
435  while ( pos && isdigit(s[pos-1]) ) {
436  --pos;
437  }
438  size_t num_len = size - pos;
439  if ( !num_len || num_len > kFilterIndexMaxLength ||
440  !pos || s[pos] == '0' || s[pos-1] != kFilterPrefixChar ) {
441  return 0;
442  }
443  size_t index = NStr::StringToNumeric<size_t>(s.substr(pos));
444  if ( !CSNPBlobId::IsValidFilterIndex(index) ) {
445  return 0;
446  }
447  // internally filter index is zero-based, but in accession it's one-based
448  --index;
449  // remove filter index from accession
450  s.resize(pos - 1);
451  return index;
452 }
453 
454 
455 static
456 string sx_AddFilterIndex(const string& s, size_t filter_index)
457 {
459  str << s << kFilterPrefixChar << (filter_index+1);
461 }
462 
463 
464 string CSNPBlobId::ToString(void) const
465 {
467  if ( IsSatId() ) {
468  out << GetSat() << '.' << GetSubSat() << '.' << GetSatKey();
469  }
470  else {
471  out << m_Accession;
473  out << kFileEnd << m_SeqId;
474  }
476 }
477 
478 
480 {
481  if ( str.empty() || !isdigit(Uchar(str[0])) ) {
482  return false;
483  }
484 
485  size_t dot1 = str.find('.');
486  if ( dot1 == NPOS ) {
487  return false;
488  }
489  size_t dot2 = str.find('.', dot1+1);
490  if ( dot2 == NPOS ) {
491  return false;
492  }
493  size_t sat = NStr::StringToNumeric<size_t>(str.substr(0, dot1),
495  bool is_primary_track = sat >= kSNPSatPrimary;
496  size_t na_version = sat - (is_primary_track? kSNPSatPrimary: kSNPSatBase);
497  if ( !IsValidNAVersion(na_version) ) {
498  return false;
499  }
500  size_t subsat = NStr::StringToNumeric<size_t>(str.substr(dot1+1, dot2-dot1-1),
502  bool is_primary_track_graph = is_primary_track && subsat >= kSNPSubSatGraph;
503  size_t na_index = subsat - (is_primary_track_graph? kSNPSubSatGraph: 0);
504  if ( !IsValidNAIndex(na_index) ) {
505  return false;
506  }
507 
508  size_t satkey = NStr::StringToNumeric<size_t>(str.substr(dot2+1),
510  size_t seq_index = satkey % kSeqIndexCount;
511  size_t filter_index = satkey / kSeqIndexCount;
512  if ( !IsValidSeqIndex(seq_index) || !IsValidFilterIndex(filter_index) ) {
513  return false;
514  }
515 
516  m_NAIndex = Uint4(na_index);
517  m_NAVersion = Uint2(na_version);
518  m_SeqIndex = Uint4(seq_index);
519  m_FilterIndex = Uint4(filter_index);
520  m_IsPrimaryTrack = is_primary_track;
521  m_IsPrimaryTrackGraph = is_primary_track_graph;
522  m_Accession.clear();
523  m_SeqId.Reset();
524 
525  _ASSERT(IsSatId());
526  return true;
527 }
528 
529 
531 {
532  if ( FromSatString(str) ) {
533  return;
534  }
535  m_NAIndex = 0;
536  m_NAVersion = 0;
537  m_SeqIndex = 0;
538  m_FilterIndex = 0;
539  m_IsPrimaryTrack = false;
540  m_IsPrimaryTrackGraph = false;
541  m_Accession.clear();
542  m_SeqId.Reset();
543  _ASSERT(!IsSatId());
544 
545  SIZE_TYPE div = str.rfind(kFileEnd);
546  if ( div == NPOS ) {
547  NCBI_THROW_FMT(CSraException, eOtherError,
548  "Bad CSNPBlobId: "<<str);
549  }
550  m_Accession = str.substr(0, div);
551  m_SeqId = CSeq_id_Handle::GetHandle(str.substr(div+strlen(kFileEnd)));
553 }
554 
555 
556 bool CSNPBlobId::operator<(const CBlobId& id) const
557 {
558  const CSNPBlobId& id2 = dynamic_cast<const CSNPBlobId&>(id);
559  if ( m_NAIndex != id2.m_NAIndex ) {
560  return m_NAIndex < id2.m_NAIndex;
561  }
562  if ( m_NAVersion != id2.m_NAVersion ) {
563  return m_NAVersion < id2.m_NAVersion;
564  }
565  if ( m_SeqIndex != id2.m_SeqIndex ) {
566  return m_SeqIndex < id2.m_SeqIndex;
567  }
568  if ( m_FilterIndex != id2.m_FilterIndex ) {
569  return m_FilterIndex < id2.m_FilterIndex;
570  }
571  if ( m_IsPrimaryTrack != id2.m_IsPrimaryTrack ) {
572  return m_IsPrimaryTrack < id2.m_IsPrimaryTrack;
573  }
576  }
577  if ( m_Accession != id2.m_Accession ) {
578  return m_Accession < id2.m_Accession;
579  }
580  return m_SeqId < id2.m_SeqId;
581 }
582 
583 
584 bool CSNPBlobId::operator==(const CBlobId& id) const
585 {
586  const CSNPBlobId& id2 = dynamic_cast<const CSNPBlobId&>(id);
587  return m_NAIndex == id2.m_NAIndex &&
588  m_NAVersion == id2.m_NAVersion &&
589  m_SeqIndex == id2.m_SeqIndex &&
590  m_FilterIndex == id2.m_FilterIndex &&
593  m_Accession == id2.m_Accession &&
594  m_SeqId == id2.m_SeqId;
595 }
596 
597 
598 /////////////////////////////////////////////////////////////////////////////
599 // CSNPDataLoader_Impl
600 /////////////////////////////////////////////////////////////////////////////
601 
602 
604  const CSNPDataLoader::SLoaderParams& params)
605  : m_FileReopenTime(GetFileReopenTimeParam()),
606  m_FileRecheckTime(GetFileRecheckTimeParam()),
607  m_RetryCount(GetRetryCountParam()),
608  m_FoundFiles(max(params.m_VDBFiles.size(), GetGCSize()),
609  m_FileReopenTime, m_FileRecheckTime)
610 {
611  m_DirPath = params.m_DirPath;
612  m_AnnotName = params.m_AnnotName;
613  m_AddPTIS = params.m_AddPTIS;
614  if ( m_AddPTIS ) {
615  if ( CSnpPtisClient::IsEnabled() ) {
617  }
618  else {
619  ERR_POST_ONCE("CSNPDataLoader: SNP primary track is disabled due to lack of GRPC support");
620  m_AddPTIS = false;
621  }
622  }
623 
624  if ( params.m_VDBFiles.empty() ) {
625  if ( !m_DirPath.empty() ) {
626  m_DirPath.erase();
627  AddFixedFile(params.m_DirPath);
628  }
629  }
630  for ( auto& file : params.m_VDBFiles ) {
632  }
633 }
634 
635 
637 {
638 }
639 
640 
641 template<class Call>
644  const char* name,
645  unsigned retry_count)
646 {
647  if ( retry_count == 0 ) {
648  retry_count = m_RetryCount;
649  }
650  for ( unsigned t = 1; t < retry_count; ++ t ) {
651  try {
652  return call();
653  }
654  catch ( CBlobStateException& ) {
655  // no retry
656  throw;
657  }
658  catch ( CException& exc ) {
659  LOG_POST(Warning<<"CSNPDataLoader::"<<name<<"() try "<<t<<" exception: "<<exc);
660  }
661  catch ( exception& exc ) {
662  LOG_POST(Warning<<"CSNPDataLoader::"<<name<<"() try "<<t<<" exception: "<<exc.what());
663  }
664  catch ( ... ) {
665  LOG_POST(Warning<<"CSNPDataLoader::"<<name<<"() try "<<t<<" exception");
666  }
667  if ( t >= 2 ) {
668  //double wait_sec = m_WaitTime.GetTime(t-2);
669  double wait_sec = 1;
670  LOG_POST(Warning<<"CSNPDataLoader: waiting "<<wait_sec<<"s before retry");
671  SleepMilliSec(Uint4(wait_sec*1000));
672  }
673  }
674  return call();
675 }
676 
677 
679 {
681  file),
682  "AddFixedFile");
683 }
684 
685 
687 {
689  string key = info->GetBaseAnnotName();
691  if ( !m_FixedFiles.insert(TFixedFiles::value_type(key, info->m_FileName)).second ) {
692  NCBI_THROW_FMT(CSraException, eOtherError,
693  "Duplicated fixed SNP NA: "<<
694  key);
695  }
696  CRef<SSNPFileInfoSlot> info_slot = m_FoundFiles.GetSlot(info->m_FileName);
697  info_slot->UpdateExpiration(m_FoundFiles, info->m_FileName);
698  info_slot->SetObject(info);
699  info->InitializeDb(*this);
700 }
701 
702 
704 {
706  CRef<CSNPFileInfo> info; // return info
707  CRef<CSNPFileInfo> delete_info; // delete stale file info after releasing mutex
708  // now open or reopen the SNP file under individual guard
709  SSNPFileInfoSlot::TSlotMutex::TWriteLockGuard guard(info_slot->GetSlotMutex());
710  info = info_slot->GetObject<CSNPFileInfo>();
711  if ( info && info_slot->IsExpired(m_FoundFiles, file) ) {
712  if ( GetDebugLevel() >= 1 ) {
713  LOG_POST_X(4, Info<<"CSNPDataLoader: "
714  "Reopening SNP file expired in cache: "<<file);
715  }
716  info_slot->ResetObject();
717  delete_info.Swap(info);
718  }
719  if ( !info ) {
720  // make sure the file is opened
721  try {
722  info_slot->UpdateExpiration(m_FoundFiles, file);
723  info = new CSNPFileInfo(*this, file);
724  info_slot->SetObject(info);
725  }
726  catch ( CSraException& exc ) {
727  if ( exc.GetErrCode() == exc.eNotFoundDb ||
728  exc.GetErrCode() == exc.eProtectedDb ) {
729  // no such SNP NA accession
730  return null;
731  }
732  else {
733  // problem in VDB or SNP reader
734  throw;
735  }
736  }
737  }
738  info->InitializeDb(*this);
739  return info;
740 }
741 
742 
744 {
746  if ( it == m_FixedFiles.end() ) {
747  return null;
748  }
749  return x_GetFileInfo(it->second);
750 }
751 
752 
754 {
755  if ( !m_FixedFiles.empty() ) {
756  // no dynamic accessions
757  return null;
758  }
759  return x_GetFileInfo(acc);
760 }
761 
762 
765 {
766  if ( !m_FixedFiles.empty() ) {
767  return GetFixedFile(acc);
768  }
769  else {
770  return FindFile(acc);
771  }
772 }
773 
774 
777 {
778  return GetFileInfo(blob_id.GetAccession());
779 }
780 
781 
784 {
785  CRef<CSNPSeqInfo> info = GetFileInfo(blob_id)->GetSeqInfo(blob_id);
786  _ASSERT(*info->GetBlobId() == blob_id);
787  return info;
788 }
789 
790 
792  const CSNPBlobId& blob_id)
793 {
795  data_source, cref(blob_id)),
796  "GetBlobById");
797 }
798 
799 
801  const CSNPBlobId& blob_id)
802 {
803  CDataLoader::TBlobId loader_blob_id(&blob_id);
804  CTSE_LoadLock load_lock = data_source->GetTSE_LoadLock(loader_blob_id);
805  if ( !load_lock.IsLoaded() ) {
807  LoadBlob(blob_id, load_lock);
808  load_lock.SetLoaded();
809  }
810  return load_lock;
811 }
812 
813 
816  const CSeq_id_Handle& idh,
817  CDataLoader::EChoice choice)
818 {
820  // SNPs are available by NA accession only, see GetOrphanAnnotRecords()
821  return locks;
822 }
823 
824 
825 static string s_GetAccVer(const CSeq_id_Handle& id)
826 {
827  if ( !id ) {
828  return string();
829  }
830  if ( auto seq_id = id.GetSeqId() ) {
831  if ( const CTextseq_id* text_id = seq_id->GetTextseq_Id() ) {
832  if ( text_id->IsSetAccession() && !text_id->GetAccession().empty() &&
833  text_id->IsSetVersion() && text_id->GetVersion() > 0 ) {
834  // fully qualified text id, no more information is necessary
835  return text_id->GetAccession()+'.'+NStr::NumericToString(text_id->GetVersion());
836  }
837  }
838  }
839  return string();
840 }
841 
842 
845  const CSeq_id_Handle& id,
846  const SAnnotSelector* sel,
847  CDataLoader::TProcessedNAs* processed_nas)
848 {
850  ds, cref(id), sel, processed_nas),
851  "GetOrphanAnnotRecords");
852 }
853 
854 
857  const CSeq_id_Handle& id,
858  const SAnnotSelector* sel,
859  CDataLoader::TProcessedNAs* processed_nas)
860 {
862  // implicitly load NA accessions
863  if ( sel && sel->IsIncludedAnyNamedAnnotAccession() ) {
866  if ( m_FixedFiles.empty() ) {
867  auto accs_size = accs.size();
868  if ( m_FoundFiles.get_size_limit() < accs_size ) {
870  if ( m_FoundFiles.get_size_limit() < accs_size ) {
871  // increase VDB cache size
873  }
874  }
875  }
877  if ( m_AddPTIS && it->first == "SNP" ) {
878  auto scale_limit = sel->GetSNPScaleLimit();
879  if (scale_limit == CSeq_id::eSNPScaleLimit_Default) {
880  scale_limit = CSNPDataLoader::GetSNP_Scale_Limit();
881  }
882  if (!id.IsAllowedSNPScaleLimit(scale_limit)) continue;
883 
884  // default SNP track
885  string acc_ver = s_GetAccVer(id);
886  if ( !acc_ver.empty() ) {
887  string na_acc;
888  try {
889  // add default SNP track
890  if ( GetDebugLevel() >= eDebug_resolve ) {
891  LOG_POST_X(13, Info<<"CSNPDataLoader:PTIS: resolving "<<acc_ver);
892  }
893  na_acc = m_PTISClient->GetPrimarySnpTrackForAccVer(acc_ver);
894  if ( GetDebugLevel() >= eDebug_resolve ) {
895  LOG_POST_X(13, Info<<"CSNPDataLoader:PTIS: "<<acc_ver<<" primary SNP track is "<<na_acc);
896  }
897  }
898  catch ( CException& exc ) {
899  ERR_POST_X(2, "CSNPDataLoader: failed to add PTIS track for "<<acc_ver<<": "<<exc);
900  }
901  if ( !na_acc.empty() ) {
902  size_t filter_index = sx_ExtractFilterIndex(na_acc);
903  if ( CRef<CSNPFileInfo> info = GetFileInfo(na_acc) ) {
904  if ( CRef<CSNPSeqInfo> seq = info->GetSeqInfo(id) ) {
905  seq->SetFilterIndex(filter_index);
906  {
907  auto blob_id = seq->GetBlobId();
908  blob_id->SetPrimaryTrackFeat();
909  locks.insert(GetBlobById(ds, *blob_id));
910  }
911  {
912  auto blob_id = seq->GetBlobId();
913  blob_id->SetPrimaryTrackGraph();
914  locks.insert(GetBlobById(ds, *blob_id));
915  }
916  }
917  }
918  }
919  }
920  CDataLoader::SetProcessedNA(it->first, processed_nas);
921  continue;
922  }
923  string acc = it->first;
924  size_t filter_index = sx_ExtractFilterIndex(acc);
925  if ( filter_index == 0 && acc.size() == it->first.size() ) {
926  // filter specification is required
927  continue;
928  }
929  if ( CRef<CSNPFileInfo> info = GetFileInfo(acc) ) {
930  CDataLoader::SetProcessedNA(it->first, processed_nas);
931  if ( CRef<CSNPSeqInfo> seq = info->GetSeqInfo(id) ) {
932  seq->SetFilterIndex(filter_index);
933  locks.insert(GetBlobById(ds, *seq->GetBlobId()));
934  }
935  }
936  }
937  }
938  return locks;
939 }
940 
941 
943  CTSE_LoadLock& load_lock)
944 {
945  CStopWatch sw;
946  if ( GetDebugLevel() >= eDebug_load ) {
947  LOG_POST_X(5, Info<<"CSNPDataLoader::LoadBlob("<<blob_id<<")");
948  sw.Start();
949  }
950  GetSeqInfo(blob_id)->LoadAnnotBlob(load_lock);
951  if ( GetDebugLevel() >= eDebug_load_time ) {
952  LOG_POST_X(6, Info<<"CSNPDataLoader::LoadBlob("<<blob_id<<")"
953  " loaded in "<<sw.Elapsed());
954  }
955 }
956 
957 
959  CTSE_Chunk_Info& chunk)
960 {
962  cref(blob_id), ref(chunk)),
963  "GetChunk");
964 }
965 
966 
968  CTSE_Chunk_Info& chunk_info)
969 {
970  CStopWatch sw;
971  if ( GetDebugLevel() >= eDebug_load ) {
972  LOG_POST_X(7, Info<<"CSNPDataLoader::"
973  "LoadChunk("<<blob_id<<", "<<chunk_info.GetChunkId()<<")");
974  sw.Start();
975  }
976  GetSeqInfo(blob_id)->LoadAnnotChunk(chunk_info);
977  if ( GetDebugLevel() >= eDebug_load_time ) {
978  LOG_POST_X(8, Info<<"CSNPDataLoader::"
979  "LoadChunk("<<blob_id<<", "<<chunk_info.GetChunkId()<<")"
980  " loaded in "<<sw.Elapsed());
981  }
982 }
983 
984 
986 {
988  if ( m_FixedFiles.empty() ) {
989  // implicit loading data loader has lower priority by default
990  priority += 1;
991  }
992  return priority;
993 }
994 
995 
998 {
1000  names.push_back(m_AnnotName);
1001  return names;
1002 }
1003 
1004 
1005 /////////////////////////////////////////////////////////////////////////////
1006 // CSNPFileInfo
1007 /////////////////////////////////////////////////////////////////////////////
1008 
1009 
1011  const string& acc)
1012 {
1013  x_Initialize(impl, acc);
1014 }
1015 
1016 
1018  const string& csra)
1019 {
1020  m_FileName = csra;
1022  m_RemainingOpenRetries = impl.m_RetryCount;
1025  if ( !m_IsValidNA ) {
1026  // remove directory part, if any
1027  SIZE_TYPE sep = m_Accession.find_last_of("/\\");
1028  if ( sep != NPOS ) {
1029  m_Accession.erase(0, sep+1);
1030  }
1031  }
1032  m_AnnotName = impl.m_AnnotName;
1033  if ( m_AnnotName.empty() ) {
1035  }
1036 }
1037 
1038 
1040 {
1041  if ( !m_SNPDb && m_RemainingOpenRetries > 0 ) {
1042  CStopWatch sw;
1043  if ( GetDebugLevel() >= eDebug_open ) {
1044  LOG_POST_X(1, Info <<
1045  "CSNPDataLoader("<<m_FileName<<")");
1046  sw.Start();
1047  }
1048  m_SNPDb = CSNPDb(impl.m_Mgr, m_FileName);
1049  if ( GetDebugLevel() >= eDebug_open_time ) {
1050  LOG_POST_X(2, Info <<
1051  "CSNPDataLoader("<<m_FileName<<")"
1052  " opened VDB in "<<sw.Elapsed());
1053  }
1054  }
1055 }
1056 
1057 
1058 string CSNPFileInfo::GetSNPAnnotName(size_t filter_index) const
1059 {
1060  return sx_AddFilterIndex(GetBaseAnnotName(), filter_index);
1061 }
1062 
1063 
1065 {
1066  for ( CSNPDbTrackIterator it(m_SNPDb); it; ++it ) {
1067  names.push_back(CAnnotName(GetSNPAnnotName(it.GetVDBTrackIndex())));
1068  }
1069 }
1070 
1071 
1074 {
1075  CRef<CSNPSeqInfo> ret;
1076  CSNPDbSeqIterator seq_it(m_SNPDb, seq_id);
1077  if ( seq_it ) {
1078  ret = new CSNPSeqInfo(this, seq_it);
1079  }
1080  return ret;
1081 }
1082 
1083 
1085 CSNPFileInfo::GetSeqInfo(size_t seq_index)
1086 {
1087  CSNPDbSeqIterator seq_it(m_SNPDb, seq_index);
1088  _ASSERT(seq_it);
1089  CRef<CSNPSeqInfo> ret(new CSNPSeqInfo(this, seq_it));
1090  return ret;
1091 }
1092 
1093 
1095 CSNPFileInfo::GetSeqInfo(const CSNPBlobId& blob_id)
1096 {
1097  CRef<CSNPSeqInfo> ret;
1098  if ( blob_id.IsSatId() ) {
1099  ret = GetSeqInfo(blob_id.GetSeqIndex());
1100  }
1101  else {
1102  ret = GetSeqInfo(blob_id.GetSeqId());
1103  }
1104  if ( ret ) {
1105  ret->SetFromBlobId(blob_id);
1106  }
1107  return ret;
1108 }
1109 
1110 
1111 /////////////////////////////////////////////////////////////////////////////
1112 // CSNPSeqInfo
1113 /////////////////////////////////////////////////////////////////////////////
1114 
1115 
1117  const CSNPDbSeqIterator& it)
1118  : m_File(file),
1119  m_SeqIndex(it.GetVDBSeqIndex()),
1120  m_FilterIndex(0),
1121  m_IsPrimaryTrack(false),
1122  m_IsPrimaryTrackGraph(false)
1123 {
1124  if ( !file->IsValidNA() ) {
1125  m_SeqId = it.GetSeqIdHandle();
1126  }
1127 }
1128 
1129 
1131 {
1132  CRef<CSNPBlobId> blob_id;
1133  _ASSERT(m_File);
1134  if ( !m_SeqId ) {
1135  blob_id = new CSNPBlobId(*m_File, m_SeqIndex, m_FilterIndex);
1136  }
1137  else {
1138  blob_id = new CSNPBlobId(*m_File, m_SeqId, m_FilterIndex);
1139  }
1140  if ( m_IsPrimaryTrack ) {
1141  if ( m_IsPrimaryTrackGraph ) {
1142  blob_id->SetPrimaryTrackGraph();
1143  }
1144  else {
1145  blob_id->SetPrimaryTrackFeat();
1146  }
1147  }
1148  return blob_id;
1149 }
1150 
1151 
1152 void CSNPSeqInfo::SetFilterIndex(size_t filter_index)
1153 {
1154  if ( !CSNPBlobId::IsValidFilterIndex(filter_index) ) {
1155  filter_index = 0;
1156  }
1157  m_FilterIndex = filter_index;
1158 }
1159 
1160 
1161 void CSNPSeqInfo::SetFromBlobId(const CSNPBlobId& blob_id)
1162 {
1163  SetFilterIndex(blob_id.GetFilterIndex());
1164  m_IsPrimaryTrack = blob_id.IsPrimaryTrack();
1166 }
1167 
1168 
1170 CSNPSeqInfo::GetSeqIterator(void) const
1171 {
1172  CSNPDbSeqIterator it;
1173  if ( !m_SeqId ) {
1175  }
1176  else {
1178  }
1179  if ( m_FilterIndex ) {
1181  }
1182  return it;
1183 }
1184 
1185 
1186 string CSNPSeqInfo::GetAnnotName(void) const
1187 {
1188  // primary SNP track features have hard-coded name from EADB
1189  if ( m_IsPrimaryTrack ) {
1190  return "SNP";
1191  }
1192  else {
1194  }
1195 }
1196 
1197 
1199 {
1201  string base_name = GetAnnotName();
1202  CSNPDbSeqIterator::TFlags flags = CSNPDbSeqIterator::fDefaultFlags;
1203  if ( m_IsPrimaryTrack ) {
1204  // primary track has overvew graph in a separate TSE
1205  if ( m_IsPrimaryTrackGraph ) {
1207  }
1208  else {
1210  }
1211  }
1212  if ( IsSplitEnabled() ) {
1213  auto split = it.GetSplitInfoAndVersion(base_name, flags);
1214  load_lock->GetSplitInfo().SetSplitVersion(split.second);
1215  if ( GetDebugLevel() >= eDebug_data ) {
1216  LOG_POST_X(6, Info<<"CSNPDataLoader::LoadAnnotBlob("<<*GetBlobId()<<"):"
1217  << " SV=" << split.second
1218  << " " << MSerial_AsnText << *split.first);
1219  }
1220  CSplitParser::Attach(*load_lock, *split.first);
1221  }
1222  else {
1223  auto entry = it.GetEntry(base_name, flags);
1224  if ( GetDebugLevel() >= eDebug_data ) {
1225  LOG_POST_X(6, Info<<"CSNPDataLoader::LoadAnnotBlob("<<*GetBlobId()<<"): "
1226  << MSerial_AsnText << *entry);
1227  }
1228  load_lock->SetSeq_entry(*entry);
1229  }
1230 }
1231 
1232 
1234 {
1235  int chunk_id = chunk_info.GetChunkId();
1236  string base_name = GetAnnotName();
1238  auto split_version = chunk_info.GetSplitInfo().GetSplitVersion();
1239  auto chunk = it.GetChunkForVersion(base_name, chunk_id, split_version);
1240  if ( GetDebugLevel() >= eDebug_data ) {
1241  LOG_POST_X(6, Info<<"CSNPDataLoader::LoadAnnotChunk("<<*GetBlobId()<<", "<<chunk_id<<"):"
1242  << " SV=" << split_version
1243  << " " << MSerial_AsnText << *chunk);
1244  }
1245  CSplitParser::Load(chunk_info, *chunk);
1246  chunk_info.SetLoaded();
1247 }
1248 
1249 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
Blob state exceptions, used by GenBank loader.
CTSE_LoadLock GetTSE_LoadLock(const TBlobId &blob_id)
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
Definition: ncbistre.hpp:802
CRef –.
Definition: ncbiobj.hpp:618
Int4 GetSubSat(void) const
Definition: snp_client.cpp:290
void SetPrimaryTrackFeat()
Definition: snp_client.cpp:387
bool IsValidSatKey(void) const
Definition: snp_client.cpp:362
static bool IsValidSeqIndex(size_t seq_index)
Definition: snp_client.cpp:233
bool m_IsPrimaryTrackGraph
int GetSubSatBase(void) const
Definition: snp_client.cpp:264
bool IsValidSat(void) const
Definition: snp_client.cpp:305
size_t GetFilterIndex(void) const
string ToString(void) const
Get string representation of blob id.
Definition: snp_client.cpp:403
CSNPBlobId(const CTempString &str)
Definition: snp_client.cpp:170
static bool IsValidNAIndex(size_t index)
Definition: snp_client.cpp:221
static bool IsValidNAVersion(size_t version)
Definition: snp_client.cpp:227
void FromString(CTempString str)
Definition: snp_client.cpp:469
Int4 GetSat(void) const
Definition: snp_client.cpp:283
void SetSatNA(CTempString acc)
Definition: snp_client.cpp:344
void SetSeqAndFilterIndex(size_t seq_index, size_t filter_index)
Definition: snp_client.cpp:352
size_t GetNAVersion(void) const
static pair< size_t, size_t > ParseNA(CTempString acc)
Definition: snp_client.cpp:311
void SetNAIndex(size_t na_index)
Definition: snp_client.cpp:245
static bool IsValidNA(pair< size_t, size_t > na)
string m_Accession
bool operator<(const CBlobId &id) const
Int4 GetSatKey(void) const
Definition: snp_client.cpp:297
void SetNAVersion(size_t na_version)
Definition: snp_client.cpp:270
size_t GetNAIndex(void) const
bool FromSatString(CTempString str)
Definition: snp_client.cpp:418
bool IsPrimaryTrackGraph() const
int GetSatBase(void) const
Definition: snp_client.cpp:258
bool IsValidSubSat(void) const
Definition: snp_client.cpp:252
~CSNPBlobId(void)
Definition: snp_client.cpp:216
bool IsPrimaryTrack() const
CSeq_id_Handle GetSeqId(void) const
Definition: snp_client.cpp:369
bool operator==(const CBlobId &id) const
static bool IsValidFilterIndex(size_t filter_index)
Definition: snp_client.cpp:239
bool IsSatId(void) const
Definition: snp_client.cpp:277
string GetAccession(void) const
Definition: snp_client.cpp:376
string GetSatNA(void) const
Definition: snp_client.cpp:335
size_t GetSeqIndex(void) const
void SetPrimaryTrackGraph()
Definition: snp_client.cpp:395
CSeq_id_Handle m_SeqId
CRef< CSNPFileInfo > FindFile(const string &acc)
CRef< CSNPFileInfo > GetFixedFile(const string &acc)
std::invoke_result< Call >::type CallWithRetry(Call &&call, const char *name, unsigned retry_count=0)
CRef< CSNPFileInfo > x_GetFileInfo(const string &file)
CRef< CSNPSeqInfo > GetSeqInfo(const CSNPBlobId &blob_id)
void GetChunkOnce(const CSNPBlobId &blob_id, CTSE_Chunk_Info &chunk_info)
CDataLoader::TTSE_LockSet GetRecords(CDataSource *data_source, const CSeq_id_Handle &idh, CDataLoader::EChoice choice)
void LoadBlob(const CSNPBlobId &blob_id, CTSE_LoadLock &load_lock)
CObjectManager::TPriority GetDefaultPriority(void) const
CSNPDataLoader_Impl(const CSNPDataLoader::SLoaderParams &params)
CTSE_LoadLock GetBlobById(CDataSource *data_source, const CSNPBlobId &blob_id)
friend class CSNPFileInfo
CRef< CSnpPtisClient > m_PTISClient
CTSE_LoadLock GetBlobByIdOnce(CDataSource *data_source, const CSNPBlobId &blob_id)
CRef< CSNPFileInfo > GetFileInfo(const string &acc)
CDataLoader::TTSE_LockSet GetOrphanAnnotRecords(CDataSource *ds, const CSeq_id_Handle &idh, const SAnnotSelector *sel, CDataLoader::TProcessedNAs *processed_nas)
CSNPDataLoader::TAnnotNames TAnnotNames
TAnnotNames GetPossibleAnnotNames(void) const
void GetChunk(const CSNPBlobId &blob_id, CTSE_Chunk_Info &chunk)
CDataLoader::TTSE_LockSet GetOrphanAnnotRecordsOnce(CDataSource *ds, const CSeq_id_Handle &id, const SAnnotSelector *sel, CDataLoader::TProcessedNAs *processed_nas)
void AddFixedFileOnce(const string &file_name)
void AddFixedFile(const string &file_name)
vector< CAnnotName > TAnnotNames
Definition: snploader.hpp:110
static CSeq_id::ESNPScaleLimit GetSNP_Scale_Limit(void)
Definition: snploader.cpp:367
pair< CRef< CID2S_Split_Info >, TSplitVersion > GetSplitInfoAndVersion(const string &base_name, TFlags flags=fDefaultFlags) const
Definition: snpread.cpp:2921
void SetTrack(const CSNPDbTrackIterator &track)
Definition: snpread.cpp:773
CSNPDb_Impl & GetDb(void) const
Definition: snpread.hpp:606
const CSeq_id_Handle & GetSeqIdHandle(void) const
Definition: snpread.hpp:503
CRef< CSeq_entry > GetEntry(const string &base_name, TFlags flags=fDefaultFlags) const
Definition: snpread.cpp:2866
CRef< CID2S_Chunk > GetChunkForVersion(const string &base_name, TChunkId chunk_id, TSplitVersion split_version) const
Definition: snpread.cpp:2994
size_t GetVDBSeqIndex(void) const
Definition: snpread.hpp:533
const string & GetDbPath(void) const
Definition: snpread.hpp:233
unsigned m_RemainingOpenRetries
CSNPDataLoader::TAnnotNames TAnnotNames
CRef< CSNPSeqInfo > GetSeqInfo(const CSeq_id_Handle &seq_id)
Definition: snp_client.cpp:642
const string & GetBaseAnnotName(void) const
void InitializeDb(CSNPDataLoader_Impl &impl)
void x_Initialize(CSNPDataLoader_Impl &impl, const string &file_name)
CSNPFileInfo(CSNPDataLoader_Impl &impl, const string &file_name)
void GetPossibleAnnotNames(TAnnotNames &names) const
string GetSNPAnnotName(size_t filter_index) const
Definition: snp_client.cpp:636
void LoadAnnotChunk(CTSE_Chunk_Info &chunk_info)
CSNPSeqInfo(CSNPFileInfo *file, const CSNPDbSeqIterator &it)
Definition: snp_client.cpp:500
bool m_IsPrimaryTrackGraph
CSNPDbSeqIterator GetSeqIterator(void) const
Definition: snp_client.cpp:540
size_t m_FilterIndex
void LoadAnnotBlob(CTSE_LoadLock &load_lock)
void SetFromBlobId(const CSNPBlobId &blob_id)
Definition: snp_client.cpp:532
CSNPFileInfo * m_File
CSeq_id_Handle m_SeqId
void SetFilterIndex(size_t filter_index)
Definition: snp_client.cpp:523
string GetAnnotName(void) const
Definition: snp_client.cpp:556
CRef< CSNPBlobId > GetBlobId(void) const
Definition: snp_client.cpp:513
CSafeStatic<>::
static bool IsEnabled()
Definition: snpptis.cpp:92
static CRef< CSnpPtisClient > CreateClient()
Definition: snpptis.cpp:114
virtual string GetPrimarySnpTrackForAccVer(const string &acc_ver)=0
static void Attach(CTSE_Info &tse, const CID2S_Split_Info &split)
static void Load(CTSE_Chunk_Info &chunk, const CID2S_Chunk &data)
@ eProtectedDb
DB is protected.
Definition: exception.hpp:98
@ eNotFoundDb
DB main file not found.
Definition: exception.hpp:92
virtual TErrCode GetErrCode(void) const
Definition: sraread.cpp:164
CStopWatch –.
Definition: ncbitime.hpp:1937
void SetLoaded(CObject *obj=0)
TChunkId GetChunkId(void) const
const CTSE_Split_Info & GetSplitInfo(void) const
CTSE_Split_Info & GetSplitInfo(void)
Definition: tse_info.cpp:1395
void SetSeq_entry(CSeq_entry &entry, CTSE_SetObjectInfo *set_info=0)
Definition: tse_info.cpp:351
bool IsLoaded(void) const
void SetLoaded(void)
void SetSplitVersion(TSplitVersion version)
TSplitVersion GetSplitVersion(void) const
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
Definition: tempstr.hpp:65
CMutex & GetCacheMutex()
Definition: vdbcache.hpp:141
size_t get_size_limit() const
Definition: vdbcache.hpp:56
void set_size_limit(size_t limit)
Definition: vdbcache.cpp:56
CRef< CSlot > GetSlot(const string &acc_or_path)
Definition: vdbcache.cpp:187
size_type size() const
Definition: map.hpp:148
const_iterator end() const
Definition: map.hpp:152
iterator_bool insert(const value_type &val)
Definition: map.hpp:165
bool empty() const
Definition: map.hpp:149
const_iterator find(const key_type &key) const
Definition: map.hpp:153
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
Include a standard set of the NCBI C++ Toolkit most basic headers.
static uch flags
std::ofstream out("events_result.xml")
main entry point for tests
static const struct name_t names[]
#define false
Definition: bool.h:36
static int type
Definition: getdata.c:31
static const char * str(char *buf, int n)
Definition: stats.c:84
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
string
Definition: cgiapp.hpp:687
#define LOG_POST_X(err_subcode, message)
Definition: ncbidiag.hpp:553
#define ERR_POST_ONCE(message)
Error posting only once during program execution.
Definition: ncbidiag.hpp:602
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
Definition: ncbidiag.hpp:550
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
Definition: ncbidiag.hpp:226
void Warning(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1191
#define NCBI_THROW_FMT(exception_class, err_code, message)
The same as NCBI_THROW but with message processed as output to ostream.
Definition: ncbiexpt.hpp:719
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
Definition: ncbiexpt.cpp:342
void Info(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1185
#define MSerial_AsnText
I/O stream manipulators –.
Definition: serialbase.hpp:696
void Reset(void)
Reset the handle (remove seq-id reference)
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
@ eSNPScaleLimit_Default
Definition: Seq_id.hpp:848
static void SetProcessedNA(const string &na, TProcessedNAs *processed_nas)
EChoice
main blob is blob with sequence all other blobs are external and contain external annotations
@ kPriority_Replace
Default priority for replacement loaders.
bool IsIncludedAnyNamedAnnotAccession(void) const
check if any named annot accession is included in the search
TSNPScaleLimit GetSNPScaleLimit(void) const
const TNamedAnnotAccessions & GetNamedAnnotAccessions(void) const
void Swap(TThisType &ref)
Swaps the pointer with another reference.
Definition: ncbiobj.hpp:754
TObjectType & GetObject(void)
Get object.
Definition: ncbiobj.hpp:1011
#define NCBI_PARAM_TYPE(section, name)
Generate typename for a parameter from its {section, name} attributes.
Definition: ncbi_param.hpp:149
@ eParam_NoThread
Do not use per-thread values.
Definition: ncbi_param.hpp:418
int32_t Int4
4-byte (32-bit) signed integer
Definition: ncbitype.h:102
unsigned char Uchar
Alias for unsigned char.
Definition: ncbitype.h:95
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
#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
NCBI_NS_STD::string::size_type SIZE_TYPE
Definition: ncbistr.hpp:132
#define NPOS
Definition: ncbistr.hpp:133
CTempString substr(size_type pos) const
Obtain a substring from this string, beginning at a given offset.
Definition: tempstr.hpp:776
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
size_type size(void) const
Return the length of the represented array.
Definition: tempstr.hpp:327
@ fConvErr_NoThrow
Do not throw an exception on error.
Definition: ncbistr.hpp:285
CMutexGuard TWriteLockGuard
Define Write Lock Guard.
Definition: ncbimtx.hpp:763
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
Definition: ncbitime.hpp:2775
void Start(void)
Start the timer.
Definition: ncbitime.hpp:2764
@ eStart
Start timer immediately after creating.
Definition: ncbitime.hpp:1941
static CStopWatch sw
#define DEBUG
Definition: config.h:32
Definition of all error codes used in SRA C++ support libraries.
FILE * file
static MDB_envinfo info
Definition: mdb_load.c:37
const struct ncbi::grid::netcache::search::fields::SIZE size
const struct ncbi::grid::netcache::search::fields::KEY key
string s_Value(TValue value)
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1227
EIPRangeType t
Definition: ncbi_localip.c:101
void SleepMilliSec(unsigned long ml_sec, EInterruptOnSignal onsignal=eRestartOnSignal)
int isdigit(Uchar c)
Definition: ncbictype.hpp:64
T max(T x_, T y_)
void split(std::vector< std::string > *strVec, const std::string &str_, const std::string &split_)
const CConstRef< CSeq_id > GetAccession(const CSeq_id_Handle &id_handle)
Helper classes and templates to implement plugins.
static bool GetSeqId(const T &d, set< string > &labels, const string name="", bool detect=false, bool found=false)
static const char kFileEnd[]
static size_t sx_ExtractFilterIndex(string &s)
@ eDebug_load_time
@ eDebug_open
@ eDebug_load
@ eDebug_open_time
@ eDebug_data
@ eDebug_resolve
static unsigned GetRetryCountParam(void)
NCBI_PARAM_DEF(unsigned, SNP_LOADER, RETRY_COUNT, 3)
static bool IsSplitEnabled(void)
const int kFilterIndexCount
const int kSNPSatPrimary
static size_t GetGCSize(void)
const int kSNPSubSatGraph
const int kFilterIndexMaxLength
static int GetDebugLevel(void)
static unsigned GetFileRecheckTimeParam(void)
const int kNAVersionMin
static string sx_AddFilterIndex(const string &s, size_t filter_index)
const int kSeqIndexCount
NCBI_PARAM_DECL(int, SNP_LOADER, DEBUG)
const int kSNPSatBase
NCBI_PARAM_DEF_EX(int, SNP_LOADER, DEBUG, 0, eParam_NoThread, SNP_LOADER_DEBUG)
static const char kFilterPrefixChar
const int kNAVersionMax
static unsigned GetFileReopenTimeParam(void)
NCBI_DEFINE_ERR_SUBCODE_X(16)
static string s_GetAccVer(const CSeq_id_Handle &id)
SAnnotSelector –.
#define _ASSERT
Modified on Tue May 28 05:51:45 2024 by modify_doxy.py rev. 669887