The automodel class contains a automodel.select_atoms() function which selects the atoms to be moved during optimization. By default, the routine selects all atoms, but you can redefine it to select any subset of atoms, and then only those atoms will be refined. (To redefine the routine, it is necessary to create a `subclass' of automodel, here called MyModel, which has the modified routine within it. We then use MyModel in place of automodel. The select_atoms routine should return a selection object; see Section 6.9 for further information.)
In this particular case, we use the model.residue_range() function to select residues 1 and 2 from a chain with no ID. See Section 6.16.9 for ways to specify residues, and selection() for other examples of selecting atoms or residues. Please note that the residue numbers and chain IDs refer to the built model, not to the template(s). This is because template PDB residue numbering can be inconsistent, and in the case where you have two or more templates, residues from different parts of the sequence coming from different templates could have the same number. MODELLER always names the model residues consistently, counting up from 1. No chain ID is assigned when building a single chain model, but if you build a multi-chain model, chain IDs A, B, C, etc are assigned2.2. If in doubt about residue numbering, first build a model using the simple script in section 2.1, and then look at the final model (or the initial unoptimized .ini model) for the residue numbering.
By default, the selected atoms will ``feel'' the presence of other atoms via all the static and possibly dynamic restraints that include both selected and un-selected atoms. However, you can turn off dynamic interactions between the selected and unselected regions by setting energy_data.nonbonded_sel_atoms to 2 (by default it is 1).
The difference between this script and the one for loop modeling is that here the selected regions are optimized with the default optimization protocol and the default restraints, which generally include template-derived restraints. In contrast, the loop modeling routine does not use template-dependent restraints, but does a much more thorough optimization.
# Homology modeling by the automodel class # # Demonstrates how to refine only a part of the model. # # You may want to use the more exhaustive "loop" modeling routines instead. # from modeller import * from modeller.automodel import * # Load the automodel class log.verbose() # Override the 'select_atoms' routine in the 'automodel' class: # (To build an all-hydrogen model, derive from allhmodel rather than automodel # here.) class MyModel(automodel): def select_atoms(self): # Select residues 1 and 2 (PDB numbering) return selection(self.residue_range('1:', '2:')) # The same thing from chain A (required for multi-chain models): # return selection(self.residue_range('1:A', '2:A')) # Residues 4, 6, 10: # return selection(self.residues['4'], self.residues['6'], # self.residues['10']) # All residues except 1-5: # return selection(self) - selection(self.residue_range('1', '5')) env = environ() # directories for input atom files env.io.atom_files_directory = ['.', '../atom_files'] # selected atoms do not feel the neighborhood env.edat.nonbonded_sel_atoms = 2 # Be sure to use 'MyModel' rather than 'automodel' here! a = MyModel(env, alnfile = 'alignment.ali', # alignment filename knowns = '5fd1', # codes of the templates sequence = '1fdx') # code of the target a.starting_model= 3 # index of the first model a.ending_model = 3 # index of the last model # (determines how many models to calculate) a.make() # do homology modeling