diff options
author | Lei Yan | 2014-01-25 00:29:35 -0600 |
---|---|---|
committer | Lei Yan | 2014-01-25 00:29:35 -0600 |
commit | 4a3c48c4b91c0cce9d7d0e9896be893d6e80a883 (patch) | |
tree | 11ac8ce52149c6892e59691e5394df214b7a5058 /wqflask | |
parent | d4c4f9566555f54e877237a99d72c71840880293 (diff) | |
download | genenetwork2-4a3c48c4b91c0cce9d7d0e9896be893d6e80a883.tar.gz |
On branch master
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/maintenance/dataset/phenotypes/phenotypes.py | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/wqflask/maintenance/dataset/phenotypes/phenotypes.py b/wqflask/maintenance/dataset/phenotypes/phenotypes.py index 08fc1432..821e5687 100644 --- a/wqflask/maintenance/dataset/phenotypes/phenotypes.py +++ b/wqflask/maintenance/dataset/phenotypes/phenotypes.py @@ -50,9 +50,9 @@ def fetch(): 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] + original_description = clearspaces(phenotyperow[1]) + pre_publication_description = clearspaces(phenotyperow[2]) + post_publication_description = clearspaces(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 @@ -71,10 +71,24 @@ def fetch(): strainname = strainname.lower() value = strainvalue[1] strainvaluedic[strainname] = value - print strainvaluedic - break + for strain in strains: + if strain in strainvaluedic: + phenotypesfile.write(str(strainvaluedic[strain])) + else: + phenotypesfile.write('x') + phenotypesfile.write('\t') + phenotypesfile.write('\n') + phenotypesfile.flush() # release phenotypesfile.close() + +def clearspaces(s): + if s: + s = re.sub('\s+', ' ', s) + s = s.strip() + return s + else: + return None # main if __name__ == "__main__": |