From c631ea00b9592251977b2f44d3b003e04c665185 Mon Sep 17 00:00:00 2001 From: Lei Yan Date: Fri, 24 Jan 2014 23:20:47 -0600 Subject: On branch master --- .../maintenance/dataset/phenotypes/phenotypes.py | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'wqflask/maintenance/dataset') 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 -- cgit v1.2.3