[modeller_usage] import pylab ImportError: No module named pylab
To: "modeller_usage" <>
Subject: [modeller_usage] import pylab ImportError: No module named pylab
From: "刘吉元" <>
Date: Fri, 5 Aug 2011 12:08:30 +0800
Hi, I installed Enthought(epd-7.1-1-win-x86_64) in Windows 7 Ulti 64bit system,when I run plot_profiles.py,it is very normal.But I installed epd-7.1-1-rh5-x86_64 in RHEL5.7 64 bit system,When I run "python plot_profiles.py",I got the error:"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)