Skip to content
Snippets Groups Projects
Commit b1ba3664 authored by marco's avatar marco
Browse files

fix to replace function

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2235 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 44d4394a
No related branches found
No related tags found
No related merge requests found
...@@ -170,16 +170,17 @@ void AlignmentHandle::Replace(const AlignedRegion& aln_r, int start, int end){ ...@@ -170,16 +170,17 @@ void AlignmentHandle::Replace(const AlignedRegion& aln_r, int start, int end){
this->CheckValidity(); this->CheckValidity();
//check that alignment handle and aligned region contain same number of sequences //check that alignment handle and aligned region contain same number of sequences
if (impl_->GetCount() != aln_r.GetAlignmentHandle().GetCount()) { if (impl_->GetCount() != aln_r.GetAlignmentHandle().GetCount()) {
throw IntegrityError("alignment handle and aligned region are required "\ throw IntegrityError("alignment handle and aligned region are required "
"to share the same number of sequences"); "to have the same number of sequences");
} }
int aln_rStart=aln_r.GetStart(); int aln_r_start=aln_r.GetStart();
int aln_rEnd=aln_r.GetEnd()-1; int aln_r_length=aln_r.GetLength();
AlignmentHandle aln=aln_r.GetAlignmentHandle(); AlignmentHandle aln=aln_r.GetAlignmentHandle();
//iterate over sequences and replace part of sequences with the substrings //iterate over sequences and replace part of sequences with the substrings
//from aligned region //from aligned region
for (int i=0;i<impl_->GetCount() ;++i) { 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);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment