[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [modeller_usage] top to python (+ symmetry restraints)



 wrote:
I have a top file from Modeller v6.0 (or possibly older). The top script defines
a tetramer and then applies alpha-helical restraints to the same residue range
in each monomer. I have been trying to convert this to use with the newest
version of Modeller. I've been unsuccessful so far - might someone be able to
help please?

The attached Python script should do pretty much what you want (caveat: it's untested). A couple of things that I changed:

1. There were a whole bunch of unnecessary ENERGY and OPTIMIZE commands in your script, which I removed.

2. Symmetry restraints are slow to evaluate, so I reduced them to the minimal A=B, B=C, C=D, D=A set (the original script also had A=C and B=D, which are not necessary).

	Ben Webb, Modeller Caretaker
--
             http://www.salilab.org/modeller/
Modeller mail list: http://salilab.org/mailman/listinfo/modeller_usage
from modeller.automodel import *

#log.verbose()    # for debugging

env = environ(rand_seed=-12312) # random seed

env.io.atom_files_directory = '.'  # Working directory

def defsym(mdl, aln, seg1, seg2):
    """Constrain segments |seg1| and |seg2| to be identical"""
    for (set,seg) in [(2,seg1), (3,seg2)]:
        mdl.pick_atoms(aln, pick_atoms_set=set, selection_segment=seg,
                       atom_types='ALL', selection_status='INITIALIZE',
                       selection_search='SEGMENT')
    mdl.symmetry.define(symmetry_weight=1.0, add_symmetry=(True, False))


def makealpha(mdl, aln, residue_ids):
    """Enforce alpha-helical structure on |residue_ids|"""
    mdl.restraints.make(aln, restraint_type='ALPHA', residue_ids=residue_ids,
                        spline_on_site=False)


class mymodel(automodel):
    def special_restraints(self, aln):
        segs = [('1', '97'), ('98', '194'), ('195', '291'), ('292', '388')]
        for n in range(len(segs)):
            defsym(self, aln, segs[n-1], segs[n])

        makealpha(self, aln, ('3', '29'))  #M1 region (consensus)
        makealpha(self, aln, ('44', '56')) #P region (jalview p/out)
        makealpha(self, aln, ('68', '94')) #M2 region (consensus)
        makealpha(self, aln, ('100', '126'))
        makealpha(self, aln, ('141', '153'))
        makealpha(self, aln, ('165', '191'))
        makealpha(self, aln, ('197', '223'))
        makealpha(self, aln, ('238', '250'))
        makealpha(self, aln, ('262', '288'))
        makealpha(self, aln, ('294', '320'))
        makealpha(self, aln, ('335', '347'))
        makealpha(self, aln, ('359', '385'))


a = mymodel(env,
            alnfile  = 'glur0.ali',  # The alignment filename
            knowns   = 'kcsa',       # The structure filenames, the pdb
                                     # is called filename.atm
            sequence = 'GluR0')      # The sequence filename
a.starting_model= 1                  # Starting and ending model indices
a.ending_model  = 25
a.deviation = 4.0                    # Deviation in models

# Call the routine model which in turn calls all the other routines required.
a.make()