diff options
author | Lei Yan | 2016-02-25 16:42:15 +0000 |
---|---|---|
committer | Lei Yan | 2016-02-25 16:42:15 +0000 |
commit | e55f38a72d47fbdf5f652a08e8da1db78f1dcdb5 (patch) | |
tree | 68161b76858cf72f7a7b5576de6384042e214d8e /wqflask/maintenance/dataset/probesets.py | |
parent | 7263c52a7d903a2dbdd5d05411821ec960961b4d (diff) | |
parent | ece60a2d25ed71980121ac1c1854c3ab3514f453 (diff) | |
download | genenetwork2-e55f38a72d47fbdf5f652a08e8da1db78f1dcdb5.tar.gz |
Merge /home/zas1024/gene
Diffstat (limited to 'wqflask/maintenance/dataset/probesets.py')
-rw-r--r-- | wqflask/maintenance/dataset/probesets.py | 90 |
1 files changed, 0 insertions, 90 deletions
diff --git a/wqflask/maintenance/dataset/probesets.py b/wqflask/maintenance/dataset/probesets.py deleted file mode 100644 index 97bb5bdf..00000000 --- a/wqflask/maintenance/dataset/probesets.py +++ /dev/null @@ -1,90 +0,0 @@ -import utilities -import datastructure -import genotypes - -def get_probesetxref(probesetfreezeid): - cursor = utilities.get_cursor() - sql = """ - SELECT ProbeSetXRef.`ProbeSetId`, ProbeSetXRef.`DataId` - FROM ProbeSetXRef - WHERE ProbeSetXRef.`ProbeSetFreezeId`=%s - """ - cursor.execute(sql, (probesetfreezeid)) - return cursor.fetchall() - -def get_probeset(probesetid): - cursor = utilities.get_cursor() - sql = """ - SELECT ProbeSet.`Id`, ProbeSet.`Name`, ProbeSet.`Symbol`, ProbeSet.`description`, ProbeSet.`Probe_Target_Description`, ProbeSet.`Chr`, ProbeSet.`Mb` - FROM ProbeSet - WHERE ProbeSet.`Id`=%s - """ - cursor.execute(sql, (probesetid)) - return cursor.fetchone() - -def get_probesetdata(probesetdataid): - cursor = utilities.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() - -def get_probesetxref_probesetfreezeid(locus, probesetfreezeid): - cursor = utilities.get_cursor() - sql = """ - SELECT ProbeSetXRef.`ProbeSetId` - FROM ProbeSetXRef - WHERE ProbeSetXRef.`ProbeSetFreezeId`=%s - AND ProbeSetXRef.`Locus` LIKE %s - """ - cursor.execute(sql, (probesetfreezeid, locus)) - return cursor.fetchall() - -def get_probesetxref_inbredsetid(locus, inbredsetid): - cursor = utilities.get_cursor() - sql = """ - SELECT ProbeSetXRef.`ProbeSetId`, ProbeSetXRef.`mean`, ProbeSetXRef.`LRS`, ProbeSetXRef.`Locus`, ProbeSetXRef.`ProbeSetFreezeId` - FROM (ProbeSetXRef, ProbeSetFreeze, ProbeFreeze) - WHERE ProbeSetXRef.`ProbeSetFreezeId`=ProbeSetFreeze.`Id` - AND ProbeSetFreeze.`ProbeFreezeId`=ProbeFreeze.`Id` - AND ProbeFreeze.`InbredSetId`=%s - AND ProbeSetXRef.`Locus` LIKE %s - """ - cursor.execute(sql, (inbredsetid, locus)) - return cursor.fetchall() - -def get_normalized_probeset(locus, inbredsetid): - normalized_probesets = [] - probesetxrefs = get_probesetxref_inbredsetid(locus, inbredsetid) - for probesetxref in probesetxrefs: - normalized_probeset = [] - # - probesetfreezeid = probesetxref[4] - probesetfreeze = datastructure.get_probesetfreeze(probesetfreezeid) - normalized_probeset.append(probesetfreeze[0]) - normalized_probeset.append(probesetfreeze[1]) - normalized_probeset.append(probesetfreeze[2]) - # - probesetid = probesetxref[0] - probeset = get_probeset(probesetid) - 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) - return normalized_probesets |