From d8c4242ee571f51ef4e9804cb72ad086dd033bdd Mon Sep 17 00:00:00 2001 From: Stefan Bienert <stefan.bienert@unibas.ch> Date: Fri, 9 Sep 2011 10:20:53 +0200 Subject: [PATCH] Added handling of 'X', '?' to AlignToSeqres --- modules/seq/alg/pymod/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/seq/alg/pymod/__init__.py b/modules/seq/alg/pymod/__init__.py index bd108a603..63157ea31 100644 --- a/modules/seq/alg/pymod/__init__.py +++ b/modules/seq/alg/pymod/__init__.py @@ -85,6 +85,10 @@ def AlignToSEQRES(chain, seqres, try_resnum_first=False, validate=True): :returns: The alignment of the residues in the chain and the SEQRES entries. :rtype: :class:`~ost.seq.AlignmentHandle` """ + + def IsEqual(olc1, olc2): + return olc1 in ('X', '?') or olc2 in ('X', '?') or olc1 == olc2 + from ost import seq from ost import mol from ost import LogWarning @@ -96,7 +100,7 @@ def AlignToSEQRES(chain, seqres, try_resnum_first=False, validate=True): aln_seq = seq.CreateSequence('atoms', '-'*len(seqres)) for r1 in residues: if r1.number.num <= len(seqres) and r1.number.num > 0: - if seqres[r1.number.num - 1] == r1.one_letter_code: + if IsEqual(seqres[r1.number.num - 1], r1.one_letter_code): aln_seq[r1.number.num - 1] = r1.one_letter_code else: LogWarning('Sequence mismatch: chain has "' + r1.one_letter_code + -- GitLab