def plotAmplifiedRegion(chrm, vmax, criteria, reorder=None): fig = plt.figure(figsize=(5,4)) if reorder is None: reorder = parameters.reorder[::-1] plotCoverageHeatMap((smoothedValuesNorm[chrm][criteria]/meanReadsPerBasepair)[:, reorder], vmin=0, vmax=vmax, cmap='coolwarm', cluster=False, rowlabels=parameters.headers[reorder], metric='correlation', cbar_label='number of insertions/bp', colorbar=False) #plt.title(chrm) xvalues = windowedLocs[chrm][criteria] ax = plt.gca() maxxtick = 25 xtickvec = np.arange(0, maxxtick+5, 5) ax.set_xticks(xtickvec-0.5) ax.set_xticklabels((xvalues)[xtickvec]/1E6) ax.set_xlabel('distance across chromosome %s (Mb)'%chrm) ax.yaxis.tick_left() return
for chrm in chrms: #smoothedValuesNorm[chrm] = smoothedValues[chrm]/np.mean(smoothedValues['chr1'], 0) * np.mean(smoothedValues['chr1']) # NOTE: not actually normalizing at all smoothedValuesNorm[chrm] = smoothedValues[chrm] # what should max plotted value be? allValues = smoothedValuesNorm[chrms[0]] for chrm in chrms[1:]: allValues = np.vstack((allValues, smoothedValuesNorm[chrm])) vmax = 0.5*np.max(allValues) for chrm in chrms: plotCoverageHeatMap(smoothedValuesNorm[chrm], xvalues=windowedLocs[chrm], vmin=0, vmax=vmax, cmap='coolwarm', rowlabels=parameters.headers, metric='correlation', cbar_label='number of insertions/bp') plt.title(chrm) ax = plt.gca() ax.set_xlabel('distance across chromosome (%dkb)'%(stepSize/1000.0)) plt.tight_layout() plt.savefig('coverage.noNorm.window_%.1e.step_%.1e.%s.pdf'%(windowSize, stepSize, chrm)) plt.close() # call things as way out of line ## define cutoff cutoff = 3*np.median(allValues, 0)