pKaTool/Ghosts/Chemical_shift_md.py
def plot(self):
		'''
		Plot the outcome of the MD simulations
		'''
		import matplotlib
		matplotlib.use('Agg')
		from mpl_toolkits.mplot3d import Axes3D
		import matplotlib.pyplot as plt
		from matplotlib import cm
		import numpy as np
		
		fileFirst = self.pdb + '.pdb.' + str(self.start)
		coordMol, coordSol, coordCl = self.parseCoord(fileFirst)
		resNumsMol = coordMol.keys()
		if not os.path.isdir(os.path.join(os.getcwd(),'figures/')):
			os.system('mkdir figures')
		dir_name = os.path.join(os.getcwd(),'figures/')
		name = ['side chain CSP', 'backbone CSP', 'solvent CSP', 'total CSP']
		color = ['r', 'b', 'c', 'k']
		for nucleus in ['N', 'H']:
			for resNumMol in resNumsMol:
				if resNumMol == 1: continue
				#PROLINE
				CSPside = []
				CSPback = []
				CSPsol = []
				CSPtotal = []
				if 'H' not in coordMol[resNumMol].keys(): continue #PROLINE
				fileName = 'energy%s%s.txt'%(nucleus, resNumMol)
				try:
					fd = open(fileName, "r")
					lines = fd.readlines()
					fd.close()
				except IOError:
					continue
				for line in lines:
					CSPside.append(float(line.split()[1]))
					CSPback.append(float(line.split()[2]))
					CSPsol.append(float(line.split()[3]))
					CSPtotal.append(float(line.split()[5]))
					
				numberFrames = len(lines)
				frames = range(1, numberFrames+1)
				plt.clf()
				plt.subplot(111)
				plt.grid(False)
				plt.hold(True)
				plt.title('CSP of %s%d'%(nucleus,resNumMol), fontsize='14')
				plt.xlabel('MD structure', verticalalignment = 'top', fontsize='12')
				plt.ylabel('predicted CSP[ppm/au]',fontsize='12')
				plt.plot(frames,CSPside,linewidth=2.0, label=name[0])
				plt.plot(frames,CSPback,linewidth=2.0, label=name[1])
				plt.plot(frames,CSPsol,linewidth=2.0, label=name[2])
				plt.plot(frames,CSPtotal,linewidth=2.0, label=name[3])
				plt.legend(shadow=True, fancybox=True, loc = 'best')
				leg = plt.gca().get_legend()
				ltext  = leg.get_texts()  # all the text.Text instance in the legend
				llines = leg.get_lines()  # all the lines.Line2D instance in the legend
				frame  = leg.get_frame()  # the patch.Rectangle instance surrounding the legend
				frame.set_facecolor('0.95') # set the frame face color to light gray
				frame.set_alpha(0.9) # set the alpha value of the legend: it will be translucent
				plt.setp(ltext, fontsize='10')    # the legend text fontsize
				plt.setp(llines, linewidth=1.0)      # the legend linewidth
				figureName = dir_name+'nuclei%s%d.png'%(nucleus,resNumMol)
				plt.savefig(figureName, dpi = 600)

		Plot the outcome of the MD simulations
		
Plot the outcome of the MD simulations
Plot the outcome of the MD simulations
def plot(self):
		import matplotlib
		matplotlib.use('Agg')
		from mpl_toolkits.mplot3d import Axes3D
		import matplotlib.pyplot as plt
		from matplotlib import cm
		import numpy as np
		fileFirst = self.pdb + '.pdb.' + str(self.start)
		coordMol, coordSol, coordCl = self.parseCoord(fileFirst)
		resNumsMol = coordMol.keys()
		if not os.path.isdir(os.path.join(os.getcwd(),'figures/')):
			os.system('mkdir figures')
		dir_name = os.path.join(os.getcwd(),'figures/')
		name = ['side chain CSP', 'backbone CSP', 'solvent CSP', 'total CSP']
		color = ['r', 'b', 'c', 'k']
		for nucleus in ['N', 'H']:
			for resNumMol in resNumsMol:
				if resNumMol == 1: continue
				CSPside = []
				CSPback = []
				CSPsol = []
				CSPtotal = []
				if 'H' not in coordMol[resNumMol].keys(): continue 
				fileName = 'energy%s%s.txt'%(nucleus, resNumMol)
				try:
					fd = open(fileName, "r")
					lines = fd.readlines()
					fd.close()
				except IOError:
					continue
				for line in lines:
					CSPside.append(float(line.split()[1]))
					CSPback.append(float(line.split()[2]))
					CSPsol.append(float(line.split()[3]))
					CSPtotal.append(float(line.split()[5]))
				numberFrames = len(lines)
				frames = range(1, numberFrames+1)
				plt.clf()
				plt.subplot(111)
				plt.grid(False)
				plt.hold(True)
				plt.title('CSP of %s%d'%(nucleus,resNumMol), fontsize='14')
				plt.xlabel('MD structure', verticalalignment = 'top', fontsize='12')
				plt.ylabel('predicted CSP[ppm/au]',fontsize='12')
				plt.plot(frames,CSPside,linewidth=2.0, label=name[0])
				plt.plot(frames,CSPback,linewidth=2.0, label=name[1])
				plt.plot(frames,CSPsol,linewidth=2.0, label=name[2])
				plt.plot(frames,CSPtotal,linewidth=2.0, label=name[3])
				plt.legend(shadow=True, fancybox=True, loc = 'best')
				leg = plt.gca().get_legend()
				ltext  = leg.get_texts()  
				llines = leg.get_lines()  
				frame  = leg.get_frame()  
				frame.set_facecolor('0.95') 
				frame.set_alpha(0.9) 
				plt.setp(ltext, fontsize='10')    
				plt.setp(llines, linewidth=1.0)      
				figureName = dir_name+'nuclei%s%d.png'%(nucleus,resNumMol)
				plt.savefig(figureName, dpi = 600)
