From b1ba3664afa43da41a3520867f953e5750848c4d Mon Sep 17 00:00:00 2001 From: marco <marco@5a81b35b-ba03-0410-adc8-b2c5c5119f08> Date: Tue, 11 May 2010 12:03:05 +0000 Subject: [PATCH] fix to replace function git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2235 5a81b35b-ba03-0410-adc8-b2c5c5119f08 --- modules/seq/base/src/alignment_handle.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/seq/base/src/alignment_handle.cc b/modules/seq/base/src/alignment_handle.cc index 39db09fa5..d4611b562 100644 --- a/modules/seq/base/src/alignment_handle.cc +++ b/modules/seq/base/src/alignment_handle.cc @@ -170,16 +170,17 @@ void AlignmentHandle::Replace(const AlignedRegion& aln_r, int start, int end){ this->CheckValidity(); //check that alignment handle and aligned region contain same number of sequences if (impl_->GetCount() != aln_r.GetAlignmentHandle().GetCount()) { - throw IntegrityError("alignment handle and aligned region are required "\ - "to share the same number of sequences"); + throw IntegrityError("alignment handle and aligned region are required " + "to have the same number of sequences"); } - int aln_rStart=aln_r.GetStart(); - int aln_rEnd=aln_r.GetEnd()-1; + int aln_r_start=aln_r.GetStart(); + int aln_r_length=aln_r.GetLength(); AlignmentHandle aln=aln_r.GetAlignmentHandle(); //iterate over sequences and replace part of sequences with the substrings //from aligned region for (int i=0;i<impl_->GetCount() ;++i) { - this->GetSequence(i).Impl()->Replace(aln.GetSequence(i).GetString().substr(aln_rStart,aln_rEnd), start, end); + String s=aln.GetSequence(i).GetString().substr(aln_r_start, aln_r_length); + this->GetSequence(i).Impl()->Replace(s, start, end); } } -- GitLab