Skip to content
Snippets Groups Projects
Commit 8a47dff6 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

Residue numbers must be unique when using them to align residues to a SEQRES

parent 3544f890
No related branches found
No related tags found
No related merge requests found
......@@ -100,10 +100,17 @@ def AlignToSEQRES(chain, seqres, try_resnum_first=False, validate=True):
return seq.CreateAlignment()
if try_resnum_first:
aln_seq = seq.CreateSequence('atoms', '-'*len(seqres))
aligned_resnums = set()
for r1 in residues:
if r1.number.num in aligned_resnums:
LogWarning('Residue numbers must be unique. Already observed %i, ' \
'cannot align %s anymore.'%(r1.number.num, r1.qualified_name))
try_resnum_first = False
break
if r1.number.num <= len(seqres) and r1.number.num > 0:
if IsEqual(seqres[r1.number.num - 1], r1.one_letter_code):
aln_seq[r1.number.num - 1] = r1.one_letter_code
aligned_resnums.add(r1.number.num)
else:
LogWarning('Sequence mismatch: chain has "' + r1.one_letter_code +
'", while SEQRES is "' + seqres[r1.number.num - 1] +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment