Skip to content
Snippets Groups Projects
Commit e155f268 authored by Ansgar Philippsen's avatar Ansgar Philippsen
Browse files

fixed residue sorting in mae importer

parent c889ceb7
Branches
Tags
No related merge requests found
......@@ -297,7 +297,23 @@ void MAEReader::parse_and_add_atom(mol::EntityHandle ent,
if(update_residue) {
if (!(curr_residue_=curr_chain_.FindResidue(rnum))) {
curr_residue_=editor.AppendResidue(curr_chain_, rkey, rnum);
if(curr_chain_.GetResidueCount()>0) {
int loc=curr_chain_.GetResidueCount()-1;
for(;loc>=0;--loc) {
if(curr_chain_.GetResidueByIndex(loc).GetNumber()<rnum) break;
}
if(loc<0) {
curr_residue_=editor.InsertResidueBefore(curr_chain_,0,rnum,rkey);
} else {
curr_residue_=editor.InsertResidueAfter(curr_chain_,loc,rnum,rkey);
}
if(!curr_residue_) {
// this should not happen...
curr_residue_=editor.AppendResidue(curr_chain_, rkey, rnum);
}
} else {
curr_residue_=editor.AppendResidue(curr_chain_, rkey, rnum);
}
assert(curr_residue_.IsValid());
LOG_TRACE(" new residue " << curr_residue_);
++residue_count_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment