diff options
author | Lei Yan | 2014-01-24 23:20:47 -0600 |
---|---|---|
committer | Lei Yan | 2014-01-24 23:20:47 -0600 |
commit | c631ea00b9592251977b2f44d3b003e04c665185 (patch) | |
tree | ac01d9f22769949283970799e0dc018d63b89c99 /wqflask/maintenance/dataset | |
parent | eb223dde7b6d543a6c2f0a6a2bdde19722db2452 (diff) | |
download | genenetwork2-c631ea00b9592251977b2f44d3b003e04c665185.tar.gz |
On branch master
Diffstat (limited to 'wqflask/maintenance/dataset')
-rw-r--r-- | wqflask/maintenance/dataset/phenotypes/phenotypes.py | 24 |
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 |