Subject: [modeller_usage] plot_profiles.py run error
From: "刘吉元" <>
Date: Mon, 22 Aug 2011 17:52:16 +0800
Hi, I installed epd-7.1-1-rh5-x86_64 which included pylab in RHEL5.7 64 bit system,When I run 'python
plot_profiles.py',I got the error: "Traceback (most recent call last): File "plot_profiles.py", line 1, in ? import pylab ImportError: No module named pylab" --------------------plot_profiles.py-------------------------- import pylab import 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='pp2a-pp2a_mult-pp2a_loop.ali')
model = get_profile('pp2a.profile', a['pp2a']) mult = get_profile('pp2a_mult.profile', a['pp2a_mult']) loop = get_profile('pp2a_loop.profile', a['pp2a_loop'])
# Plot the template and model profiles in the same plot for comparison: pylab.figure(1, figsize=(20,12)) pylab.xlabel('Residue index') pylab.ylabel('DOPE per-residue score') pylab.plot(model, color='red', linewidth=2, label='Basic Model') pylab.plot(mult, color='green', linewidth=2, label='Multiple templates') pylab.plot(loop, color='blue', linewidth=2, label='Loop refinement') pylab.legend() pylab.savefig('dope_profile.png', dpi=96)
When I run help(pylab) of enthought in RHEL5.7,it also prompt that follow: Help on module matplotlib.pylab in matplotlib:
DESCRIPTION This is a procedural interface to the matplotlib object-oriented plotting library.
The following plotting commands are provided; the majority have MATLAB |reg| [*]_ analogs and similar arguments.
.. |reg| unicode:: 0xAE
_Plotting commands acorr - plot the autocorrelation function annotate - annotate something in the figure arrow - add an arrow to the axes axes - Create a new axes axhline - draw a horizontal line across axes :