about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--wqflask/maintenance/dataset/phenotypes/phenotypes.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/wqflask/maintenance/dataset/phenotypes/phenotypes.py b/wqflask/maintenance/dataset/phenotypes/phenotypes.py
index 843b2dfd..08fc1432 100644
--- a/wqflask/maintenance/dataset/phenotypes/phenotypes.py
+++ b/wqflask/maintenance/dataset/phenotypes/phenotypes.py
@@ -36,7 +36,9 @@ def fetch():
         strains.append(strain)
     print "get %d strains: %s" % (len(strains), strains)
     phenotypesfile.write('\t'.join([strain.upper() for strain in strains]))
-    #
+    phenotypesfile.write('\n')
+    phenotypesfile.flush()
+    # phenotypes
     sql = """
         SELECT PublishXRef.`Id`, Phenotype.`Original_description`, Phenotype.`Pre_publication_description`, Phenotype.`Post_publication_description`
         FROM (PublishXRef, Phenotype)
@@ -51,6 +53,7 @@ def fetch():
         original_description = phenotyperow[1]
         pre_publication_description = phenotyperow[2]
         post_publication_description = phenotyperow[3]
+        phenotypesfile.write("%s\t%s\t%s\t%s\t" % (publishxrefid, original_description, pre_publication_description, post_publication_description))
         sql = """
             SELECT Strain.Name, PublishData.value
             FROM (PublishXRef, PublishData, Strain)
@@ -62,8 +65,13 @@ def fetch():
         cursor.execute(sql, (inbredsetid, publishxrefid))
         results = cursor.fetchall()
         print "get %d values" % (len(results))
+        strainvaluedic = {}
         for strainvalue in results:
-            print strainvalue
+            strainname = strainvalue[0]
+            strainname = strainname.lower()
+            value = strainvalue[1]
+            strainvaluedic[strainname] = value
+        print strainvaluedic
         break
     # release
     phenotypesfile.close()