77 m_UnknownLength(unknown_len),
80 m_RefMinusStrand(
false),
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)
184 m_Segments(sm.m_Segments),
185 m_Resolved(sm.m_Resolved.load()),
188 m_HasSegments(sm.m_HasSegments.load()),
189 m_Changed(sm.m_Changed),
190 m_SeqLength(sm.m_SeqLength.load())
196 it->m_RefObject =
null;
230 switch (ext.
Which()) {
247 "CSeq_inst.ext.map with unset CSeq_inst.length");
254 "CSeq_ext::??? -- not implemented");
270 "CSeq_inst.repr map with unset CSeq_inst.length");
282 "CSeq_inst.repr of sequence without data "
283 "should be not_set");
287 "CSeq_inst.length of sequence without data "
308 "Invalid segment index");
332 "Cannot resolve "<<seq_id<<
": null scope pointer");
337 "Cannot resolve "<<seq_id<<
": unknown");
368 "Invalid sequence length");
382 if ( index <= resolved )
386 TSeqPos seg_pos = resolved_pos;
390 "Sequence position overflow");
392 m_Segments[++resolved].m_Position = resolved_pos;
393 }
while ( resolved < index );
407 if ( resolved_pos <= pos ) {
414 TSeqPos seg_pos = resolved_pos;
418 "Sequence position overflow");
420 m_Segments[++resolved].m_Position = resolved_pos;
421 }
while ( resolved_pos <= pos );
430 TSegments::const_iterator itend =
m_Segments.begin()+resolved;
431 TSegments::const_iterator it =
524 bool resolveExternal)
const
554 if (
literal.IsSetSeq_data() ) {
559 "Invalid segment type");
578 "Invalid segment type");
580 if (
data.IsGap() ) {
581 ERR_POST(
"CSeqMap: gap Seq-data was split as real data");
617 "Cannot edit unattached sequence map");
621 "Bioseq is not in edit state");
630 if ( gap_data && !gap_data->
IsGap() ) {
632 "SetSegmentGap: Seq-data is not gap");
666 bool ref_minus_strand)
750 "cannot remove end segment");
771 "Invalid segment size");
783 "Invalid segment type");
872 size_t maxResolveCount,
899 if ( it->m_SegType ==
type ) {
910 if ( index ==
size_t(-1) && pos ==
GetLength(scope) ) {
916 if ( pos_in_seg > 0 ) {
994 if ( start >= length ) {
1000 if ( stop < start || stop > length ) {
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;
1017 vector< AutoPtr<CInitGuard> > guards;
1047 chunks.push_back(chunk);
1055 sort(chunks.begin(), chunks.end(), PByLoader());
1056 chunks.erase(unique(chunks.begin(), chunks.end()), chunks.end());
1057 while ( !chunks.empty() ) {
1060 load_chunks.clear();
1063 size_t s = chunks.size();
1068 for (
size_t i = s;
i < chunks.size(); ++
i ) {
1070 if ( guard.
get() && *guard.
get() ) {
1071 load_chunks.push_back(chunks[
i]);
1072 guards.push_back(guard);
1076 if ( !load_chunks.empty() ) {
1083 if ( !next_ids.empty() ) {
1085 vector<CBioseq_Handle> seqs =
1087 _ASSERT(seqs.size() == parent_tse.size());
1088 for (
size_t i = 0;
i < seqs.size(); ++
i ) {
1093 all_tse.push_back(tse);
1094 if ( !parent_tse[
i].AddUsedTSE(tse) ) {
1116 catch (exception&) {
1141 for (
size_t i = 1; ; ++
i ) {
1167 if ( loc.
IsInt() ) {
1190 for (
size_t i = 1; ; ++
i ) {
1361 const bool is_unknown_len = (
1382 switch ( loc.
Which() ) {
1411 "e_Bond is not allowed as a reference type");
1414 "e_Feat is not allowed as a reference type");
1417 "invalid reference type");
1424 switch ( seq.
Which() ) {
1433 "Can not add empty Delta-seq");
1465 "SeqMap segment crosses split chunk boundary");
1469 "split chunk covers bad SeqMap segment");
1499 if ( single_segment && !inst.
IsSetExt() ) {
1509 if ( single_segment && !inst.
IsSetExt() ) {
1520 CSeg_ext::Tdata::iterator iter =
data.begin();
1525 if ( iter ==
data.end() ) {
1555 CDelta_ext::Tdata::iterator iter =
delta.begin();
1559 if ( iter ==
delta.end() ) {
User-defined methods of the data storage class.
User-defined methods of the data storage class.
bool IsReverse(ENa_strand s)
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.
int GetSequenceClass(void) const
TSeqPos GetBioseqLength(void) const
void x_SetChangedSeqMap(void)
bool CanBeEdited(void) const
SeqMap related exceptions.
TSeqPos GetLength(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
CConstRef< CBioseq_Info > FindMatchingBioseq(const CSeq_id_Handle &id) const
CDataLoader & GetDataLoader(void) const
static unsigned char depth[2 *(256+1+29)+1]
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
element_type * get(void) const
Get pointer.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
const TSeqPos kInvalidSeqPos
Define special value for invalid sequence position.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#define NCBI_THROW_FMT(exception_class, err_code, message)
The same as NCBI_THROW but with message processed as output to ostream.
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.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
TBioseqHandles GetBioseqHandles(const TIds &ids)
Get bioseq handles for all ids.
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.
const CSeqMap::CSegment & x_GetSegment(void) const
void AddUsedTSE(const CTSE_Handle &tse) const
SSeqMapSelector m_Selector
const TSegmentInfo & x_GetSegmentInfo(void) const
SSeqMapSelector & SetFlags(TFlags flags)
Select segment type(s)
const CSeqMap & x_GetSeqMap(void) const
const CSeqMap & x_GetSeqMap(void) const
CSeqMap::ESegmentType GetType(void) const
SSeqMapSelector & SetRange(TSeqPos start, TSeqPos length)
Set range for iterator.
CSeq_id_Handle GetRefSeqid(void) const
The following function makes sense only when the segment is a reference to another seq.
size_t x_GetIndex(void) const
SSeqMapSelector & SetStrand(ENa_strand strand)
Set strand to iterate over.
TSeqPos GetPosition(void) const
return position of current segment in sequence
TSeqPos GetLength(void) const
return length of current segment
bool x_HasLimitTSE(void) const
void x_SetSubSeqMap(size_t index, CSeqMap_Delta_seqs *subMap)
bool HasZeroGapAt(TSeqPos pos, CScope *scope=0) const
Returns true if there is zero-length gap at position.
void SetSegmentRef(const CSeqMap_CI &seg, TSeqPos length, const CSeq_id_Handle &ref_id, TSeqPos ref_pos, bool ref_minus_strand)
atomic< TSeqPos > m_SeqLength
CSeqMap_CI End(CScope *scope) const
size_t CountSegmentsOfType(ESegmentType type) const
const_iterator begin(CScope *scope) const
STL style methods.
const_iterator end(CScope *scope) const
void x_GetSegmentException(size_t index) const
void x_SetSegmentData(size_t index, TSeqPos length, CSeq_data &data)
void SetSegmentGap(const CSeqMap_CI &seg, TSeqPos length)
void x_LoadObject(const CSegment &seg) const
CConstRef< CSeqMap > x_GetSubSeqMap(const CSegment &seg, CScope *scope, bool resolveExternal=false) const
const CBioseq_Info & x_GetBioseqInfo(const CSegment &seg, CScope *scope) const
void x_AddGap(TSeqPos len, bool unknown_len)
size_t x_FindSegment(TSeqPos position, CScope *scope) const
CSegment(ESegmentType seg_type=eSeqEnd, TSeqPos length=kInvalidSeqPos, bool unknown_len=false)
TSeqPos x_ResolveSegmentPosition(size_t index, CScope *scope) const
atomic< TSeqPos > m_Position
void x_SetSegmentGap(size_t index, TSeqPos length, CSeq_data *gap_data=0)
atomic< THasSegments > m_HasSegments
CSeqMap_CI BeginResolved(CScope *scope) const
CConstRef< CSeq_literal > x_GetSeq_literal(const CSegment &seg) const
atomic< size_t > m_Resolved
void x_SetChanged(size_t index)
CSegment & x_SetSegment(size_t index)
int x_GetSequenceClass(void) const
const CSegment & x_GetSegment(size_t index) const
const CObject * x_GetObject(const CSegment &seg) const
static CRef< CSeqMap > CreateSeqMapForSeq_loc(const CSeq_loc &loc, CScope *scope)
size_t x_GetLastEndSegmentIndex(void) const
void x_SetObject(CSegment &seg, const CObject &obj)
CSeqMap_CI Begin(CScope *scope) const
NCBI style methods.
void x_SetChunk(CSegment &seg, CTSE_Chunk_Info &chunk)
CSeqMap_CI FindSegment(TSeqPos pos, CScope *scope) const
Find segment containing the position.
vector< CSegment > m_Segments
CRef< CSeqMap > CloneFor(const CBioseq &seq) const
CSeqMap_CI FindResolved(CScope *scope, TSeqPos pos, const SSeqMapSelector &selector) 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
bool HasSegmentOfType(ESegmentType type) const
void x_AddSegment(ESegmentType type, TSeqPos len, bool unknown_len=false)
void x_StartEditing(void)
static CConstRef< CSeqMap > GetSeqMapForSeq_loc(const CSeq_loc &loc, CScope *scope)
void SetRegionInChunk(CTSE_Chunk_Info &chunk, TSeqPos pos, TSeqPos length)
void x_Add(CSeqMap *submap)
bool x_GetRefMinusStrand(const CSegment &seg) const
void LoadSeq_data(TSeqPos pos, TSeqPos len, const CSeq_data &data)
vector< CSegment > TSegments
void SetRepr(CSeq_inst::TRepr repr)
CSeqMap_CI RemoveSegment(const CSeqMap_CI &seg)
Delete segment from sequence map.
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.
static CRef< CSeqMap > CreateSeqMapForBioseq(const CBioseq &seq)
CConstRef< CObject > m_RefObject
void SetSegmentData(const CSeqMap_CI &seg, TSeqPos length, CSeq_data &data)
bool CanResolveRange(CScope *scope, const SSeqMapSelector &sel) const
CRef< CTSE_Chunk_Info > x_GetChunkToLoad(const CSegment &seg) const
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_id & x_GetRefSeqid(const CSegment &seg) const
bool x_DoUpdateSeq_inst(CSeq_inst &inst)
void x_SetSegmentRef(size_t index, TSeqPos length, const CSeq_id &ref_id, TSeqPos ref_pos, bool ref_minus_strand)
void x_AddUnloadedSeq_data(TSeqPos len)
CSegment & operator=(const CSegment &seg)
TSeqPos x_GetRefPosition(const CSegment &seg) const
void SetMol(CSeq_inst::TMol mol)
const CSeq_data & x_GetSeq_data(const CSegment &seg) const
void x_SetSeq_data(size_t index, CSeq_data &data)
size_t GetSegmentsCount(void) const
CSeqMap_CI EndResolved(CScope *scope) const
TSeqPos x_ResolveSegmentLength(size_t index, CScope *scope) const
@ eSeqData
real sequence data
@ eSeqLiteral
used only in m_ObjType for gap segments
@ eSeqRef
reference to Bioseq
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
CConstRef< C > ConstRef(const C *object)
Template function for conversion of const object pointer to CConstRef.
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
void Reset(void)
Reset reference object.
#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.
CTempString literal(const char(&str)[Size])
Templatized initialization from a string literal.
bool IsLim(void) const
Check if variant Lim is selected.
TLim GetLim(void) const
Get the variant data.
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
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.
TPoint GetPoint(void) const
Get the Point member data.
const TWhole & GetWhole(void) const
Get the variant data.
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.
const TId & GetId(void) const
Get the Id member data.
const TId & GetId(void) const
Get the Id member data.
void SetFrom(TFrom value)
Assign a value to From data member.
TStrand GetStrand(void) const
Get the Strand member data.
const Tdata & Get(void) const
Get the member data.
const TPacked_pnt & GetPacked_pnt(void) const
Get the variant data.
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.
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.
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.
bool IsInt(void) const
Check if variant Int is selected.
const TInt & GetInt(void) const
Get the variant data.
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.
const TPacked_int & GetPacked_int(void) const
Get the variant data.
@ e_not_set
No variant selected.
@ e_Equiv
equivalent sets of locations
@ e_Empty
to NULL one Seq-id in a collection
@ e_Feat
indirect, through a Seq-feat
TLiteral & SetLiteral(void)
Select the variant.
TRepr GetRepr(void) const
Get the Repr member data.
void SetLength(TLength value)
Assign a value to Length data member.
const TSeg & GetSeg(void) const
Get the variant data.
bool IsSetSeq_data(void) const
the sequence Check if a value has been assigned to Seq_data data member.
ERepr
representation class
const TInst & GetInst(void) const
Get the Inst member data.
void SetSeq_data(TSeq_data &value)
Assign a value to Seq_data data member.
TLoc & SetLoc(void)
Select the variant.
void SetExt(TExt &value)
Assign a value to Ext data member.
bool IsSetMol(void) const
Check if a value has been assigned to Mol data member.
const TLiteral & GetLiteral(void) const
Get the variant data.
bool IsSetExt(void) const
extensions for special types Check if a value has been assigned to Ext data member.
TLength GetLength(void) const
Get the Length member data.
TLength GetLength(void) const
Get the Length member data.
bool IsSeg(void) const
Check if variant Seg is selected.
const TFuzz & GetFuzz(void) const
Get the Fuzz member data.
TMol GetMol(void) const
Get the Mol member data.
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.
const TExt & GetExt(void) const
Get the Ext member data.
E_Choice Which(void) const
Which variant is currently selected.
EMol
molecule class in living organism
E_Choice Which(void) const
Which variant is currently selected.
const TDelta & GetDelta(void) const
Get the variant data.
const TLoc & GetLoc(void) const
Get the variant data.
void SetRepr(TRepr value)
Assign a value to Repr data member.
bool CanGetFuzz(void) const
Check if it is safe to call GetFuzz method.
const Tdata & Get(void) const
Get the member data.
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.
list< CRef< CDelta_seq > > Tdata
const Tdata & Get(void) const
Get the member data.
bool IsGap(void) const
Check if variant Gap is selected.
void SetSeq_data(TSeq_data &value)
Assign a value to Seq_data data member.
void ResetExt(void)
Reset Ext data member.
const TSeq_data & GetSeq_data(void) const
Get the Seq_data member data.
list< CRef< CSeq_loc > > Tdata
const TSeq_data & GetSeq_data(void) const
Get the Seq_data member data.
const TRef & GetRef(void) const
Get the variant data.
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.
@ eRepr_delta
sequence made by changes (delta) to others
@ eRepr_map
ordered map of any kind
@ eRepr_virtual
no seq data
@ e_Seg
segmented sequences
@ e_Map
ordered map of markers
@ e_Ref
hot link to another sequence (a view)
@ eMol_not_set
> cdna = rna
@ e_Literal
a piece of sequence
@ e_Loc
point to a sequence
const TYPE & Get(const CNamedParameterList *param)
constexpr auto sort(_Init &&init)
double value_type
The numeric datatype used by the parser.
Int4 delta(size_t dimension_, const Int4 *score_)
Selector used in CSeqMap methods returning iterators.