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
On 10/7/10 9:45 PM, Munishika Kalia wrote: > I am trying to plot the DOPE score against one of the template used in > modelling and final model. > The script is as follows: ... > The error is : > File "plot_profiles.py", line 14 > for n, res in enumerate (seq.residues): > ^ > SyntaxError: invalid syntax
Like it says, you have a syntax error in your script. That's a Python error - nothing to do with Modeller. It's impossible to say for sure what the problem is, because by pasting the script into your email, you have probably changed the nature of the error (better to attach the script to your email instead). Maybe that line isn't indented properly.
Ben Webb, Modeller Caretaker
participants (2)
-
Modeller Caretaker
-
Munishika Kalia