1 #ifndef OBJTOOLS_ALNMGR__ALN_RNG_COLL_OPER__HPP
2 #define OBJTOOLS_ALNMGR__ALN_RNG_COLL_OPER__HPP
47 template<
class TAlnRng>
59 typename TAlnRngColl::const_iterator subtrahend_it = subtrahend.
begin();
60 ITERATE (
typename TAlnRngColl, minuend_it, minuend) {
70 TAlnRngCollExt subtrahend_ext(subtrahend);
71 subtrahend_ext.UpdateIndex();
73 typename TAlnRngCollExt::const_iterator subtrahend_ext_it = subtrahend_ext.begin();
74 TAlnRngCollExt diff_on_first_ext(difference_on_first);
75 diff_on_first_ext.UpdateIndex();
76 ITERATE (
typename TAlnRngCollExt, minuend_it, diff_on_first_ext) {
91 return r.GetFirstToOpen() <= pos;
95 return pos <
r.GetFirstToOpen();
99 return r1.GetFirstToOpen() <= r2.GetFirstToOpen();
103 return r->GetFirstToOpen() <= pos;
107 return pos <
r->GetFirstToOpen();
111 return r1->GetFirstToOpen() <= r2->GetFirstToOpen();
116 template<
class Iter,
class T,
class Compare>
129 template<
class TAlnRng>
131 const TAlnRng& minuend,
140 minuend.GetFirstFrom(),
143 if (r_it == subtrahend.
end()) {
144 difference.
insert(minuend);
150 trim = (r_it->
GetFirstFrom() <= minuend.GetFirstFrom());
161 if ((
int)
r.GetLength() <= 0) {
165 if (r_it == subtrahend.
end()) {
192 template <
class TAlnRng>
200 return p.second->GetSecondTo() < pos;
205 return pos < p.second->GetSecondTo();
210 return p1.second->GetSecondTo() < p2.second->GetSecondTo();
215 template<
class TAlnRng>
217 const TAlnRng& minuend,
222 if (minuend.GetSecondFrom() < 0) {
223 difference.
insert(minuend);
230 subtrahend_ext.end(),
231 minuend.GetSecondFrom(),
234 if (r_it == subtrahend_ext.end()) {
235 difference.
insert(minuend);
241 trim = (r_it->second->GetSecondFrom() <= minuend.GetSecondFrom());
250 trim = r_it->second->GetSecondToOpen() -
r.GetSecondFrom();
252 if ((
int)
r.GetLength() <= 0) {
256 if (r_it == subtrahend_ext.end()) {
264 trim =
r.GetSecondToOpen() - r_it->second->GetSecondFrom();
283 template <
class TAlnRng>
286 rng.SetLength(rng.GetLength() - trim);
287 rng.SetFirstFrom(rng.GetFirstFrom() + trim);
288 if (rng.IsDirect()) {
289 rng.SetSecondFrom(rng.GetSecondFrom() + trim);
294 template <
class TAlnRng>
297 if (rng.IsReversed()) {
298 rng.SetSecondFrom(rng.GetSecondFrom() + trim);
300 rng.SetLength(rng.GetLength() - trim);
303 template <
class TAlnRng>
306 rng.SetLength(rng.GetLength() - trim);
307 rng.SetSecondFrom(rng.GetSecondFrom() + trim);
308 if (rng.IsDirect()) {
309 rng.SetFirstFrom(rng.GetFirstFrom() + trim);
313 template <
class TAlnRng>
316 if (rng.IsReversed()) {
317 rng.SetFirstFrom(rng.GetFirstFrom() + trim);
319 rng.SetLength(rng.GetLength() - trim);
void TrimSecondTo(TAlnRng &rng, int trim)
void SubtractAlnRngCollections(const CAlignRangeCollection< TAlnRng > &minuend, const CAlignRangeCollection< TAlnRng > &subtrahend, CAlignRangeCollection< TAlnRng > &difference)
Subtract one range collection from another.
void TrimFirstFrom(TAlnRng &rng, int trim)
void TrimFirstTo(TAlnRng &rng, int trim)
void SubtractOnFirst(const TAlnRng &minuend, const CAlignRangeCollection< TAlnRng > &subtrahend, CAlignRangeCollection< TAlnRng > &difference, typename CAlignRangeCollection< TAlnRng >::const_iterator &r_it)
Iter scan_to_lower_bound(Iter first, Iter last, const T &value, Compare comp)
void SubtractOnSecond(const TAlnRng &minuend, const CAlignRangeCollExtender< CAlignRangeCollection< TAlnRng > > &subtrahend_ext, CAlignRangeCollection< TAlnRng > &difference, typename CAlignRangeCollExtender< CAlignRangeCollection< TAlnRng > >::const_iterator &r_it)
void TrimSecondFrom(TAlnRng &rng, int trim)
class CAlignRangeCollection<TAlignRange> represent a sorted collection of TAlignRange.
TAlignRangeVector::const_iterator const_iterator
int GetPolicyFlags() const
position_type GetFirstToOpen() const
position_type GetFirstFrom() const
const_iterator insert(const TAlignRange &r)
const_iterator end() const
const_iterator begin() const
Include a standard set of the NCBI C++ Toolkit most basic headers.
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
sequence::ECompare Compare(const CSeq_loc &loc1, const CSeq_loc &loc2, CScope *scope)
Returns the sequence::ECompare containment relationship between CSeq_locs.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
double value_type
The numeric datatype used by the parser.
const GenericPointer< typename T::ValueType > T2 value
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
TAlnRng::position_type position_type
CAlignRangeCollExtender< CAlignRangeCollection< TAlnRng > >::TFrom2Range::value_type value_type
bool operator()(const value_type &p, position_type pos)
bool operator()(const Range &r1, const Range &r2)
bool operator()(const Range &r, position_type pos)
bool operator()(const Range *r1, const Range *r2)
Range::position_type position_type
bool operator()(const Range *r, position_type pos)
bool operator()(position_type pos, const Range *r)
bool operator()(position_type pos, const Range &r)