GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — glide-scripts/qqplot.py at master · BorgwardtLab/glide-scripts Expand file tree/ Copy pathqqplot.pyMore file actions 64 lines (44 loc) · 1.37 KB / Copy pathqqplot.pyFile metadata and controls64 lines (44 loc) · 1.37 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 # qqplot.py --- Plot a Q-Q plot for (single SNP) p-values, from PLINK output. # contact: [email protected] import sys from math import log10 import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt from matplotlib import rc def main(args): usage = """python %s <PLINK association file> <qqplot file> Plot a Q-Q plot for the given PLINK output file. """ % args[0] if len(args) != 3: print usage sys.exit(0) plinkOutF = args[1] qplotOutF = args[2] with open(plinkOutF) as f: f.readline() observed = [float(line.split()[8]) for line in f] observed.sort() observed = [-log10(x) for x in observed] L = len(observed) expected = range(1,L+1) L = float(L) expected = [-log10(float(x)/L) for x in expected] plt.ion() rc('text', usetex=True) rc('font', family='serif') plt.figure(figsize=(6,6)) pltIdx = 1 ax = plt.subplot(1, 1, pltIdx) plt.plot(expected, observed, linestyle='-', color='#cc0000') plt.plot(expected, expected, linestyle='-', color='#cccccc') plt.xlabel('Expected (-logP)') plt.ylabel('Observed (-logP)') plt.xlim([0, 6]) plt.ylim([0, 6]) plt.savefig(qplotOutF) sys.stdout.write('Q-Q plot saved to %s\n' % qplotOutF) plt.clf() plt.close() if __name__ == "__main__": main(sys.argv) |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |