diff --git a/modules/seq/base/pymod/export_sequence.cc b/modules/seq/base/pymod/export_sequence.cc index ce9d50ad2e7bca497a6c163a4e708ed3fd41ff9b..fe3502c1b4f33e46e5cda8e28d9c4ddb8eaf9d62 100644 --- a/modules/seq/base/pymod/export_sequence.cc +++ b/modules/seq/base/pymod/export_sequence.cc @@ -97,7 +97,8 @@ void export_sequence() .def("GetPos", &ConstSequenceHandle::GetPos) .def("GetLength", &ConstSequenceHandle::GetLength) .def("GetResidue", &ConstSequenceHandle::GetResidue) - .def("GetOneLetterCode", &ConstSequenceHandle::GetOneLetterCode) + .def("GetOneLetterCode", &ConstSequenceHandle::GetOneLetterCode) + .def("__getitem__", &ConstSequenceHandle::GetOneLetterCode) .def("GetSequenceOffset", &ConstSequenceHandle::GetSequenceOffset) .def("Copy", &ConstSequenceHandle::Copy) .def("GetFirstNonGap", &ConstSequenceHandle::GetFirstNonGap) @@ -158,6 +159,7 @@ void export_sequence() .def("Copy", &AlignmentHandle::Copy) .def("ToString", &AlignmentHandle::ToString) .def("GetLength", &AlignmentHandle::GetLength) + .def("__len__", &AlignmentHandle::GetLength) .def("GetSequences", &AlignmentHandle::GetSequences) .def("AttachView", attach_view_a) .def("AttachView", attach_view_b) @@ -167,6 +169,7 @@ void export_sequence() .def("__getitem__", &AlignmentHandle::operator[]) .def("__iter__", iterator<AlignmentHandle>()) .add_property("sequences", &AlignmentHandle::GetSequences) + .def("SetSequenceName", &AlignmentHandle::SetSequenceName) ; class_<AlignedColumn>("AlignedColumn", no_init) .def("GetIndex", &AlignedColumn::GetIndex) diff --git a/modules/seq/base/src/aligned_region.hh b/modules/seq/base/src/aligned_region.hh index cfd6f757d485b72eb25c62c126cdd3039795f23c..ca8166ee17d49324bc44d80a5e640f55d6b28088 100644 --- a/modules/seq/base/src/aligned_region.hh +++ b/modules/seq/base/src/aligned_region.hh @@ -49,8 +49,10 @@ public: void SetMaster(int master); /// \brief delete interval and update length of AlignedRegion void Delete(); - ///\brief replace region with content of AlignedRegion and set length to length of \p aln_r + /// \brief replace region with content of AlignedRegion and set length to + /// length of \p aln_r void Replace(const AlignedRegion& aln_r); + /// \brief shift the aligned region of the master sequence to the left by /// n characters. void ShiftLeft(int n); diff --git a/modules/seq/base/src/alignment_handle.cc b/modules/seq/base/src/alignment_handle.cc index 6d6d5bb63489b1e4463199081f34825850ea34c0..0c9d312d21dba2a6f759fb19f9383e02a19da7a6 100644 --- a/modules/seq/base/src/alignment_handle.cc +++ b/modules/seq/base/src/alignment_handle.cc @@ -231,4 +231,11 @@ AlignedColumn AlignmentHandle::operator[](int index) return AlignedColumn(*this, index); } +void AlignmentHandle::SetSequenceName(int seq_index, const String& name) + +{ + this->CheckValidity(); + impl_->GetSequence(seq_index)->SetName(name); +} + }} diff --git a/modules/seq/base/src/alignment_handle.hh b/modules/seq/base/src/alignment_handle.hh index 893ec4cf86a0ad6d02bccbe74ee2b4908c7bd4ff..d097d90bd7ad16bb097cb3867e69b0077152c826 100644 --- a/modules/seq/base/src/alignment_handle.hh +++ b/modules/seq/base/src/alignment_handle.hh @@ -104,7 +104,10 @@ public: /// \sa SequenceHandle::AttachView(const mol::EntityView&, const String&) void AttachView(int seq_index, const mol::EntityView& view, const String& chain_name); - + + /// \brief set name of sequence + void SetSequenceName(int seq_index, const String& name); + /// \brief Get list of sequences (read-only) ConstSequenceList GetSequences() const;