about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLei Yan2014-02-10 15:21:44 -0600
committerLei Yan2014-02-10 15:21:44 -0600
commit37e4152e6bbf446c165faefa0220cc722c5e3c54 (patch)
tree08408aed36364f48ae843d1b64036f7f0a99dbc7
parenta260db93da548ce7511521c5f63c03c3d279bcb1 (diff)
downloadgenenetwork2-37e4152e6bbf446c165faefa0220cc722c5e3c54.tar.gz
On branch master
-rw-r--r--wqflask/maintenance/dataset/specials2.py36
1 files changed, 33 insertions, 3 deletions
diff --git a/wqflask/maintenance/dataset/specials2.py b/wqflask/maintenance/dataset/specials2.py
index 2acfd2ef..2438af43 100644
--- a/wqflask/maintenance/dataset/specials2.py
+++ b/wqflask/maintenance/dataset/specials2.py
@@ -54,9 +54,9 @@ def bxd_correlations():
     probesetfreezes = datastructure.get_probesetfreezes(inbredsetid)
     print "From DB, get %d probesetfreezes" % (len(probesetfreezes))
     for probesetfreeze in probesetfreezes:
-        correlations(genos, probesetfreeze)
+        correlations(outputdir=outputdir, genos=genos, probesetfreeze=probesetfreeze)
     
-def correlations(genos, probesetfreeze):
+def correlations(outputdir, genos, probesetfreeze):
     print probesetfreeze
     probesetfreezeid = probesetfreeze[0]
     probesetfreezename = probesetfreeze[1]
@@ -106,4 +106,34 @@ def correlations(genos, probesetfreeze):
             outputfile.write("\n")
             outputfile.flush()
     #
-    outputfile.close()
\ No newline at end of file
+    outputfile.close()
+    
+"""
+For:    Ash
+Date:   2014-02-10
+Function:
+    For BXD group, calculate correlations with genotypes and probesets.
+    given probesetfreezes
+"""
+def bxd_correlations_givenprobesetfreezes(probesetfreezesfile):
+    #
+    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]
+    print "From geno file, get %d strains" % (len(genostrains))
+    print "From geno file, get %d genos" % (len(genos))
+    #
+    file = open(probesetfreezesfile, 'r')
+    for line in file:
+        line = line.strip()
+        cells = line.split()
+        probesetfreezeid = cells[0]
+        probesetfreeze = datastructure.get_probesetfreeze(probesetfreezeid)
+        correlations(outputdir=outputdir, genos=genos, probesetfreeze=probesetfreeze)
+    file.close()
+
+bxd_correlations_givenprobesetfreezes('/home/leiyan/gn2/wqflask/maintenance/dataset/datadir/20140205_Ash_correlations/output/probesetfreezes_filter.txt')