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

Go to the SVN repository for this file.

1 /* $Id: blob_splitter_parser.cpp 75781 2016-12-14 20:32:22Z 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:
29 * Application for splitting blobs withing ID1 cache
30 *
31 * ===========================================================================
32 */
33 
34 #include <ncbi_pch.hpp>
37 
38 #include <serial/objostr.hpp>
39 #include <serial/serial.hpp>
40 #include <serial/iterator.hpp>
41 
43 
47 
50 
51 #include <objects/seq/seq__.hpp>
52 
56 
60 
69 #include <objmgr/scope.hpp>
70 #include <objmgr/seq_map.hpp>
71 #include <objmgr/error_codes.hpp>
72 
73 
74 #define NCBI_USE_ERRCODE_X ObjMgr_BlobSplit
75 
77 
79 
81 
82 template<class C>
83 inline
84 C& NonConst(const C& c)
85 {
86  return const_cast<C&>(c);
87 }
88 
89 
90 /////////////////////////////////////////////////////////////////////////////
91 // CBlobSplitterImpl
92 /////////////////////////////////////////////////////////////////////////////
93 
94 
97 
98 
100 {
101  small_annot->clear();
102 
103  if ( src.IsSeq() ) {
104  CopySkeleton(dst.SetSeq(), src.GetSeq());
105  }
106  else {
107  CopySkeleton(dst.SetSet(), src.GetSet());
108  }
109 
110  if ( m_Params.m_Verbose ) {
111  // annot statistics
112  if ( *small_annot ) {
113  NcbiCout << "Small Seq-annots: " << *small_annot << NcbiEndl;
114  }
115  }
116 
117  if ( m_Params.m_Verbose && m_Skeleton == &dst ) {
118  // skeleton statistics
119  s_Sizer->Set(*m_Skeleton, m_Params);
120  CSize size(*s_Sizer);
121  NcbiCout <<
122  "\nSkeleton: " << size << NcbiEndl;
123  }
124 }
125 
126 
128 {
129  switch ( src.Which() ) {
131  return TSeqPos(src.GetIupacna().Get().size());
133  return TSeqPos(src.GetIupacaa().Get().size());
135  return TSeqPos(src.GetNcbi2na().Get().size()*4);
137  return TSeqPos(src.GetNcbi4na().Get().size()*2);
139  return TSeqPos(src.GetNcbi8na().Get().size());
141  return TSeqPos(src.GetNcbi8aa().Get().size());
143  return TSeqPos(src.GetNcbieaa().Get().size());
144  default:
145  NCBI_THROW(CSplitException, eInvalidBlob,
146  "Invalid Seq-data");
147  }
148 }
149 
150 
152 {
153  switch ( src.Which() ) {
155  return src.GetLiteral().GetLength();
156  case CDelta_seq::e_Loc:
157  return src.GetLoc().GetInt().GetLength();
158  default:
159  NCBI_THROW(CSplitException, eInvalidBlob,
160  "Delta-seq is unset");
161  }
162 }
163 
164 
166 {
167  TSeqPos ret = 0;
168  ITERATE ( CDelta_ext::Tdata, it, src.Get() ) {
169  ret += GetLength(**it);
170  }
171  return ret;
172 }
173 
174 
176 {
177  return GetLength(src.GetDelta());
178 }
179 
180 
182 {
183  try {
184  if ( src.IsSetLength() ) {
185  return src.GetLength();
186  }
187  else if ( src.IsSetSeq_data() ) {
188  return GetLength(src.GetSeq_data());
189  }
190  else if ( src.IsSetExt() ) {
191  return GetLength(src.GetExt());
192  }
193  }
194  catch ( CException& exc ) {
195  ERR_POST_X(1, "GetLength(CSeq_inst): exception: " << exc.GetMsg());
196  }
197  return kInvalidSeqPos;
198 }
199 
200 
202 {
203  dst.Reset();
204  const CBioseq::TId& ids = src.GetId();
205  CPlaceId place_id;
206  ITERATE ( CBioseq::TId, it, ids ) {
207  const CSeq_id& id = **it;
209  if ( !place_id.IsBioseq() ||
210  (!place_id.GetBioseqId().IsGi() &&
211  (idh.IsGi() || idh.IsBetter(place_id.GetBioseqId()))) ) {
212  place_id = CPlaceId(idh);
213  }
214  dst.SetId().push_back(Ref(&NonConst(id)));
215  }
216 
217  const CSeq_inst& inst = src.GetInst();
218  TSeqPos seq_length = GetLength(inst);
219 
220  bool need_split_descr;
222  need_split_descr = false;
223  }
224  else {
225  need_split_descr = src.IsSetDescr() && !src.GetDescr().Get().empty();
226  }
227 
228  bool need_split_inst;
230  need_split_inst = false;
231  }
232  else {
233  need_split_inst = false;
234  if ( inst.IsSetSeq_data() && inst.IsSetExt() ) {
235  // both data and ext
236  need_split_inst = false;
237  }
238  else {
239  if ( inst.IsSetSeq_data() ) {
240  need_split_inst = true;
241  }
242  if ( inst.IsSetExt() ) {
243  const CSeq_ext& ext = inst.GetExt();
244  if ( ext.Which() == CSeq_ext::e_Delta ) {
245  need_split_inst = true;
246  // check delta segments' lengths
247  try {
248  if ( seq_length != GetLength(ext) ) {
249  need_split_inst = false;
250  }
251  }
252  catch ( CException& /*exc*/ ) {
253  need_split_inst = false;
254  }
255  }
256  }
257  }
258  }
259 
260  bool need_split_annot;
262  need_split_annot = false;
263  }
264  else {
265  need_split_annot = !src.GetAnnot().empty();
266  }
267 
268  bool need_split = need_split_descr || need_split_inst || need_split_annot;
269  CPlace_SplitInfo* info = 0;
270 
271  if ( need_split ) {
272  if ( !place_id.IsBioseq() ) {
273  ERR_POST_X(2, "Bioseq doesn't have Seq-id");
274  }
275  else {
276  info = &m_Entries[place_id];
277 
278  if ( info->m_PlaceId.IsBioseq() ) {
279  ERR_POST_X(3, "Several Bioseqs with the same id: " <<
280  place_id.GetBioseqId().AsString());
281  info = 0;
282  }
283  else {
284  _ASSERT(info->m_PlaceId.IsNull());
285  _ASSERT(!info->m_Bioseq);
286  _ASSERT(!info->m_Bioseq_set);
287  info->m_PlaceId = place_id;
288  info->m_Bioseq.Reset(&dst);
289  }
290  }
291 
292  if ( !info ) {
293  need_split_descr = need_split_inst = need_split_annot = false;
294  }
295  }
296 
297  if ( need_split_descr ) {
298  if ( !CopyDescr(*info, seq_length, src.GetDescr()) ) {
299  dst.SetDescr().Set() = src.GetDescr().Get();
300  }
301  }
302  else {
303  if ( src.IsSetDescr() ) {
304  dst.SetDescr().Set() = src.GetDescr().Get();
305  }
306  }
307 
308  if ( need_split_inst ) {
309  CopySequence(*info, seq_length, dst.SetInst(), inst);
310  }
311  else {
312  dst.SetInst(NonConst(inst));
313  }
314 
315  if ( need_split_annot ) {
316  ITERATE ( CBioseq::TAnnot, it, src.GetAnnot() ) {
317  if ( !CopyAnnot(*info, **it) ) {
318  dst.SetAnnot().push_back(*it);
319  }
320  }
321  }
322 }
323 
324 
326 {
327  dst.Reset();
328  CPlaceId place_id;
329  if ( src.IsSetId() ) {
330  dst.SetId(NonConst(src.GetId()));
331  if ( src.GetId().IsId() ) {
332  place_id = CPlaceId(src.GetId().GetId());
333  }
334  }
335  else {
336  int id = m_NextBioseq_set_Id++;
337  dst.SetId().SetId(id);
338  place_id = CPlaceId(id);
339  }
340  if ( src.IsSetColl() ) {
341  dst.SetColl(NonConst(src.GetColl()));
342  }
343  if ( src.IsSetLevel() ) {
344  dst.SetLevel(src.GetLevel());
345  }
346  if ( src.IsSetClass() ) {
347  dst.SetClass(src.GetClass());
348  }
349  if ( src.IsSetRelease() ) {
350  dst.SetRelease(src.GetRelease());
351  }
352  if ( src.IsSetDate() ) {
353  dst.SetDate(NonConst(src.GetDate()));
354  }
355 
356  // Try to split all descriptors, the most important of them will get
357  // skeleton priority anyway.
358  bool need_split_descr = !m_Params.m_DisableSplitDescriptions
359  && src.IsSetDescr();
360 
361  bool need_split_annot;
363  need_split_annot = false;
364  }
365  else {
366  need_split_annot = !src.GetAnnot().empty();
367  }
368 
369  bool need_split_bioseq = false;
372  const CSeq_entry& entry = **it;
373  if ( entry.Which() == CSeq_entry::e_Seq ) {
374  const CBioseq& bioseq = entry.GetSeq();
375  if ( CanSplitBioseq(bioseq) ) {
376  need_split_bioseq = true;
377  break;
378  }
379  }
380  // cannot split bioseqs before unsplit entry (seq or set)
381  break;
382  }
383  }
384 
385  bool need_split =need_split_descr || need_split_annot || need_split_bioseq;
386  CPlace_SplitInfo* info = 0;
387 
388  if ( need_split ) {
389  if ( !place_id.IsBioseq_set() ) {
390  ERR_POST_X(4, "Bioseq_set doesn't have integer id");
391  }
392  else {
393  info = &m_Entries[place_id];
394  if ( info->m_PlaceId.IsBioseq_set() ) {
395  ERR_POST_X(5, "Several Bioseq-sets with the same id: " <<
396  place_id.GetBioseq_setId());
397  info = 0;
398  }
399  else {
400  _ASSERT(info->m_PlaceId.IsNull());
401  _ASSERT(!info->m_Bioseq);
402  _ASSERT(!info->m_Bioseq_set);
403  info->m_PlaceId = place_id;
404  info->m_Bioseq_set.Reset(&dst);
405  }
406  }
407 
408  if ( !info ) {
409  need_split_descr = need_split_annot = need_split_bioseq = 0;
410  }
411  }
412 
413 
414  if ( need_split_descr ) {
415  if ( !CopyDescr(*info, kInvalidSeqPos, src.GetDescr()) ) {
416  dst.SetDescr().Set() = src.GetDescr().Get();
417  }
418  }
419  else {
420  if ( src.IsSetDescr() ) {
421  dst.SetDescr().Set() = src.GetDescr().Get();
422  }
423  }
424 
425  if ( need_split_annot ) {
426  ITERATE ( CBioseq_set::TAnnot, it, src.GetAnnot() ) {
427  if ( !CopyAnnot(*info, **it) ) {
428  dst.SetAnnot().push_back(*it);
429  }
430  }
431  }
432 
433  dst.SetSeq_set();
434  {{
435  auto& seq_set = src.GetSeq_set();
436  auto begin = seq_set.begin();
437  auto end = seq_set.end();
438  if ( need_split_bioseq ) {
439  // extract split bioseqs starting from end
440  // remember start of split bioseqs
441  size_t old_size = info->m_Bioseqs.size();
442  while ( begin != end ) {
443  auto it = prev(end);
444  const CSeq_entry& entry = **it;
445  if ( entry.Which() == CSeq_entry::e_Seq ) {
446  const CBioseq& seq = entry.GetSeq();
447  if ( SplitBioseq(*info, seq) ) {
448  end = it;
449  continue;
450  }
451  }
452  break;
453  }
454  // reverse split entries as they were added in backward order
455  reverse(info->m_Bioseqs.begin()+old_size, info->m_Bioseqs.end());
456  }
457  // add remaining entries to skeleton
458  while ( begin != end ) {
459  dst.SetSeq_set().push_back(Ref(new CSeq_entry));
460  CopySkeleton(*dst.SetSeq_set().back(), **begin++);
461  }
462  }}
463 
464  if ( src.IsSetClass() &&
466  !src.GetSeq_set().empty() ) {
467  CConstRef<CSeq_entry> first = src.GetSeq_set().front();
468  if ( first->IsSeq() ) {
470  CBioseq_Handle bh = m_Scope->GetBioseqHandle(first->GetSeq());
472  ITERATE ( CBioseq_set::TSeq_set, it, src.GetSeq_set() ) {
473  if ( *it != first && (*it)->IsSeq() ) {
474  m_Master->AddSegmentIds((*it)->GetSeq().GetId());
475  }
476  }
477  }
478  }
479 }
480 
481 
483  TSeqPos seq_length,
484  const CSeq_descr& descr)
485 {
486  _ASSERT(!place_info.m_Descr);
487  place_info.m_Descr = new CSeq_descr_SplitInfo(place_info.m_PlaceId,
488  seq_length,
489  descr, m_Params);
490  if ( !place_info.m_Bioseq ) {
491  // try not to split descriptors of Bioseq-sets
493  }
494  if ( seq_length != kInvalidSeqPos && seq_length > 100000 ) {
495  // try not to split descriptors of very long sequences
497  }
498  return true;
499 }
500 
501 
503  const CSeq_hist& hist)
504 {
506  return false;
507  }
508  _ASSERT( place_info.m_Bioseq );
509  _ASSERT(!place_info.m_Hist);
510  // Split history with big assembly only
511  if ( !hist.IsSetAssembly() ) {
512  return false;
513  }
514  place_info.m_Hist = new CSeq_hist_SplitInfo(place_info.m_PlaceId,
515  hist, m_Params);
516  if (place_info.m_Hist->m_Size.GetZipSize() < m_Params.m_MinChunkSize) {
517  place_info.m_Hist.Reset();
518  return false;
519  }
520  return true;
521 }
522 
523 
525  TSeqPos seq_length,
526  CSeq_inst& dst,
527  const CSeq_inst& src)
528 {
529  if ( !place_info.m_Bioseq ) {
530  // we will not split descriptors of Bioseq-sets
531  return false;
532  }
533  _ASSERT(!place_info.m_Inst);
534  place_info.m_Inst.Reset(new CSeq_inst_SplitInfo);
535  CSeq_inst_SplitInfo& info = *place_info.m_Inst;
536  info.m_Seq_inst.Reset(&src);
537 
538  dst.SetRepr(src.GetRepr());
539  dst.SetMol(src.GetMol());
540 
541  if ( seq_length != kInvalidSeqPos )
542  dst.SetLength(seq_length);
543  if ( src.IsSetFuzz() )
544  dst.SetFuzz(const_cast<CInt_fuzz&>(src.GetFuzz()));
545  if ( src.IsSetTopology() )
546  dst.SetTopology(src.GetTopology());
547  if ( src.IsSetStrand() )
548  dst.SetStrand(src.GetStrand());
549  if ( src.IsSetHist() ) {
550  if ( !CopyHist(place_info, src.GetHist()) ) {
551  dst.SetHist(const_cast<CSeq_hist&>(src.GetHist()));
552  }
553  else {
554  // Create history, but do not create assembly
555  dst.SetHist();
556  if ( src.GetHist().IsSetReplaces() ) {
557  dst.SetHist().SetReplaces(const_cast<CSeq_hist_rec&>(
558  src.GetHist().GetReplaces()));
559  }
560  if ( src.GetHist().IsSetReplaced_by() ) {
561  dst.SetHist().SetReplaced_by(const_cast<CSeq_hist_rec&>(
562  src.GetHist().GetReplaced_by()));
563  }
564  if ( src.GetHist().IsSetDeleted() ) {
565  dst.SetHist().SetDeleted(const_cast<CSeq_hist::TDeleted&>(
566  src.GetHist().GetDeleted()));
567  }
568  }
569  }
570 
571  if ( src.IsSetSeq_data() ) {
574  range.SetFrom(0).SetLength(seq_length);
575  data.SetSeq_data(place_info.m_PlaceId, range, seq_length,
576  src.GetSeq_data(), m_Params);
577  info.Add(data);
578  }
579  else {
580  if ( !src.IsSetExt() ) {
581  return false;
582  }
583  _ASSERT(src.IsSetExt());
584  const CSeq_ext& src_ext = src.GetExt();
585  _ASSERT(src_ext.Which() == CSeq_ext::e_Delta);
586  const CDelta_ext& src_delta = src_ext.GetDelta();
587  CDelta_ext& dst_delta = dst.SetExt().SetDelta();
588  TSeqPos pos = 0;
589  ITERATE ( CDelta_ext::Tdata, it, src_delta.Get() ) {
590  const CDelta_seq& src_seq = **it;
591  TSeqPos length = GetLength(src_seq);
592  CRef<CDelta_seq> new_seq;
593  switch ( src_seq.Which() ) {
594  case CDelta_seq::e_Loc:
595  new_seq = *it;
596  break;
598  {{
599  const CSeq_literal& src_lit = src_seq.GetLiteral();
600  new_seq.Reset(new CDelta_seq);
601  CSeq_literal& dst_lit = new_seq->SetLiteral();
602  dst_lit.SetLength(length);
603  if ( src_lit.IsSetFuzz() )
604  dst_lit.SetFuzz(const_cast<CInt_fuzz&>(src_lit.GetFuzz()));
605  if ( src_lit.IsSetSeq_data() ) {
606  const CSeq_data& src_data = src_lit.GetSeq_data();
607  if ( src_data.IsGap() ) {
608  dst_lit.SetSeq_data(const_cast<CSeq_data&>(src_data));
609  }
610  else {
613  range.SetFrom(pos).SetLength(length);
614  data.SetSeq_data(place_info.m_PlaceId,
615  range, seq_length,
616  src_data, m_Params);
617  info.Add(data);
618  }
619  }
620  break;
621  }}
622  default:
623  new_seq.Reset(new CDelta_seq);
624  break;
625  }
626  dst_delta.Set().push_back(new_seq);
627  pos += length;
628  }
629  }
630  return false;
631 }
632 
633 
635  const CSeq_annot& annot)
636 {
638  return false;
639  }
640 
641  switch ( annot.GetData().Which() ) {
645  break;
649  break;
650  }
651  // splitting non-feature Seq-tables is disabled
652  return false;
653  default:
654  // we don't split other types of Seq-annot
655  return false;
656  }
657 
658  CSeq_annot_SplitInfo& info = place_info.m_Annots[ConstRef(&annot)];
659  info.SetSeq_annot(annot, m_Params, *this);
660 
661  if ( info.m_Size.GetAsnSize() > 1024 ) {
662  if ( m_Params.m_Verbose ) {
663  NcbiCout << info;
664  }
665  }
666  else {
667  *small_annot += info.m_Size;
668  }
669 
670  return true;
671 }
672 
673 
674 // quick check if Bioseq is suitable for whole splitting
676 {
677  return GetLength(seq.GetInst()) < m_Params.m_ChunkSize*2 &&
678  seq.GetId().size() <= 4;
679 }
680 
681 
683  const CBioseq& seq)
684 {
685  _ASSERT(place_info.m_Bioseq_set);
686  if ( !CanSplitBioseq(seq) ) {
687  return false;
688  }
689  const CBioseq::TId& ids = seq.GetId();
690 
691  for ( CTypeConstIterator<CSeq_id> i(ConstBegin(seq)); i; ++i ) {
692  bool same_id = false;
693  ITERATE ( CBioseq::TId, j, ids ) {
694  if ( i->Equals(**j) ) {
695  same_id = true;
696  break;
697  }
698  }
699  if ( !same_id ) {
700  // extra Seq-id in Bioseq
701  return false;
702  }
703  }
704  // check compressed size also
706  if ( info.m_Size.GetZipSize() > m_Params.m_ChunkSize ) {
707  // too big
708  return false;
709  }
710 
711  // ok, split it
712  place_info.m_Bioseqs.push_back(info);
713 
714  return true;
715 }
716 
717 
719 {
720  size_t count = 0;
721  for ( CTypeConstIterator<CSeq_annot> it(ConstBegin(entry)); it; ++it ) {
723  }
724  return count;
725 }
726 
727 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
static CSafeStatic< CSize > small_annot
static CSafeStatic< CAsnSizer > s_Sizer
C & NonConst(const C &c)
NCBI_DEFINE_ERR_SUBCODE_X(12)
CBioseq_Handle –.
CRef< CMasterSeqSegments > m_Master
static size_t CountAnnotObjects(const CSeq_annot &annot)
bool CopyHist(CPlace_SplitInfo &place_info, const CSeq_hist &hist)
SSplitterParams m_Params
bool CopyAnnot(CPlace_SplitInfo &place_info, const CSeq_annot &annot)
TSeqPos GetLength(const CSeq_data &src) const
bool CopySequence(CPlace_SplitInfo &place_info, TSeqPos seq_length, CSeq_inst &dst, const CSeq_inst &src)
bool CopyDescr(CPlace_SplitInfo &place_info, TSeqPos seq_length, const CSeq_descr &descr)
CRef< CSeq_entry > m_Skeleton
bool CanSplitBioseq(const CBioseq &bioseq) const
bool SplitBioseq(CPlace_SplitInfo &place_info, const CBioseq &bioseq)
void CopySkeleton(CSeq_entry &dst, const CSeq_entry &src)
CDelta_seq –.
Definition: Delta_seq.hpp:66
void AddSegments(const CSeqMap &seq)
void AddSegmentIds(int idx, const TIds &ids)
bool IsBioseq_set(void) const
Definition: place_id.hpp:71
bool IsBioseq(void) const
Definition: place_id.hpp:67
TBioseq_setId GetBioseq_setId(void) const
Definition: place_id.hpp:81
const TBioseqId & GetBioseqId(void) const
Definition: place_id.hpp:76
CRef< CSeq_inst_SplitInfo > m_Inst
CRef< CSeq_descr_SplitInfo > m_Descr
CRef< CBioseq > m_Bioseq
CRef< CSeq_hist_SplitInfo > m_Hist
CRef< CBioseq_set > m_Bioseq_set
CRef –.
Definition: ncbiobj.hpp:618
CSafeStatic<>::
static bool IsGoodFeatTable(const CSeq_table &table)
static size_t CountAnnotObjects(const CSeq_annot &annot)
@Seq_descr.hpp User-defined methods of the data storage class.
Definition: Seq_descr.hpp:55
Definition: Seq_entry.hpp:56
CSeq_ext –.
Definition: Seq_ext.hpp:66
C_Deleted –.
Definition: Seq_hist_.hpp:100
CSeq_hist_rec –.
CSeq_hist –.
Definition: Seq_hist.hpp:66
TSeqPos GetLength(void) const
Definition: size.hpp:46
TDataSize GetZipSize(void) const
Definition: size.hpp:94
Template class for iteration on objects of class C (non-medifiable version)
Definition: iterator.hpp:767
#define C(s)
Definition: common.h:231
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
Definition: dlist.tmpl.h:46
static DLIST_TYPE *DLIST_NAME() prev(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
Definition: dlist.tmpl.h:61
char data[12]
Definition: iconv.c:80
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
const TSeqPos kInvalidSeqPos
Define special value for invalid sequence position.
Definition: ncbimisc.hpp:878
#define REVERSE_ITERATE(Type, Var, Cont)
ITERATE macro to reverse sequence through container elements.
Definition: ncbimisc.hpp:827
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
Definition: ncbidiag.hpp:550
#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
const string & GetMsg(void) const
Get message string.
Definition: ncbiexpt.cpp:461
const TPrim & Get(void) const
Definition: serialbase.hpp:347
bool IsGi(void) const
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
string AsString(void) const
bool IsBetter(const CSeq_id_Handle &h) const
True if "this" is a better bioseq than "h".
CConstBeginInfo ConstBegin(const C &obj)
Get starting point of non-modifiable object hierarchy.
Definition: iterator.hpp:1012
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
Definition: scope.cpp:95
const CSeqMap & GetSeqMap(void) const
Get sequence map.
CConstRef< C > ConstRef(const C *object)
Template function for conversion of const object pointer to CConstRef.
Definition: ncbiobj.hpp:2024
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
Definition: ncbiobj.hpp:2015
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
#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
#define NcbiEndl
Definition: ncbistre.hpp:548
#define NcbiCout
Definition: ncbistre.hpp:543
bool IsId(void) const
Check if variant Id is selected.
Definition: Object_id_.hpp:264
TId GetId(void) const
Get the variant data.
Definition: Object_id_.hpp:270
const TInt & GetInt(void) const
Get the variant data.
Definition: Seq_loc_.cpp:194
const TSeq & GetSeq(void) const
Get the variant data.
Definition: Seq_entry_.cpp:102
bool IsSetClass(void) const
Check if a value has been assigned to Class data member.
void SetRelease(const TRelease &value)
Assign a value to Release data member.
const TDescr & GetDescr(void) const
Get the Descr member data.
TSet & SetSet(void)
Select the variant.
Definition: Seq_entry_.cpp:130
bool IsSetColl(void) const
to identify a collection Check if a value has been assigned to Coll data member.
TClass GetClass(void) const
Get the Class member data.
bool IsSetDate(void) const
Check if a value has been assigned to Date data member.
bool IsSetRelease(void) const
Check if a value has been assigned to Release data member.
TAnnot & SetAnnot(void)
Assign a value to Annot data member.
const TSet & GetSet(void) const
Get the variant data.
Definition: Seq_entry_.cpp:124
bool IsSeq(void) const
Check if variant Seq is selected.
Definition: Seq_entry_.hpp:257
void SetId(TId &value)
Assign a value to Id data member.
Definition: Bioseq_set_.cpp:93
bool IsSetId(void) const
Check if a value has been assigned to Id data member.
void SetLevel(TLevel value)
Assign a value to Level data member.
const TRelease & GetRelease(void) const
Get the Release member data.
bool IsSetLevel(void) const
nesting level Check if a value has been assigned to Level data member.
bool IsSetDescr(void) const
Check if a value has been assigned to Descr data member.
E_Choice Which(void) const
Which variant is currently selected.
Definition: Seq_entry_.hpp:228
const TDate & GetDate(void) const
Get the Date member data.
list< CRef< CSeq_annot > > TAnnot
void SetDate(TDate &value)
Assign a value to Date data member.
const TSeq_set & GetSeq_set(void) const
Get the Seq_set member data.
void SetClass(TClass value)
Assign a value to Class data member.
const TAnnot & GetAnnot(void) const
Get the Annot member data.
void SetColl(TColl &value)
Assign a value to Coll data member.
void SetDescr(TDescr &value)
Assign a value to Descr data member.
const TColl & GetColl(void) const
Get the Coll member data.
virtual void Reset(void)
Reset the whole object.
list< CRef< CSeq_entry > > TSeq_set
TSeq & SetSeq(void)
Select the variant.
Definition: Seq_entry_.cpp:108
TSeq_set & SetSeq_set(void)
Assign a value to Seq_set data member.
const TId & GetId(void) const
Get the Id member data.
TLevel GetLevel(void) const
Get the Level member data.
@ eClass_segset
segmented sequence + parts
const TIupacaa & GetIupacaa(void) const
Get the variant data.
Definition: Seq_data_.hpp:530
TRepr GetRepr(void) const
Get the Repr member data.
Definition: Seq_inst_.hpp:565
void SetLength(TLength value)
Assign a value to Length data member.
bool IsSetDeleted(void) const
Check if a value has been assigned to Deleted data member.
Definition: Seq_hist_.hpp:567
TId & SetId(void)
Assign a value to Id data member.
Definition: Bioseq_.hpp:296
bool IsSetReplaced_by(void) const
these seqs make this one obsolete Check if a value has been assigned to Replaced_by data member.
Definition: Seq_hist_.hpp:546
bool IsSetSeq_data(void) const
the sequence Check if a value has been assigned to Seq_data data member.
Definition: Seq_inst_.hpp:805
TStrand GetStrand(void) const
Get the Strand member data.
Definition: Seq_inst_.hpp:777
const TInst & GetInst(void) const
Get the Inst member data.
Definition: Bioseq_.hpp:336
void SetSeq_data(TSeq_data &value)
Assign a value to Seq_data data member.
bool IsSetAssembly(void) const
how was this assembled? Check if a value has been assigned to Assembly data member.
Definition: Seq_hist_.hpp:500
const TDeleted & GetDeleted(void) const
Get the Deleted member data.
Definition: Seq_hist_.hpp:579
TTopology GetTopology(void) const
Get the Topology member data.
Definition: Seq_inst_.hpp:733
const TIupacna & GetIupacna(void) const
Get the variant data.
Definition: Seq_data_.hpp:510
void SetExt(TExt &value)
Assign a value to Ext data member.
Definition: Seq_inst_.cpp:147
void SetHist(THist &value)
Assign a value to Hist data member.
Definition: Seq_inst_.cpp:164
const TFuzz & GetFuzz(void) const
Get the Fuzz member data.
Definition: Seq_inst_.hpp:699
bool IsSetStrand(void) const
Check if a value has been assigned to Strand data member.
Definition: Seq_inst_.hpp:758
const TNcbi8aa & GetNcbi8aa(void) const
Get the variant data.
Definition: Seq_data_.hpp:630
const TLiteral & GetLiteral(void) const
Get the variant data.
Definition: Delta_seq_.cpp:124
TAnnot & SetAnnot(void)
Assign a value to Annot data member.
Definition: Bioseq_.hpp:372
const TAnnot & GetAnnot(void) const
Get the Annot member data.
Definition: Bioseq_.hpp:366
const TId & GetId(void) const
Get the Id member data.
Definition: Bioseq_.hpp:290
bool IsSetHist(void) const
sequence history Check if a value has been assigned to Hist data member.
Definition: Seq_inst_.hpp:847
bool IsSetExt(void) const
extensions for special types Check if a value has been assigned to Ext data member.
Definition: Seq_inst_.hpp:826
const Tdata & Get(void) const
Get the member data.
Definition: Seq_descr_.hpp:166
bool IsSetReplaces(void) const
seq makes these seqs obsolete Check if a value has been assigned to Replaces data member.
Definition: Seq_hist_.hpp:525
Tdata & Set(void)
Assign a value to data member.
Definition: Delta_ext_.hpp:170
TLength GetLength(void) const
Get the Length member data.
Definition: Seq_inst_.hpp:659
TLength GetLength(void) const
Get the Length member data.
list< CRef< CSeq_id > > TId
Definition: Bioseq_.hpp:94
const TFuzz & GetFuzz(void) const
Get the Fuzz member data.
TMol GetMol(void) const
Get the Mol member data.
Definition: Seq_inst_.hpp:612
const TNcbieaa & GetNcbieaa(void) const
Get the variant data.
Definition: Seq_data_.hpp:650
bool IsSetFuzz(void) const
could be unsure Check if a value has been assigned to Fuzz data member.
void SetFuzz(TFuzz &value)
Assign a value to Fuzz data member.
void SetInst(TInst &value)
Assign a value to Inst data member.
Definition: Bioseq_.cpp:86
bool IsSetLength(void) const
length of sequence in residues Check if a value has been assigned to Length data member.
Definition: Seq_inst_.hpp:640
const THist & GetHist(void) const
Get the Hist member data.
Definition: Seq_inst_.hpp:859
virtual void Reset(void)
Reset the whole object.
Definition: Bioseq_.cpp:97
const TExt & GetExt(void) const
Get the Ext member data.
Definition: Seq_inst_.hpp:838
E_Choice Which(void) const
Which variant is currently selected.
Definition: Delta_seq_.hpp:228
bool IsSetDescr(void) const
descriptors Check if a value has been assigned to Descr data member.
Definition: Bioseq_.hpp:303
void SetTopology(TTopology value)
Assign a value to Topology data member.
Definition: Seq_inst_.hpp:739
const TSeq_table & GetSeq_table(void) const
Get the variant data.
Definition: Seq_annot_.cpp:153
void SetDescr(TDescr &value)
Assign a value to Descr data member.
Definition: Bioseq_.cpp:65
E_Choice Which(void) const
Which variant is currently selected.
Definition: Seq_ext_.hpp:289
const TDelta & GetDelta(void) const
Get the variant data.
Definition: Seq_ext_.cpp:180
const TNcbi4na & GetNcbi4na(void) const
Get the variant data.
Definition: Seq_data_.hpp:570
const TLoc & GetLoc(void) const
Get the variant data.
Definition: Delta_seq_.cpp:102
void SetRepr(TRepr value)
Assign a value to Repr data member.
Definition: Seq_inst_.hpp:574
const TNcbi2na & GetNcbi2na(void) const
Get the variant data.
Definition: Seq_data_.hpp:550
const Tdata & Get(void) const
Get the member data.
Definition: Delta_ext_.hpp:164
const TData & GetData(void) const
Get the Data member data.
Definition: Seq_annot_.hpp:873
void SetFuzz(TFuzz &value)
Assign a value to Fuzz data member.
Definition: Seq_inst_.cpp:113
list< CRef< CSeq_annot > > TAnnot
Definition: Bioseq_.hpp:97
bool IsSetSeq_data(void) const
may have the data Check if a value has been assigned to Seq_data data member.
void SetLength(TLength value)
Assign a value to Length data member.
Definition: Seq_inst_.hpp:668
list< CRef< CDelta_seq > > Tdata
Definition: Delta_ext_.hpp:89
const TReplaces & GetReplaces(void) const
Get the Replaces member data.
Definition: Seq_hist_.hpp:537
void SetStrand(TStrand value)
Assign a value to Strand data member.
Definition: Seq_inst_.hpp:786
bool IsGap(void) const
Check if variant Gap is selected.
Definition: Seq_data_.hpp:704
const TSeq_data & GetSeq_data(void) const
Get the Seq_data member data.
Definition: Seq_inst_.hpp:817
const TReplaced_by & GetReplaced_by(void) const
Get the Replaced_by member data.
Definition: Seq_hist_.hpp:558
const TNcbi8na & GetNcbi8na(void) const
Get the variant data.
Definition: Seq_data_.hpp:590
const TDescr & GetDescr(void) const
Get the Descr member data.
Definition: Bioseq_.hpp:315
const TSeq_data & GetSeq_data(void) const
Get the Seq_data member data.
E_Choice Which(void) const
Which variant is currently selected.
Definition: Seq_annot_.hpp:586
void SetMol(TMol value)
Assign a value to Mol data member.
Definition: Seq_inst_.hpp:621
bool IsSetTopology(void) const
Check if a value has been assigned to Topology data member.
Definition: Seq_inst_.hpp:708
bool IsSetFuzz(void) const
length uncertainty Check if a value has been assigned to Fuzz data member.
Definition: Seq_inst_.hpp:687
E_Choice Which(void) const
Which variant is currently selected.
Definition: Seq_data_.hpp:475
@ e_Ncbieaa
extended ASCII 1 letter aa codes
Definition: Seq_data_.hpp:111
@ e_Ncbi2na
2 bit nucleic acid code
Definition: Seq_data_.hpp:106
@ e_Iupacna
IUPAC 1 letter nuc acid code.
Definition: Seq_data_.hpp:104
@ e_Ncbi8na
8 bit extended nucleic acid code
Definition: Seq_data_.hpp:108
@ e_Ncbi4na
4 bit nucleic acid code
Definition: Seq_data_.hpp:107
@ e_Iupacaa
IUPAC 1 letter amino acid code.
Definition: Seq_data_.hpp:105
@ e_Ncbi8aa
8 bit extended amino acid codes
Definition: Seq_data_.hpp:110
@ e_Literal
a piece of sequence
Definition: Delta_seq_.hpp:90
@ e_Loc
point to a sequence
Definition: Delta_seq_.hpp:89
Definition of all error codes used in objmgr libraries (xobjmgr.lib, xobjutil.lib and others).
int i
static MDB_envinfo info
Definition: mdb_load.c:37
range(_Ty, _Ty) -> range< _Ty >
const struct ncbi::grid::netcache::search::fields::SIZE size
@ eAnnotPriority_skeleton
#define _ASSERT
Modified on Wed May 01 14:19:42 2024 by modify_doxy.py rev. 669887