I have an input alignment, two structures, and a subset of residues I would like to use to perform a superposition. When I perform the superposition using all residues in the alignment I am successful. However, when I attempt to perform the superposition using a subset, I get error messages:
The script:
from modeller import * env = environ() log.very_verbose() env.io.atom_files_directory = '.' aln = alignment(env, file='reference.1dlf_L.pir', align_codes=('1ck0', '1dlf')) mdl1 = model(env, file='1ck0', model_segment=aln['1ck0'].range) mdl2 = model(env, file='1dlf', model_segment=aln['1dlf'].range) atmsel = selection(mdl1.residue_range('19', '23'), mdl1.residue_range('35', '39')) r = atmsel.superpose(mdl2, aln) mdl2.write(file='1dlf.subset.pdb')
The alignment: >P1;1ck0 structureX:1ck0:FIRST:L:LAST:L:Ab:species:: DIQLTQSPS-SLAVSAGEKVTMNCKSSQNLLHSITR--KNYLAWYRQKPGQSPKLLIYW---ASTRGSGVPDRFTGSGSGTDFTLTISSVQAEDLAVYYC---KQSYNL-YTFGGGTKLEIKRADAAPTVSIFPPSSEQLTSGGASVVCFLNNFYPKDINVKWKIDGSERQNGVLNSWTDQDSKDSTYSMSSTLTLTKDEYERHNSYTCEATHKTSTSPIVKSFNR * >P1;1dlf structureX:1dlf:FIRST:L:LAST:L:Ab:species:: DVVMTQ-TPLSLPVSLGNQASISCRSSQS---LVHSNGNTYLHWYLQKPGQSPKLLIYK---VSNRFSGVPDRFSGSGSGTDFTLKISRVEAEDLGVYFC---SQSTHVPFTFGSGTKLEIKR------------------------------------------------------------------------------------------------------- *
The Error:
Traceback (most recent call last): File "modelscript.1ck0.1dlf.py", line 10, in ? atmsel = selection(mdl1.residue_range('19', '23'), mdl1.residue_range('35', '39')) File "/usr/lib/modeller9v3/modlib/modeller/coordinates.py", line 71, in residue_range start = self.residues[start]._num File "/usr/lib/modeller9v3/modlib/modeller/coordinates.py", line 198, in __getitem__ (self.offset, self.length, self.suffix)) File "/usr/lib/modeller9v3/modlib/modeller/util/modutil.py", line 19, in handle_seq_indx int_indx = lookup_func(*args) File "/usr/lib/modeller9v3/modlib/modeller/coordinates.py", line 56, in _indxres raise KeyError("No such residue: %s" % indx) KeyError: 'No such residue: 19'