:
return "eNotSet";
158 if( points.size() == 1 ) {
176 if( ranges.size() == 1 ) {
178ranges.front().GetFrom(), ranges.front().GetTo(), strand));
194 switch( src.
Which() ) {
216 "Int-fuzz is not set");
320 data.back()->Assign(**
i);
332 data.back()->Assign(**
i);
342 switch( loc.
Which() ) {
391 m_IdCache.store(
id, memory_order_release);
404 boolmay_throw)
const 406 if( total_id ==
id) {
412}
else if( (
id&& !total_id->
Equals(*
id)) ) {
415 "CSeq_loc::GetTotalRange() is not defined " 416 "for seq-loc with several different seq-ids");
432 switch(
Which() ) {
464total_range.
Set(pos, pos);
486total_range +=
TRange(pos, pos);
497total_range += (*li)->x_CalculateTotalRangeCheckId(
id);
507total_range += (*li)->x_CalculateTotalRangeCheckId(
id);
518total_range =
TRange(pos, pos);
523total_range +=
TRange(pos, pos);
531 "CSeq_loc::CalculateTotalRange(): " 532 "unsupported location type: "<<
544 if( !id1 || !id2 ) {
546 "CSeq_loc::Compare(): " 547 "cannot compare locations with several different seq-ids");
562 boolcircular1 = from1 > to1;
563 boolcircular2 = from2 > to2;
564 if(
intdiff = circular2 - circular1 ) {
569 if( from1 != from2 ) {
570 returnfrom1 < from2? -1: 1;
574 returnto1 > to2? -1: 1;
585 if(s1 != s2)
returns1 < s2 ? -1 : 1;
608 for( ; iter1 && iter2; ) {
610 for(
intk = 0; k < 2; ++k ) {
636 if( !loc->
IsMix() ) {
644 if( loc1 && !loc2 ) {
648 if( loc2 && !loc1 ) {
652 if( !loc1 && !loc2 ) {
656id1 = loc1->
GetId();
657id2 = loc2->
GetId();
663 if( iter1 && !iter2 ) {
667 if( iter2 && !iter1 ) {
712 return!filter || (*filter)( loc.
GetId() );
719 return!filter || (*filter)( &loc.
GetId() );
728 if( minus_strand ) {
756 template<
classContainer1,
classContainer2 >
758 constContainer2& container2,
762 typenameContainer1::const_iterator iter1 = container1.begin();
763 typenameContainer1::const_iterator iter1end = container1.end();
764 typenameContainer2::const_iterator iter2 = container2.begin();
765 typenameContainer2::const_iterator iter2end = container2.end();
766 for( ; iter1 != iter1end && iter2 != iter2end ; ++iter1, ++iter2 ) {
769 if(
NULL!= filter ) {
776 if( iter1 == iter1end || iter2 == iter2end ) {
790 if( iter1 == iter1end ) {
791 if( iter2 == iter2end ) {
810 if( loc2.
IsMix() ) {
824 returnminus_strand? -1: 1;
828 if( loc2.
IsMix() ) {
842 returnminus_strand? -1: 1;
848 returnminus_strand? 1: -1;
860 switch(
Which() ) {
884 switch(
Which() ) {
909 "CSeq_loc::GetStrand(): unsupported location type"<<
917 switch(
Which() ) {
957 "CSeq_loc::GetStart(): " 965 switch(
Which() ) {
1005 "CSeq_loc::GetStop(): " 1021 return minus? (seq_len - stop + start + 1) : (stop - start + 1);
1023 return minus? (start - stop + 1) : (seq_len - start + stop + 1);
1043: m_IsSetStrand(
false),
1113 returnpart ==
m_Parts.begin()? 0: *--part;
1190 return info.m_Loc &&
info.m_Loc->IsPnt();
1194 if( !
info.m_Loc ) {
1197 switch(
info.m_Loc->Which() ) {
1241 bool CanBeBond(
size_tidx_begin,
size_tidx_end)
const;
1250 return info.m_Loc &&
info.m_Loc->IsBond();
1293 if( it->Contains(idx) ) {
1303 if( it->Contains(idx) ) {
1311vector<const SEquivSet*> sets;
1313 if( it->Contains(idx) ) {
1314sets.push_back(&*it);
1317 if( level >= sets.size() ) {
1319 "CSeq_loc_CI: bad equiv set level: "<<level);
1322 return*sets[level];
1401: m_HasChanges(
false),
1411m_EmptyFlag(empty_flag),
1412m_HasChanges(
false),
1430 template<
classContainer>
1433 if( cont.size()+add_size > cont.capacity() ) {
1434cont.reserve(
max(cont.size()+add_size, cont.capacity()*2));
1441 switch( loc.
Which() ) {
1528 size_tpart_start =
m_Ranges.size();
1530 size_tpart_end =
m_Ranges.size();
1531 if( part_start != part_end ) {
1533eq_set.
m_Parts.push_back(part_end-start);
1536 if( !eq_set.
m_Parts.empty() ) {
1553 "CSeq_loc_CI: unsupported location type: "<<
1608 if( eq_end <= begin || eq_begin >= end ) {
1612 if( eq_begin > begin && eq_begin < end ) {
1614ret =
min(ret, eq_begin);
1625 returnret == end? 0: ret;
1639 if( eq_begin < begin || eq_end > end ) {
1642 if( used_equivs.
find(&eq_set) != used_equivs.
end() ) {
1646 if( !ret ||
PByLevel()(ret, &eq_set) ) {
1662 if( idx < start_index ) {
1667 size_t offset= idx - start_index;
1668 size_tprev_offset = 0;
1672 if( *it2 == prev_offset ) {
1689 return(idx > start && idx <= end) || (idx == start && idx == 0);
1704 else if( idx <
m_Ranges.size() ) {
1709 switch( loc->
Which() ) {
1739vector<SEquivSet*> add_to_set_mid;
1746 if( idx == eq_start &&
1752 if( !add_to_set_beg ||
PByLevel()(&eq_set, add_to_set_beg) ) {
1753add_to_set_beg = &eq_set;
1756 else if( idx == eq_end &&
1760 if( !add_to_set_end ||
PByLevel()(&eq_set, add_to_set_end) ) {
1761add_to_set_end = &eq_set;
1764 else if( idx > eq_start && idx < eq_end ) {
1766add_to_set_mid.push_back(&eq_set);
1768 else if( idx <= eq_start ) {
1773 sort(add_to_set_mid.begin(), add_to_set_mid.end(),
PByLevel());
1774 if( add_to_set_beg ) {
1781add_to_set_beg->
m_Parts.insert(add_to_set_beg->
m_Parts.begin(), 1);
1785 else if( add_to_set_end ) {
1789add_to_set_end->
m_Parts.push_back(add_to_set_end->
m_Parts.back()+1);
1793++add_to_set_end->
m_Parts.back();
1797!add_to_set_mid.empty() ) {
1798 SEquivSet& eq_set = **add_to_set_mid.begin();
1799add_to_set_mid.erase(add_to_set_mid.begin());
1802 for( ; it != eq_set.
m_Parts.end(); ++it ) {
1807 ITERATE( vector<SEquivSet*>, set_it, add_to_set_mid ) {
1810 for( ; it != eq_set.
m_Parts.end(); ++it ) {
1820eq_set.
m_Parts.push_back(1);
1830 if(
info.m_Range.GetLength() != 1 ) {
1833 if(
info.m_Fuzz.first !=
info.m_Fuzz.second ) {
1836 if( !
info.m_IdHandle ) {
1845 if(
info.m_Range.Empty() ||
info.m_Range.IsWhole() ) {
1848 if( !
info.m_IdHandle ) {
1857 size_t count= idx_end - idx_begin;
1864 if(
GetBondRange(idx_begin) != make_pair(idx_begin, idx_end) ) {
1867 for(
size_tidx = idx_begin; idx < idx_end; ++idx ) {
1885 while( idx > 0 &&
m_Ranges[idx-1].m_Loc == loc ) {
1907 "CSeq_loc_I::RemoveBond(): " 1908 "there is no bond at current position");
1913 for( idx = range.first; idx < range.second; ++idx ) {
1921pair<size_t, size_t> range;
1925 size_tbond_len = range.second-range.first;
1926 if( bond_len > 0 ) {
1928 if( idx != range.first ) {
1930 "CSeq_loc_I::MakeBondA(): " 1931 "current position is B part of other bond");
1933 if( bond_len == 1 ) {
1939 for( idx = range.first+1; idx < range.second; ++idx ) {
1954 "CSeq_loc_I::MakeBondAB(): " 1955 "no more parts in the location");
1957pair<size_t, size_t> range;
1961 size_tbond_len = range.second-range.first;
1962 if( bond_len > 0 ) {
1964 if( idx != range.first ) {
1966 "CSeq_loc_I::MakeBondAB(): " 1967 "current position is B part of other bond");
1969 if( bond_len == 2 ) {
1974 if( bond_len > 2 ) {
1976 for( idx = range.first+2; idx < range.second; ++idx ) {
1995 "CSeq_loc_I::MakeBondB(): " 1996 "no parts before current");
1998pair<size_t, size_t> range;
2005 size_tbond_len = range.second-range.first;
2006 if( bond_len > 0 ) {
2008 if( range.first != idx + 1 ) {
2010 "CSeq_loc_I::MakeBondB(): " 2011 "current position is not a B part of other bond");
2013 if( bond_len == 2 ) {
2018 if( bond_len > 2 ) {
2020 for( idx = range.first+2; idx < range.second; ++idx ) {
2037 size_tidx_end)
const 2041 if( idx_begin+1 < idx_end ) {
2051 if( !
info.m_IdHandle ) {
2053 "CSeq_loc_I: part id is null");
2070 if(
info.m_IsSetStrand ) {
2076 if(
info.m_Fuzz.first ) {
2121 if(
info.m_Loc ) {
2122 switch(
info.m_Loc->Which() ) {
2128 info.m_Loc =
null;
2143seq_int->
SetTo(
info.m_Range.GetTo());
2144 if(
info.m_IsSetStrand ) {
2147 if(
info.m_Fuzz.first ) {
2150 if(
info.m_Fuzz.second ) {
2170 if(
info.m_Range.IsWhole() ) {
2174 if( !
info.m_Range.Empty() ) {
2176 "CSeq_loc_I::MakeSeq_loc(): " 2177 "cannot determine type of loc part");
2179 if(
info.m_IdHandle ) {
2196 else if(
info.m_Range.IsWhole() ||
info.m_Range.Empty() ) {
2206 size_tidx_end)
const 2208 _ASSERT(idx_end >= idx_begin);
2209 if( idx_end == idx_begin ) {
2213 for(
size_tidx = idx_begin; idx < idx_end; ++idx ) {
2221 if( idx != idx_begin ) {
2231 if(
info.m_Fuzz.first != info0.
m_Fuzz.first ) {
2244 size_tidx_end)
const 2246 _ASSERT(idx_end >= idx_begin);
2247 for(
size_tidx = idx_begin; idx < idx_end; ++idx ) {
2263 size_tidx_end)
const 2272 if( info0.
m_Fuzz.first ) {
2275pnts.
SetPoints().reserve(idx_end-idx_begin);
2276 for(
size_tidx = idx_begin; idx < idx_end; ++idx ) {
2285 size_tidx_end)
const 2289 for(
size_tidx = idx_begin; idx < idx_end; ++idx ) {
2303 if( !loc->
IsMix() ) {
2306loc->
SetMix().Set().push_back(loc1);
2308loc->
SetMix().Set().push_back(loc2);
2318used_equivs.
insert(eq_set);
2319 size_tidx = eq_set->GetStartIndex();
2321 if( idx > idx_begin ) {
2322loc =
MakeLoc(idx_begin, idx, make_type, used_equivs);
2327 size_tpart_end = eq_set->GetPartEndIndex(it);
2329 MakeLoc(idx, part_end, make_type, used_equivs);
2330equiv.
Set().push_back(part_loc);
2334 if( idx < idx_end ) {
2335loc2 =
MakeLoc(idx, idx_end, make_type, used_equivs);
2336 if( loc2->
IsMix() ) {
2350 "CSeq_loc_I::MakeSeq_loc: equiv set overlaps with range");
2353 if( idx_begin == idx_end ) {
2373idx_end - idx_begin > 1 ) {
2384 for(
size_tidx = idx_begin; idx < idx_end; ++idx ) {
2387 if( range.first < idx || range.second > idx_end ||
2388!
CanBeBond(range.first, range.second) ) {
2390 "CSeq_loc_I::MakeSeq_loc: " 2394idx = range.second-1;
2403 if( (!
info.m_Loc ||
info.m_Loc->IsInt()) &&
2450: m_Impl(iter.m_Impl),
2463: m_Impl(iter.m_Impl),
2464m_Index(iter.m_Index)
2492 return!(*
this== iter);
2517pair<CSeq_loc_CI, CSeq_loc_CI>
2522 returnmake_pair(
CSeq_loc_CI(*
this, indexes.first),
2547pair<CSeq_loc_CI, CSeq_loc_CI>
2552 returnmake_pair(
CSeq_loc_CI(*
this, indexes.first),
2557pair<CSeq_loc_CI, CSeq_loc_CI>
2562 returnmake_pair(
CSeq_loc_CI(*
this, indexes.first),
2579 "CSeq_loc_CI::GetSeq_loc(): NULL seq-loc");
2589 if(
info.m_Loc ) {
2590 switch(
info.m_Loc->Which() ) {
2619 "iterator is not valid");
2625 return "CSeq_loc_CI";
2647 "position is too big: "<<pos<<
" > "<<
GetSize());
2662:
CSeq_loc_CI(loc, eEmpty_Allow, eOrder_Biological)
2687 return "CSeq_loc_I";
2701 info.m_Id =
id.GetSeqId();
2702 info.m_IdHandle = id;
2768 info.m_Range.SetFrom(pos).SetLength(1);
2770 info.SetStrand(strand);
2785 info.m_Range = range;
2787 info.SetStrand(strand);
2800 if(
info.m_IdHandle !=
id) {
2811 if(
info.m_Range != range ) {
2812 info.m_Range = range;
2822 if(
info.m_Range.GetFrom() != from ) {
2823 info.m_Range.SetFrom(from);
2833 if(
info.m_Range.GetTo() != to ) {
2834 info.m_Range.SetTo(to);
2860 if(
info.m_IsSetStrand ) {
2861 info.m_IsSetStrand =
false;
2872 if( !
info.m_IsSetStrand ||
info.m_Strand != strand ) {
2873 info.SetStrand(strand);
2883 if(
info.m_Fuzz.first ) {
2884 info.m_Fuzz.first =
null;
2894 if( !
info.m_Fuzz.first || !
info.m_Fuzz.first->Equals(fuzz) ) {
2905 if(
info.m_Fuzz.second ) {
2906 info.m_Fuzz.second =
null;
2916 if( !
info.m_Fuzz.second || !
info.m_Fuzz.second->Equals(fuzz) ) {
2927 if(
info.m_Fuzz.first ||
info.m_Fuzz.second ) {
2928 info.m_Fuzz.first =
info.m_Fuzz.second =
null;
2938 if( !
info.m_Fuzz.first || !
info.m_Fuzz.first->Equals(fuzz) ||
2939 info.m_Fuzz.first !=
info.m_Fuzz.second ) {
2952pair<CSeq_loc_I, CSeq_loc_I>
2957 returnmake_pair(
CSeq_loc_I(*
this, indexes.first),
2962pair<CSeq_loc_I, CSeq_loc_I>
2967 returnmake_pair(
CSeq_loc_I(*
this, indexes.first),
3009 id.WriteAsFasta(os);
3022 if( !last_id || !last_id->
Match(pnt.
GetId()) ) {
3029*
label+= GetTypeInfo_enum_ENa_strand()
3042last_id = &pnt.
GetId();
3054 if(!last_id || !last_id->
Match(itval.
GetId())) {
3058last_id = &itval.
GetId();
3101 bool first=
false);
3142 switch(loc.
Which()) {
3182 if( !
str.empty() ) {
3212*
label+=
"(feat)";
3215*
label+=
"(?\?)";
3224 switch(
Which()) {
3253 switch(
Which()) {
3286 switch(
Which()) {
3319 switch(
Which()) {
3348 switch(
Which()) {
3374 switch(
Which()) {
3404 switch(
Which()) {
3437 switch(
Which()) {
3477 switch(
Which()) {
3491(*iter)->SetId(
id);
3501(*iter)->SetId(
id);
3515(*iter)->SetId(
id);
3530<<
"unhandled loc type in CSeq_loc::SetId(): e_Feat");
3543 switch(
Which() ) {
3591 if( !(*li)->CheckId(
id, may_throw) ) {
3614 if( !(*li)->CheckId(
id, may_throw) ) {
3624 "CSeq_loc::CheckId(): " 3625 "unsupported location type: "<<
3635 switch(
Which() ) {
3655mix.
Set().push_back(ival);
3672 switch(
Which() ) {
3699 if(
GetPnt().IsSetFuzz()) {
3716vector<CRef<CSeq_loc> > sub_locs;
3720new_sub_loc->
Assign(**orig_sub_loc);
3722sub_locs.push_back(new_sub_loc);
3726 copy((*sub_loc)->GetPacked_int().Get().begin(),
3727(*sub_loc)->GetPacked_int().Get().end(),
3734 "CSeq_loc::ChangeToPackedInt(): " 3735 "Can not convert location to packed-int: "<<
3764 if( other.
IsInt() ) {
3790 if( other.
IsPnt() ) {
3798 template<
typenameT1,
typenameT2>
3812 const CSeq_id* id1 = obj1.CanGetId() ? &obj1.GetId() : 0;
3813 const CSeq_id* id2 = obj2.CanGetId() ? &obj2.GetId() : 0;
3815 if(id1 == 0 && id2 == 0)
return true;
3817 if(id1 == 0 || id2 == 0 || !id1->
Match(*id2) ) {
3824 const CInt_fuzz* f1 = obj1.CanGetFuzz() ? &obj1.GetFuzz() : 0;
3825 const CInt_fuzz* f2 = obj2.CanGetFuzz() ? &obj2.GetFuzz() : 0;
3827 if(f1 == 0 && f2 == 0)
return true;
3829 if(f1 == 0 || f2 == 0 || !f1->
Equals(*f2)) {
3840 switch( loc1.
Which() ) {
3843 switch( loc2.
Which() ) {
3855 switch( loc2.
Which() ) {
3878 switch(
Which() ) {
3922 if( other.
IsInt() ) {
3934 if( other.
IsPnt() ) {
3963 "cannot add sub-location to location of type: "<<
3971 switch(
Which() ) {
4063 else if(old_from == rg.GetFrom()) {
4067 if(old_to !=
GetTo()) {
4070 else if(old_to == rg.GetTo()) {
4085 if(old_to !=
GetTo()) {
4095 TFuzzcopy_from_cref;
4096 if(copy_from == fuzz) copy_from_cref.
Reset(copy_from);
4102new_fuzz->
Assign(*copy_from);
4104fuzz.
Reset(new_fuzz);
4109 const TFuzz& other,
4133 switch( fz.
Which() ) {
4139 boolother_rev =
IsReverse(other_strand);
4146 switch( fz.
GetLim() ) {
4158 if((!this_rev && other_lt) ||
4159(this_rev && other_gt)) {
4164 if((!this_rev && other_gt) ||
4165(this_rev && other_lt)) {
4170 if(other_lim == this_lim) {
4184new_fuzz->
SetAlt().insert(
4185new_fuzz->
SetAlt().end(),
4197 if(min1 > min2 || max1 < max2) {
4208 if(fz.
GetP_m() < pm) {
4218 if(fz.
GetPct() < pct) {
4237 classCSeq_id_Handle_Wrapper
4245 if(
id.IsLocal() &&
id.GetLocal().IsStr()) {
4256 return m_Handle== handle.m_Handle;
4261 return m_Handle!= handle.m_Handle;
4263 bool operator<(
constCSeq_id_Handle_Wrapper& handle)
const 4290 if( rg1.IsWhole() ) {
4291 return!rg2.IsWhole();
4293 if( rg1.Empty() ) {
4294 return!rg2.Empty() && !rg2.IsWhole();
4296 return!rg2.IsWhole() && !rg2.Empty() && rg1 < rg2;
4308 if( rg1.IsWhole() ) {
4309 return!rg2.IsWhole();
4311 if( rg1.Empty() ) {
4312 return!rg2.Empty() && !rg2.IsWhole();
4314 if( rg2.IsWhole() || rg2.Empty() ) {
4317 if(rg1.GetTo() != rg2.GetTo()) {
4318 returnrg1.GetTo() > rg2.GetTo();
4320 returnrg1.GetFrom() < rg2.GetFrom();
4343 if(rg1.GetFrom() <= rg2.GetFrom() && rg1.GetTo() >= rg2.GetTo()) {
4345 if(rg1.GetFrom() == rg2.GetFrom()) {
4346rg1.AddFuzzFrom(rg2);
4348 if(rg1.GetTo() == rg2.GetTo()) {
4353 if(rg1.GetFrom() >= rg2.GetFrom() && rg1.GetTo() <= rg2.GetTo()) {
4355 boolsame_from = rg1.GetFrom() == rg2.GetFrom();
4356 boolsame_to = rg1.GetTo() == rg2.GetTo();
4359rg1.AddFuzzFrom(rg2);
4369rg1.IntersectingWith(rg2) ) {
4376 if( rg1.GetToOpen() == rg2.GetFrom() ) {
4382 if(rg1.GetFrom() == rg2.GetToOpen()) {
4394 constCSeq_id_Handle_Wrapper& idh,
4399 if( !dst.
IsMix() ) {
4405 if(dst.
IsMix()) {
4414 id->Assign(*idh.GetSeqId());
4415 if( rg.IsWhole() ) {
4416 if(dst.
IsMix()) {
4418 whole->SetWhole(*
id);
4425 else if( rg.Empty() ) {
4426 if(dst.
IsMix()) {
4428 empty->SetEmpty(*
id);
4435 else if( rg.GetLength() == 1 &&
4436rg.IsSetFuzzFrom() == rg.IsSetFuzzTo() &&
4437( !rg.IsSetFuzzFrom() ||
4438rg.GetFuzzFrom().Equals(rg.GetFuzzTo()) ) )
4442pnt->
SetId(*
id);
4447 if( rg.IsSetFuzzFrom() ) {
4448pnt->
SetFuzz().Assign(rg.GetFuzzFrom());
4449}
else if( rg.IsSetFuzzTo() ) {
4450pnt->
SetFuzz().Assign(rg.GetFuzzTo());
4452 if(dst.
IsMix()) {
4455dst.
SetMix().Set().push_back(pnt_loc);
4462 if(dst.
IsMix()) {
4466ival.
SetTo(rg.GetTo());
4467ival.
SetId().Assign(*
id);
4471 if( rg.IsSetFuzzFrom() ) {
4474 if( rg.IsSetFuzzTo() ) {
4477dst.
SetMix().Set().push_back(int_loc);
4484 if( rg.IsSetFuzzFrom() ) {
4487 if( rg.IsSetFuzzTo() ) {
4488interval->
SetFuzz_to().Assign(rg.GetFuzzTo());
4503CSeq_id_Handle_Wrapper first_id;
4506CSeq_id_Handle_Wrapper next_id(syn_mapper.
GetBestSynonym(it.GetSeq_id()), it.GetSeq_id());
4513 if(next_id && first_id != next_id) {
4515 "Can not merge multi-id seq-loc");
4520first_strand = it.GetStrand();
4526 id->Assign(*first_id.GetSeqId());
4531 if( total_rg.IsSetFuzzFrom() ) {
4532interval->
SetFuzz_from().Assign(total_rg.GetFuzzFrom());
4534 if( total_rg.IsSetFuzzTo() ) {
4535interval->
SetFuzz_to().Assign(total_rg.GetFuzzTo());
4554 if( !id_it->first ) {
4563 id->Assign(*id_it->first.GetSeqId());
4564 TRanges& ranges = id_it->second;
4575 boolhave_range =
false;
4578*rg, default_strand,
4585 x_PushRange(dst, id_it->first, last_rg, default_strand);
4591 x_PushRange(dst, id_it->first, last_rg, default_strand);
4604CSeq_id_Handle_Wrapper last_id;
4607 boolhave_range =
false;
4609CSeq_id_Handle_Wrapper idh(syn_mapper.
GetBestSynonym(it.GetSeq_id()), it.GetSeq_id());
4612 if( have_range && last_id == idh ) {
4628last_strand = it.GetStrand();
4648unique_ptr<TIdToRangeMap> pid_map_minus(use_strand ?
4652*pid_map_minus.get() : id_map_plus;
4660CSeq_id_Handle_Wrapper idh(syn_mapper.
GetBestSynonym(it.GetSeq_id()), it.GetSeq_id());
4666default_minus = strand;
4668 else if(default_minus != strand) {
4677default_plus = strand;
4679 else if(default_plus != strand) {
4711CSeq_id_Handle_Wrapper first_id;
4714CSeq_id_Handle_Wrapper next_id(syn_mapper.
GetBestSynonym(it.GetSeq_id()), it.GetSeq_id());
4721 if(next_id && first_id != next_id) {
4723 "Can not merge multi-id seq-loc");
4728first_strand = it.GetStrand();
4731 if(it_range.GetFrom() >= total_rg.GetFrom() &&
4732it_range.GetTo() <= total_rg.GetTo()) {
4736 if( it_range.IsWhole() ) {
4737it_range.SetOpen(0, len_getter.
GetLength(it.GetSeq_id()));
4738it_range.ResetFuzzFrom();
4739it_range.ResetFuzzTo();
4743rg_coll_minus : rg_coll_plus;
4745 if(id_it != rg_coll.
end()) {
4746it_rg_coll -= id_it->second;
4749 if(curr_rg.GetFrom() == it_range.GetFrom()) {
4750curr_rg.AddFuzzFrom(it_range);
4752 if(curr_rg.GetTo() == it_range.GetTo()) {
4753curr_rg.AddFuzzTo(it_range);
4757 const TFuzzMap& fm_from =
IsReverse(it.GetStrand()) ? fuzz_from_minus : fuzz_from_plus;
4759 if(subtr_fuzz != fm_from.
end()) {
4760curr_rg.AddFuzzTo(*subtr_fuzz->second, it.GetStrand());
4762 const TFuzzMap& fm_to =
IsReverse(it.GetStrand()) ? fuzz_to_minus : fuzz_to_plus;
4763subtr_fuzz = fm_to.
find(curr_rg.GetFrom());
4764 if(subtr_fuzz != fm_to.
end()) {
4765curr_rg.AddFuzzFrom(*subtr_fuzz->second, it.GetStrand());
4768total_rg += curr_rg;
4773 id->Assign(*first_id.GetSeqId());
4778 if( total_rg.IsSetFuzzFrom() ) {
4780fuzz->
Assign(total_rg.GetFuzzFrom());
4783 if( total_rg.IsSetFuzzTo() ) {
4785fuzz->
Assign(total_rg.GetFuzzTo());
4811CSeq_id_Handle_Wrapper last_id;
4814 boolhave_range =
false;
4816CSeq_id_Handle_Wrapper idh(syn_mapper.
GetBestSynonym(it.GetSeq_id()), it.GetSeq_id());
4819 if( it_range.IsWhole() ) {
4820it_range.SetOpen(0, len_getter.
GetLength(it.GetSeq_id()));
4824rg_coll_minus : rg_coll_plus;
4826list<TRangeWithFuzz> result_ranges;
4827 boolmodified =
false;
4828 if(id_it != rg_coll.
end()) {
4832it_rg_coll -= id_it->second;
4836result_ranges.push_front(*result_it);
4839result_ranges.push_back(*result_it);
4847 ITERATE(list<TRangeWithFuzz>, rg_it, result_ranges) {
4849 if(curr_rg.GetFrom() == it_range.GetFrom()) {
4850curr_rg.AddFuzzFrom(it_range);
4852 if(curr_rg.GetTo() == it_range.GetTo()) {
4853curr_rg.AddFuzzTo(it_range);
4857 const TFuzzMap& fm_from =
IsReverse(it.GetStrand()) ? fuzz_from_minus : fuzz_from_plus;
4859 if(subtr_fuzz != fm_from.
end()) {
4860curr_rg.AddFuzzTo(*subtr_fuzz->second, it.GetStrand());
4862 const TFuzzMap& fm_to =
IsReverse(it.GetStrand()) ? fuzz_to_minus : fuzz_to_plus;
4863subtr_fuzz = fm_to.
find(curr_rg.GetFrom());
4864 if(subtr_fuzz != fm_to.
end()) {
4865curr_rg.AddFuzzFrom(*subtr_fuzz->second, it.GetStrand());
4868 if( have_range && last_id == idh ) {
4884last_strand = it.GetStrand();
4890 boolmerged =
false;
4891 if(last_id == idh) {
4904last_strand = it.GetStrand();
4933unique_ptr<TIdToRangeMap> p_id_map_minus(use_strand ?
4937*p_id_map_minus.get() : id_map_plus;
4946CSeq_id_Handle_Wrapper idh(syn_mapper.
GetBestSynonym(it.GetSeq_id()), it.GetSeq_id());
4948 if( it_range.IsWhole() ) {
4949it_range.SetOpen(0, len_getter.
GetLength(it.GetSeq_id()));
4950it_range.ResetFuzzFrom();
4951it_range.ResetFuzzTo();
4955id_map_minus[idh] : id_map_plus[idh];
4957rg_coll_minus : rg_coll_plus;
4959 boolmodified =
false;
4960 if(id_it != rg_coll.
end()) {
4964it_rg_coll -= id_it->second;
4974 if(curr_rg.GetFrom() == it_range.GetFrom()) {
4975curr_rg.AddFuzzFrom(it_range);
4977 if(curr_rg.GetTo() == it_range.GetTo()) {
4978curr_rg.AddFuzzTo(it_range);
4982 const TFuzzMap& fm_from =
IsReverse(it.GetStrand()) ? fuzz_from_minus : fuzz_from_plus;
4984 if(subtr_fuzz != fm_from.
end()) {
4985curr_rg.AddFuzzTo(*subtr_fuzz->second, it.GetStrand());
4987 const TFuzzMap& fm_to =
IsReverse(it.GetStrand()) ? fuzz_to_minus : fuzz_to_plus;
4988subtr_fuzz = fm_to.
find(curr_rg.GetFrom());
4989 if(subtr_fuzz != fm_to.
end()) {
4990curr_rg.AddFuzzFrom(*subtr_fuzz->second, it.GetStrand());
4993rg_map.push_back(curr_rg);
4997rg_map.push_back(it_range);
5040unique_ptr<CDummySynonymMapper> p_mapper;
5041 if( !syn_mapper ) {
5043syn_mapper = p_mapper.get();
5064unique_ptr<CDummySynonymMapper> p_mapper;
5065 if( !syn_mapper ) {
5067syn_mapper = p_mapper.get();
5072 tmp.SetMix().AddSeqLoc(
const_cast<CSeq_loc&
>(*
this));
5073 tmp.SetMix().AddSeqLoc(
const_cast<CSeq_loc&
>(other));
5092unique_ptr<CDummySynonymMapper> p_mapper;
5093 if( !syn_mapper ) {
5095syn_mapper = p_mapper.get();
5097unique_ptr<CDummyLengthGetter> p_getter;
5098 if( !len_getter ) {
5100len_getter = p_getter.get();
5108unique_ptr<TIdToRangeColl> p_rg_coll_minus(use_strand ?
5112*p_rg_coll_minus.get() : rg_coll_plus;
5117 TFuzzMapfuzz_from_plus, fuzz_from_minus, fuzz_to_plus, fuzz_to_minus;
5121 if( it.IsEmpty() ) {
5124CSeq_id_Handle_Wrapper idh(syn_mapper->
GetBestSynonym(it.GetSeq_id()), it.GetSeq_id());
5126rg_coll_minus[idh] : rg_coll_plus[idh];
5129 const CInt_fuzz* fuzz = it.GetFuzzFrom();
5131 if(it.IsSetStrand() &&
IsReverse(it.GetStrand())) {
5132fuzz_from_minus[it.GetRange().GetFrom()].Reset(fuzz);
5135fuzz_from_plus[it.GetRange().GetFrom()].Reset(fuzz);
5138fuzz = it.GetFuzzTo();
5140 if(it.IsSetStrand() &&
IsReverse(it.GetStrand())) {
5141fuzz_to_minus[it.GetRange().GetToOpen()].Reset(fuzz);
5144fuzz_to_plus[it.GetRange().GetToOpen()].Reset(fuzz);
5152fuzz_from_plus, fuzz_from_minus, fuzz_to_plus, fuzz_to_minus,
5161fuzz_from_plus, fuzz_from_minus, fuzz_to_plus, fuzz_to_minus,
5171fuzz_from_plus, fuzz_from_minus, fuzz_to_plus, fuzz_to_minus,
5191syn_mapper, len_getter.get());
5198 switch(
Which() ) {
5223 switch(
Which() ) {
5249 #undef NCBI_USE_ERRCODE_XUser-defined methods of the data storage class.
bool IsReverse(ENa_strand s)
ESeqLocExtremes
Used to determine the meaning of a location's Start/Stop positions.
@ eExtreme_Positional
numerical value
@ eExtreme_Biological
5' and 3'
EIsSetStrand
Flag used by IsSetStrand() to switch between any/all modes.
User-defined methods of the data storage class.
void x_Assign(CInt_fuzz &dst, const CInt_fuzz &src)
int s_CompareIntervals(const Container1 &container1, const Container2 &container2, bool minus_strand, const CSeq_loc::ISubLocFilter *filter)
static void x_RangesToSeq_loc(CSeq_loc &dst, TIdToRangeMap &id_map, ENa_strand default_strand, CSeq_loc::TOpFlags flags)
static bool x_MatchStrand(ENa_strand str1, ENa_strand str2, CSeq_loc::TOpFlags flags)
map< CSeq_id_Handle_Wrapper, TRanges > TIdToRangeMap
static void x_SubAndSort(CSeq_loc &dst, const CSeq_loc &minuend, const TFuzzMap &fuzz_from_plus, const TFuzzMap &fuzz_from_minus, const TFuzzMap &fuzz_to_plus, const TFuzzMap &fuzz_to_minus, TIdToRangeColl &rg_coll_plus, TIdToRangeColl &rg_coll_minus, ISynonymMapper &syn_mapper, ILengthGetter &len_getter, CSeq_loc::TOpFlags flags)
vector< TRangeWithFuzz > TRanges
static bool s_InsertExpands(size_t idx, size_t start, size_t end)
map< TSeqPos, CConstRef< CInt_fuzz > > TFuzzMap
static void x_MergeNoSort(CSeq_loc &dst, const CSeq_loc &src, CSeq_loc::TOpFlags flags, ISynonymMapper &syn_mapper)
CRangeWithFuzz TRangeWithFuzz
void s_GetLabel(const CSeq_id &id, string *label)
static int s_CompareRanges(const COpenRange< TSeqPos > &x_rng, const COpenRange< TSeqPos > &y_rng, bool minus_strand)
static void x_SubNoSort(CSeq_loc &dst, const CSeq_loc &minuend, const TFuzzMap &fuzz_from_plus, const TFuzzMap &fuzz_from_minus, const TFuzzMap &fuzz_to_plus, const TFuzzMap &fuzz_to_minus, TIdToRangeColl &rg_coll_plus, TIdToRangeColl &rg_coll_minus, ISynonymMapper &syn_mapper, ILengthGetter &len_getter, CSeq_loc::TOpFlags flags)
static CRef< CSeq_id > MakeId(const SSeq_loc_CI_RangeInfo &info)
static void s_ReserveMore(Container &cont, size_t add_size)
static void x_MergeAndSort(CSeq_loc &dst, const CSeq_loc &src, CSeq_loc::TOpFlags flags, ISynonymMapper &syn_mapper)
static bool s_CheckIfMatchesBioseq(const CSeq_loc &loc, const CSeq_loc::ISubLocFilter *filter)
static void AddLoc(CRef< CSeq_loc > &loc, CRef< CSeq_loc > loc2)
map< CSeq_id_Handle_Wrapper, TRangeColl > TIdToRangeColl
CRangeCollection< TSeqPos > TRangeColl
bool s_CanAdd(const T1 &obj1, const T2 &obj2)
static bool x_MergeRanges(TRangeWithFuzz &rg1, ENa_strand str1, const TRangeWithFuzz &rg2, ENa_strand str2, CSeq_loc::TOpFlags flags)
static CRange< TSeqPos > s_LocToRange(const CSeq_loc &loc)
static void x_SingleRange(CSeq_loc &dst, const CSeq_loc &src, ISynonymMapper &syn_mapper)
static void x_PushRange(CSeq_loc &dst, const CSeq_id_Handle_Wrapper &idh, const TRangeWithFuzz &rg, ENa_strand strand)
virtual ~CDummyLengthGetter(void)
virtual TSeqPos GetLength(const CSeq_id &)
virtual CSeq_id_Handle GetBestSynonym(const CSeq_id &id)
CDummySynonymMapper(void)
virtual ~CDummySynonymMapper(void)
void GetLabel(string *label, TSeqPos pos, bool right=true) const
CNcbiOstrstreamToString class helps convert CNcbiOstrstream to a string Sample usage:
void ResetStrand(void)
Reset the strand to 'not set'.
bool IsPartialStop(ESeqLocExtremes ext) const
void SetPartialStart(bool val, ESeqLocExtremes ext)
TSeqPos GetStop(ESeqLocExtremes ext) const
void SetTruncatedStart(bool val, ESeqLocExtremes ext)
set / remove e_Lim fuzz on start or stop (tl/tr - indicating removed parts of the seq-loc)
void FlipStrand(void)
Flip the strand (e.g. plus to minus)
bool IsTruncatedStart(ESeqLocExtremes ext) const
check if parts of the seq-loc are missing
void AddIntervals(const CPacked_seqint &ivals)
void SetTruncatedStop(bool val, ESeqLocExtremes ext)
TSeqPos GetStart(ESeqLocExtremes ext) const
void SetPartialStop(bool val, ESeqLocExtremes ext)
bool IsPartialStart(ESeqLocExtremes ext) const
bool IsSetStrand(EIsSetStrand flag=eIsSetStrand_Any) const
bool IsTruncatedStop(ESeqLocExtremes ext) const
ENa_strand GetStrand(void) const
void SetStrand(ENa_strand strand)
Set the strand for all of the location's ranges.
void AddInterval(const CSeq_interval &ival)
for convenience
bool IsTruncatedStop(ESeqLocExtremes ext) const
void SetPartialStop(bool val, ESeqLocExtremes ext)
void SetPartialStart(bool val, ESeqLocExtremes ext)
void SetTruncatedStart(bool val, ESeqLocExtremes ext)
set / remove e_Lim fuzz on start or stop (tl/tr - indicating removed parts of the seq-loc)
bool IsPartialStop(ESeqLocExtremes ext) const
TSeqPos GetStop(ESeqLocExtremes ext) const
void AddPoint(TSeqPos point)
bool IsPartialStart(ESeqLocExtremes ext) const
void SetTruncatedStop(bool val, ESeqLocExtremes ext)
void AddPoints(const TPoints &points)
bool IsTruncatedStart(ESeqLocExtremes ext) const
check if parts of the seq-loc are missing
TSeqPos GetStart(ESeqLocExtremes ext) const
bool IntersectingWith(const TRange &r) const
void AddFuzzFrom(const CRangeWithFuzz &rg)
void AddFuzzFrom(const CInt_fuzz &fuzz, ENa_strand strand)
CConstRef< CInt_fuzz > TFuzz
bool IsSetFuzzFrom(void) const
CRef< CInt_fuzz > x_SetFuzz(TFuzz &fuzz, const CInt_fuzz *copy_from)
const CInt_fuzz & GetFuzzTo(void) const
void x_AddFuzz(TFuzz &fuzz, const TFuzz &other, ENa_strand other_strand)
const CInt_fuzz & GetFuzzFrom(void) const
bool IsSetFuzzTo(void) const
CRangeWithFuzz(const TParent &rg)
void AddFuzzTo(const CRangeWithFuzz &rg)
void CopyTo(const CRangeWithFuzz &rg)
CRangeWithFuzz(const CSeq_loc_CI &it)
void AddFuzzTo(const CInt_fuzz &fuzz, ENa_strand strand)
void CopyFrom(const CRangeWithFuzz &rg)
bool operator()(const TRangeWithFuzz &rg1, const TRangeWithFuzz &rg2) const
bool operator()(const TRangeWithFuzz &rg1, const TRangeWithFuzz &rg2) const
bool IsSetStrand(EIsSetStrand flag=eIsSetStrand_Any) const
TSeqPos GetStop(ESeqLocExtremes ext) const
ENa_strand GetStrand(void) const
TSeqPos GetStart(ESeqLocExtremes ext) const
CSeq_id_Handle_Wrapper(const CSeq_id_Handle &idh, const CSeq_id &id)
const CSeq_id_Handle & GetHandle(void) const
CConstRef< CSeq_id > GetSeqId(void) const
CConstRef< CSeq_id > m_Id
DECLARE_OPERATOR_BOOL(m_Handle)
CSeq_id_Handle_Wrapper(void)
bool IsTruncatedStop(ESeqLocExtremes ext) const
bool IsPartialStop(ESeqLocExtremes ext) const
void SetTruncatedStart(bool val, ESeqLocExtremes ext)
set / remove e_Lim fuzz on start or stop (tl/tr - indicating removed parts of the seq-loc)
TSeqPos GetStart(ESeqLocExtremes ext) const
bool IsPartialStart(ESeqLocExtremes ext) const
bool IsTruncatedStart(ESeqLocExtremes ext) const
check if parts of the seq-loc are missing
TSeqPos GetStop(ESeqLocExtremes ext) const
void SetTruncatedStop(bool val, ESeqLocExtremes ext)
void SetPartialStart(bool val, ESeqLocExtremes ext)
void SetPartialStop(bool val, ESeqLocExtremes ext)
Used as a helper for determining which pieces of a CSeq_loc to compare.
bool IsInBond(size_t idx) const
CRef< CSeq_loc > MakeLocPacked_int(size_t idx_begin, size_t idx_end) const
CSeq_loc_I::EEquivMode m_EquivMode
CRef< CSeq_loc > MakeLoc(CSeq_loc_I::EMakeType make_type) const
void MakeBondB(size_t idx)
pair< size_t, size_t > GetEquivPartRange(size_t idx, size_t level) const
bool IsEnd(size_t idx) const
bool CanBePoint(size_t idx) const
pair< size_t, size_t > GetBondRange(size_t idx) const
void x_AddBondPartB(size_t idx)
void MakeBondAB(size_t idx)
size_t HasEquivBreak(size_t begin, size_t end) const
void RemoveBond(size_t idx)
CRef< CSeq_loc > MakeRangeLoc(const SSeq_loc_CI_RangeInfo &info) const
vector< SSeq_loc_CI_RangeInfo > TRanges
CRef< CSeq_loc > MakeLocOther(const SSeq_loc_CI_RangeInfo &info) const
void x_ProcessLocation(const CSeq_loc &loc)
CConstRef< CSeq_loc > m_Location
CRef< CSeq_loc > MakeLocBond(size_t idx_begin, size_t idx_end) const
vector< SEquivSet > TEquivSets
void x_CreateBond(size_t idx)
bool CanBePoint(const SSeq_loc_CI_RangeInfo &info) const
static void x_SetId(SSeq_loc_CI_RangeInfo &info, const CSeq_id &id)
CRef< CSeq_loc > MakeLocPoint(const SSeq_loc_CI_RangeInfo &info) const
void UpdatePoint(CSeq_point &pnt, const SSeq_loc_CI_RangeInfo &info) const
CSeq_loc_I::EEquivMode GetEquivMode(void) const
bool CanBeBond(size_t idx_begin, size_t idx_end) const
void SetEquivMode(CSeq_loc_I::EEquivMode mode)
bool WasPoint(const SSeq_loc_CI_RangeInfo &info) const
TRanges & GetRanges(void)
void UpdateLoc(SSeq_loc_CI_RangeInfo &info)
const TRanges & GetRanges(void) const
size_t GetBondBegin(size_t idx) const
virtual ~CSeq_loc_CI_Impl(void)
void SetPoint(SSeq_loc_CI_RangeInfo &info)
void x_ProcessInterval(const CSeq_interval &seq_int, const CSeq_loc &loc)
void x_ProcessPoint(const CSeq_point &seq_pnt, const CSeq_loc &loc)
void x_BreakBond(size_t idx)
CSeq_loc_CI_Impl & operator=(const CSeq_loc_CI_Impl &)
set< const SEquivSet * > TUsedEquivs
CRef< CSeq_interval > MakeInterval(const SSeq_loc_CI_RangeInfo &info) const
void DeleteRange(size_t idx)
bool CanBePacked_int(size_t idx_begin, size_t idx_end) const
bool CanBeInterval(const SSeq_loc_CI_RangeInfo &info) const
pair< size_t, size_t > GetEquivSetRange(size_t idx, size_t level) const
bool IsBondPartB(size_t idx) const
bool IsInEquivSet(size_t idx) const
const SEquivSet * FindInnerEquivSet(size_t begin, size_t end, const TUsedEquivs &used_equivs) const
CSeq_loc_CI::EEmptyFlag m_EmptyFlag
CSeq_loc_CI_Impl(const CSeq_loc_CI_Impl &)
void MakeBondA(size_t idx)
bool CanBePacked_pnt(size_t idx_begin, size_t idx_end) const
bool HasEquivSets(void) const
SSeq_loc_CI_RangeInfo::TRange TRange
const SEquivSet & GetEquivSet(size_t idx, size_t level) const
bool ShouldBePoint(const SSeq_loc_CI_RangeInfo &info) const
bool IsBondPartA(size_t idx) const
CRef< CSeq_point > MakePoint(const SSeq_loc_CI_RangeInfo &info) const
bool IsInBond(const SSeq_loc_CI_RangeInfo &info) const
CRef< CInt_fuzz > MakeFuzz(const CInt_fuzz &fuzz) const
CRef< CSeq_loc > MakeLocPacked_pnt(size_t idx_begin, size_t idx_end) const
SSeq_loc_CI_RangeInfo & InsertRange(size_t idx, CSeq_loc::E_Choice type)
size_t GetBondEnd(size_t idx) const
bool CanBeInterval(size_t idx) const
CRef< CSeq_loc > MakeLocInterval(const SSeq_loc_CI_RangeInfo &info) const
size_t GetEquivSetsCount(size_t idx) const
bool HasChanges(void) const
Seq-loc iterator class â iterates all intervals from a seq-loc in the correct order.
Seq-loc iterator class â iterates all intervals from a seq-loc in the correct order.
void Add(const CSeq_loc &loc)
void SetPartialStart(bool val, ESeqLocExtremes ext)
bool IsTruncatedStop(ESeqLocExtremes ext) const
void SetPartialStop(bool val, ESeqLocExtremes ext)
void ResetStrand(void)
Reset the strand to 'not set'.
bool IsSetStrand(EIsSetStrand flag=eIsSetStrand_Any) const
void SetTruncatedStart(bool val, ESeqLocExtremes ext)
set / remove e_Lim fuzz on start or stop (tl/tr - indicating removed parts of the seq-loc)
TSeqPos GetStop(ESeqLocExtremes ext) const
void AddSeqLoc(const CSeq_loc &other)
bool IsPartialStart(ESeqLocExtremes ext) const
ENa_strand GetStrand(void) const
TSeqPos GetStart(ESeqLocExtremes ext) const
bool IsPartialStop(ESeqLocExtremes ext) const
void SetStrand(ENa_strand strand)
Set the strand for all of the location's ranges.
bool IsTruncatedStart(ESeqLocExtremes ext) const
check if parts of the seq-loc are missing
void FlipStrand(void)
Flip the strand (e.g. plus to minus)
void SetTruncatedStop(bool val, ESeqLocExtremes ext)
bool IsPartialStart(ESeqLocExtremes ext) const
void SetTruncatedStart(bool val, ESeqLocExtremes ext)
set / remove e_Lim fuzz on start or stop (tl/tr - indicating removed parts of the seq-loc)
bool IsTruncatedStop(ESeqLocExtremes ext) const
bool IsPartialStop(ESeqLocExtremes ext) const
bool IsTruncatedStart(ESeqLocExtremes ext) const
check if parts of the seq-loc are missing
void SetPartialStart(bool val, ESeqLocExtremes ext)
void SetTruncatedStop(bool val, ESeqLocExtremes ext)
void SetPartialStop(bool val, ESeqLocExtremes ext)
Base class for all serializable objects.
Interface for getting bioseq length.
Interface for mapping IDs to the best synonym.
container_type::const_iterator const_iterator
const_iterator end() const
const_iterator find(const key_type &key) const
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
const_iterator end() const
bool operator<(const CEquivRange &A, const CEquivRange &B)
bool operator==(const CEquivRange &A, const CEquivRange &B)
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static const char * str(char *buf, int n)
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define ERASE_ITERATE(Type, Var, Cont)
Non-constant version with ability to erase current element, if container permits.
#define VECTOR_ERASE(Var, Cont)
Use this macro inside body of ERASE_ITERATE cycle to erase from vector-like container.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
const TSeqPos kInvalidSeqPos
Define special value for invalid sequence position.
#define INT_ID_TO(T, id)
Convert gi-compatible int to/from other types.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
void Error(CExceptionArgs_Base &args)
TErrCode GetErrCode(void) const
Get error code.
#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.
virtual const char * GetErrCodeString(void) const
Get error code interpreted as text.
ESerialRecursionMode
How to assign and compare child sub-objects of serial objects.
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
virtual const CTypeInfo * GetThisTypeInfo(void) const =0
C * SerialClone(const C &src)
Create on heap a clone of the source object.
virtual bool Equals(const CSerialObject &object, ESerialRecursionMode how=eRecursive) const
Check if both objects contain the same values.
@ eShallow
Assign/Compare pointers only.
const string AsFastaString(void) const
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Optimized implementation of CSerialObject::Assign, which is not so efficient.
CConstRef< CSeq_id > GetSeqId(void) const
int CompareOrdered(const CSeq_id &sid2) const
bool Match(const CSeq_id &sid2) const
Match() - TRUE if SeqIds are equivalent.
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
void SetRange(const TRange &range)
Set the range.
bool IsBondA(void) const
Return true if current position is A part of a bond.
CRef< CSeq_loc > MakeSeq_loc(EMakeType make_type=eMake_CompactType) const
return constructed CSeq_loc with all changes
void SetTruncatedStart(bool val, ESeqLocExtremes ext)
set / remove e_Lim fuzz on start or stop (tl/tr - indicating removed parts of the seq-loc)
void SetPacked_int(TPacked_int &v)
size_t GetEquivSetsCount(void) const
Return number of recursuve equiv parts current position in.
virtual const char * x_GetIteratorType(void) const
void SetFrom(TSeqPos from)
Set the range from position.
void ResetFuzz(void)
Reset fuzz of a point.
void InvalidateCache(void) const
Combine invalidation of all cached values.
bool x_IsValid(void) const
CSeq_loc_CI(void)
constructors
void SetTo(TSeqPos to)
Set the range to position.
CSeq_loc_I InsertPoint(const CSeq_id_Handle &id, TSeqPos pos, ENa_strand strand=eNa_strand_unknown)
Insert new element before the current one (.
void SetPacked_pnt(TPacked_pnt &v)
bool IsPartialStart(ESeqLocExtremes ext) const
check start or stop of location for e_Lim fuzz
void Delete(void)
Delete current element, and make iterator to point to the next element.
void x_ChangeToPackedPnt(const CSeq_loc &other)
ENa_strand GetStrand(void) const
Get the location's strand.
void x_CheckValidForInsert(const char *where) const
CRange< TSeqPos > TRange
See related functions in objmgr/util/seq_loc_util.hpp:
void ChangeToPackedInt(void)
Works only if location is currently an interval, point, packed-int (handled trivially),...
bool x_UpdateId(const CSeq_id *&total_id, const CSeq_id *id, bool may_throw=true) const
TPacked_int & SetPacked_int(void)
bool IsReverseStrand(void) const
Return true if all ranges have reverse strand.
CSeq_loc_CI & operator=(const CSeq_loc_CI &iter)
EEmptyFlag
Options for empty locations processing.
void FlipStrand(void)
Flip the strand (e.g. plus to minus)
void MakeBondA(void)
Make bond at current position (only A) The current part must be a point If current posision is alread...
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Override Assign() to incorporate cache invalidation.
void SetId(CSeq_id &id)
set the 'id' field in all parts of this location
bool IsInEquivSet(void) const
Return true if current position is in some equiv part.
CSeq_loc_I(void)
constructors
atomic< TSeqPos > m_TotalRangeCacheFrom
void ResetStrand(void)
Reset the range strand.
void ResetFuzzTo(void)
Reset fuzz to.
void x_CheckValid(const char *where) const
EMakeType
Options for creation modified locations Bond and equiv types are preserved if possible.
void ResetFuzzFrom(void)
Reset fuzz from.
TRange GetTotalRange(void) const
virtual CSeq_id_Handle GetBestSynonym(const CSeq_id &id)=0
TSeqPos GetStart(ESeqLocExtremes ext) const
Return start and stop positions of the seq-loc.
pair< CSeq_loc_CI, CSeq_loc_CI > GetBondRange(void) const
Return iterators that cover bond of current position result.first is the first segment in the equiv s...
CConstRef< CSeq_loc > GetRangeAsSeq_loc(void) const
Get seq-loc for the current iterator position.
void MakeBondB(void)
Make bond at previous position with the current position (A and B) The current and previous parts mus...
pair< CConstRef< CInt_fuzz >, CConstRef< CInt_fuzz > > m_Fuzz
CRef< CSeq_loc > Merge(TOpFlags flags, ISynonymMapper *syn_mapper) const
All functions create and return a new seq-loc object.
void SetStrand(ENa_strand strand)
Set the range strand.
const CSeq_loc & GetSeq_loc(void) const
void MakeBondAB(void)
Make bond at current position with the next position (A and B) The current and next parts must be poi...
bool HasEquivSets(void) const
Return true if location has equiv parts.
TRange x_CalculateTotalRangeCheckId(const CSeq_id *&id) const
const_iterator end(void) const
const_iterator begin(void) const
void x_ChangeToMix(const CSeq_loc &other)
bool HasChanges(void) const
return true of any part was changed since initialization
int Compare(const CSeq_loc &loc) const
bool IsTruncatedStop(ESeqLocExtremes ext) const
void x_ChangeToPackedInt(const CSeq_interval &other)
int CompareSubLoc(const CSeq_loc &loc, ENa_strand strand, const ISubLocFilter *filter=NULL) const
Compare first-level sub-locations sequentially to order them by biological "complexity".
bool x_IsValidForInsert(void) const
void SetSeq_id_Handle(const CSeq_id_Handle &id)
Set seq_id of the current location.
void SetFuzz(CInt_fuzz &fuzz)
Change fuzz of a point.
void x_SetSeq_id_Handle(SSeq_loc_CI_RangeInfo &info, const CSeq_id_Handle &id)
void SetFuzzTo(CInt_fuzz &fuzz)
Change fuzz to values.
bool IsInBond(void) const
Location of type equiv define set of equivalent locations.
void Add(const CSeq_loc &other)
Simple adding of seq-locs.
void SetPoint(TSeqPos pos)
Set the range from and to positions.
~SSeq_loc_CI_RangeInfo(void)
CRef< CSeq_loc > Subtract(const CSeq_loc &other, TOpFlags flags, ISynonymMapper *syn_mapper, ILengthGetter *len_getter) const
Subtract seq-loc from this, merge/sort resulting ranges depending on flags.
bool operator==(const CSeq_loc_CI &iter) const
bool IsTruncatedStart(ESeqLocExtremes ext) const
check if parts of the seq-loc are missing
TPacked_pnt & SetPacked_pnt(void)
bool IsSetStrand(EIsSetStrand flag=eIsSetStrand_Any) const
Check if strand is set for any/all part(s) of the seq-loc depending on the flag.
TSeqPos GetCircularLength(TSeqPos seq_len) const
Special case for circular sequences.
const CSeq_loc & GetEmbeddingSeq_loc(void) const
Get the nearest seq-loc containing the current range.
CSeq_loc_I InsertInterval(const CSeq_id_Handle &id, const TRange &range, ENa_strand strand=eNa_strand_unknown)
Insert new element before the current one (.
pair< CSeq_loc_CI, CSeq_loc_CI > GetEquivSetRange(size_t level=0) const
Return iterators that cover equiv set of current position result.first is the first segment in the eq...
void SetPos(size_t pos)
Set iterator's position.
CRef< CSeq_loc_CI_Impl > m_Impl
pair< CSeq_loc_I, CSeq_loc_I > GetEquivPartRange(size_t level=0) const
Return iterators that cover equiv part of current position result.first is the first segment in the e...
CPacked_seqint::TRanges TRanges
const CSeq_id * GetId(void) const
Get the id of the location return NULL if has multiple ids or no id at all.
void PostRead(void) const
Invalidate id/range cache after deserialization.
CPacked_seqpnt_Base::TPoints TPoints
atomic< const CSeq_id * > m_IdCache
size_t GetSize(void) const
Get number of ranges.
CSeq_id_Handle m_IdHandle
bool IsBondB(void) const
Return true if current position is B part of a bond.
void ResetStrand(void)
Reset the strand on this location.
void SetPartialStart(bool val, ESeqLocExtremes ext)
set / remove e_Lim fuzz on start or stop (lt/gt - indicating partial interval)
virtual TSeqPos GetLength(const CSeq_id &id)=0
void x_ThrowNotValid(const char *where) const
virtual const char * x_GetIteratorType(void) const
pair< CSeq_loc_CI, CSeq_loc_CI > GetEquivPartRange(size_t level=0) const
Return iterators that cover equiv part of current position result.first is the first segment in the e...
CSeq_loc_I InsertWhole(const CSeq_id_Handle &id)
Insert new element before the current one (.
const SSeq_loc_CI_RangeInfo & x_GetRangeInfo(void) const
void SetFuzzFrom(CInt_fuzz &fuzz)
Change fuzz from.
void RemoveBond(void)
Remove bond at current position - it may be either A or B part.
CRef< CSeq_loc > Intersect(const CSeq_loc &other, TOpFlags flags, ISynonymMapper *syn_mapper) const
Find the intersection with the seq-loc, merge/sort resulting ranges depending on flags.
bool operator!=(const CSeq_loc_CI &iter) const
EEquivMode
This enum defines a way equiv sets are expanded or created when one of Insert*() methods is called.
CSeq_loc_I InsertEmpty(const CSeq_id_Handle &id)
Insert new element before the current one (.
pair< CSeq_loc_I, CSeq_loc_I > GetEquivSetRange(size_t level=0) const
Return iterators that cover equiv set of current position result.first is the first segment in the eq...
const CSeq_id & GetSeq_id(void) const
Get seq_id of the current location.
TRange x_UpdateTotalRange(void) const
SSeq_loc_CI_RangeInfo(void)
void GetLabel(string *label) const
Appends a label suitable for display (e.g., error messages) label must point to an existing string ob...
void SetStrand(ENa_strand strand)
Set the strand for all of the location's ranges.
void SetEquivMode(EEquivMode mode)
Change equiv modification mode.
void SetPartialStop(bool val, ESeqLocExtremes ext)
CSeq_loc(void)
constructors
atomic< TSeqPos > m_TotalRangeCacheToOpen
int x_CompareSingleId(const CSeq_loc &loc, const CSeq_id *id1, const CSeq_id *id2, TCompareFlags flags) const
Compare single-id locations, or throw an exception if any location is multi-id.
SSeq_loc_CI_RangeInfo & x_GetRangeInfo(void)
virtual ~CSeq_loc_I(void)
destructor
EEquivMode GetEquivMode(void) const
Get equiv modification mode.
void SetNull(void)
Override all setters to incorporate cache invalidation.
bool IsPartialStop(ESeqLocExtremes ext) const
void SetTruncatedStop(bool val, ESeqLocExtremes ext)
virtual ~CSeq_loc_CI(void)
destructor
CSeq_loc_I InsertNull(void)
Set of Insert*() methods.
CConstRef< CSeq_loc > m_Loc
bool x_CheckId(const CSeq_id *&id, bool may_throw=true) const
TSeqPos GetStop(ESeqLocExtremes ext) const
virtual const char * GetErrCodeString(void) const override
Get error code interpreted as text.
@ eEmpty_Allow
ignore empty locations
@ eMake_PreserveType
use most compact Seq-loc type (default)
@ eEquiv_prepend
If the insertion point is just before any equiv part, including the first one in an equiv,...
@ eEquiv_new_part
New equiv part will be started with the inserted element.
@ eEquiv_new_equiv
A new equiv set will be created, even if the insertion point is already inside of an existing equiv,...
@ eEquiv_append
If the insertion point is just after any equiv part, including the last one in an equiv,...
@ eMultipleId
Seq-loc on multiple ids when one id is required.
@ eNotSet
Seq-loc is not set.
@ eIncomatible
Seq-loc type is incompatible with operation.
@ eBadLocation
Seq-loc is incorrectly formed.
@ eOutOfRange
parameter is out of valid range
@ eBadIterator
Seq-loc iterator is in bad state.
@ eUnsupported
Seq-loc has data that is not supported yet.
ENa_strand GetStrand(const CSeq_loc &loc, CScope *scope=0)
Returns eNa_strand_unknown if multiple Bioseqs in loc Returns eNa_strand_other if multiple strands in...
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.
TObjectType * GetPointerOrNull(void) const THROWS_NONE
Get pointer value.
TObjectType * Release(void)
Release a reference to the object and return a pointer to the object.
position_type GetLength(void) const
position_type GetTo(void) const
position_type GetToOpen(void) const
position_type GetFrom(void) const
static TThisType GetEmpty(void)
TThisType & operator+=(const TThisType &r)
TThisType & Set(position_type from, position_type to)
static position_type GetWholeToOpen(void)
static TThisType GetWhole(void)
TParent::position_type position_type
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
bool operator!=(const CNCBI_IPAddr &lhs, unsigned int rhs)
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static const char label[]
void SetFrom(TFrom value)
Assign a value to From data member.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
void SetTo(TTo value)
Assign a value to To data member.
void SetMin(TMin value)
Assign a value to Min data member.
bool IsLim(void) const
Check if variant Lim is selected.
TRange & SetRange(void)
Select the variant.
TAlt & SetAlt(void)
Select the variant.
TPct GetPct(void) const
Get the variant data.
virtual void Reset(void)
Reset the whole object.
TLim GetLim(void) const
Get the variant data.
TP_m & SetP_m(void)
Select the variant.
TMin GetMin(void) const
Get the Min member data.
void SetMax(TMax value)
Assign a value to Max data member.
E_Choice Which(void) const
Which variant is currently selected.
TLim & SetLim(void)
Select the variant.
const TAlt & GetAlt(void) const
Get the variant data.
TPct & SetPct(void)
Select the variant.
TMax GetMax(void) const
Get the Max member data.
TP_m GetP_m(void) const
Get the variant data.
const TRange & GetRange(void) const
Get the variant data.
@ eLim_tl
space to left of position
@ eLim_tr
space to right of position
@ e_not_set
No variant selected.
@ e_Pct
% plus or minus (x10) 0-1000
@ e_Alt
set of alternatives for the integer
@ e_P_m
plus or minus fixed amount
void SetTo(TTo value)
Assign a value to To data member.
const TFuzz_from & GetFuzz_from(void) const
Get the Fuzz_from member data.
void SetPoint(TPoint value)
Assign a value to Point data member.
void SetId(TId &value)
Assign a value to Id data member.
void SetA(TA &value)
Assign a value to A data member.
bool IsSetId(void) const
WARNING: this used to be optional Check if a value has been assigned to Id data member.
void ResetFuzz_to(void)
Reset Fuzz_to data member.
bool IsMix(void) const
Check if variant Mix is selected.
const TFeat & GetFeat(void) const
Get the variant data.
const TB & GetB(void) const
Get the B member data.
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.
void ResetStrand(void)
Reset Strand data member.
bool IsPacked_pnt(void) const
Check if variant Packed_pnt is selected.
Tdata & Set(void)
Assign a value to data member.
const TPnt & GetPnt(void) const
Get the variant data.
TPoint GetPoint(void) const
Get the Point member data.
const TFuzz_to & GetFuzz_to(void) const
Get the Fuzz_to member data.
const TWhole & GetWhole(void) const
Get the variant data.
void SetId(TId &value)
Assign a value to Id data member.
void SetStrand(TStrand value)
Assign a value to Strand 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.
void SetFuzz(TFuzz &value)
Assign a value to Fuzz data member.
bool IsSetFuzz(void) const
Check if a value has been assigned to Fuzz data member.
list< CRef< CSeq_loc > > Tdata
const TFuzz & GetFuzz(void) const
Get the Fuzz member data.
void ResetFuzz(void)
Reset Fuzz data member.
bool CanGetA(void) const
Check if it is safe to call GetA method.
E_Choice Which(void) const
Which variant is currently selected.
const TId & GetId(void) const
Get the Id member data.
E_Choice Which(void) const
Which variant is currently selected.
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.
bool IsBond(void) const
Check if variant Bond is selected.
void SetStrand(TStrand value)
Assign a value to Strand data member.
bool IsSetFuzz(void) const
Check if a value has been assigned to Fuzz data member.
const Tdata & Get(void) const
Get the member data.
void ResetFuzz(void)
Reset Fuzz data member.
const TPacked_pnt & GetPacked_pnt(void) const
Get the variant data.
void SetFuzz(TFuzz &value)
Assign a value to Fuzz data member.
void ResetStrand(void)
Reset Strand data member.
void SetId(TId &value)
Assign a value to Id data member.
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.
TPoints & SetPoints(void)
Assign a value to Points data member.
list< CRef< CSeq_loc > > Tdata
vector< TSeqPos > TPoints
virtual void Reset(void)
Reset the whole object.
void SetFuzz_to(TFuzz_to &value)
Assign a value to Fuzz_to data member.
void SetFuzz_from(TFuzz_from &value)
Assign a value to Fuzz_from data member.
bool IsPacked_int(void) const
Check if variant Packed_int is selected.
const TA & GetA(void) const
Get the A member data.
static string SelectionName(E_Choice index)
Retrieve selection name (for diagnostic purposes).
bool CanGetB(void) const
Check if it is safe to call GetB method.
const TEmpty & GetEmpty(void) const
Get the variant data.
bool IsSetStrand(void) const
Check if a value has been assigned to Strand data member.
Tdata & Set(void)
Assign a value to data member.
bool IsSetFuzz_to(void) const
Check if a value has been assigned to Fuzz_to data member.
Tdata & Set(void)
Assign a value to 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 IsInt(void) const
Check if variant Int is selected.
const TInt & GetInt(void) const
Get the variant data.
void SetB(TB &value)
Assign a value to B data member.
bool IsSetFuzz_from(void) const
Check if a value has been assigned to Fuzz_from data member.
void SetStrand(TStrand value)
Assign a value to Strand data member.
void ResetStrand(void)
Reset Strand data member.
E_Choice
Choice variants.
const TFuzz & GetFuzz(void) const
Get the Fuzz member data.
const TMix & GetMix(void) const
Get the variant data.
void ResetB(void)
Reset B data member.
bool IsPnt(void) const
Check if variant Pnt is selected.
bool IsSetB(void) const
other end may not be available Check if a value has been assigned to B data member.
const TPacked_int & GetPacked_int(void) const
Get the variant data.
const TBond & GetBond(void) const
Get the variant data.
@ eNa_strand_both_rev
in reverse orientation
@ eNa_strand_both
in forward orientation
@ e_not_set
No variant selected.
@ 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
Definition of all error codes used in objects libraries.
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is whole
CNcbiMatrix< T > & operator+=(CNcbiMatrix< T > &, const CNcbiMatrix< U > &)
global addition: matrix += matrix
const TYPE & Get(const CNamedParameterList *param)
constexpr auto sort(_Init &&init)
constexpr bool empty(list< Ts... >) noexcept
const struct ncbi::grid::netcache::search::fields::SIZE size
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
bool operator()(const SEquivSet *e1, const SEquivSet *e2) const
size_t GetPartStartIndex(TPart_CI part) const
size_t GetPartEndOffset(TPart_CI part) const
size_t GetStartIndex(void) const
size_t GetElementsCount(void) const
size_t GetPartsCount(void) const
TPart_CI FindPartByElementIndex(size_t idx) const
size_t GetPartStartOffset(TPart_CI part) const
bool Contains(size_t idx) const
size_t GetPartEndIndex(TPart_CI part) const
size_t GetEndIndex(void) const
TPart_I FindPartByElementIndex(size_t idx)
TParts::const_iterator TPart_CI
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4