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

added RemoveSequence

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2655 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 4fd00f33
No related branches found
No related tags found
No related merge requests found
......@@ -304,6 +304,7 @@ void export_sequence()
.def("AttachView", attach_view_b)
.def("Cut", &AlignmentHandle::Cut)
.def("MakeRegion", &AlignmentHandle::MakeRegion)
.def("RemoveSequence", &AlignmentHandle::RemoveSequence)
.def("Replace",&AlignmentHandle::Replace)
.def("__getitem__", &slice_aln)
.def("__getitem__", &AlignmentHandle::operator[])
......
......@@ -82,6 +82,12 @@ String AlignmentHandle::ToString(int width) const
return impl_->ToString(width);
}
void AlignmentHandle::RemoveSequence(int seq_index)
{
this->CheckValidity();
impl_->RemoveSequence(seq_index);
}
int AlignmentHandle::GetLength() const
{
this->CheckValidity();
......
......@@ -80,7 +80,9 @@ public:
/// \brief Get sequence with given index.
/// \return sequence or invalid handle if the index is out of bounds
ConstSequenceHandle GetSequence(int seq_id) const;
/// \brief remove sequence at seq_index from alignment
void RemoveSequence(int seq_index);
/// \brief Convert multiple sequence alignment to string.
String ToString(int width=80) const;
......
......@@ -96,7 +96,13 @@ String SequenceListImpl::ToString(int width) const
return buffer.str();
}
void SequenceListImpl::RemoveSequence(int index)
{
if (index<0 || index>=static_cast<int>(list_.size())) {
return;
}
list_.erase(list_.begin()+index);
}
int SequenceListImpl::GetMinLength() const
{
int min_length=std::numeric_limits<int>::max();
......
......@@ -57,6 +57,8 @@ public:
throw std::out_of_range("Index not covered SequenceList");
}
void RemoveSequence(int index);
int GetPos(int seq_index, int residue_index) const;
int GetResidueIndex(int seq_index, int pos) const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment