about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLei Yan2014-01-24 23:20:47 -0600
committerLei Yan2014-01-24 23:20:47 -0600
commitc631ea00b9592251977b2f44d3b003e04c665185 (patch)
treeac01d9f22769949283970799e0dc018d63b89c99
parenteb223dde7b6d543a6c2f0a6a2bdde19722db2452 (diff)
downloadgenenetwork2-c631ea00b9592251977b2f44d3b003e04c665185.tar.gz
On branch master
-rw-r--r--wqflask/maintenance/dataset/phenotypes/phenotypes.py24
1 files changed, 20 insertions, 4 deletions
diff --git a/wqflask/maintenance/dataset/phenotypes/phenotypes.py b/wqflask/maintenance/dataset/phenotypes/phenotypes.py
index bd5dcaa6..28fd3398 100644
--- a/wqflask/maintenance/dataset/phenotypes/phenotypes.py
+++ b/wqflask/maintenance/dataset/phenotypes/phenotypes.py
@@ -35,15 +35,31 @@ def fetch():
     #
     sql = """
         SELECT PublishXRef.`Id`, Phenotype.`Original_description`, Phenotype.`Pre_publication_description`, Phenotype.`Post_publication_description`
-        FROM PublishXRef, Phenotype
+        FROM (PublishXRef, Phenotype)
         WHERE PublishXRef.`PhenotypeId`=Phenotype.`Id`
         AND PublishXRef.`InbredSetId`=%s
         """
     cursor.execute(sql, (inbredsetid))
     results = cursor.fetchall()
-    print "get %d phenotypes" % len(results)
-    for row in results:
-        print row
+    print "get %d phenotypes" % (len(results))
+    for phenotyperow in results:
+        publishxrefid = phenotyperow[0]
+        original_description = phenotyperow[1]
+        pre_publication_description = phenotyperow[2]
+        post_publication_description = phenotyperow[3]
+        sql = """
+            SELECT Strain.Name, PublishData.value
+            FROM (PublishXRef, PublishData, Strain)
+            WHERE PublishXRef.`InbredSetId`=%s
+            AND PublishXRef.Id=%s
+            AND PublishXRef.DataId=PublishData.Id
+            AND PublishData.StrainId=Strain.Id
+        """
+        cursor.execute(sql, (inbredsetid, publishxrefid))
+        results = cursor.fetchall()
+        print "get %d values" % (len(results))
+        for strainvalue in results:
+            print strainvalue
         break
     
 # main