Hi,
I am trying to plot the DOPE score against one of the template used in modelling and final model.The script is as follows:import pylabimport modeller
def get_profile(profile_file, seq):Ā Ā Ā """Read `profile_file` into a Python array, and add gaps corresponding toĀ Ā Ā Ā the alignment sequence `seq`."""Ā Ā Ā # Read all non-comment and non-blank lines from the file:Ā Ā Ā f = file(profile_file)Ā Ā Ā vals = []Ā Ā Ā for line in f:Ā Ā Ā Ā Ā if not line.startswith('#') and len(line) > 10:Ā Ā Ā Ā Ā Ā Ā spl = line.split()Ā Ā Ā Ā Ā Ā Ā vals.append(float(spl[-1]))Ā Ā Ā # Insert gaps into the profile corresponding to those in seq:Ā Ā Ā for n, res in enumerate(seq.residues):Ā Ā Ā Ā Ā Ā Ā for gap in range(res.get_leading_gaps()):Ā Ā Ā Ā Ā Ā Ā Ā Ā vals.insert(n, None)Ā Ā Ā # Add a gap at position '0', so that we effectively count from 1:Ā Ā Ā vals.insert(0, None)Ā Ā Ā return vals
e = modeller.environ()a = modeller.alignment(e, file='TvLDH-1bdmA.ali')
template = get_profile('1bdmA.profile', a['1bdmA'])model = get_profile('TvLDH.profile', a['TvLDH'])
# Plot the template and model profiles in the same plot for comparison:pylab.figure(1, figsize=(10,6))pylab.xlabel('Alignment position')pylab.ylabel('DOPE per-residue score')pylab.plot(model, color='red', linewidth=2, label='Model')pylab.plot(template, color='green', linewidth=2, label='Template')pylab.legend()pylab.savefig('dope_profile.png', dpi=65)
The error is :File "plot_profiles.py", line 14Ā Ā Ā for n, res in enumerate (seq.residues):Ā Ā Ā Ā ^SyntaxError: invalid syntax
Please let me know how i can rectify the script.
Many thanks,Munishika Kalia