diff --git a/modules/seq/base/src/alignment_handle.cc b/modules/seq/base/src/alignment_handle.cc index cf19f5a13fb6528469707f029d13150424af76f4..62514274c110d8d6389122f848e76feef3042be8 100644 --- a/modules/seq/base/src/alignment_handle.cc +++ b/modules/seq/base/src/alignment_handle.cc @@ -203,8 +203,8 @@ void AlignmentHandle::ShiftRegion(int start, int end, int amount, AlignedRegion AlignmentHandle::MakeRegion(int start, int n, int master) const { this->CheckValidity(); - if(start<0 || n < 0 || start >= n || start + n > this->GetLength()){ - throw std::out_of_range("Region not valid"); + if((start<0 )||( n < 0 )|| ((start + n) > this->GetLength())){ + throw std::out_of_range("invalid region"); } return AlignedRegion(*this, start, start+n, master); } diff --git a/modules/seq/base/src/impl/sequence_impl.cc b/modules/seq/base/src/impl/sequence_impl.cc index 941d2c04230c9bbd2a4885e09cf4331d8fc270f1..c90e71c8982e53d11d5c8b176211c144060dd001 100644 --- a/modules/seq/base/src/impl/sequence_impl.cc +++ b/modules/seq/base/src/impl/sequence_impl.cc @@ -170,7 +170,7 @@ int SequenceImpl::GetLength() const { char SequenceImpl::GetOneLetterCode(int position) const { - if (position<0 || position>=static_cast<int>(seq_string_.length())) + if (position<0 || position>static_cast<int>(seq_string_.length())) throw Error("Position is not covered in sequence"); return seq_string_[position]; } @@ -281,7 +281,7 @@ void SequenceImpl::Replace(const String& str,int start, int end) void SequenceImpl::ShiftRegion(int start, int end, int amount) { if(start > end || start + amount <= 0 || end + amount > this->GetLength()){ - throw std::out_of_range("Region not valid"); + throw std::out_of_range("ShiftRegion: invalid region"); } String str1=seq_string_.substr(start, end-start); if (amount<0) {