def plot ( self ) : import matplotlib matplotlib . use ( 'Agg' ) from mpl_toolkits . mplot3d import Axes3D import matplotlib . pyplot as plt from matplotlib import cm import numpy as np fileFirst = self . pdb + '.pdb.' + str ( self . start ) coordMol , coordSol , coordCl = self . parseCoord ( fileFirst ) resNumsMol = coordMol . keys ( ) if not os . path . isdir ( os . path . join ( os . getcwd ( ) , 'figures/' ) ) : os . system ( 'mkdir figures' ) dir_name = os . path . join ( os . getcwd ( ) , 'figures/' ) name = [ 'side chain CSP' , 'backbone CSP' , 'solvent CSP' , 'total CSP' ] color = [ 'r' , 'b' , 'c' , 'k' ] for nucleus in [ 'N' , 'H' ] : for resNumMol in resNumsMol : if resNumMol == 1 : continue CSPside = [ ] CSPback = [ ] CSPsol = [ ] CSPtotal = [ ] if 'H' not in coordMol [ resNumMol ] . keys ( ) : continue fileName = 'energy%s%s.txt' % ( nucleus , resNumMol ) try : fd = open ( fileName , "r" ) lines = fd . readlines ( ) fd . close ( ) except IOError : continue for line in lines : CSPside . append ( float ( line . split ( ) [ 1 ] ) ) CSPback . append ( float ( line . split ( ) [ 2 ] ) ) CSPsol . append ( float ( line . split ( ) [ 3 ] ) ) CSPtotal . append ( float ( line . split ( ) [ 5 ] ) ) numberFrames = len ( lines ) frames = range ( 1 , numberFrames + 1 ) plt . clf ( ) plt . subplot ( 111 ) plt . grid ( False ) plt . hold ( True ) plt . title ( 'CSP of %s%d' % ( nucleus , resNumMol ) , fontsize = '14' ) plt . xlabel ( 'MD structure' , verticalalignment = 'top' , fontsize = '12' ) plt . ylabel ( 'predicted CSP[ppm/au]' , fontsize = '12' ) plt . plot ( frames , CSPside , linewidth = 2.0 , label = name [ 0 ] ) plt . plot ( frames , CSPback , linewidth = 2.0 , label = name [ 1 ] ) plt . plot ( frames , CSPsol , linewidth = 2.0 , label = name [ 2 ] ) plt . plot ( frames , CSPtotal , linewidth = 2.0 , label = name [ 3 ] ) plt . legend ( shadow = True , fancybox = True , loc = 'best' ) leg = plt . gca ( ) . get_legend ( ) ltext = leg . get_texts ( ) llines = leg . get_lines ( ) frame = leg . get_frame ( ) frame . set_facecolor ( '0.95' ) frame . set_alpha ( 0.9 ) plt . setp ( ltext , fontsize = '10' ) plt . setp ( llines , linewidth = 1.0 ) figureName = dir_name + 'nuclei%s%d.png' % ( nucleus , resNumMol ) plt . savefig ( figureName , dpi = 600 )
Plot the outcome of the MD simulations
Plot the outcome of the MD simulations
'''
		Plot the outcome of the MD simulations
		''' #PROLINE #PROLINE # all the text.Text instance in the legend # all the lines.Line2D instance in the legend # the patch.Rectangle instance surrounding the legend # set the frame face color to light gray # set the alpha value of the legend: it will be translucent # the legend text fontsize # the legend linewidth
self