blob: 52a2389fdced8cdd270059788e99cf5a3d7228b1 (
plain)
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
65
66
67
68
69
70
71
72
73
|
import datastructure
import genotypes
import probesets
"""
For: Ash
Date: 2014-02-05
Function:
For BXD group, calculate correlations with genotypes and probesets.
Running History:
2014-02-05 /home/leiyan/gn2/wqflask/maintenance/dataset/datadir/20140205_Ash_correlations/output
"""
def bxd_correlations():
#
inbredsetid = 1
genofile = "/home/leiyan/gn/web/genotypes/BXD.geno"
outputdir = "/home/leiyan/gn2/wqflask/maintenance/dataset/datadir/20140205_Ash_correlations/output"
#
t = genotypes.load_genos(genofile)
genostrains = t[0]
genos = t[1]
#
probesetfreezes = datastructure.get_probesetfreezes(inbredsetid)
print "Get %d probesetfreezes" % (len(probesetfreezes))
#
for probesetfreeze in probesetfreezes:
#
print probesetfreeze
probesetfreezeid = probesetfreeze[0]
probesetfreezename = probesetfreeze[1]
probesetfreezefullname = probesetfreeze[2]
#
outputfile = open("%s/%d_%s.txt" % (outputdir, probesetfreezeid, probesetfreezename), "w+")
outputfile.write("%s\t" % "ProbeSet Id")
outputfile.write("%s\t" % "ProbeSet Name")
outputfile.write("%s\t" % "Geno Name")
outputfile.write("%s\t" % "Overlap Number")
outputfile.write("%s\t" % "Pearson r")
outputfile.write("%s\t" % "Pearson p")
outputfile.write("%s\t" % "Spearman r")
outputfile.write("%s\t" % "Spearman p")
outputfile.write("\n")
outputfile.flush()
#
probesetxrefs = probesets.get_probesetxref(probesetfreezeid)
print "Get %d probesetxrefs" % (len(probesetxrefs))
#
for probesetxref in probesetxrefs:
#
probesetid = probesetxref[0]
probesetdataid = probesetxref[1]
probeset = probesets.get_probeset(probesetid)
ProbeSetId = probeset[0]
ProbeSetName = probeset[1]
# Geno Name Overlap Number Pearson r Pearson p Spearman r Spearman p
probesetdata = probesets.get_probesetdata(probesetdataid)
#
for geno in genos:
genoname = geno['locus']
outputfile.write("%s\t" % probeSetid)
outputfile.write("%s\t" % ProbeSetName)
outputfile.write("%s\t" % GenoName)
outputfile.write("%s\t" % "Overlap Number")
outputfile.write("%s\t" % "Pearson r")
outputfile.write("%s\t" % "Pearson p")
outputfile.write("%s\t" % "Spearman r")
outputfile.write("%s\t" % "Spearman p")
outputfile.write("\n")
outputfile.flush()
#
outputfile.close()
bxd_correlations()
|