In [2]:
import numpy as np
import matplotlib.pyplot as plt
In [3]:
%matplotlib inline
plt.rcParams['figure.figsize'] = [12, 10]
plt.rcParams['font.size'] = 12
In [3]:
%ll
In [18]:
pval, MAF, numSNP = [], [], []
with open("MAF_by_pval_ery") as f:
f.readline() # read the first line, but discard (header)
for line in f:
one, two, three = line.strip().split("\t")
pval.append(float(one))
MAF.append(float(two))
numSNP.append(int(three))
numSNP = np.array(numSNP)
In [9]:
plt.scatter?
In [35]:
plt.scatter(pval, MAF, s=75, c=numSNP, cmap='jet')
plt.colorbar()
plt.grid()
plt.xlabel('p-value')
plt.ylabel('average MAF')
Out[35]:
In [29]:
plt.semilogx?
In [93]:
ax = plt.gca()
ax.semilogx()
plt.scatter(pval, MAF, s=80, c=np.log10(numSNP), cmap='jet')
cb = plt.colorbar(ticks=[2, 3, 4]) # shrink=0.9, ticks=[1, 2, 3, 4, 5]
cb.set_label(r"$log_{10}$" + " #SNP")
plt.grid()
plt.xlabel('p-value')
plt.ylabel('average MAF')
plt.title('Dependence of HWE p-value on MAF')
#ax.text(20, 0.445, r"$log_{10}$" + " #SNP")
plt.savefig("MAF_by_pval_ery.png")
In [80]:
plt.colorbar?
In [43]:
np.log10?
In [48]:
np.log10(numSNP)
Out[48]:
In [53]:
plt.annotate?
In [89]:
cb.set_label?
I am still looking for a way to set tick labels on the colorbar.
Now do the same for the SNP's in the PAR population.
In [94]:
pval, MAF, numSNP = [], [], []
with open("MAF_by_pval_par") as f:
f.readline() # read the first line, but discard (header)
for line in f:
one, two, three = line.strip().split("\t")
pval.append(float(one))
MAF.append(float(two))
numSNP.append(int(three))
numSNP = np.array(numSNP)
ax = plt.gca()
ax.semilogx()
plt.scatter(pval, MAF, s=80, c=np.log10(numSNP), cmap='jet')
cb = plt.colorbar(ticks=[2, 3, 4]) # shrink=0.9, ticks=[1, 2, 3, 4, 5]
cb.set_label(r"$log_{10}$" + " #SNP")
plt.grid()
plt.xlabel('p-value')
plt.ylabel('average MAF')
plt.title('Dependence of HWE p-value on MAF')
#ax.text(20, 0.445, r"$log_{10}$" + " #SNP")
plt.savefig("MAF_by_pval_par.png")
I have also determined the MAF for SNP with negative F value for different p-value cutoffs.
In [4]:
pval, MAF, numSNP = [], [], []
with open("MAF_by_pval_negFis_par") as f:
f.readline() # read the first line, but discard (header)
for line in f:
one, two, three = line.strip().split("\t")
pval.append(float(one))
MAF.append(float(two))
numSNP.append(int(three))
numSNP = np.array(numSNP)
ax = plt.gca()
ax.semilogx()
plt.scatter(pval, MAF, s=80, c=np.log10(numSNP), cmap='jet')
cb = plt.colorbar(ticks=[2, 3, 4]) # shrink=0.9, ticks=[1, 2, 3, 4, 5]
cb.set_label(r"$log_{10}$" + " #SNP")
plt.grid()
plt.xlabel('p-value')
plt.ylabel('average MAF')
plt.title('Dependence of HWE p-value on MAF')
#ax.text(20, 0.445, r"$log_{10}$" + " #SNP")
plt.savefig("MAF_by_pval_par.png")
In [5]:
pval, MAF, numSNP = [], [], []
with open("MAF_by_pval_negFis_ery") as f:
f.readline() # read the first line, but discard (header)
for line in f:
one, two, three = line.strip().split("\t")
pval.append(float(one))
MAF.append(float(two))
numSNP.append(int(three))
numSNP = np.array(numSNP)
ax = plt.gca()
ax.semilogx()
plt.scatter(pval, MAF, s=80, c=np.log10(numSNP), cmap='jet')
cb = plt.colorbar(ticks=[2, 3, 4]) # shrink=0.9, ticks=[1, 2, 3, 4, 5]
cb.set_label(r"$log_{10}$" + " #SNP")
plt.grid()
plt.xlabel('p-value')
plt.ylabel('average MAF')
plt.title('Dependence of HWE p-value on MAF')
#ax.text(20, 0.445, r"$log_{10}$" + " #SNP")
plt.savefig("MAF_by_pval_par.png")
In [ ]: