From ad07fc167c4f35490fd59e687aac1f4291defcc2 Mon Sep 17 00:00:00 2001 From: Lei Yan Date: Tue, 4 Feb 2014 11:35:41 -0600 Subject: On branch master --- wqflask/maintenance/dataset/genotypes.py | 13 +++++++++++++ wqflask/maintenance/dataset/probesets.py | 18 +++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 wqflask/maintenance/dataset/genotypes.py (limited to 'wqflask') 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) -- cgit v1.2.3