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

Go to the SVN repository for this file.

1 /* $Id: seq_map.cpp 102039 2024-03-21 14:36:08Z 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 * Authors: Aleksey Grichenko, Michael Kimelman, Eugene Vasilchenko,
27 * Andrei Gourianov
28 *
29 * File Description:
30 * Sequence map for the Object Manager. Describes sequence as a set of
31 * segments of different types (data, reference, gap or end).
32 *
33 */
34 
35 #include <ncbi_pch.hpp>
36 #include <objmgr/seq_map.hpp>
37 #include <objmgr/seq_map_ci.hpp>
38 #include <objmgr/scope.hpp>
39 #include <objmgr/bioseq_handle.hpp>
44 
45 #include <objects/seq/Bioseq.hpp>
46 #include <objects/seq/Seq_data.hpp>
47 #include <objects/seq/Seq_inst.hpp>
51 #include <objects/seq/Seq_ext.hpp>
52 #include <objects/seq/Seg_ext.hpp>
53 #include <objects/seq/Ref_ext.hpp>
54 
62 
63 #include <algorithm>
64 
67 
68 ////////////////////////////////////////////////////////////////////
69 // CSeqMap::CSegment
70 
71 inline
73  TSeqPos length,
74  bool unknown_len)
75  : m_Position(kInvalidSeqPos),
76  m_Length(length),
77  m_UnknownLength(unknown_len),
78  m_SegType(seg_type),
79  m_ObjType(seg_type),
80  m_RefMinusStrand(false),
81  m_RefPosition(0)
82 {
83 }
84 
85 
86 inline
88  : m_Position(seg.m_Position.load()),
89  m_Length(seg.m_Length.load()),
90  m_UnknownLength(seg.m_UnknownLength),
91  m_SegType(seg.m_SegType),
92  m_ObjType(seg.m_ObjType),
93  m_RefMinusStrand(seg.m_RefMinusStrand),
94  m_RefPosition(seg.m_RefPosition),
95  m_RefObject(seg.m_RefObject)
96 {
97 }
98 
99 
100 inline
102 {
103  m_Position = seg.m_Position.load();
104  m_Length = seg.m_Length.load();
105  m_UnknownLength = seg.m_UnknownLength;
106  m_SegType = seg.m_SegType;
107  m_ObjType = seg.m_ObjType;
108  m_RefMinusStrand = seg.m_RefMinusStrand;
109  m_RefPosition = seg.m_RefPosition;
110  m_RefObject = seg.m_RefObject;
111  return *this;
112 }
113 
114 
115 ////////////////////////////////////////////////////////////////////
116 // CSeqMap
117 
118 
120  : m_Bioseq(0),
121  m_Resolved(0),
122  m_Mol(CSeq_inst::eMol_not_set),
123  m_HasSegments(0),
124  m_Changed(false),
126 {
127 }
128 
129 
130 CSeqMap::CSeqMap(CSeqMap* /*parent*/, size_t /*index*/)
131  : m_Bioseq(0),
132  m_Resolved(0),
133  m_Mol(CSeq_inst::eMol_not_set),
134  m_HasSegments(0),
135  m_Changed(false),
136  m_SeqLength(kInvalidSeqPos)
137 {
138 }
139 
140 
142  : m_Bioseq(0),
143  m_Resolved(0),
144  m_Mol(CSeq_inst::eMol_not_set),
145  m_HasSegments(0),
146  m_Changed(false),
147  m_SeqLength(kInvalidSeqPos)
148 {
149  x_AddEnd();
150  x_Add(ref);
151  x_AddEnd();
152 }
153 
154 /*
155 CSeqMap::CSeqMap(const CSeq_data& data, TSeqPos length)
156  : m_Resolved(0),
157  m_Mol(CSeq_inst::eMol_not_set),
158  m_HasSegments(0),
159  m_Changed(false),
160  m_SeqLength(kInvalidSeqPos)
161 {
162  x_AddEnd();
163  x_Add(data, length);
164  x_AddEnd();
165 }
166 */
167 
169  : m_Bioseq(0),
170  m_Resolved(0),
171  m_Mol(CSeq_inst::eMol_not_set),
172  m_HasSegments(0),
173  m_Changed(false),
174  m_SeqLength(length)
175 {
176  x_AddEnd();
177  x_AddGap(length, false);
178  x_AddEnd();
179 }
180 
181 
183  : m_Bioseq(0),
184  m_Segments(sm.m_Segments),
185  m_Resolved(sm.m_Resolved.load()),
186  m_Delta(sm.m_Delta),
187  m_Mol(sm.m_Mol),
188  m_HasSegments(sm.m_HasSegments.load()),
189  m_Changed(sm.m_Changed),
190  m_SeqLength(sm.m_SeqLength.load())
191 {
193  if ( it->m_ObjType == eSeqChunk ) {
194  it->m_SegType = eSeqGap;
195  it->m_ObjType = eSeqGap;
196  it->m_RefObject = null;
197  }
198  }
199 }
200 
201 
203  : m_Bioseq(0),
204  m_Resolved(0),
205  m_Mol(CSeq_inst::eMol_not_set),
206  m_HasSegments(0),
207  m_Changed(false),
208  m_SeqLength(kInvalidSeqPos)
209 {
210  x_AddEnd();
211 
212  if ( inst.IsSetMol() ) {
213  m_Mol = inst.GetMol();
214  }
215  if ( inst.IsSetLength() ) {
216  m_SeqLength = inst.GetLength();
217  }
218 
219  if ( inst.IsSetSeq_data() ) {
220  if ( !inst.GetSeq_data().IsGap() ) {
221  x_Add(inst.GetSeq_data(), inst.GetLength());
222  }
223  else {
224  // split Seq-data
225  x_AddGap(inst.GetLength(), false, inst.GetSeq_data());
226  }
227  }
228  else if ( inst.IsSetExt() ) {
229  const CSeq_ext& ext = inst.GetExt();
230  switch (ext.Which()) {
231  case CSeq_ext::e_Seg:
232  ITERATE ( CSeq_ext::TSeg::Tdata, iter, ext.GetSeg().Get() ) {
233  x_Add(**iter);
234  }
235  break;
236  case CSeq_ext::e_Ref:
237  x_Add(ext.GetRef());
238  break;
239  case CSeq_ext::e_Delta:
240  ITERATE ( CSeq_ext::TDelta::Tdata, iter, ext.GetDelta().Get() ) {
241  x_Add(**iter);
242  }
243  break;
244  case CSeq_ext::e_Map:
245  if ( m_SeqLength == kInvalidSeqPos ) {
246  NCBI_THROW(CSeqMapException, eDataError,
247  "CSeq_inst.ext.map with unset CSeq_inst.length");
248  }
249  x_AddGap(m_SeqLength, false);
250  break;
251  default:
252  //### Not implemented
253  NCBI_THROW(CSeqMapException, eUnimplemented,
254  "CSeq_ext::??? -- not implemented");
255  }
256  }
257  else if ( inst.GetRepr() == CSeq_inst::eRepr_virtual ) {
258  // Virtual sequence -- no data, no segments
259  // The total sequence is gap
260  if ( m_SeqLength == kInvalidSeqPos ) {
261  m_SeqLength = 0;
262  }
263  x_AddGap(m_SeqLength, false);
264  }
265  else if ( inst.GetRepr() == CSeq_inst::eRepr_map ) {
266  // Virtual map sequence -- no data, no segments
267  // The total sequence is gap
268  if ( m_SeqLength == kInvalidSeqPos ) {
269  NCBI_THROW(CSeqMapException, eDataError,
270  "CSeq_inst.repr map with unset CSeq_inst.length");
271  }
272  x_AddGap(m_SeqLength, false);
273  }
274  else if ( inst.GetRepr() != CSeq_inst::eRepr_not_set &&
275  inst.IsSetLength() && inst.GetLength() != 0 ) {
276  // split seq-data
277  x_AddGap(inst.GetLength(), false);
278  }
279  else {
280  if ( inst.GetRepr() != CSeq_inst::eRepr_not_set ) {
281  NCBI_THROW(CSeqMapException, eDataError,
282  "CSeq_inst.repr of sequence without data "
283  "should be not_set");
284  }
285  if ( inst.IsSetLength() && inst.GetLength() != 0 ) {
286  NCBI_THROW(CSeqMapException, eDataError,
287  "CSeq_inst.length of sequence without data "
288  "should be 0");
289  }
290  x_AddGap(0, false);
291  }
292 
293  x_AddEnd();
294 }
295 
296 
298 {
299  _ASSERT(!m_Bioseq);
300  m_Resolved = 0;
301  m_Segments.clear();
302 }
303 
304 
305 void CSeqMap::x_GetSegmentException(size_t /*index*/) const
306 {
307  NCBI_THROW(CSeqMapException, eInvalidIndex,
308  "Invalid segment index");
309 }
310 
311 
313 {
314  _ASSERT(index < m_Segments.size());
315  return m_Segments[index];
316 }
317 
318 
320  CScope* scope) const
321 {
323  if ( !scope ) {
324  if ( m_Bioseq ) {
326  m_Bioseq->GetTSE_Info().FindBioseq(seq_id);
327  if ( seq ) {
328  return *seq;
329  }
330  }
331  NCBI_THROW_FMT(CSeqMapException, eNullPointer,
332  "Cannot resolve "<<seq_id<<": null scope pointer");
333  }
334  CBioseq_Handle bh = scope->GetBioseqHandle(seq_id);
335  if ( !bh ) {
337  "Cannot resolve "<<seq_id<<": unknown");
338  }
339  return bh.x_GetInfo();
340 }
341 
342 
343 TSeqPos CSeqMap::x_ResolveSegmentLength(size_t index, CScope* scope) const
344 {
345  const CSegment& seg = x_GetSegment(index);
346  TSeqPos length = seg.m_Length;
347  if ( length == kInvalidSeqPos ) {
348  if ( seg.m_SegType == eSeqSubMap ) {
349  length = x_GetSubSeqMap(seg, scope)->GetLength(scope);
350  }
351  else if ( seg.m_SegType == eSeqRef ) {
352  if ( m_Bioseq ) {
353  // first look directly into TSE
354  CSeq_id_Handle id =
358  if ( seq ) {
359  length = seq->GetBioseqLength();
360  }
361  }
362  if ( length == kInvalidSeqPos ) {
363  length = x_GetBioseqInfo(seg, scope).GetBioseqLength();
364  }
365  }
366  if (length == kInvalidSeqPos) {
367  NCBI_THROW(CSeqMapException, eDataError,
368  "Invalid sequence length");
369  }
370  seg.m_Length = length;
371  }
372  return length;
373 }
374 
375 
377 {
378  if ( index > x_GetLastEndSegmentIndex() ) {
379  x_GetSegmentException(index);
380  }
381  size_t resolved = m_Resolved;
382  if ( index <= resolved )
383  return x_GetSegment(index).m_Position;
384  TSeqPos resolved_pos = x_GetSegment(resolved).m_Position;
385  do {
386  TSeqPos seg_pos = resolved_pos;
387  resolved_pos += x_GetSegmentLength(resolved, scope);
388  if (resolved_pos < seg_pos || resolved_pos == kInvalidSeqPos) {
389  NCBI_THROW(CSeqMapException, eDataError,
390  "Sequence position overflow");
391  }
392  m_Segments[++resolved].m_Position = resolved_pos;
393  } while ( resolved < index );
394  {{
395  CMutexGuard guard(m_SeqMap_Mtx);
396  if ( m_Resolved < resolved )
397  m_Resolved = resolved;
398  }}
399  return resolved_pos;
400 }
401 
402 
403 size_t CSeqMap::x_FindSegment(TSeqPos pos, CScope* scope) const
404 {
405  size_t resolved = m_Resolved;
406  TSeqPos resolved_pos = x_GetSegment(resolved).m_Position;
407  if ( resolved_pos <= pos ) {
408  do {
409  if ( resolved >= x_GetLastEndSegmentIndex() ) {
410  // end of segments
411  m_Resolved = resolved;
412  return size_t(-1);
413  }
414  TSeqPos seg_pos = resolved_pos;
415  resolved_pos += x_GetSegmentLength(resolved, scope);
416  if (resolved_pos < seg_pos || resolved_pos == kInvalidSeqPos) {
417  NCBI_THROW(CSeqMapException, eDataError,
418  "Sequence position overflow");
419  }
420  m_Segments[++resolved].m_Position = resolved_pos;
421  } while ( resolved_pos <= pos );
422  {{
423  CMutexGuard guard(m_SeqMap_Mtx);
424  if ( m_Resolved < resolved )
425  m_Resolved = resolved;
426  }}
427  return resolved - 1;
428  }
429  else {
430  TSegments::const_iterator itend = m_Segments.begin()+resolved;
431  TSegments::const_iterator it =
432  upper_bound(m_Segments.begin(), itend,
433  pos, SPosLessSegment());
434  if ( it == itend ) {
435  return size_t(-1);
436  }
437  return it - m_Segments.begin();
438  }
439 }
440 
441 
442 void CSeqMap::x_LoadObject(const CSegment& seg) const
443 {
445  if ( seg.m_SegType != seg.m_ObjType ) {
447  {{
448  CMutexGuard guard(m_SeqMap_Mtx);
449  const CObject* obj = seg.m_RefObject.GetPointer();
450  if ( obj && seg.m_ObjType == eSeqChunk ) {
451  chunk = dynamic_cast<const CTSE_Chunk_Info*>(obj);
452  }
453  }}
454  if ( chunk ) {
455  chunk->Load();
456  }
457  }
458 }
459 
460 
462 {
464  if ( seg.m_SegType != seg.m_ObjType ) {
465  CRef<CTSE_Chunk_Info> chunk;
466  {{
467  CMutexGuard guard(m_SeqMap_Mtx);
468  const CObject* obj = seg.m_RefObject.GetPointer();
469  if ( obj && seg.m_ObjType == eSeqChunk ) {
470  chunk = dynamic_cast<CTSE_Chunk_Info*>(const_cast<CObject*>(obj));
471  }
472  }}
473  if ( chunk && chunk->NotLoaded() ) {
474  return chunk;
475  }
476  }
477  return null;
478 }
479 
480 
481 const CObject* CSeqMap::x_GetObject(const CSegment& seg) const
482 {
483  if ( seg.m_SegType != seg.m_ObjType ) {
484  x_LoadObject(seg);
485  }
486  if ( !seg.m_RefObject || seg.m_SegType != seg.m_ObjType ) {
487  NCBI_THROW(CSeqMapException, eNullPointer, "null object pointer");
488  }
489  return seg.m_RefObject.GetPointer();
490 }
491 
492 
493 void CSeqMap::x_SetObject(CSegment& seg, const CObject& obj)
494 {
495  // lock for object modification
496  CMutexGuard guard(m_SeqMap_Mtx);
497  // check for object
498  if ( seg.m_RefObject && seg.m_SegType == seg.m_ObjType ) {
499  NCBI_THROW(CSeqMapException, eDataError, "object already set");
500  }
501  // set object
502  seg.m_RefObject.Reset(&obj);
503  seg.m_ObjType = seg.m_SegType;
504  m_Changed = true;
505 }
506 
507 
509 {
510  // lock for object modification
511  //CMutexGuard guard(m_SeqMap_Mtx);
512  // check for object
513  if ( seg.m_ObjType == eSeqChunk ||
514  (seg.m_RefObject && seg.m_SegType == seg.m_ObjType) ) {
515  NCBI_THROW(CSeqMapException, eDataError, "object already set");
516  }
517  // set object
518  seg.m_RefObject.Reset(&chunk);
519  seg.m_ObjType = eSeqChunk;
520 }
521 
522 
524  bool resolveExternal) const
525 {
526  CConstRef<CSeqMap> ret;
527  if ( seg.m_SegType == eSeqSubMap ) {
528  ret.Reset(static_cast<const CSeqMap*>(x_GetObject(seg)));
529  }
530  else if ( resolveExternal && seg.m_SegType == eSeqRef ) {
531  ret.Reset(&x_GetBioseqInfo(seg, scope).GetSeqMap());
532  }
533  return ret;
534 }
535 
536 
537 void CSeqMap::x_SetSubSeqMap(size_t /*index*/, CSeqMap_Delta_seqs* /*subMap*/)
538 {
539  // not valid in generic seq map -> incompatible objects
540  NCBI_THROW(CSeqMapException, eDataError, "Invalid parent map");
541 }
542 
543 
544 const CSeq_data& CSeqMap::x_GetSeq_data(const CSegment& seg) const
545 {
546  if ( seg.m_SegType == eSeqData ) {
547  return *static_cast<const CSeq_data*>(x_GetObject(seg));
548  }
549  else if ( seg.m_SegType == eSeqGap && seg.m_ObjType == eSeqData ) {
550  return static_cast<const CSeq_data&>(*seg.m_RefObject);
551  }
552  else if ( seg.m_SegType == eSeqGap && seg.m_ObjType == eSeqLiteral ) {
553  const CSeq_literal& literal = static_cast<const CSeq_literal&>(*seg.m_RefObject);
554  if ( literal.IsSetSeq_data() ) {
555  return literal.GetSeq_data();
556  }
557  }
558  NCBI_THROW(CSeqMapException, eSegmentTypeError,
559  "Invalid segment type");
560 }
561 
562 
564 {
565  if ( seg.m_ObjType == eSeqLiteral ) {
566  return ConstRef(static_cast<const CSeq_literal*>(&*seg.m_RefObject));
567  }
568  return null;
569 }
570 
571 
573 {
574  // check segment type
575  CSegment& seg = x_SetSegment(index);
576  if ( seg.m_SegType != eSeqData ) {
577  NCBI_THROW(CSeqMapException, eSegmentTypeError,
578  "Invalid segment type");
579  }
580  if ( data.IsGap() ) {
581  ERR_POST("CSeqMap: gap Seq-data was split as real data");
582  seg.m_SegType = eSeqGap;
583  }
584  x_SetObject(seg, data);
585 }
586 
587 
589 {
590  if ( m_Bioseq ) {
591  return m_Bioseq->GetSequenceClass();
592  }
594 }
595 
596 
597 void CSeqMap::x_SetChanged(size_t index)
598 {
599  while ( m_Resolved > index ) {
601  }
603  m_HasSegments = 0;
604  if ( !m_Changed ) {
605  m_Changed = true;
606  if ( m_Bioseq ) {
608  }
609  }
610 }
611 
612 
614 {
615  if ( !m_Bioseq ) {
616  NCBI_THROW(CSeqMapException, eSegmentTypeError,
617  "Cannot edit unattached sequence map");
618  }
619  if ( !m_Bioseq->GetDataSource().CanBeEdited() ) {
620  NCBI_THROW(CSeqMapException, eSegmentTypeError,
621  "Bioseq is not in edit state");
622  }
623 }
624 
625 
626 void CSeqMap::x_SetSegmentGap(size_t index,
627  TSeqPos length,
628  CSeq_data* gap_data)
629 {
630  if ( gap_data && !gap_data->IsGap() ) {
631  NCBI_THROW(CSeqMapException, eSegmentTypeError,
632  "SetSegmentGap: Seq-data is not gap");
633  }
634  CMutexGuard guard(m_SeqMap_Mtx);
635  x_StartEditing();
636  CSegment& seg = x_SetSegment(index);
637  seg.m_SegType = seg.m_ObjType = eSeqGap;
638  if ( gap_data ) {
639  seg.m_ObjType = eSeqData;
640  seg.m_RefObject = gap_data;
641  }
642  seg.m_Length = length;
643  x_SetChanged(index);
644 }
645 
646 
647 void CSeqMap::x_SetSegmentData(size_t index,
648  TSeqPos length,
649  CSeq_data& data)
650 {
651  CMutexGuard guard(m_SeqMap_Mtx);
652  x_StartEditing();
653  CSegment& seg = x_SetSegment(index);
654  seg.m_SegType = data.IsGap()? eSeqGap: eSeqData;
655  seg.m_ObjType = eSeqData;
656  seg.m_RefObject = &data;
657  seg.m_Length = length;
658  x_SetChanged(index);
659 }
660 
661 
662 void CSeqMap::x_SetSegmentRef(size_t index,
663  TSeqPos length,
664  const CSeq_id& ref_id,
665  TSeqPos ref_pos,
666  bool ref_minus_strand)
667 {
668  CMutexGuard guard(m_SeqMap_Mtx);
669  x_StartEditing();
670  CSegment& seg = x_SetSegment(index);
671  seg.m_SegType = seg.m_ObjType = eSeqRef;
672  CRef<CSeq_id> id(new CSeq_id);
673  id->Assign(ref_id);
674  seg.m_RefObject = id.GetPointer();
675  seg.m_RefPosition = ref_pos;
676  seg.m_RefMinusStrand = ref_minus_strand;
677  seg.m_Length = length;
678  x_SetChanged(index);
679 }
680 
681 
683  TSeqPos length,
684  const CSeq_id_Handle& ref_id,
685  TSeqPos ref_pos,
686  bool ref_minus)
687 {
688  _ASSERT(&seg.x_GetSegmentInfo().x_GetSeqMap() == this);
689  size_t index = seg.x_GetSegmentInfo().x_GetIndex();
690  x_SetSegmentRef(index, length, *ref_id.GetSeqId(), ref_pos, ref_minus);
691 }
692 
693 
695  TSeqPos length)
696 {
697  _ASSERT(&seg.x_GetSegmentInfo().x_GetSeqMap() == this);
698  size_t index = seg.x_GetSegmentInfo().x_GetIndex();
699  x_SetSegmentGap(index, length);
700 }
701 
702 
704  TSeqPos length,
705  CSeq_data& gap_data)
706 {
707  _ASSERT(&seg.x_GetSegmentInfo().x_GetSeqMap() == this);
708  size_t index = seg.x_GetSegmentInfo().x_GetIndex();
709  x_SetSegmentGap(index, length, &gap_data);
710 }
711 
712 
714  TSeqPos length,
715  CSeq_data& data)
716 {
717  _ASSERT(&seg.x_GetSegmentInfo().x_GetSeqMap() == this);
718  size_t index = seg.x_GetSegmentInfo().x_GetIndex();
719  x_SetSegmentData(index, length, data);
720 }
721 
722 
724  TSeqPos length)
725 {
726  _ASSERT(&seg0.x_GetSegmentInfo().x_GetSeqMap() == this);
727  size_t index = seg0.x_GetSegmentInfo().x_GetIndex();
728  TSeqPos pos = x_GetSegmentPosition(index, 0);
729  CMutexGuard guard(m_SeqMap_Mtx);
730  x_StartEditing();
731  _ASSERT(m_Resolved >= index);
732  m_Segments.insert(m_Segments.begin() + index, CSegment(eSeqGap, length));
733  ++m_Resolved;
734  x_SetSegment(index).m_Position = pos;
735  x_SetChanged(index);
736  return CSeqMap_CI(seg0, *this, index, pos);
737 }
738 
739 
741 {
742  _ASSERT(&seg0.x_GetSegmentInfo().x_GetSeqMap() == this);
743  size_t index = seg0.x_GetSegmentInfo().x_GetIndex();
744  TSeqPos pos = x_GetSegmentPosition(index, 0);
745  CMutexGuard guard(m_SeqMap_Mtx);
746  x_StartEditing();
747  CSegment& seg = x_SetSegment(index);
748  if ( seg.m_SegType == eSeqEnd ) {
749  NCBI_THROW(CSeqMapException, eSegmentTypeError,
750  "cannot remove end segment");
751  }
752  _ASSERT(m_Resolved >= index);
753  m_Segments.erase(m_Segments.begin() + index);
754  if ( m_Resolved > index ) {
755  --m_Resolved;
756  }
757  x_SetSegment(index).m_Position = pos;
758  x_SetChanged(index);
759  _ASSERT(m_Resolved == index);
760  return CSeqMap_CI(seg0, *this, index, pos);
761 }
762 
763 
765  const CSeq_data& data)
766 {
767  size_t index = x_FindSegment(pos, 0);
768  const CSegment& seg = x_GetSegment(index);
769  if ( seg.m_Position != pos || seg.m_Length != len ) {
770  NCBI_THROW(CSeqMapException, eDataError,
771  "Invalid segment size");
772  }
773  x_SetSeq_data(index, const_cast<CSeq_data&>(data));
774 }
775 
776 
777 const CSeq_id& CSeqMap::x_GetRefSeqid(const CSegment& seg) const
778 {
779  if ( seg.m_SegType == eSeqRef ) {
780  return static_cast<const CSeq_id&>(*x_GetObject(seg));
781  }
782  NCBI_THROW(CSeqMapException, eSegmentTypeError,
783  "Invalid segment type");
784 }
785 
786 
788 {
789  return seg.m_RefPosition;
790 }
791 
792 
794 {
795  return seg.m_RefMinusStrand;
796 }
797 
798 
800 {
801  return CSeqMap_CI(CConstRef<CSeqMap>(this), scope, SSeqMapSelector());
802 }
803 
804 
806 {
807  return CSeqMap_CI(CConstRef<CSeqMap>(this), scope, SSeqMapSelector(),
808  kMax_UInt);
809 }
810 
811 
813 {
814  return CSeqMap_CI(CConstRef<CSeqMap>(this), scope, SSeqMapSelector(), pos);
815 }
816 
817 
819 {
820  return Begin(scope);
821 }
822 
823 
825 {
826  return End(scope);
827 }
828 
829 
831  const SSeqMapSelector& sel) const
832 {
833  return CSeqMap_CI(CConstRef<CSeqMap>(this), scope, sel);
834 }
835 
836 
838 {
839  SSeqMapSelector sel;
841  return CSeqMap_CI(CConstRef<CSeqMap>(this), scope, sel);
842 }
843 
844 
846 {
847  SSeqMapSelector sel;
849  return CSeqMap_CI(CConstRef<CSeqMap>(this), scope, sel, kMax_UInt);
850 }
851 
852 
854  const SSeqMapSelector& sel) const
855 {
856  return CSeqMap_CI(CConstRef<CSeqMap>(this), scope, sel, kMax_UInt);
857 }
858 
859 
861  TSeqPos pos,
862  const SSeqMapSelector& selector) const
863 {
864  return CSeqMap_CI(CConstRef<CSeqMap>(this), scope, selector, pos);
865 }
866 
867 
869  TSeqPos from,
870  TSeqPos length,
871  ENa_strand strand,
872  size_t maxResolveCount,
873  TFlags flags) const
874 {
875  SSeqMapSelector sel;
876  sel.SetFlags(flags).SetResolveCount(maxResolveCount);
877  sel.SetRange(from, length).SetStrand(strand);
878  return CSeqMap_CI(CConstRef<CSeqMap>(this), scope, sel);
879 }
880 
881 
883 {
884  if ( m_HasSegments == 0 ) {
885  THasSegments flags = 0;
886  ITERATE ( TSegments, it, m_Segments ) {
887  flags = flags | THasSegments(1 << it->m_SegType);
888  }
890  }
891  return bool((m_HasSegments >> type) & 1);
892 }
893 
894 
896 {
897  size_t count = 0;
898  ITERATE ( TSegments, it, m_Segments ) {
899  if ( it->m_SegType == type ) {
900  ++count;
901  }
902  }
903  return count;
904 }
905 
906 
907 bool CSeqMap::HasZeroGapAt(TSeqPos pos, CScope* scope) const
908 {
909  size_t index = x_FindSegment(pos, scope);
910  if ( index == size_t(-1) && pos == GetLength(scope) ) {
911  index = x_GetLastEndSegmentIndex();
912  }
913  const CSegment& seg = x_GetSegment(index);
914  TSeqPos pos_in_seg = pos - seg.m_Position;
915  _ASSERT(index == x_GetLastEndSegmentIndex() || pos_in_seg < seg.m_Length);
916  if ( pos_in_seg > 0 ) {
917  if ( seg.m_SegType != eSeqRef ) {
918  // not zero length segment
919  return false;
920  }
921  CConstRef<CSeqMap> sub_map = x_GetSubSeqMap(seg, scope, true);
922  TSeqPos sub_pos;
923  if ( !seg.m_RefMinusStrand ) {
924  sub_pos = seg.m_RefPosition + pos_in_seg;
925  }
926  else {
927  sub_pos = seg.m_RefPosition + (seg.m_Length-pos_in_seg);
928  }
929  return sub_map->HasZeroGapAt(sub_pos, scope);
930  }
931  else {
932  // pos_in_seg == 0, check previous segments
933  while ( index > x_GetFirstEndSegmentIndex() ) {
934  const CSegment& pseg = x_GetSegment(--index);
935  if ( pseg.m_Position < pos ) {
936  // no more zero length segments
937  return false;
938  }
939  if ( pseg.m_SegType == eSeqGap ) {
940  // found zero gap segment
941  return true;
942  }
943  }
944  }
945  return false;
946 }
947 
948 
950  TSeqPos from,
951  TSeqPos length,
952  ENa_strand strand,
953  size_t depth,
954  TFlags flags) const
955 {
956  SSeqMapSelector sel;
958  sel.SetRange(from, length).SetStrand(strand);
959  return CanResolveRange(scope, sel);
960 }
961 
962 
963 namespace {
964  struct PByLoader {
965  static CDataLoader* Get(const CRef<CTSE_Chunk_Info>& c) {
966  return &c->GetSplitInfo().GetDataLoader();
967  }
968  bool operator()(const CRef<CTSE_Chunk_Info>& c1,
969  const CRef<CTSE_Chunk_Info>& c2) const {
970  const CTSE_Split_Info* s1 = &c1->GetSplitInfo();
971  const CTSE_Split_Info* s2 = &c2->GetSplitInfo();
972  CDataLoader* l1 = &s1->GetDataLoader();
973  CDataLoader* l2 = &s2->GetDataLoader();
974  if ( l1 != l2 ) {
975  return l1 < l2;
976  }
977  if ( s1 != s2 ) {
978  return s1 < s2;
979  }
980  return c1->GetChunkId() < c2->GetChunkId();
981  }
982  };
983 }
984 
985 
986 bool CSeqMap::CanResolveRange(CScope* scope, const SSeqMapSelector& sel) const
987 {
988  try {
989  TSeqPos length = kInvalidSeqPos;
990  if ( scope ) {
991  length = GetLength(scope);
992  }
993  TSeqPos start = sel.m_Position;
994  if ( start >= length ) {
995  return false;
996  }
997  TSeqPos stop = length;
998  if ( sel.m_Length != kInvalidSeqPos ) {
999  stop = start + sel.m_Length;
1000  if ( stop < start || stop > length ) {
1001  return false;
1002  }
1003  }
1004  TSeqPos found_length = 0;
1005 
1006  if ( scope && sel.m_LinkUsedTSE && sel.m_TopTSE &&
1007  !sel.x_HasLimitTSE() ) {
1008  // Faster BFS search with batch load requests.
1009  // We will do it only if loaded data will be locked in scope.
1010  // That's why we verify that scope exists, and start TSE is set.
1011  bool deeper = true;
1012  size_t next_depth = 0;
1013  vector<CTSE_Handle> all_tse;
1014  vector<CTSE_Handle> parent_tse;
1015  vector<CSeq_id_Handle> next_ids;
1016  CDataLoader::TChunkSet load_chunks, chunks;
1017  vector< AutoPtr<CInitGuard> > guards;
1018 
1019  SSeqMapSelector next_sel(sel);
1020  while ( deeper ) {
1021  deeper = false;
1022  if ( next_depth > sel.m_MaxResolveCount ) {
1023  break;
1024  }
1025  next_sel.SetResolveCount(next_depth);
1026  next_sel.SetFlags(fFindAnyLeaf);
1027  parent_tse.clear();
1028  next_ids.clear();
1029  chunks.clear();
1030  {{
1031  CSeqMap_CI it(ConstRef(this), scope, next_sel);
1032  for(; it; ++it) {
1033  if ( it.m_Selector.m_MaxResolveCount != 0 ) {
1034  continue;
1035  }
1036  if ( it.GetType() == eSeqRef ) {
1037  parent_tse.push_back(it.x_GetSegmentInfo().m_TSE);
1038  _ASSERT(parent_tse.back());
1039  next_ids.push_back(it.GetRefSeqid());
1040  _ASSERT(next_ids.back());
1041  }
1042  else {
1043  found_length += it.GetLength();
1044  CRef<CTSE_Chunk_Info> chunk = it.x_GetSeqMap()
1046  if ( chunk ) {
1047  chunks.push_back(chunk);
1048  }
1049  }
1050  }
1051  if ( it.GetPosition() < stop ) {
1052  return false;
1053  }
1054  }}
1055  sort(chunks.begin(), chunks.end(), PByLoader());
1056  chunks.erase(unique(chunks.begin(), chunks.end()), chunks.end());
1057  while ( !chunks.empty() ) {
1058  // Collect and lock chunks from one loader to be loaded
1059  CDataLoader* loader = PByLoader::Get(chunks.back());
1060  load_chunks.clear();
1061  guards.clear();
1062  // find start index of chunks from this loader
1063  size_t s = chunks.size();
1064  while ( s > 0 && PByLoader::Get(chunks[s-1]) == loader ) {
1065  --s;
1066  }
1067  // lock chunks to be loaded
1068  for ( size_t i = s; i < chunks.size(); ++i ) {
1069  AutoPtr<CInitGuard> guard = chunks[i]->GetLoadInitGuard();
1070  if ( guard.get() && *guard.get() ) {
1071  load_chunks.push_back(chunks[i]);
1072  guards.push_back(guard);
1073  }
1074  }
1075  // load the chunks
1076  if ( !load_chunks.empty() ) {
1077  loader->GetChunks(load_chunks);
1078  guards.clear();
1079  }
1080  // done with this loader
1081  chunks.resize(s);
1082  }
1083  if ( !next_ids.empty() ) {
1084  deeper = true;
1085  vector<CBioseq_Handle> seqs =
1086  scope->GetBioseqHandles(next_ids);
1087  _ASSERT(seqs.size() == parent_tse.size());
1088  for ( size_t i = 0; i < seqs.size(); ++i ) {
1089  if ( !seqs[i] ) {
1090  return false;
1091  }
1092  const CTSE_Handle& tse = seqs[i].GetTSE_Handle();
1093  all_tse.push_back(tse);
1094  if ( !parent_tse[i].AddUsedTSE(tse) ) {
1095  sel.AddUsedTSE(tse);
1096  }
1097  }
1098  }
1099  ++next_depth;
1100  }
1101  }
1102  else {
1103  CSeqMap_CI it(ConstRef(this), scope, sel);
1104  for(; it; ++it) {
1105  found_length += it.GetLength();
1106  }
1107  if ( it.GetPosition() < stop ) {
1108  return false;
1109  }
1110  }
1111  if ( stop != kInvalidSeqPos && stop-start != found_length ) {
1112  return false;
1113  }
1114  return true;
1115  }
1116  catch (exception&) {
1117  return false;
1118  }
1119 }
1120 
1121 
1123 {
1124  return Ref(new CSeqMap(seq.GetInst()));
1125 }
1126 
1127 
1129 {
1130  return CreateSeqMapForBioseq(seq);
1131 }
1132 
1133 
1135  CScope* scope)
1136 {
1138  CRef<CSeqMap> ret(new CSeqMap(loc));
1139  if ( scope && ret->m_Mol == CSeq_inst::eMol_not_set ) {
1140  if ( mol == CSeq_inst::eMol_not_set ) {
1141  for ( size_t i = 1; ; ++i ) {
1142  const CSegment& seg = ret->x_GetSegment(i);
1143  if ( seg.m_SegType == eSeqEnd ) {
1144  break;
1145  }
1146  else if ( seg.m_SegType == eSeqRef ) {
1147  CBioseq_Handle bh =
1148  scope->GetBioseqHandle(ret->x_GetRefSeqid(seg));
1149  if ( bh ) {
1150  mol = bh.GetSequenceType();
1151  break;
1152  }
1153  }
1154  }
1155  }
1156  ret->m_Mol = mol;
1157  }
1158  return ret;
1159 }
1160 
1161 
1163  CScope* scope)
1164 {
1166  if ( scope ) {
1167  if ( loc.IsInt() ) {
1168  const CSeq_interval& locint = loc.GetInt();
1169  if ( locint.GetFrom() == 0 &&
1170  (!locint.IsSetStrand() || !IsReverse(locint.GetStrand())) ) {
1171  CBioseq_Handle bh = scope->GetBioseqHandle(locint.GetId());
1172  if ( bh ) {
1173  if ( bh.GetBioseqLength() == locint.GetTo()+1 ) {
1174  return ConstRef(&bh.GetSeqMap());
1175  }
1176  mol = bh.GetSequenceType();
1177  }
1178  }
1179  }
1180  else if ( loc.IsWhole() ) {
1181  CBioseq_Handle bh = scope->GetBioseqHandle(loc.GetWhole());
1182  if ( bh ) {
1183  return ConstRef(&bh.GetSeqMap());
1184  }
1185  }
1186  }
1187  CRef<CSeqMap> ret(new CSeqMap(loc));
1188  if ( scope && ret->m_Mol == CSeq_inst::eMol_not_set ) {
1189  if ( mol == CSeq_inst::eMol_not_set ) {
1190  for ( size_t i = 1; ; ++i ) {
1191  const CSegment& seg = ret->x_GetSegment(i);
1192  if ( seg.m_SegType == eSeqEnd ) {
1193  break;
1194  }
1195  else if ( seg.m_SegType == eSeqRef ) {
1196  CBioseq_Handle bh =
1197  scope->GetBioseqHandle(ret->x_GetRefSeqid(seg));
1198  if ( bh ) {
1199  mol = bh.GetSequenceType();
1200  break;
1201  }
1202  }
1203  }
1204  }
1205  ret->m_Mol = mol;
1206  }
1207  return ret;
1208 }
1209 
1210 
1211 inline
1213  TSeqPos len,
1214  bool unknown_len)
1215 {
1216  m_Segments.push_back(CSegment(type, len, unknown_len));
1217 }
1218 
1219 
1221  const CObject* object)
1222 {
1223  x_AddSegment(type, len);
1224  CSegment& ret = m_Segments.back();
1225  ret.m_RefObject.Reset(object);
1226 }
1227 
1228 
1230  const CObject* object,
1231  TSeqPos refPos,
1232  TSeqPos len,
1233  ENa_strand strand)
1234 {
1235  x_AddSegment(type, len, object);
1236  CSegment& ret = m_Segments.back();
1237  ret.m_RefPosition = refPos;
1238  ret.m_RefMinusStrand = IsReverse(strand);
1239 }
1240 
1241 
1243 {
1244  TSeqPos pos = kInvalidSeqPos;
1245  if ( m_Segments.empty() ) {
1246  m_Segments.reserve(3);
1247  pos = 0;
1248  }
1249  x_AddSegment(eSeqEnd, 0);
1250  CSegment& ret = m_Segments.back();
1251  ret.m_Position = pos;
1252 }
1253 
1254 
1255 void CSeqMap::x_AddGap(TSeqPos len, bool unknown_len)
1256 {
1257  x_AddSegment(eSeqGap, len, unknown_len);
1258 }
1259 
1260 
1261 void CSeqMap::x_AddGap(TSeqPos len, bool unknown_len,
1262  const CSeq_data& gap_data)
1263 {
1264  x_AddSegment(eSeqGap, len, unknown_len);
1265  CSegment& ret = m_Segments.back();
1266  ret.m_ObjType = eSeqData;
1267  ret.m_RefObject = &gap_data;
1268 }
1269 
1270 
1271 void CSeqMap::x_AddGap(TSeqPos len, bool unknown_len,
1272  const CSeq_literal& gap_data)
1273 {
1274  x_AddSegment(eSeqGap, len, unknown_len);
1275  CSegment& ret = m_Segments.back();
1276  ret.m_ObjType = eSeqLiteral;
1277  ret.m_RefObject = &gap_data;
1278 }
1279 
1280 
1282 {
1284 }
1285 
1286 
1288 {
1290 }
1291 
1292 
1293 void CSeqMap::x_Add(const CSeq_point& ref)
1294 {
1295  x_AddSegment(eSeqRef, &ref.GetId(),
1296  ref.GetPoint(), 1,
1297  ref.IsSetStrand()? ref.GetStrand(): eNa_strand_unknown);
1298 }
1299 
1300 
1302 {
1303  x_AddSegment(eSeqRef, &ref.GetId(),
1304  ref.GetFrom(), ref.GetLength(),
1305  ref.IsSetStrand()? ref.GetStrand(): eNa_strand_unknown);
1306 }
1307 
1308 
1309 void CSeqMap::x_Add(const CSeq_id& ref)
1310 {
1311  x_AddSegment(eSeqRef, &ref, 0, kInvalidSeqPos);
1312 }
1313 
1314 /*
1315 CSeqMap::CSegment& CSeqMap::x_Add(CSeqMap* submap)
1316 {
1317  return x_AddSegment(eSeqSubMap, kInvalidSeqPos, submap);
1318 }
1319 */
1320 
1322 {
1323  ITERATE ( CPacked_seqint::Tdata, it, seq.Get() ) {
1324  x_Add(**it);
1325  }
1326  //return x_Add(new CSeqMap_Seq_intervals(seq));
1327 }
1328 
1329 
1331 {
1332  const CSeq_id& id = seq.GetId();
1333  ENa_strand strand = seq.IsSetStrand()? seq.GetStrand(): eNa_strand_unknown;
1334  ITERATE ( CPacked_seqpnt::TPoints, it, seq.GetPoints() ) {
1335  x_AddSegment(eSeqRef, &id, *it, 1, strand);
1336  }
1337  //return x_Add(new CSeqMap_SeqPoss(seq));
1338 }
1339 
1340 
1342 {
1343  ITERATE ( CSeq_loc_mix::Tdata, it, seq.Get() ) {
1344  x_Add(**it);
1345  }
1346  //return x_Add(new CSeqMap_Seq_locs(seq, seq.Get()));
1347 }
1348 
1349 
1351 {
1352  ITERATE ( CSeq_loc_equiv::Tdata, it, seq.Get() ) {
1353  x_Add(**it);
1354  }
1355  //return x_Add(new CSeqMap_Seq_locs(seq, seq.Get()));
1356 }
1357 
1358 
1360 {
1361  const bool is_unknown_len = (
1362  seq.CanGetFuzz() &&
1363  seq.GetFuzz().IsLim() &&
1364  seq.GetFuzz().GetLim() == CInt_fuzz::eLim_unk );
1365 
1366  if ( !seq.IsSetSeq_data() ) {
1367  // No data exist - treat it like a gap
1368  x_AddGap(seq.GetLength(), is_unknown_len, seq); //???
1369  }
1370  else if ( seq.GetSeq_data().IsGap() ) {
1371  // Seq-data.gap
1372  x_AddGap(seq.GetLength(), is_unknown_len, seq);
1373  }
1374  else {
1375  x_Add(seq.GetSeq_data(), seq.GetLength());
1376  }
1377 }
1378 
1379 
1380 void CSeqMap::x_Add(const CSeq_loc& loc)
1381 {
1382  switch ( loc.Which() ) {
1383  case CSeq_loc::e_not_set:
1384  case CSeq_loc::e_Null:
1385  case CSeq_loc::e_Empty:
1386  x_AddGap(0, false); // Add gap ???
1387  break;
1388  case CSeq_loc::e_Whole:
1389  x_Add(loc.GetWhole());
1390  break;
1391  case CSeq_loc::e_Int:
1392  x_Add(loc.GetInt());
1393  break;
1394  case CSeq_loc::e_Pnt:
1395  x_Add(loc.GetPnt());
1396  break;
1398  x_Add(loc.GetPacked_int());
1399  break;
1401  x_Add(loc.GetPacked_pnt());
1402  break;
1403  case CSeq_loc::e_Mix:
1404  x_Add(loc.GetMix());
1405  break;
1406  case CSeq_loc::e_Equiv:
1407  x_Add(loc.GetEquiv());
1408  break;
1409  case CSeq_loc::e_Bond:
1410  NCBI_THROW(CSeqMapException, eDataError,
1411  "e_Bond is not allowed as a reference type");
1412  case CSeq_loc::e_Feat:
1413  NCBI_THROW(CSeqMapException, eDataError,
1414  "e_Feat is not allowed as a reference type");
1415  default:
1416  NCBI_THROW(CSeqMapException, eDataError,
1417  "invalid reference type");
1418  }
1419 }
1420 
1421 
1422 void CSeqMap::x_Add(const CDelta_seq& seq)
1423 {
1424  switch ( seq.Which() ) {
1425  case CDelta_seq::e_Loc:
1426  x_Add(seq.GetLoc());
1427  break;
1428  case CDelta_seq::e_Literal:
1429  x_Add(seq.GetLiteral());
1430  break;
1431  default:
1432  NCBI_THROW(CSeqMapException, eDataError,
1433  "Can not add empty Delta-seq");
1434  }
1435 }
1436 
1437 
1439  TSeqPos pos, TSeqPos length)
1440 {
1441  if ( length == kInvalidSeqPos ) {
1442  _ASSERT(pos == 0);
1444  length = m_SeqLength;
1445  }
1446  size_t index = x_FindSegment(pos, 0);
1447  CMutexGuard guard(m_SeqMap_Mtx);
1448  while ( length ) {
1449  // get segment
1450  if ( index > x_GetLastEndSegmentIndex() ) {
1451  x_GetSegmentException(index);
1452  }
1453  CSegment& seg = x_SetSegment(index);
1454 
1455  // update segment position if not set yet
1456  if ( index > m_Resolved ) {
1457  _ASSERT(index == m_Resolved + 1);
1458  _ASSERT(seg.m_Position == kInvalidSeqPos || seg.m_Position == pos);
1459  seg.m_Position = pos;
1460  m_Resolved = index;
1461  }
1462  // check segment
1463  if ( seg.m_Position != pos || seg.m_Length > length ) {
1464  NCBI_THROW(CSeqMapException, eDataError,
1465  "SeqMap segment crosses split chunk boundary");
1466  }
1467  if ( seg.m_SegType != eSeqGap ) {
1468  NCBI_THROW(CSeqMapException, eDataError,
1469  "split chunk covers bad SeqMap segment");
1470  }
1471  if ( auto literal = x_GetSeq_literal(seg) ) {
1472  // reset temporary literal segment
1473  if ( !literal->IsSetFuzz() && !literal->IsSetSeq_data() ) {
1474  seg.m_ObjType = eSeqGap;
1475  seg.m_RefObject = null;
1476  }
1477  }
1478  _ASSERT(!seg.m_RefObject);
1479 
1480  if ( seg.m_Length > 0 ) {
1481  // update segment
1482  seg.m_SegType = eSeqData;
1483  x_SetChunk(seg, chunk);
1484 
1485  // next
1486  pos += seg.m_Length;
1487  length -= seg.m_Length;
1488  }
1489  ++index;
1490  }
1491 }
1492 
1493 
1495 {
1496  inst.SetLength(GetLength(0));
1497  bool single_segment = GetSegmentsCount() == 1;
1498  if ( HasSegmentOfType(eSeqData) ) {
1499  if ( single_segment && !inst.IsSetExt() ) {
1500  // seq-data
1502  _ASSERT(seg.m_SegType == eSeqData);
1503  inst.SetSeq_data(const_cast<CSeq_data&>(x_GetSeq_data(seg)));
1504  inst.ResetExt();
1505  return true;
1506  }
1507  }
1508  else if ( HasSegmentOfType(eSeqGap) ) {
1509  if ( single_segment && !inst.IsSetExt() ) {
1511  inst.ResetSeq_data();
1512  inst.ResetExt();
1513  return true;
1514  }
1515  }
1516  else {
1517  if ( !inst.IsSetExt() || inst.GetExt().IsSeg() ) {
1518  // ref only -> CSeg_ext
1519  CSeg_ext::Tdata& data = inst.SetExt().SetSeg().Set();
1520  CSeg_ext::Tdata::iterator iter = data.begin();
1521  for ( size_t index = x_GetFirstEndSegmentIndex() + 1;
1522  index < x_GetLastEndSegmentIndex(); ++index ) {
1523  CSegment& seg = x_SetSegment(index);
1524  _ASSERT(seg.m_SegType == eSeqRef);
1525  if ( iter == data.end() ) {
1526  iter = data.insert(iter, CSeg_ext::Tdata::value_type());
1527  }
1528  if ( !*iter ) {
1529  iter->Reset(new CSeq_loc);
1530  }
1531  CSeq_loc& loc = **iter;
1532  ++iter;
1533  CSeq_interval& interval = loc.SetInt();
1534  interval.SetId(const_cast<CSeq_id&>(x_GetRefSeqid(seg)));
1535  TSeqPos pos = seg.m_RefPosition;
1536  interval.SetFrom(pos);
1537  interval.SetTo(pos+x_GetSegmentLength(index, 0)-1);
1538  if ( seg.m_RefMinusStrand ) {
1539  interval.SetStrand(eNa_strand_minus);
1540  }
1541  else {
1542  interval.ResetStrand();
1543  }
1544  interval.ResetFuzz_from();
1545  interval.ResetFuzz_to();
1546  }
1547  data.erase(iter, data.end());
1548  return true;
1549  }
1550  }
1551 
1552  // delta
1553  CDelta_ext::Tdata& delta = inst.SetExt().SetDelta().Set();
1555  CDelta_ext::Tdata::iterator iter = delta.begin();
1556  for ( size_t index = x_GetFirstEndSegmentIndex() + 1;
1557  index < x_GetLastEndSegmentIndex(); ++index ) {
1558  CSegment& seg = x_SetSegment(index);
1559  if ( iter == delta.end() ) {
1560  iter = delta.insert(iter, CDelta_ext::Tdata::value_type());
1561  }
1562  iter->Reset(new CDelta_seq);
1563  CDelta_seq& dseq = **iter;
1564  ++iter;
1565  if ( seg.m_SegType == eSeqData ) {
1566  CSeq_literal& lit = dseq.SetLiteral();
1567  lit.SetLength(x_GetSegmentLength(index, 0));
1568  lit.SetSeq_data(const_cast<CSeq_data&>(x_GetSeq_data(seg)));
1569  lit.ResetFuzz();
1570  }
1571  else if ( seg.m_SegType == eSeqGap && seg.m_ObjType == eSeqLiteral ) {
1572  dseq.SetLiteral(const_cast<CSeq_literal&>(*x_GetSeq_literal(seg)));
1573  }
1574  else if ( seg.m_SegType == eSeqGap ) {
1575  CSeq_literal& lit = dseq.SetLiteral();
1576  lit.SetLength(x_GetSegmentLength(index, 0));
1577  lit.ResetSeq_data();
1578  if ( seg.m_UnknownLength ) {
1579  lit.SetFuzz().SetLim(CInt_fuzz::eLim_unk);
1580  }
1581  else {
1582  lit.ResetFuzz();
1583  }
1584  }
1585  else {
1586  _ASSERT(seg.m_SegType == eSeqRef);
1587  CSeq_loc& loc = dseq.SetLoc();
1588  CSeq_interval& interval = loc.SetInt();
1589  interval.SetId(const_cast<CSeq_id&>(x_GetRefSeqid(seg)));
1590  TSeqPos pos = seg.m_RefPosition;
1591  interval.SetFrom(pos);
1592  interval.SetTo(pos+x_GetSegmentLength(index, 0)-1);
1593  if ( seg.m_RefMinusStrand ) {
1594  interval.SetStrand(eNa_strand_minus);
1595  }
1596  else {
1597  interval.ResetStrand();
1598  }
1599  interval.ResetFuzz_from();
1600  interval.ResetFuzz_to();
1601  }
1602  }
1603  delta.erase(iter, delta.end());
1604  inst.ResetSeq_data();
1605  return true;
1606 }
1607 
1608 
1610 {
1611 }
1612 
1613 
1615 {
1616 }
1617 
1618 
1620 {
1621  m_Mol = mol;
1622 }
1623 
1624 
1626 {
1628 }
1629 
1630 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
bool IsReverse(ENa_strand s)
Definition: Na_strand.hpp:75
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CBioseq_Handle –.
int GetSequenceClass(void) const
TSeqPos GetBioseqLength(void) const
void x_SetChangedSeqMap(void)
bool CanBeEdited(void) const
CDelta_seq –.
Definition: Delta_seq.hpp:66
CObject –.
Definition: ncbiobj.hpp:180
CScope –.
Definition: scope.hpp:92
SeqMap related exceptions.
Iterator over CSeqMap.
Definition: seq_map_ci.hpp:252
CSeqMap –.
Definition: seq_map.hpp:93
CSeq_ext –.
Definition: Seq_ext.hpp:66
TSeqPos GetLength(void) const
void Load(void) const
TChunkId GetChunkId(void) const
const CTSE_Split_Info & GetSplitInfo(void) const
bool NotLoaded(void) const
CDataSource & GetDataSource(void) const
const CTSE_Info & GetTSE_Info(void) const
CConstRef< CBioseq_Info > FindBioseq(const CSeq_id_Handle &id) const
Definition: tse_info.cpp:760
CConstRef< CBioseq_Info > FindMatchingBioseq(const CSeq_id_Handle &id) const
Definition: tse_info.cpp:776
CDataLoader & GetDataLoader(void) const
static uch flags
static unsigned char depth[2 *(256+1+29)+1]
#define false
Definition: bool.h:36
#define bool
Definition: bool.h:34
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
element_type * get(void) const
Get pointer.
Definition: ncbimisc.hpp:469
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
Definition: ncbimisc.hpp:822
const TSeqPos kInvalidSeqPos
Define special value for invalid sequence position.
Definition: ncbimisc.hpp:878
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
Definition: ncbidiag.hpp:186
#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
#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
CConstRef< CSeq_id > GetSeqId(void) const
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
void SetInt(TInt &v)
Definition: Seq_loc.hpp:983
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
Definition: scope.cpp:95
TBioseqHandles GetBioseqHandles(const TIds &ids)
Get bioseq handles for all ids.
Definition: scope.cpp:143
virtual void GetChunks(const TChunkSet &chunks)
vector< TChunk > TChunkSet
TSeqPos GetBioseqLength(void) const
TMol GetSequenceType(void) const
const CBioseq_Info & x_GetInfo(void) const
const CSeqMap & GetSeqMap(void) const
Get sequence map.
SSeqMapSelector & SetResolveCount(size_t res_cnt)
Set max depth of resolving seq-map.
Definition: seq_map_ci.hpp:151
const CSeqMap::CSegment & x_GetSegment(void) const
Definition: seq_map_ci.hpp:637
void AddUsedTSE(const CTSE_Handle &tse) const
Definition: seq_map_ci.cpp:94
SSeqMapSelector m_Selector
Definition: seq_map_ci.hpp:391
TSeqPos m_Position
Definition: seq_map_ci.hpp:230
const TSegmentInfo & x_GetSegmentInfo(void) const
Definition: seq_map_ci.hpp:609
SSeqMapSelector & SetFlags(TFlags flags)
Select segment type(s)
Definition: seq_map_ci.hpp:179
const CSeqMap & x_GetSeqMap(void) const
Definition: seq_map_ci.hpp:480
CTSE_Handle m_TopTSE
Definition: seq_map_ci.hpp:238
size_t m_MaxResolveCount
Definition: seq_map_ci.hpp:240
const CSeqMap & x_GetSeqMap(void) const
Definition: seq_map_ci.hpp:623
CSeqMap::ESegmentType GetType(void) const
Definition: seq_map_ci.hpp:651
SSeqMapSelector & SetRange(TSeqPos start, TSeqPos length)
Set range for iterator.
Definition: seq_map_ci.hpp:127
CSeq_id_Handle GetRefSeqid(void) const
The following function makes sense only when the segment is a reference to another seq.
Definition: seq_map_ci.cpp:312
size_t x_GetIndex(void) const
Definition: seq_map_ci.hpp:487
SSeqMapSelector & SetStrand(ENa_strand strand)
Set strand to iterate over.
Definition: seq_map_ci.hpp:144
TSeqPos GetPosition(void) const
return position of current segment in sequence
Definition: seq_map_ci.hpp:665
TSeqPos GetLength(void) const
return length of current segment
Definition: seq_map_ci.hpp:672
bool x_HasLimitTSE(void) const
Definition: seq_map_ci.hpp:223
void x_SetSubSeqMap(size_t index, CSeqMap_Delta_seqs *subMap)
Definition: seq_map.cpp:537
bool HasZeroGapAt(TSeqPos pos, CScope *scope=0) const
Returns true if there is zero-length gap at position.
Definition: seq_map.cpp:907
void SetSegmentRef(const CSeqMap_CI &seg, TSeqPos length, const CSeq_id_Handle &ref_id, TSeqPos ref_pos, bool ref_minus_strand)
Definition: seq_map.cpp:682
atomic< TSeqPos > m_SeqLength
Definition: seq_map.hpp:404
CSeqMap_CI End(CScope *scope) const
Definition: seq_map.cpp:805
size_t CountSegmentsOfType(ESegmentType type) const
Definition: seq_map.cpp:895
const_iterator begin(CScope *scope) const
STL style methods.
Definition: seq_map.cpp:818
CBioseq_Info * m_Bioseq
Definition: seq_map.hpp:380
const_iterator end(CScope *scope) const
Definition: seq_map.cpp:824
void x_GetSegmentException(size_t index) const
Definition: seq_map.cpp:305
void x_SetSegmentData(size_t index, TSeqPos length, CSeq_data &data)
Definition: seq_map.cpp:647
void SetSegmentGap(const CSeqMap_CI &seg, TSeqPos length)
Definition: seq_map.cpp:694
~CSeqMap(void)
Definition: seq_map.cpp:297
void x_LoadObject(const CSegment &seg) const
Definition: seq_map.cpp:442
CConstRef< CSeqMap > x_GetSubSeqMap(const CSegment &seg, CScope *scope, bool resolveExternal=false) const
Definition: seq_map.cpp:523
const CBioseq_Info & x_GetBioseqInfo(const CSegment &seg, CScope *scope) const
Definition: seq_map.cpp:319
void x_AddGap(TSeqPos len, bool unknown_len)
Definition: seq_map.cpp:1255
size_t x_FindSegment(TSeqPos position, CScope *scope) const
Definition: seq_map.cpp:403
CSegment(ESegmentType seg_type=eSeqEnd, TSeqPos length=kInvalidSeqPos, bool unknown_len=false)
Definition: seq_map.cpp:72
TSeqPos x_ResolveSegmentPosition(size_t index, CScope *scope) const
Definition: seq_map.cpp:376
atomic< TSeqPos > m_Position
Definition: seq_map.hpp:253
friend class CSegment
Definition: seq_map.hpp:233
TMol m_Mol
Definition: seq_map.hpp:394
void x_SetSegmentGap(size_t index, TSeqPos length, CSeq_data *gap_data=0)
Definition: seq_map.cpp:626
atomic< THasSegments > m_HasSegments
Definition: seq_map.hpp:398
CSeqMap_CI BeginResolved(CScope *scope) const
Definition: seq_map.cpp:837
CConstRef< CSeq_literal > x_GetSeq_literal(const CSegment &seg) const
Definition: seq_map.cpp:563
atomic< size_t > m_Resolved
Definition: seq_map.hpp:388
void x_SetChanged(size_t index)
Definition: seq_map.cpp:597
void ResetMol(void)
Definition: seq_map.cpp:1625
void x_AddEnd(void)
Definition: seq_map.cpp:1242
CSegment & x_SetSegment(size_t index)
Definition: seq_map.cpp:312
int x_GetSequenceClass(void) const
Definition: seq_map.cpp:588
const CSegment & x_GetSegment(size_t index) const
Definition: seq_map.hpp:447
const CObject * x_GetObject(const CSegment &seg) const
Definition: seq_map.cpp:481
CSeqMap(void)
Definition: seq_map.cpp:119
TSeqPos m_RefPosition
Definition: seq_map.hpp:264
friend class CSeqMap_CI
Definition: seq_map.hpp:409
static CRef< CSeqMap > CreateSeqMapForSeq_loc(const CSeq_loc &loc, CScope *scope)
Definition: seq_map.cpp:1134
size_t x_GetLastEndSegmentIndex(void) const
Definition: seq_map.hpp:433
void x_SetObject(CSegment &seg, const CObject &obj)
Definition: seq_map.cpp:493
CSeqMap_CI Begin(CScope *scope) const
NCBI style methods.
Definition: seq_map.cpp:799
void x_SetChunk(CSegment &seg, CTSE_Chunk_Info &chunk)
Definition: seq_map.cpp:508
int TFlags
Definition: seq_map.hpp:142
CSeqMap_CI FindSegment(TSeqPos pos, CScope *scope) const
Find segment containing the position.
Definition: seq_map.cpp:812
vector< CSegment > m_Segments
Definition: seq_map.hpp:385
CRef< CSeqMap > CloneFor(const CBioseq &seq) const
Definition: seq_map.cpp:1128
CSeqMap_CI FindResolved(CScope *scope, TSeqPos pos, const SSeqMapSelector &selector) const
Definition: seq_map.cpp:860
TSeqPos x_GetSegmentLength(size_t index, CScope *scope) const
Definition: seq_map.hpp:464
Uint1 THasSegments
Definition: seq_map.hpp:397
size_t x_GetFirstEndSegmentIndex(void) const
Definition: seq_map.hpp:440
TSeqPos x_GetSegmentPosition(size_t index, CScope *scope) const
Definition: seq_map.hpp:455
bool HasSegmentOfType(ESegmentType type) const
Definition: seq_map.cpp:882
void x_AddSegment(ESegmentType type, TSeqPos len, bool unknown_len=false)
Definition: seq_map.cpp:1212
void x_StartEditing(void)
Definition: seq_map.cpp:613
static CConstRef< CSeqMap > GetSeqMapForSeq_loc(const CSeq_loc &loc, CScope *scope)
Definition: seq_map.cpp:1162
void SetRegionInChunk(CTSE_Chunk_Info &chunk, TSeqPos pos, TSeqPos length)
Definition: seq_map.cpp:1438
void x_Add(CSeqMap *submap)
void ResetRepr(void)
Definition: seq_map.cpp:1614
bool x_GetRefMinusStrand(const CSegment &seg) const
Definition: seq_map.cpp:793
void LoadSeq_data(TSeqPos pos, TSeqPos len, const CSeq_data &data)
Definition: seq_map.cpp:764
vector< CSegment > TSegments
Definition: seq_map.hpp:382
void SetRepr(CSeq_inst::TRepr repr)
Definition: seq_map.cpp:1609
CSeqMap_CI RemoveSegment(const CSeqMap_CI &seg)
Delete segment from sequence map.
Definition: seq_map.cpp:740
CSeqMap_CI ResolvedRangeIterator(CScope *scope, TSeqPos from, TSeqPos length, ENa_strand strand=eNa_strand_plus, size_t maxResolve=size_t(-1), TFlags flags=fDefaultFlags) const
Iterate segments in the range with specified strand coordinates.
Definition: seq_map.cpp:868
static CRef< CSeqMap > CreateSeqMapForBioseq(const CBioseq &seq)
Definition: seq_map.cpp:1122
CConstRef< CObject > m_RefObject
Definition: seq_map.hpp:265
void SetSegmentData(const CSeqMap_CI &seg, TSeqPos length, CSeq_data &data)
Definition: seq_map.cpp:713
bool CanResolveRange(CScope *scope, const SSeqMapSelector &sel) const
Definition: seq_map.cpp:986
CRef< CTSE_Chunk_Info > x_GetChunkToLoad(const CSegment &seg) const
Definition: seq_map.cpp:461
CMutex m_SeqMap_Mtx
Definition: seq_map.hpp:407
CSeqMap_CI InsertSegmentGap(const CSeqMap_CI &seg, TSeqPos length)
Insert new gap into sequence map.
Definition: seq_map.cpp:723
atomic< TSeqPos > m_Length
Definition: seq_map.hpp:255
TSeqPos GetLength(CScope *scope) const
Definition: seq_map.hpp:482
TChanged m_Changed
Definition: seq_map.hpp:401
const CSeq_id & x_GetRefSeqid(const CSegment &seg) const
Definition: seq_map.cpp:777
bool x_DoUpdateSeq_inst(CSeq_inst &inst)
Definition: seq_map.cpp:1494
void x_SetSegmentRef(size_t index, TSeqPos length, const CSeq_id &ref_id, TSeqPos ref_pos, bool ref_minus_strand)
Definition: seq_map.cpp:662
void x_AddUnloadedSeq_data(TSeqPos len)
Definition: seq_map.cpp:1281
CSegment & operator=(const CSegment &seg)
Definition: seq_map.cpp:101
TSeqPos x_GetRefPosition(const CSegment &seg) const
Definition: seq_map.cpp:787
void SetMol(CSeq_inst::TMol mol)
Definition: seq_map.cpp:1619
const CSeq_data & x_GetSeq_data(const CSegment &seg) const
Definition: seq_map.cpp:544
void x_SetSeq_data(size_t index, CSeq_data &data)
Definition: seq_map.cpp:572
size_t GetSegmentsCount(void) const
Definition: seq_map.hpp:426
ESegmentType
Definition: seq_map.hpp:96
CSeqMap_CI EndResolved(CScope *scope) const
Definition: seq_map.cpp:845
TSeqPos x_ResolveSegmentLength(size_t index, CScope *scope) const
Definition: seq_map.cpp:343
@ fFindAnyLeaf
Definition: seq_map.hpp:139
@ eSeqEnd
Definition: seq_map.hpp:101
@ eSeqData
real sequence data
Definition: seq_map.hpp:98
@ eSeqLiteral
used only in m_ObjType for gap segments
Definition: seq_map.hpp:103
@ eSeqSubMap
sub seqmap
Definition: seq_map.hpp:99
@ eSeqChunk
Definition: seq_map.hpp:102
@ eSeqGap
gap
Definition: seq_map.hpp:97
@ eSeqRef
reference to Bioseq
Definition: seq_map.hpp:100
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:1684
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:1439
#define kMax_UInt
Definition: ncbi_limits.h:185
#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
CTempString literal(const char(&str)[Size])
Templatized initialization from a string literal.
Definition: tempstr.hpp:441
bool IsLim(void) const
Check if variant Lim is selected.
Definition: Int_fuzz_.hpp:636
TLim GetLim(void) const
Get the variant data.
Definition: Int_fuzz_.hpp:642
@ eLim_unk
unknown
Definition: Int_fuzz_.hpp:210
void SetTo(TTo value)
Assign a value to To data member.
void ResetFuzz_to(void)
Reset Fuzz_to data member.
list< CRef< CSeq_interval > > Tdata
ENa_strand
strand of nucleic acid
Definition: Na_strand_.hpp:64
const Tdata & Get(void) const
Get the member data.
TStrand GetStrand(void) const
Get the Strand member data.
const TId & GetId(void) const
Get the Id member data.
const TPnt & GetPnt(void) const
Get the variant data.
Definition: Seq_loc_.cpp:238
TPoint GetPoint(void) const
Get the Point member data.
Definition: Seq_point_.hpp:303
const TWhole & GetWhole(void) const
Get the variant data.
Definition: Seq_loc_.cpp:172
void SetId(TId &value)
Assign a value to Id data member.
bool IsSetStrand(void) const
Check if a value has been assigned to Strand data member.
TFrom GetFrom(void) const
Get the From member data.
list< CRef< CSeq_loc > > Tdata
E_Choice Which(void) const
Which variant is currently selected.
Definition: Seq_loc_.hpp:475
const TId & GetId(void) const
Get the Id member data.
const TId & GetId(void) const
Get the Id member data.
Definition: Seq_point_.hpp:390
void SetFrom(TFrom value)
Assign a value to From data member.
TStrand GetStrand(void) const
Get the Strand member data.
Definition: Seq_point_.hpp:350
const Tdata & Get(void) const
Get the member data.
const TPacked_pnt & GetPacked_pnt(void) const
Get the variant data.
Definition: Seq_loc_.cpp:260
const Tdata & Get(void) const
Get the member data.
void ResetFuzz_from(void)
Reset Fuzz_from data member.
const TEquiv & GetEquiv(void) const
Get the variant data.
Definition: Seq_loc_.cpp:304
list< CRef< CSeq_loc > > Tdata
vector< TSeqPos > TPoints
bool IsSetStrand(void) const
Check if a value has been assigned to Strand data member.
bool IsSetStrand(void) const
Check if a value has been assigned to Strand data member.
Definition: Seq_point_.hpp:331
const TPoints & GetPoints(void) const
Get the Points member data.
TStrand GetStrand(void) const
Get the Strand member data.
TTo GetTo(void) const
Get the To member data.
bool IsWhole(void) const
Check if variant Whole is selected.
Definition: Seq_loc_.hpp:522
bool IsInt(void) const
Check if variant Int is selected.
Definition: Seq_loc_.hpp:528
const TInt & GetInt(void) const
Get the variant data.
Definition: Seq_loc_.cpp:194
void SetStrand(TStrand value)
Assign a value to Strand data member.
void ResetStrand(void)
Reset Strand data member.
const TMix & GetMix(void) const
Get the variant data.
Definition: Seq_loc_.cpp:282
const TPacked_int & GetPacked_int(void) const
Get the variant data.
Definition: Seq_loc_.cpp:216
@ eNa_strand_minus
Definition: Na_strand_.hpp:67
@ eNa_strand_unknown
Definition: Na_strand_.hpp:65
@ e_not_set
No variant selected.
Definition: Seq_loc_.hpp:97
@ e_Null
not placed
Definition: Seq_loc_.hpp:98
@ e_Equiv
equivalent sets of locations
Definition: Seq_loc_.hpp:106
@ e_Empty
to NULL one Seq-id in a collection
Definition: Seq_loc_.hpp:99
@ e_Feat
indirect, through a Seq-feat
Definition: Seq_loc_.hpp:108
@ e_Int
from to
Definition: Seq_loc_.hpp:101
@ e_Whole
whole sequence
Definition: Seq_loc_.hpp:100
TLiteral & SetLiteral(void)
Select the variant.
Definition: Delta_seq_.cpp:130
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.
const TSeg & GetSeg(void) const
Get the variant data.
Definition: Seq_ext_.cpp:114
bool IsSetSeq_data(void) const
the sequence Check if a value has been assigned to Seq_data data member.
Definition: Seq_inst_.hpp:805
ERepr
representation class
Definition: Seq_inst_.hpp:91
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.
TLoc & SetLoc(void)
Select the variant.
Definition: Delta_seq_.cpp:108
void SetExt(TExt &value)
Assign a value to Ext data member.
Definition: Seq_inst_.cpp:147
bool IsSetMol(void) const
Check if a value has been assigned to Mol data member.
Definition: Seq_inst_.hpp:593
const TLiteral & GetLiteral(void) const
Get the variant data.
Definition: Delta_seq_.cpp:124
bool IsSetExt(void) const
extensions for special types Check if a value has been assigned to Ext data member.
Definition: Seq_inst_.hpp:826
TLength GetLength(void) const
Get the Length member data.
Definition: Seq_inst_.hpp:659
TLength GetLength(void) const
Get the Length member data.
bool IsSeg(void) const
Check if variant Seg is selected.
Definition: Seq_ext_.hpp:318
const TFuzz & GetFuzz(void) const
Get the Fuzz member data.
TMol GetMol(void) const
Get the Mol member data.
Definition: Seq_inst_.hpp:612
void SetFuzz(TFuzz &value)
Assign a value to Fuzz data member.
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 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
EMol
molecule class in living organism
Definition: Seq_inst_.hpp:108
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 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
bool CanGetFuzz(void) const
Check if it is safe to call GetFuzz method.
const Tdata & Get(void) const
Get the member data.
Definition: Delta_ext_.hpp:164
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 Tdata & Get(void) const
Get the member data.
Definition: Seg_ext_.hpp:164
bool IsGap(void) const
Check if variant Gap is selected.
Definition: Seq_data_.hpp:704
void SetSeq_data(TSeq_data &value)
Assign a value to Seq_data data member.
Definition: Seq_inst_.cpp:130
void ResetExt(void)
Reset Ext data member.
Definition: Seq_inst_.cpp:142
const TSeq_data & GetSeq_data(void) const
Get the Seq_data member data.
Definition: Seq_inst_.hpp:817
list< CRef< CSeq_loc > > Tdata
Definition: Seg_ext_.hpp:89
const TSeq_data & GetSeq_data(void) const
Get the Seq_data member data.
const TRef & GetRef(void) const
Get the variant data.
Definition: Seq_ext_.cpp:136
void ResetFuzz(void)
Reset Fuzz data member.
void ResetSeq_data(void)
Reset Seq_data data member.
void ResetSeq_data(void)
Reset Seq_data data member.
Definition: Seq_inst_.cpp:125
@ eRepr_delta
sequence made by changes (delta) to others
Definition: Seq_inst_.hpp:100
@ eRepr_map
ordered map of any kind
Definition: Seq_inst_.hpp:99
@ eRepr_virtual
no seq data
Definition: Seq_inst_.hpp:93
@ eRepr_not_set
empty
Definition: Seq_inst_.hpp:92
@ e_Seg
segmented sequences
Definition: Seq_ext_.hpp:94
@ e_Map
ordered map of markers
Definition: Seq_ext_.hpp:96
@ e_Ref
hot link to another sequence (a view)
Definition: Seq_ext_.hpp:95
@ eMol_not_set
> cdna = rna
Definition: Seq_inst_.hpp:109
@ e_Literal
a piece of sequence
Definition: Delta_seq_.hpp:90
@ e_Loc
point to a sequence
Definition: Delta_seq_.hpp:89
int i
int len
const TYPE & Get(const CNamedParameterList *param)
constexpr auto sort(_Init &&init)
double value_type
The numeric datatype used by the parser.
Definition: muParserDef.h:228
Int4 delta(size_t dimension_, const Int4 *score_)
Selector used in CSeqMap methods returning iterators.
Definition: seq_map_ci.hpp:113
Definition: type.c:6
#define _ASSERT
Modified on Wed May 01 14:21:42 2024 by modify_doxy.py rev. 669887