62 m_Flags(
CSeqMap::fDefaultFlags),
73 m_MaxResolveCount(resolve_count),
111 if ( !minusStrand ) {
143 m_FeaturePolicyWasApplied(
false)
156 m_FeaturePolicyWasApplied(
false)
167 m_SearchPos(
range.GetFrom()),
168 m_SearchEnd(
range.GetToOpen()),
169 m_FeaturePolicyWasApplied(
false)
181 m_FeaturePolicyWasApplied(
false)
193 m_SearchPos(
range.GetFrom()),
194 m_SearchEnd(
range.GetToOpen()),
195 m_FeaturePolicyWasApplied(
false)
208 m_Stack(1, base.m_Stack.back()),
211 m_FeaturePolicyWasApplied(
false)
214 if ( &
info.x_GetSeqMap() != &seqmap ||
215 info.x_GetIndex() != index ) {
219 info.m_LevelRangePos = 0;
221 info.m_MinusStrand = 0;
271 "Iterator out of range");
275 "Non standard Seq_data: use methods "
276 "GetRefData/GetRefPosition/GetRefMinusStrand");
286 "Iterator out of range");
296 "Iterator out of range");
306 "Iterator out of range");
316 "Iterator out of range");
327 "Iterator out of range");
415 if ( !
info.InRange() ) {
425 (
static_cast<const CSeqMap*
>(
info.m_SeqMap->x_GetObject(seg)));
435 if ( !resolveExternal ) {
438 const CSeq_id& seq_id =
info.m_SeqMap->x_GetRefSeqid(seg);
464 if ( (
m_Stack.size() & 63) == 0 ) {
467 for (
int i =
int(
m_Stack.size())-2;
i >= 0; --
i ) {
470 "Self-reference in CSeqMap");
490 push.m_SeqMap = seqMap;
492 push.m_LevelRangePos = from;
493 push.m_LevelRangeEnd = from + length;
494 if (
push.m_LevelRangeEnd <
push.m_LevelRangePos) {
497 "Sequence position overflow");
499 push.m_MinusStrand = minusStrand;
500 TSeqPos findOffset = !minusStrand? pos: length - 1 - pos;
502 if (
push.m_Index ==
size_t(-1) ) {
506 push.m_Index = !minusStrand?
513 if ( pos >= length ) {
514 if ( !minusStrand ) {
516 push.m_LevelRangeEnd ) {
519 push.m_LevelRangeEnd);
524 push.m_LevelRangePos ) {
527 push.m_LevelRangePos);
599 TSeqPos offset = search_pos > level_pos? search_pos - level_pos: 0;
618 TSeqPos end_offset = search_end < level_end? level_end - search_end: 0;
665 const CSeq_id& seq_id =
info.m_SeqMap->x_GetRefSeqid(seg);
759 sx_AdjustSelector(selector),
761 m_SeqMap(&bioseq.SetSeqMap())
771 sx_AdjustSelector(selector),
773 m_SeqMap(&bioseq.SetSeqMap())
784 sx_AdjustSelector(selector),
797 sx_AdjustSelector(selector),
832 bool ref_minus_strand)
835 *
this, ref_length, ref_id, ref_pos, ref_minus_strand);
852 CSeqMap_CI::operator=(it);
860 bool ref_minus_strand)
864 *
this, ref_length, ref_id, ref_pos, ref_minus_strand);
865 CSeqMap_CI::operator=(it);
875 CSeqMap_CI::operator=(it);
896 CSeqMap_CI::operator=(it);
907 #define CODING_UNPACK_CASE(coding) \
908 case CSeq_data::e_##coding: \
909 CSeqConvert::Convert( \
910 data->Get##coding().Get(), \
911 CSeqUtil::e_##coding, \
913 buffer, buffer_coding); \
917 switch ( src_coding ) {
930 "Unsupported seq-data type: " +
943 #define CODING_PACK_CASE(coding) \
944 case CSeq_data::e_##coding: \
945 CSeqConvert::Convert( \
946 buffer, buffer_coding, \
947 0, TSeqPos(buffer.size()), \
948 new_data->Set##coding().Set(), \
949 CSeqUtil::e_##coding); \
952 switch ( seq_data_coding ) {
965 "Unsupported seq-data type: " +
static CRef< CScope > m_Scope
User-defined methods of the data storage class.
SeqMap related exceptions.
Non-const iterator over CSeqMap (allows to edit the sequence).
CBioseq_Handle GetBioseqHandle(const CSeq_id &id) const
Get Bioseq handle from this TSE.
static unsigned char depth[2 *(256+1+29)+1]
unsigned int TSeqPos
Type for sequence locations and lengths.
const TSeqPos kInvalidSeqPos
Define special value for invalid sequence position.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string AsFastaString(void) const
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
EFeatureFetchPolicy GetFeatureFetchPolicy(void) const
const CTSE_Handle & GetTSE_Handle(void) const
Get CTSE_Handle of containing TSE.
const CTSE_Handle & GetTSE_Handle(void) const
EFeatureFetchPolicy
Feature fetch policy describes when to look for features on sequence segments.
const CSeqMap & GetSeqMap(void) const
Get sequence map.
ESequenceClass GetSequenceClass(void) const
@ eFeatureFetchPolicy_default
@ eFeatureFetchPolicy_only_near
CSeqMap_I & Remove(void)
Remove current segment.
TSeqPos x_GetLevelRealPos(void) const
CSeqMap_I & InsertRef(const CSeq_id_Handle &ref_id, TSeqPos ref_pos, TSeqPos ref_length, bool ref_minus_strand=false)
Insert reference. On return the iterator points to the new segment.
TSeqPos GetEndPosition(void) const
return end position of current segment in sequence (exclusive)
int x_GetSequenceClass(void) const
SSeqMapSelector & SetResolveCount(size_t res_cnt)
Set max depth of resolving seq-map.
size_t GetResolveCount(void) const
const CSeqMap::CSegment & x_GetSegment(void) const
const CSeq_data & GetRefData(void) const
will allow any data segments, user should check for position and strand
void x_Select(const CConstRef< CSeqMap > &seqMap, const SSeqMapSelector &selector, TSeqPos pos)
bool CanResolve(void) const
void AddUsedTSE(const CTSE_Handle &tse) const
bool Next(bool resolveExternal=true)
go to next/next segment, return false if no more segments if no_resolve_current == true,...
SSeqMapSelector & SetLinkUsedTSE(bool link=true)
TSeqPos x_GetTopOffset(void) const
TSeqPos x_CalcLength(void) const
void GetSequence(string &buffer, CSeqUtil::ECoding buffer_coding) const
Get current sequence as a string with the selected encoding.
SSeqMapSelector m_Selector
TSeqPos GetRefPosition(void) const
void SetSeq_data(TSeqPos length, CSeq_data &data)
Change current segment to data.
SSeqMapSelector & SetPosition(TSeqPos pos)
Find segment containing the position.
CSeqMap_I & InsertGap(TSeqPos length, CSeq_data *gap_data=0)
Insert gap. On return the iterator points to the new segment.
const TSegmentInfo & x_GetSegmentInfo(void) const
const CSeq_data & GetData(void) const
will allow only regular data segments (whole, plus strand)
void SetRef(const CSeq_id_Handle &ref_id, TSeqPos ref_pos, TSeqPos ref_length, bool ref_minus_strand=false)
Change current segment to reference.
CScope * GetScope(void) const
SSeqMapSelector & SetFlags(TFlags flags)
Select segment type(s)
void SetSequence(const string &buffer, CSeqUtil::ECoding buffer_coding, CSeq_data::E_Choice seq_data_coding)
Set sequence data.
CConstRef< CSeqMap > m_SeqMap
const CTSE_Handle & x_GetLimitTSE(CScope *scope=0) const
TSeqPos x_GetTopOffset(void) const
const CSeqMap::CSegment & x_GetSegment(void) const
TSeqPos GetRefPosition(void) const
bool x_RefTSEMatch(const CSeqMap::CSegment &seg) const
const CSeqMap & x_GetSeqMap(void) const
void SetGap(TSeqPos length, CSeq_data *gap_data=0)
Change current segment to gap.
bool GetRefMinusStrand(void) const
CSeqMap_I & InsertData(TSeqPos length, CSeq_data &data)
Insert data. On return the iterator points to the new segment.
bool x_CanResolve(const CSeqMap::CSegment &seg) const
CBioseq_Handle x_GetBioseq(const CSeq_id &seq_id) const
void x_UpdateLength(void)
SSeqMapSelector & SetLimitTSE(const CSeq_entry_Handle &tse)
Limit TSE to resolve references.
bool m_FeaturePolicyWasApplied
void SetFlags(TFlags flags)
CSeq_id_Handle GetRefSeqid(void) const
The following function makes sense only when the segment is a reference to another seq.
bool IsUnknownLength(void) const
return true if current segment is a gap of unknown length
SSeqMapSelector::TFlags TFlags
static SSeqMapSelector sx_AdjustSelector(const SSeqMapSelector &selector)
bool x_Move(bool minusStrand, CScope *scope)
TFlags GetFlags(void) const
vector< CTSE_Handle > * m_UsedTSEs
bool x_Push(TSeqPos offset, bool resolveExternal)
TSeqPos x_GetLevelRealEnd(void) const
TSeqPos GetPosition(void) const
return position of current segment in sequence
int x_GetSequenceClass(void) const
TSeqPos GetLength(void) const
return length of current segment
bool x_HasLimitTSE(void) const
CConstRef< CSeq_literal > GetRefGapLiteral(void) const
return CSeq_literal with gap data, or null if either the segment is not a gap, or an unspecified gap
void SetSegmentRef(const CSeqMap_CI &seg, TSeqPos length, const CSeq_id_Handle &ref_id, TSeqPos ref_pos, bool ref_minus_strand)
void SetSegmentGap(const CSeqMap_CI &seg, TSeqPos length)
size_t x_FindSegment(TSeqPos position, CScope *scope) const
atomic< TSeqPos > m_Position
CConstRef< CSeq_literal > x_GetSeq_literal(const CSegment &seg) const
int x_GetSequenceClass(void) const
const CSegment & x_GetSegment(size_t index) const
size_t x_GetLastEndSegmentIndex(void) const
TSeqPos x_GetSegmentLength(size_t index, CScope *scope) const
size_t x_GetFirstEndSegmentIndex(void) const
TSeqPos x_GetSegmentPosition(size_t index, CScope *scope) const
TSeqPos x_GetSegmentEndPosition(size_t index, CScope *scope) const
CSeqMap_CI RemoveSegment(const CSeqMap_CI &seg)
Delete segment from sequence map.
void SetSegmentData(const CSeqMap_CI &seg, TSeqPos length, CSeq_data &data)
CSeqMap_CI InsertSegmentGap(const CSeqMap_CI &seg, TSeqPos length)
Insert new gap into sequence map.
atomic< TSeqPos > m_Length
TSeqPos GetLength(CScope *scope) const
const CSeq_data & x_GetSeq_data(const CSegment &seg) const
@ eSeqData
real sequence data
@ eSeqRef
reference to Bioseq
CConstRef< C > ConstRef(const C *object)
Template function for conversion of const object pointer to CConstRef.
int8_t Int1
1-byte (8-bit) signed integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
range(_Ty, _Ty) -> range< _Ty >
#define CODING_PACK_CASE(coding)
#define CODING_UNPACK_CASE(coding)
Selector used in CSeqMap methods returning iterators.