aboutsummaryrefslogtreecommitdiff
path: root/wqflask/maintenance/dataset/probesets.py
blob: 7fa65786eccc27b805d6171abbe5cc1d65580604 (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
import sys
sys.path.append('.')
sys.path.append('..')

from utilities import db

def fetch_probesetxref(probesetfreezeid):
    cursor = db.get_cursor()
    sql = """
        SELECT ProbeSetXRef.`ProbeSetId`, ProbeSetXRef.`DataId`
        FROM ProbeSetXRef
        WHERE ProbeSetXRef.`ProbeSetFreezeId`=%s
        """
    cursor.execute(sql, (probesetfreezeid))
    return cursor.fetchall()
    
def fetch_probeset(probesetid):
    cursor = db.get_cursor()
    sql = """
        SELECT *
        FROM ProbeSet
        WHERE ProbeSet.`Id`=%s
        """
    cursor.execute(sql, (probesetid))
    return cursor.fetchone()
    
def fetch_probesetdata(probesetdataid):
    cursor = db.get_cursor()
    sql = """
        SELECT Strain.`Id`, Strain.`Name`, ProbeSetData.`value`
        FROM ProbeSetData, Strain
        WHERE ProbeSetData.`Id`=%s
        AND ProbeSetData.`StrainId`=Strain.`Id`;
        """
    cursor.execute(sql, (probesetdataid))
    return cursor.fetchall()

results = fetch_probesetxref(112)
for row in results:
    print row
    probesetid = row[0]
    probesetdataid = row[1]
    print fetch_probeset(probesetid)
    print fetch_probesetdata(probesetdataid)
    break