Skip to content
Snippets Groups Projects
Commit 54decf4b authored by Niklaus Johner's avatar Niklaus Johner
Browse files

Corrected the function to set the residue number of a residue in the editor

to check for breaking of the in_sequence property.
Added an SetInSequence() function to the ChainHandle to check and update
the in_sequence property
parent 9ffa67ae
No related branches found
No related tags found
No related merge requests found
...@@ -242,4 +242,4 @@ message(STATUS ...@@ -242,4 +242,4 @@ message(STATUS
" Compound Lib (-DCOMPOUND_LIB) : ${_COMP_LIB}\n" " Compound Lib (-DCOMPOUND_LIB) : ${_COMP_LIB}\n"
" TMAlign and TMScore (-DCOMPILE_TMTOOLS) : ${_TM_TOOLS}\n" " TMAlign and TMScore (-DCOMPILE_TMTOOLS) : ${_TM_TOOLS}\n"
" Static Libraries (-DENABLE_STATIC) : ${ENABLE_STATIC}\n" " Static Libraries (-DENABLE_STATIC) : ${ENABLE_STATIC}\n"
" Debian-style 'libexec' (-DDEBIAN_STYLE_LIBEXEC) : ${_DEBIAN_STYLE_LIBEXEC}") " Debian-style 'libexec' (-DDEBIAN_STYLE_LIBEXEC) : ${_DEBIAN_STYLE_LIBEXEC}")
\ No newline at end of file
...@@ -113,7 +113,6 @@ BOOST_PYTHON_MODULE(_ost_io) ...@@ -113,7 +113,6 @@ BOOST_PYTHON_MODULE(_ost_io)
def("LoadCRD", &LoadCRD); def("LoadCRD", &LoadCRD);
def("LoadCHARMMTraj_", &LoadCHARMMTraj, (arg("ent"), arg("trj_filename"), def("LoadCHARMMTraj_", &LoadCHARMMTraj, (arg("ent"), arg("trj_filename"),
arg("stride")=1, arg("lazy_load")=false)); arg("stride")=1, arg("lazy_load")=false));
def("LoadMAE", &LoadMAE); def("LoadMAE", &LoadMAE);
export_pdb_io(); export_pdb_io();
......
...@@ -251,5 +251,11 @@ EntityView ChainHandle::Select(const String& q, QueryFlags flags) const { ...@@ -251,5 +251,11 @@ EntityView ChainHandle::Select(const String& q, QueryFlags flags) const {
else return this->GetEntity().Select(Query("cname='"+Impl()->GetName()+"'"), flags); else return this->GetEntity().Select(Query("cname='"+Impl()->GetName()+"'"), flags);
} }
void ChainHandle::SetInSequence(const int index)
{
this->CheckValidity();
Impl()->SetInSequence(index);
}
}} }}
...@@ -193,7 +193,9 @@ public: ...@@ -193,7 +193,9 @@ public:
bool operator==(const ChainHandle& ref) const; bool operator==(const ChainHandle& ref) const;
bool operator!=(const ChainHandle& ref) const; bool operator!=(const ChainHandle& ref) const;
/// \brief checks whether res breaks the in sequence property
/// and updates it accordingly
void SetInSequence(const int index);
}; };
}} // ns }} // ns
......
...@@ -79,7 +79,9 @@ void EditorBase::RenameResidue(ResidueHandle res, const String& new_name) ...@@ -79,7 +79,9 @@ void EditorBase::RenameResidue(ResidueHandle res, const String& new_name)
void EditorBase::SetResidueNumber(ResidueHandle res, const ResNum& new_num) void EditorBase::SetResidueNumber(ResidueHandle res, const ResNum& new_num)
{ {
CheckHandleValidity(res); CheckHandleValidity(res);
int index=res.GetIndex();
res.Impl()->SetNumber(new_num); res.Impl()->SetNumber(new_num);
res.GetChain().SetInSequence(index);
} }
void EditorBase::RenameChain(ChainHandle chain, const String& new_name) void EditorBase::RenameChain(ChainHandle chain, const String& new_name)
......
...@@ -484,4 +484,19 @@ void ChainImpl::ReorderResidues() ...@@ -484,4 +484,19 @@ void ChainImpl::ReorderResidues()
UpdateShifts(); UpdateShifts();
} }
void ChainImpl::SetInSequence(const int index)
{
ResNum num=residue_list_[index]->GetNumber();
//Check if rp is in sequence
if (in_sequence_) {
if (index>0 && residue_list_[index-1]->GetNumber()>=num)
in_sequence_=false;
if (index<static_cast<int>(residue_list_.size())-1 && residue_list_[index+1]->GetNumber()<=num)
in_sequence_=false;
}
if (in_sequence_) {
this->UpdateShifts();
}
}
}}} // ns }}} // ns
...@@ -175,7 +175,10 @@ public: ...@@ -175,7 +175,10 @@ public:
const ResNum& start, const ResNum& start,
const ResNum& end); const ResNum& end);
int GetIndexForResNum(const ResNum& number) const; int GetIndexForResNum(const ResNum& number) const;
///\brief checks if the residue with that index breaks the in_sequence
/// property and updates it accordingly
void SetInSequence(int index);
private: private:
int GetIndexForResNumInSequence(const ResNum& number) const; int GetIndexForResNumInSequence(const ResNum& number) const;
void UpdateShifts(); void UpdateShifts();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment