def plotDihedralD1_1d(): dihedralName = 'Cb4N' graphicsFormat = "png" nTmessage("Starting plotDihedralD1_1d") # interestingResTypeList = [ 'GLY' ] interestingResTypeList = common20AAList # interestingResTypeList = [ 'GLY', 'ALA' ] # interestingResTypeList = [ 'CYS', 'PRO' ] for resType in common20AAList: for resTypePrev in common20AAList: # nTmessage("Looking at %s %s" % ( resType, resTypePrev)) if resType not in interestingResTypeList: continue if resTypePrev not in interestingResTypeList: continue if resType != 'GLY': continue # if resTypePrev != 'ALA': # continue titleStr = 'd1 %s(i-1) %s(i)' % (resTypePrev, resType) nTmessage("plotting: %s" % titleStr) plotparams = plotParameters.getdefault(dihedralName, 'dihedralDefault') ps = NTplotSet() # closes any previous plots ps.hardcopySize = (600, 369) plot = NTplot(title=titleStr, xRange=(plotparams.min, plotparams.max), yRange=(0, 50), xTicks=range(int(plotparams.min), int(plotparams.max + 1), plotparams.ticksize), xLabel=dihedralName, yLabel='Occurrence (%)') ps.addPlot(plot) h = getDeepByKeys(hPlot.histd1ByResTypes, resType, resTypePrev) if h == None: continue sumh = sum(h) plot.title += ' tot: %d' % sumh x = range(5, 360, 10) y = 100.0 * h / sumh # mod inplace points = zip(x, y) lAttr = solidLine(color='black') plot.lines(points, attributes=lAttr) ssTypeList = hPlot.histd1BySs0.keys() ssTypeList.sort() # in place sort to: space, H, S colorList = ['green', 'blue', 'yellow'] for isI in (1, 0): if isI: # histd1BySs = hPlot.histd1BySs0 histd1BySsAndResTypes = hPlot.histd1BySs0AndResTypes else: # histd1BySs = hPlot.histd1BySs1 histd1BySsAndResTypes = hPlot.histd1BySs1AndResTypes for i, ssType in enumerate(ssTypeList): h = getDeepByKeys(histd1BySsAndResTypes, ssType, resType, resTypePrev) sumh = sum(h) plot.title += ' %s: %d' % (ssType, sumh) if h == None: continue # nTdebug('appending [%s]' % ssType) y = 100.0 * h / sumh points = zip(x, y) lAttr = solidLine(color=colorList[i]) plot.lines(points, attributes=lAttr) fn = "d1 %s %s_d1d2." % (resTypePrev, resType) fn += graphicsFormat ps.hardcopy(fn, graphicsFormat)
def plotDihedralD1_1d(): dihedralName = 'Cb4N' graphicsFormat = "png" nTmessage("Starting plotDihedralD1_1d") # interestingResTypeList = [ 'GLY' ] interestingResTypeList = common20AAList # interestingResTypeList = [ 'GLY', 'ALA' ] # interestingResTypeList = [ 'CYS', 'PRO' ] for resType in common20AAList: for resTypePrev in common20AAList: # nTmessage("Looking at %s %s" % ( resType, resTypePrev)) if resType not in interestingResTypeList: continue if resTypePrev not in interestingResTypeList: continue if resType != 'GLY': continue # if resTypePrev != 'ALA': # continue titleStr = 'd1 %s(i-1) %s(i)' % (resTypePrev, resType) nTmessage("plotting: %s" % titleStr) plotparams = plotParameters.getdefault(dihedralName, 'dihedralDefault') ps = NTplotSet() # closes any previous plots ps.hardcopySize = (600, 369) plot = NTplot(title=titleStr, xRange=(plotparams.min, plotparams.max), yRange=(0, 50), xTicks=range(int(plotparams.min), int(plotparams.max + 1), plotparams.ticksize), xLabel=dihedralName, yLabel='Occurrence (%)') ps.addPlot(plot) h = getDeepByKeys(hPlot.histd1ByResTypes, resType, resTypePrev) if h == None: continue sumh = sum(h) plot.title += ' tot: %d' % sumh x = range(5, 360, 10) y = 100.0 * h / sumh # mod inplace points = zip(x, y) lAttr = solidLine(color='black') plot.lines(points, attributes=lAttr) ssTypeList = hPlot.histd1BySs0.keys() ssTypeList.sort() # in place sort to: space, H, S colorList = [ 'green', 'blue', 'yellow'] for isI in (1, 0): if isI: # histd1BySs = hPlot.histd1BySs0 histd1BySsAndResTypes = hPlot.histd1BySs0AndResTypes else: # histd1BySs = hPlot.histd1BySs1 histd1BySsAndResTypes = hPlot.histd1BySs1AndResTypes for i, ssType in enumerate(ssTypeList): h = getDeepByKeys(histd1BySsAndResTypes, ssType, resType, resTypePrev) sumh = sum(h) plot.title += ' %s: %d' % (ssType, sumh) if h == None: continue # nTdebug('appending [%s]' % ssType) y = 100.0 * h / sumh points = zip(x, y) lAttr = solidLine(color=colorList[i]) plot.lines(points, attributes=lAttr) fn = "d1 %s %s_d1d2." % (resTypePrev, resType) fn += graphicsFormat ps.hardcopy(fn, graphicsFormat)