aboutsummaryrefslogtreecommitdiff
path: root/wqflask/maintenance/dataset
diff options
context:
space:
mode:
authorLei Yan2014-02-04 11:35:41 -0600
committerLei Yan2014-02-04 11:35:41 -0600
commitad07fc167c4f35490fd59e687aac1f4291defcc2 (patch)
tree725b7a446036269d895c6ff34c14c45218e9c55d /wqflask/maintenance/dataset
parent2c6abd47b78bea42423aa45f417897525f63f8a2 (diff)
downloadgenenetwork2-ad07fc167c4f35490fd59e687aac1f4291defcc2.tar.gz
On branch master
Diffstat (limited to 'wqflask/maintenance/dataset')
-rw-r--r--wqflask/maintenance/dataset/genotypes.py13
-rw-r--r--wqflask/maintenance/dataset/probesets.py18
2 files changed, 28 insertions, 3 deletions
diff --git a/wqflask/maintenance/dataset/genotypes.py b/wqflask/maintenance/dataset/genotypes.py
new file mode 100644
index 00000000..c83fb8b7
--- /dev/null
+++ b/wqflask/maintenance/dataset/genotypes.py
@@ -0,0 +1,13 @@
+import utilities
+
+def get_geno(inbredsetid, name):
+ cursor = utilities.get_cursor()
+ sql = """
+ SELECT Geno.`Id`, Geno.`Name`, Geno.`Chr`, Geno.`Mb`
+ FROM (Geno, InbredSet)
+ WHERE Geno.`SpeciesId`=InbredSet.`SpeciesId`
+ AND InbredSet.`Id`=%s
+ AND Geno.`Name` LIKE %s
+ """
+ cursor.execute(sql, (inbredsetid, name))
+ return cursor.fetchone()
diff --git a/wqflask/maintenance/dataset/probesets.py b/wqflask/maintenance/dataset/probesets.py
index 2c755203..06b9a394 100644
--- a/wqflask/maintenance/dataset/probesets.py
+++ b/wqflask/maintenance/dataset/probesets.py
@@ -1,6 +1,7 @@
import sys
import utilities
+import genotypes
def get_probesetxref(probesetfreezeid):
cursor = utilities.get_cursor()
@@ -47,7 +48,7 @@ def get_probesetxref_probesetfreezeid(locus, probesetfreezeid):
def get_probesetxref_inbredsetid(locus, inbredsetid):
cursor = utilities.get_cursor()
sql = """
- SELECT ProbeSetXRef.`ProbeSetId`
+ SELECT ProbeSetXRef.`ProbeSetId`, ProbeSetXRef.`mean`, ProbeSetXRef.`LRS`, ProbeSetXRef.`Locus`
FROM (ProbeSetXRef, ProbeSetFreeze, ProbeFreeze)
WHERE ProbeSetXRef.`ProbeSetFreezeId`=ProbeSetFreeze.`Id`
AND ProbeSetFreeze.`ProbeFreezeId`=ProbeFreeze.`Id`
@@ -64,8 +65,19 @@ def get_normalized_probeset(locus, inbredsetid):
normalized_probeset = []
probesetid = probesetxref[0]
probeset = get_probeset(probesetid)
- normalized_probeset.append(probeset)
+ normalized_probeset.append(probeset[1])
+ normalized_probeset.append(probeset[2])
+ normalized_probeset.append(probeset[3])
+ normalized_probeset.append(probeset[4])
+ normalized_probeset.append(probeset[5])
+ normalized_probeset.append(probeset[6])
+ normalized_probeset.append(probesetxref[1])
+ normalized_probeset.append(probesetxref[2])
+ locus = probesetxref[3]
+ geno = genotypes.get_geno(inbredsetid=inbredsetid, name=locus)
+ normalized_probeset.append(geno[2])
+ normalized_probeset.append(geno[3])
normalized_probesets.append(normalized_probeset)
- print normalized_probesets
+ print normalized_probesets[:2]
get_normalized_probeset(locus="rs3663871", inbredsetid=1)