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

[modeller_usage] How to include alignment to model_symmetry_define()



Hi Modellers,

I need to obtain loop conformation distributions in a tetramer structure. So I
used loopmodel() to redefine the 4 loops in each subunit. I found that the 4
loops in each tetramer is not symmetrical. I therefore applied
model_symmetry_define() in order to fix them the same during the optimisation.

Here I have a question. The code I have used is at
http://salilab.org/modeller/manual/node160.html

However, in define_symmetry-3.atm file, the structure looks very bizarre. It has
lost its secondary structure elements and 4 loops are not symmetrical at all.

So I tried to add the sequence alignment between the loop model and the
template. I cannot work out the python code. Could some one kindly have a look
what I have done wrongly please.

Here is the code:

# Example for: model.symmetry.define()

# This will force two copies of RCK4 to have similar mainchain
# conformation.

log.level(1, 1, 1, 1, 0)
env = environ()
env.libs.topology.read(file='$(LIB)/top_heav.lib')
env.libs.parameters.read(file='$(LIB)/par.lib')

#env.io.atom_files_directory = 'xxx'
env.io.atom_files_directory = '.'


def defsym(lop, aln, seg1, seg2):
    for (set, seg) in [(2, seg1), (3, seg2)]:
        lop.pick_atoms(aln, pick_atoms_set=set, selection_segment=seg,
                       atom_types='All', selection_status='INITIALIZE',
                       selection_search='SEGMENT')
    lop.symmetry.define(symmetry_weight=1.0, add_symmetry=(True, False))

# Generate two copies of a segment:
lop = model(env, file='model-nam', model_segment=('1:A', '110:D'))
aln = alignment(env)
aln.append_model(lop, align_codes='model-nam', atom_files='tmp-nam')
aln.append_model(lop, align_codes='model-nam'+'_ini',
atom_files='tmp-nam'+'_ini')
lop.generate_topology(aln, sequence='model-nam'+'_ini')
lop.transfer_xyz(aln)
lop.build(initialize_xyz=False, build_method='INTERNAL_COORDINATES')
#lop.rename_segments(segment_ids=('A', 'B')) #, renumber_residues=(1, 1))

myedat = energy_data(dynamic_sphere = False)
lop.energy(edat=myedat)
lop.randomize_xyz(deviation=6.0)
# Define the two segments (chains in this case) to be identical:
defsym(lop, aln, seg1=('39:A', '49:A'), seg2=('39:B', '49:B'))

# Make them identical by optimizing the initial randomized structure
# without any other restraints:
lop.energy(edat=myedat)
lop.write(file='define_symmetry-1.atm')
lop.optimize(max_iterations=300, edat=myedat)
lop.write(file='define_symmetry-2.atm')
lop.energy(edat=myedat)

# Now optimize with stereochemical restraints so that the
# result is not so distorted a structure (still distorted
# because optimization is not thorough):
myedat.dynamic_sphere = True
lop.restraints.make(aln, restraint_type='stereo', spline_on_site=False,
                    edat=myedat)
lop.randomize_xyz(deviation=3.0)
for method in (1, 3, 1):   # 1 = conjugate gradients, 3 = molecular dynamics
    lop.optimize(max_iterations=300, md_return='FINAL', edat=myedat,
                 optimization_method=method, output='REPORT')
lop.write(file='define_symmetry-3.atm')
lop.energy(edat=myedat)

# Create a blank alignment so that superpose uses its 1:1 default
aln = alignment(env)

lop = model(env, file='define_symmetry-3.atm', model_segment=('39:A', '49:A'))
lop2 = model(env, file='define_symmetry-3.atm', model_segment=('39:B', '49:B'))
lop.pick_atoms(aln, atom_types='All')
lop.superpose(lop2, aln)

Also, what does aln.append_model(lop, align_codes='model-nam'+'_ini',
atom_files='tmp-nam'+'_ini') mean?

The erro message by executing the above .py file is:
"_modeller.error: transfe_682E> Structural information is not available for all
sequences in the alignment. Aborting."


Thank you very much.

Binbin